| name | claude-code-best-practices |
|---|---|
| description | Configure Claude Code projects with production-ready patterns from an Anthropic hackathon winner. Use when: (1) Setting up a new project with Claude Code, (2) Adding agents, commands, rules, or hooks to an existing project, (3) Optimizing context window management, (4) Implementing multi-agent workflows, (5) Creating CLAUDE.md for a new project. Triggers: "set up claude code", "configure agents", "add slash commands", "context window", "CLAUDE.md setup", "hooks configuration", "multi-agent workflow", "claude code best practices", "vibe coding setup", "agent configuration" |
Production-ready patterns for Claude Code configuration.
When this skill is activated, guide the user through setup with these questions:
Ask the user (use AskUserQuestion tool):
What would you like to do?
1. π **Quick Start** - I'm new to Claude Code CLI, set up everything for me
2. π§ **Agent SDK Patterns** - I'm building production agents, show me advanced architecture
3. β **Add Specific Config** - I want to add a specific agent/rule/command/hook
4. π **Just Explore** - Show me what's available, I'll decide later
Ask about their environment:
Let's set up your Claude Code environment!
What's your primary tech stack?
- React/Next.js (Frontend)
- Node.js/Express (Backend)
- Python/FastAPI (Backend)
- Full-stack TypeScript
- Other (please specify)
Then ask about installation scope:
How would you like to install the starter kit?
1. **Full Install** - All 9 agents, 8 rules, 10 commands, hooks (Recommended for new users)
2. **Minimal Install** - Core only: planner, code-reviewer, /plan, /tdd, security rules
3. **Custom Install** - Let me choose which configs to install
Then execute the appropriate installation:
Full Install:
cp -r ~/.claude/skills/claude-code-best-practices/assets/starter-kit/* ~/.claude/
cp ~/.claude/skills/claude-code-best-practices/assets/examples/CLAUDE.md ./CLAUDE.mdMinimal Install:
# Core agents
cp ~/.claude/skills/claude-code-best-practices/assets/starter-kit/agents/planner.md ~/.claude/agents/
cp ~/.claude/skills/claude-code-best-practices/assets/starter-kit/agents/code-reviewer.md ~/.claude/agents/
# Core commands
cp ~/.claude/skills/claude-code-best-practices/assets/starter-kit/commands/plan.md ~/.claude/commands/
cp ~/.claude/skills/claude-code-best-practices/assets/starter-kit/commands/tdd.md ~/.claude/commands/
# Core rules
cp ~/.claude/skills/claude-code-best-practices/assets/starter-kit/rules/security.md ~/.claude/rules/
cp ~/.claude/skills/claude-code-best-practices/assets/starter-kit/rules/coding-style.md ~/.claude/rules/
# CLAUDE.md template
cp ~/.claude/skills/claude-code-best-practices/assets/examples/CLAUDE.md ./CLAUDE.mdCustom Install: Show the available configs and let user select.
Finally, ask about optional features:
Enable optional features?
β Memory Persistence Hooks - Remember context across sessions
β Strategic Compact Hooks - Smart context window management
β MCP Server Configs - Pre-configured MCP servers (GitHub, Supabase, etc.)
Ask which patterns they need:
Which Agent SDK patterns do you need? (Select all that apply)
β Source/MCP Integration - Build MCP server configs from sources
β Credential Manager - Multi-backend secret storage with priority resolution
β Permission Mode System - Safe/ask/allow-all permission levels
β Headless Execution - Non-interactive automation for CI/scripts
β Session-Scoped Tools - Tools with UI callbacks and execution pause
Then load the relevant section from references/advanced-architecture.md and explain the pattern with code examples.
Ask what they want to add:
What type of config do you want to add?
1. π€ **Agent** - Specialized subagent for delegated tasks
2. π **Rule** - Always-follow guidelines
3. β‘ **Command** - Slash command for quick execution
4. πͺ **Hook** - Automated trigger-based actions
5. π― **Skill** - Domain knowledge module
6. π **Context** - Mode switching profile
Then provide the appropriate template and guide them through customization.
Show the full catalog and let them browse:
- Load references/all-configs.md for the complete list
- Explain the config type decision tree
- Offer to dive deeper into any specific area
After any installation, verify and summarize:
β
Setup Complete!
Installed:
- X agents in ~/.claude/agents/
- X rules in ~/.claude/rules/
- X commands in ~/.claude/commands/
- Hooks configured in ~/.claude/settings.json
Next steps:
1. Edit ./CLAUDE.md to customize for your project
2. Try `/plan` to create an implementation plan
3. Try `/tdd` to start test-driven development
Need help? Ask me about any specific config or pattern!
# 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
cp ~/.claude/skills/claude-code-best-practices/assets/examples/CLAUDE.md ./CLAUDE.md
# 3. Customize for your stack (edit CLAUDE.md, remove unused configs)| Need | Config Type | Location | When to Use |
|---|---|---|---|
| Always-follow rules | rules/*.md |
~/.claude/rules/ |
Security, style guides, invariants |
| Delegated specialist | agents/*.md |
~/.claude/agents/ |
Complex tasks needing focused context |
| Quick user command | commands/*.md |
~/.claude/commands/ |
Repeatable workflows (e.g., /plan, /tdd) |
| Automated triggers | hooks.json |
~/.claude/settings.json |
Pre/post tool actions, guardrails |
| Domain knowledge | skills/*.md |
~/.claude/skills/ |
Frameworks, APIs, project-specific knowledge |
| Project context | CLAUDE.md |
Project root | Build commands, architecture, conventions |
The 200k Problem: Your 200k context window can shrink to 70k with too many MCPs/tools enabled.
Rules:
- Keep under 10 MCPs enabled per project
- Under 80 tools active total
- Use
disabledMcpServersin project.claude.jsonto disable unused MCPs - Compact strategically at logical breakpoints
Signs of Context Bloat:
- Claude forgetting earlier conversation
- Repeated questions about already-discussed topics
- Slower responses
See references/context-management.md for detailed strategies.
Specialized subagents for delegated tasks with limited scope.
---
name: agent-name
description: What this agent does. When to use it.
tools: Read, Grep, Glob, Bash # Limit tools!
model: opus # or sonnet
---
You are a [role] specialist...
## Your Role
- Specific responsibility 1
- Specific responsibility 2
## Process
1. Step 1
2. Step 2Template: assets/templates/agent-template.md
Always-follow guidelines loaded into every session.
# Rule Name
## Mandatory Checks
- [ ] Check 1
- [ ] Check 2
## Examples
[Good and bad examples]Template: assets/templates/rule-template.md
Slash commands for quick execution (/command-name).
---
description: What this command does in one line.
---
# Command Name
## What This Command Does
[Explanation]
## When to Use
[Triggers]
## Process
[Steps]Template: assets/templates/command-template.md
Trigger-based automations in ~/.claude/settings.json.
{
"hooks": {
"PreToolUse": [
{
"matcher": "tool == \"Bash\" && tool_input.command matches \"pattern\"",
"hooks": [{ "type": "command", "command": "#!/bin/bash\n..." }],
"description": "What this hook does"
}
]
}
}Hook Types: PreToolUse, PostToolUse, PreCompact, SessionStart, Stop
Template: assets/templates/hooks-template.json
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]
Key agents: planner (plan before code), code-reviewer (quality), architect (design), tdd-guide (tests)
Independent operations run simultaneously.
# GOOD: Parallel
Launch 3 agents in parallel:
1. Security analysis of auth.ts
2. Performance review of cache
3. Type checking of utils
# BAD: Sequential when unnecessary
First agent 1, then 2, then 3Use /plan command before implementing complex features.
/plan I need to add real-time notifications when markets resolve
The planner agent creates a phased implementation plan and WAITS for confirmation.
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
The starter kit (assets/starter-kit/) includes:
| Type | Files | Purpose |
|---|---|---|
| Agents (9) | planner.md, architect.md, tdd-guide.md, code-reviewer.md, security-reviewer.md, build-error-resolver.md, e2e-runner.md, refactor-cleaner.md, doc-updater.md |
Full delegation suite |
| Rules (8) | security.md, coding-style.md, agents.md, git-workflow.md, hooks.md, patterns.md, performance.md, testing.md |
Complete guardrails |
| Commands (10) | plan.md, tdd.md, code-review.md, build-fix.md, e2e.md, learn.md, refactor-clean.md, test-coverage.md, update-codemaps.md, update-docs.md |
All workflows |
| Hooks | hooks.json, memory-persistence/, strategic-compact/ |
Automated checks + memory |
| Contexts (3) | dev.md, research.md, review.md |
Mode switching |
| Skills (8) | backend-patterns.md, frontend-patterns.md, coding-standards.md, clickhouse-io.md, project-guidelines-example.md, lsp-integration.md, tdd-workflow/, security-review/ |
Domain knowledge |
assets/mcp-servers.json- MCP server configurations (GitHub, Supabase, Vercel, Railway, etc.)assets/examples/statusline.json- Custom status line configuration
Load these when you need deeper context:
- references/config-types.md - Deep dive on each config type with full examples
- references/context-management.md - MCP limits, tool management, compaction strategies
- references/all-configs.md - Full catalog of all available configs with descriptions
- references/advanced-architecture.md - Production patterns from Craft Agents (Source/MCP integration, Credentials, Permissions, Headless, Session-scoped tools)
- references/plugins.md - Plugin ecosystem, marketplaces, and installation guide
- feature-dev - Guided feature development with codebase understanding
- code-simplifier - Simplify and refine code for clarity and maintainability
Available through Claude Code Marketplace - use /marketplace to install:
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
- cf-deploy - Deploy to Cloudflare Workers/Containers/Sandbox
- agent-ui - Build real-time AI agent interfaces with AG-UI protocol
These patterns are from everything-claude-code by @affaanmustafa, an Anthropic hackathon winner. Check the repo for updates and additional configs.