Quick Reference & Sources
Complete CLAUDE.md Template
# Global CLAUDE.md
## Identity & Accounts
- GitHub: YourUsername (SSH key: ~/.ssh/id_ed25519)
- Docker Hub: authenticated via ~/.docker/config.json
- Deployment: Dokploy (API URL in ~/.env)
## NEVER EVER DO (Security Gatekeeper)
- NEVER commit .env files
- NEVER hardcode credentials
- NEVER publish secrets to git/npm/docker
- NEVER skip .gitignore verification
## New Project Setup (Scaffolding Rules)
### Required Files
- .env (NEVER commit)
- .env.example (with placeholders)
- .gitignore (with all required entries)
- .dockerignore
- README.md
- CLAUDE.md
### Required Structure
project/
├── src/
├── tests/
├── docs/
├── .claude/commands/
└── scripts/
### Required .gitignore
.env
.env.*
node_modules/
dist/
.claude/settings.local.json
CLAUDE.local.md
### Node.js Requirements
- Error handlers in entry point
- TypeScript strict mode
- ESLint + Prettier configured
### Quality Gates
- No file > 300 lines
- All tests must pass
- No linter warnings
- CI/CD workflow required
## Framework-Specific Rules
[Your framework patterns here]
## Required MCP Servers
- context7 (live documentation)
- playwright (browser testing)
## Global Commands
- /new-project — Apply scaffolding rules
- /security-check — Verify no secrets exposed
- /pre-commit — Run all quality gates
Quick Reference Table
| Tool | Purpose | Location |
|---|---|---|
| Global CLAUDE.md | Security + Scaffolding | ~/.claude/CLAUDE.md |
| Project CLAUDE.md | Architecture + Commands | ./CLAUDE.md |
| MCP Servers | External integrations | claude mcp add |
| Context7 | Live documentation | claude mcp add context7 |
| Slash Commands | Workflow automation | .claude/commands/*.md |
| Skills | Packaged expertise | .claude/skills/*/SKILL.md |
| Hooks | Deterministic enforcement | ~/.claude/settings.json |
| Sub-Agents | Isolated context | Spawn via commands |
/clear |
Reset context | Type in chat |
/init |
Generate project CLAUDE.md | Type in chat |
GitHub Repository
All templates, hooks, and skills from this guide are available:
What's included:
- Complete CLAUDE.md templates (global + project)
- Ready-to-use hooks (block-secrets.py, end-of-turn.sh, etc.)
- Example skills (commit-messages, security-audit)
- settings.json with hooks pre-configured
Sources
Anthropic Official
- Claude Code: Best practices for agentic coding — Anthropic
- Effective context engineering for AI agents — Anthropic
- Introducing the Model Context Protocol — Anthropic
- Equipping agents for the real world with Agent Skills — Anthropic
Claude Code Documentation
- Agent Skills Documentation — Claude Code Docs
- Hooks Reference — Claude Code Docs
- Slash Commands Documentation — Claude Code Docs
Community Resources
- Claude Project Scaffolding — Madison Hutson
- CLAUDE.md Templates — Claude-Flow
- Context7 MCP Server — Upstash
- Claude Code Hooks: Guardrails That Actually Work — Paddo.dev
- Claude Code Hooks Mastery — GitHub
Research & Analysis
- Context Rot Research — Chroma
- LLMs Get Lost In Multi-Turn Conversation — arXiv
- Context Drift in LLMs — arXiv
- Measuring Context Pollution — Kurt Kemple
Security
- Claude Code Security Best Practices — Backslash
- Claude loads secrets without permission — Knostic
Best Practices
- Writing a good CLAUDE.md — HumanLayer
- Context Management Guide — Arsturn
- Commands vs Sub-Agents — Arsturn
- CLAUDE.md Best Practices from Prompt Learning — Arize
- Compound Engineering: How Every Codes with Agents — Every
- Compound Engineering Plugin — GitHub