Production-ready patterns for Claude Code CLI and Agent SDK
| User Type | Start Here |
|---|---|
| 🚀 New to Claude Code CLI? | Quick Start - Get productive in 3 steps |
| 🔧 Building with Agent SDK? | Advanced Architecture - Production patterns |
Get a complete Claude Code configuration in 3 steps:
# 1. Copy starter kit to your Claude config
cp -r ~/.claude/skills/claude-code-best-practices/assets/starter-kit/* ~/.claude/
# 2. Copy project CLAUDE.md template to your project
cp ~/.claude/skills/claude-code-best-practices/assets/examples/CLAUDE.md ./CLAUDE.md
# 3. Customize for your stack (edit CLAUDE.md, remove unused configs)That's it! You now have agents, rules, commands, hooks, and contexts ready to use.
Building production agents? Check out Advanced Architecture Patterns for battle-tested patterns including:
- Source/MCP Integration - Clean server configuration building
- Credential Manager - Multi-backend secret storage
- Permission Mode System - Safe/ask/allow-all levels
- Headless Execution - Non-interactive automation
- Session-Scoped Tools - UI-integrated tool patterns
| Type | Count | Included |
|---|---|---|
| Agents | 9 | planner, architect, code-reviewer, tdd-guide, security-reviewer, build-error-resolver, e2e-runner, refactor-cleaner, doc-updater |
| Rules | 8 | security, coding-style, agents, git-workflow, hooks, patterns, performance, testing |
| Commands | 10 | /plan, /tdd, /code-review, /build-fix, /e2e, /learn, /refactor-clean, /test-coverage, /update-codemaps, /update-docs |
| Hooks | 3 | hooks.json, memory-persistence/, strategic-compact/ |
| Contexts | 3 | dev, research, review |
| Skills | 8 | backend-patterns, frontend-patterns, coding-standards, clickhouse-io, project-guidelines-example, lsp-integration, tdd-workflow/, security-review/ |
Production patterns from Craft Agents:
| Pattern | Purpose |
|---|---|
| SourceServerBuilder | Build MCP/API server configs from sources |
| Dynamic API Tool Factory | Single flexible tool per API with auto-auth |
| CredentialManager | Multi-backend secret storage with priority resolution |
| Permission Mode System | Session-scoped safe/ask/allow-all permissions |
| Headless Runner | Non-interactive execution for CI/automation |
| Session-Scoped Tools | Tools with UI callbacks and execution pause |
Complex tasks go to specialized agents, not the main session:
User: Implement user authentication
Claude: I'll use the planner agent to create an implementation plan first.
[Delegates to planner agent with focused context]
The 200k Problem: Your 200k context window can shrink to 70k with too many MCPs/tools.
Rules:
- Keep under 10 MCPs enabled per project
- Under 80 tools active total
- Use
disabledMcpServersin project.claude.json - Compact strategically at logical breakpoints
Tests before implementation via /tdd command:
- Define interfaces first
- Write failing tests (RED)
- Implement minimal code (GREEN)
- Refactor (IMPROVE)
- Verify coverage
Automate quality checks:
- Block dev servers outside tmux
- Warn about
console.logstatements - Auto-format after edits
- TypeScript check after
.tsedits
claude-code-best-practices/
├── SKILL.md # Main skill definition
├── README.md # This file
├── README_CN.md # Chinese documentation
├── CONTRIBUTING.md # Contribution guide
├── LICENSE # MIT License
├── assets/
│ ├── starter-kit/ # Ready-to-use configs
│ │ ├── agents/ # 9 specialized agents
│ │ ├── rules/ # 8 guardrail rules
│ │ ├── commands/ # 10 slash commands
│ │ ├── hooks/ # Hook configurations
│ │ ├── contexts/ # Mode contexts
│ │ └── skills/ # Domain knowledge
│ ├── templates/ # Config file templates
│ ├── examples/ # Example configurations
│ └── mcp-servers.json # MCP server configs
└── references/ # Deep-dive documentation
├── config-types.md # Config type details
├── context-management.md # Context window strategies
├── advanced-architecture.md # Agent SDK patterns
├── all-configs.md # Full config catalog
└── plugins.md # Plugin ecosystem
| Document | Description |
|---|---|
| Config Types | Deep dive on each config type with full examples |
| Context Management | MCP limits, tool management, compaction strategies |
| Advanced Architecture | Production patterns from Craft Agents |
| All Configs Catalog | Full catalog of all available configs |
| Plugins | Plugin ecosystem and installation guide |
This project builds upon the work of:
-
everything-claude-code by @affaanmustafa - Core configuration patterns and starter kit structure. Anthropic hackathon winner.
-
Craft Agents by Luki Labs - Advanced architecture patterns for Agent SDK. An open-source Agent-native desktop app built entirely with AI assistance.
-
Personal Experience - Additional patterns, optimizations, and documentation from real-world Claude Code usage.
Contributions are welcome! Please read our Contributing Guide for details on:
- Adding new agents, rules, commands, or hooks
- Updating documentation (English + Chinese)
- Pull request process and style guidelines
This project is licensed under the MIT License - see the LICENSE file for details.
- feature-dev - Guided feature development with codebase understanding
- code-simplifier - Simplify and refine code for clarity and maintainability
Use /marketplace to install these recommended skills:
Vercel Skills:
- frontend-design - Production-grade frontend interfaces with high design quality
- react-best-practices - React and Next.js performance optimization guidelines
- agent-browser - Automate browser interactions for web testing and data extraction
Anthropic Skills:
- ralph-loop - Agentic coding loops for iterative development
- hookify - Hook management and automation utilities