Skip to content

These pages document master, which is unreleased and in development. The Quick Start installs the latest stable release; anything newer than that tag is marked in the text.

๐ŸŽ›๏ธ Claude Code Setup Cookbook

(Optimized for Multi-Phase SDLC + Token Economy + Shared Rules)

This cookbook is structured into logical operational blocks covering:

  • IDE & Environment Setup
  • Project Artefact Discipline
  • Prompt and Model Configuration
  • System-wide Rules & Guardrails
  • Workflow Templates
  • Token Efficiency Practices
  • Monitoring, Validation & Testing

๐Ÿงฐ 1. Environment Setup โ€” Universal Foundations

Section titled โ€œ๐Ÿงฐ 1. Environment Setup โ€” Universal Foundationsโ€

๐Ÿ”น Standard Project Structure
Enforce this on every project:

/src
/tests
/doc_internal
README.md
ARCHITECTURE.md
OPERATIONAL_RULES.md
.gitignore
CLAUDE.md
COPILOT_RULES.md

This separates internal reference from public code, reduces accidental context leaks, and keeps project config tidy. (YouTube)

๐Ÿ”น Editor Integrations
Use Claude Code CLI inside terminal plus editor extensions:

  • VS Code (via โ€œClaude Codeโ€ or local LLM extensions)
  • Cursor (with custom rules)
  • JetBrains (IntelliJ/PyCharm)
  • Dedicated shell workflow (CLI with aliases)

Tip: set up editor commands or macros that generate 2โ€“3 boilerplate files when a project is created.


๐Ÿ“ 2. Artefact Discipline โ€” Canonicals You Always Create

Section titled โ€œ๐Ÿ“ 2. Artefact Discipline โ€” Canonicals You Always Createโ€

Every new project must have:

__pycache__/
*.pyc
.env
.venv/
dist/
build/
.eggs/
*.egg-info/

# Internal docs
doc_internal/
DOC_INTERNAL/
.clinerules
.coverage

This folder contains non-public artefacts (which should not be re-sent to the LLM automatically unless explicitly needed):

  • ARCHITECTURE.md โ€” formal architecture document
  • OPERATIONAL_RULES.md โ€” specific coding rules
  • CONTEXT.md โ€” summaries intended for Claude
  • HISTORY.md โ€” timestamped log of prior sessions
  • CLAUDE.md โ€” Claude Code manifest & default rules

This structure avoids accidental repetition of full context in prompts, saving tokens over time. (YouTube)


Claude Code (Opus 4.5+) supports model selection and prompt scaffolding. Use prompt modules โ€” reusable sections โ€” and use prompt caching where supported:

Model and effort are real settings.json keys (~/.claude/settings.json globally, .claude/settings.json per project); /model and /effort change them for the current session:

{
"model": "opus",
"effortLevel": "medium"
}

Reusable context is loaded by reference, not re-pasted. CLAUDE.md imports a file with an @ line, so the session summary in doc_internal/CONTEXT.md is read once per session:

@doc_internal/CONTEXT.md

Prompt caching needs no keys: the API caches the stable prefix of each request (the system prompt, CLAUDE.md and its imports, the rules) automatically. What you control is the cache lifetime, below.

Effort Levels

  • Low โ€” exploratory research (cheap, less reasoning)
  • Medium โ€” design reasoning + nuanced tasks
  • High โ€” full architectural work, agentic execution
  • Extra-high (xhigh) โ€” complex multi-file reasoning, deep architectural analysis (Opus 4.7+ only; other models fall back to high). Set with /effort xhigh or "effortLevel": "xhigh" in settings.

This lets you trade token cost vs reasoning depth. (Wikipedia)

Prompt Caching โ€” Extended TTL

By default, Claude Code uses a 5-minute prompt cache TTL. For long multi-phase sessions (30+ minutes with the same context), enable the 1-hour TTL:

Terminal window
export ENABLE_PROMPT_CACHING_1H=1

Or persist in settings.json via "env": {"ENABLE_PROMPT_CACHING_1H": "1"}. The 5-minute default is fine for short tasks.


๐Ÿง  4. Universal Engineering Rules (Enforce Across Copilots)

Section titled โ€œ๐Ÿง  4. Universal Engineering Rules (Enforce Across Copilots)โ€

These should live in OPERATIONAL_RULES.md and be enforced by Claude Code / your local Copilot workflows:

  1. Follow SOLID, Clean Architecture, Pragmatic Programmer principles.
  2. Use linting and formatting (Prettier/ESLint for JS, Black/Flake8 for Python, Checkstyle/SonarLint for Java).
  3. No hard-coded structured data (JSON/XML inside code). Use config files.
  4. API design must be modular, testable, and versioned.
  5. Every production feature must have automated tests (unit + integration).

These rules should be explicitly codified and referenced by your agent workflows. (YouTube)

In CLAUDE.md or agent config:

RULE: ask_before_execute
RULE: safety_sanitize_output
RULE: no_silent_code_changes

Meaning: never make silent changes; always request confirmation before edits, and sanitize outputs for security & compliance.


๐Ÿ“ฆ 5. Workflow Patterns (Consistent Across Sessions)

Section titled โ€œ๐Ÿ“ฆ 5. Workflow Patterns (Consistent Across Sessions)โ€

Planning phase โ€” use Opus (or your highest-capability model) with high effort. This is where architectural mistakes happen, and theyโ€™re expensive to fix later. You want Claude to think deeply about component boundaries, data models, API contracts, and auth flows. The token cost during planning is tiny compared to the cost of rebuilding after a bad architectural decision.

Building phase โ€” use Sonnet with medium effort for the bulk of implementation. Most implementation work (writing React components, API routes, Prisma models, tests) is well-defined once the plan exists. Sonnet handles this efficiently at lower cost and faster speed. Switch to Opus only when you hit something genuinely complex mid-build โ€” a tricky state machine, a concurrency issue, a subtle security concern.

Quick tasks (renaming, formatting, simple config changes, generating boilerplate) โ€” Haiku with low effort. Fast, cheap, good enough.

The principle is simple: pay for intelligence where mistakes are costly, use speed where the path is clear.

Below are repeatable workflows you can share across different Copilots and LLM models:


Start with:

@mode research
@model Opus 4.5
@effort medium

Then use a structured prompt template:

Task: Summarize current domain knowledge for PROJECT_X.
Input: document references, URLs, code repo path
Constraints:
- Return structured topics
- Produce taxonomy of concepts
- Output as JSON with sections: summary, key entities, risks, unknowns

Save the result into doc_internal/CONTEXT.md for reference โ€” and avoid re-pasting long summaries. (YouTube)


Prompt skeleton:

Task: Generate draft architecture
Input: design goals + constraints
Output:
- 3 architectural options ranked
- tradeoffs
- risks & mitigation
- integration points

Store this as ARCHITECTURE.md. Use version tags (v0.1, v0.2) so Claude can reference instead of re-regenerating.


Switch to:

@mode execution
@model Opus 4.5
@effort high

Use a diff-only pattern:

Before:
<existing files>

Task: Make changes for feature X
Response format: diff (unified), tests added, summary

By only returning diffs, you avoid large code rewrites and reduce token costs.


๐Ÿ“Œ Prompt Caching โ€” cache static headers like System Prompt and Global Rules so they arenโ€™t re-sent each time.
๐Ÿ“Œ Chunk context manually โ€” load only relevant parts rather than whole ARCHITECTURE.md. (YouTube)
๐Ÿ“Œ Compact context periodically โ€” use built-in /compact or explicit summarization to reduce token window.
๐Ÿ“Œ Session per task โ€” finish a task, flush the context before starting another to avoid uncontrolled growth. (YouTube)


Inject automated validation steps at key points:

Trigger: code_write
Follow-up: run linters + test suite
Output: failures + suggested fixes

Claude Codeโ€™s agent frameworks increasingly support test runs and integrations (even GitHub Actions). (YouTube)


Together with CLAUDE.md, maintain:

  • COPILOT_RULES.md โ€” shared conventions for Copilots
  • AGENT_MANIFEST.md โ€” mappings of agent behaviors (refactorer, architect, reviewer)
  • DEPLOY_PIPELINE.md โ€” CI/CD rules (SonarQube, code coverage)

This lets you treat Copilot/Claude workflows like real engineering assets โ€” checked in, versioned, audited.

Reflecting current research, โ€œagentic coding manifestsโ€ like Claude.md files play the same role as traditional build pipelines, and having well-structured manifests is critical in real development workflows. (arXiv)


Here are reusable templates you can apply whether youโ€™re using Claude Code, GitHub Copilot, Cursor, or local LLM workflows:

[ERROR_PATTERNS]
missing_input_validation
missing_tests
error_prone_regex
โ€ฆ

RULE: no silent code changes
RULE: require test coverage >= 80%
RULE: lint errors must be zero before merge

indentation: spaces
line_length: 100
naming_conventions: camelCase /*adjust per language*/

All AI copilots can be coerced to follow these by embedding them into prompts once and caching.


What you want is not just better prompts, itโ€™s a shared engineering contract โ€” files, templates, rules, versioned artifacts, and workflows that all agents respect. This turns Claude Code / Copilot / Cursor / local LLMs into repeatable, programmable teammates rather than unpredictable assistants.

If you want, I can generate executable CLI templates (shell scripts) that initialize this entire repo structure and include pre-built templates oriented to your SDLC. Just let me know your preferred language ecosystem (Python + Node + Java?) and Iโ€™ll produce them.