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:
๐ธ .gitignore (your base template)
Section titled โ๐ธ .gitignore (your base template)โ__pycache__/
*.pyc
.env
.venv/
dist/
build/
.eggs/
*.egg-info/
# Internal docs
doc_internal/
DOC_INTERNAL/
.clinerules
.coverage
๐ธ doc_internal/ Rules
Section titled โ๐ธ doc_internal/ Rulesโ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)
๐ 3. Model Selection & Prompt Modules
Section titled โ๐ 3. Model Selection & Prompt Modulesโ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.mdPrompt 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 tohigh). Set with/effort xhighor"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:
export ENABLE_PROMPT_CACHING_1H=1Or 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:
๐น General Best Practices
Section titled โ๐น General Best Practicesโ- Follow SOLID, Clean Architecture, Pragmatic Programmer principles.
- Use linting and formatting (Prettier/ESLint for JS, Black/Flake8 for Python, Checkstyle/SonarLint for Java).
- No hard-coded structured data (JSON/XML inside code). Use config files.
- API design must be modular, testable, and versioned.
- Every production feature must have automated tests (unit + integration).
These rules should be explicitly codified and referenced by your agent workflows. (YouTube)
๐น CLI & Agent Safety Rules
Section titled โ๐น CLI & Agent Safety Rulesโ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:
๐ ๏ธ A) Research & Planning Workflow
Section titled โ๐ ๏ธ A) Research & Planning Workflowโ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)
๐งพ B) Incremental System Design Workflow
Section titled โ๐งพ B) Incremental System Design Workflowโ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.
๐งช C) Code Generation/Execution Workflow
Section titled โ๐งช C) Code Generation/Execution Workflowโ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.
๐ฐ 6. Token Efficiency Practices
Section titled โ๐ฐ 6. Token Efficiency Practicesโ๐ 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)
๐งช 7. Test & Validation Integration
Section titled โ๐งช 7. Test & Validation Integrationโ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)
๐ 8. Versioning & Shared Rules
Section titled โ๐ 8. Versioning & Shared RulesโTogether with CLAUDE.md, maintain:
COPILOT_RULES.mdโ shared conventions for CopilotsAGENT_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)
๐ 9. Shared Config Templates (Cross-Copilot)
Section titled โ๐ 9. Shared Config Templates (Cross-Copilot)โHere are reusable templates you can apply whether youโre using Claude Code, GitHub Copilot, Cursor, or local LLM workflows:
๐น Error Patterns File
Section titled โ๐น Error Patterns Fileโ[ERROR_PATTERNS]
missing_input_validation
missing_tests
error_prone_regex
โฆ
๐น SAFE_GUARD.md
Section titled โ๐น SAFE_GUARD.mdโRULE: no silent code changes
RULE: require test coverage >= 80%
RULE: lint errors must be zero before merge
๐น CODE_STYLE.yaml
Section titled โ๐น CODE_STYLE.yamlโ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.
๐ง Closing
Section titled โ๐ง Closingโ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.