高质量 Claude.md 模板
网络碎片
— Tw93 (@HiTw93) March 12, 2026
Claude Code Deep Dive: Architecture, Governance, and Engineering Practices - Tw93
This handbook distills six months of hands-on Claude Code usage across two accounts. It covers context management, Skills, Hooks, Subagents, prompt caching, and CLAUDE.md design, with a focus on making agent collaboration stable, governed, and verifiable.

Project Contract
Build And Test
- Install:
pnpm install - Dev:
pnpm dev - Test:
pnpm test - Typecheck:
pnpm typecheck - Lint:
pnpm lint
Architecture Boundaries
- HTTP handlers live in
src/http/handlers/ - Domain logic lives in
src/domain/ - Do not put persistence logic in handlers
- Shared types live in
src/contracts/
Coding Conventions
- Prefer pure functions in domain layer
- Do not introduce new global state without explicit justification
- Reuse existing error types from
src/errors/
Safety Rails
NEVER
- Modify
.env, lockfiles, or CI secrets without explicit approval - Remove feature flags without searching all call sites
- Commit without running tests
ALWAYS
- Show diff before committing
- Update CHANGELOG for user-facing changes
Verification
- Backend changes:
make test+make lint - API changes: update contract tests under
tests/contracts/ - UI changes: capture before/after screenshots
Compact Instructions
Preserve:
- Architecture decisions (NEVER summarize)
- Modified files and key changes
- Current verification status (pass/fail commands)
- Open risks, TODOs, rollback notes
