hmz-claude-code-best-practice
CLAUDE.md0 starsChanged 6 months agoMITView on GitHub
This is a best practices repository for Claude Code configuration, demonstrating patterns for skills, subagents, hooks, and commands. It serves as a reference implementation rather than an application codebase. Two skill patterns: agent skills (preloaded via skills: field) vs skills (invoked via Skill tool). See orchestration-workflow/orchestration-workflow.md for the complete flow diagram. Hook events configured in .claude/settings.json: PreToolUse, PostToolUse, UserPromptSubmit, Notification, Stop, SubagentStart, SubagentStop, PreCompact, SessionStart, SessionEnd, Setup, PermissionRequest, TeammateIdle, TaskCompleted, ConfigChange. Special handling: git commits trigger pretooluse-git-committing sound. Be explicit…
1 other project uses a version of this.
Adopted by
Most recently taken up by
- Recepay6358/claude-code-best-practiceword for word, first seen Mar 11, 2026
Other versions1 project uses a version of this.
Word for word · 1
- Recepay6358/claude-code-best-practice★ 4100% same
Edited · 0
None found.
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository4 other files it gives its agents.
- agent-browserSkill
- time-skillSkill
- weather-fetcherSkill
- weather-svg-creatorSkill
The file
We split this CLAUDE.md into the rules it gives an agent
8 rules. About 0 are common, 7 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈7
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 94
Keep CLAUDE.md under 200 lines per file for reliable adherence
- Distinctive: line 95
Use commands for workflows instead of standalone agents
- Distinctive: line 96
Create feature-specific subagents with skills (progressive disclosure) rather than general-purpose agents
- Distinctive: line 98
Start with plan mode for complex tasks
- Distinctive: line 99
Use human-gated task list workflow for multi-step tasks
- Very specific: line 104
Use /doctor for diagnostics
- Distinctive: line 105
Run long-running terminal commands as background tasks for better log visibility
- Distinctive: line 106
Use browser automation MCPs (Claude in Chrome, Playwright, Chrome DevTools) for Claude to inspect console logs
≈ “Common” is an estimate: at least 1 in 5 of the 26,980 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Repository Overview
This is a best practices repository for Claude Code configuration, demonstrating patterns for skills, subagents, hooks, and commands. It serves as a reference implementation rather than an application codebase.
Key Components
Weather System (Example Workflow)
A demonstration of two distinct skill patterns via the Command → Agent → Skill architecture:
/weather-orchestratorcommand (.claude/commands/weather-orchestrator.md): Entry point — asks user for C/F, invokes agent, then invokes SVG skillweather-agentagent (.claude/agents/weather-agent.md): Fetches temperature using its preloadedweather-fetcherskill (agent skill pattern)weather-fetcherskill (.claude/skills/weather-fetcher/SKILL.md): Preloaded into agent — instructions for fetching temperature from Open-Meteoweather-svg-creatorskill (.claude/skills/weather-svg-creator/SKILL.md): Skill — creates SVG weather card, writesorchestration-workflow/weather.svgandorchestration-workflow/output.md
Two skill patterns: agent skills (preloaded via skills: field) vs skills (invoked via Skill tool). See orchestration-workflow/orchestration-workflow.md for the complete flow diagram.
Skill Definition Structure
Skills in .claude/skills/<name>/SKILL.md use YAML frontmatter:
name: Display name and/slash-command(defaults to directory name)description: When to invoke (recommended for auto-discovery)argument-hint: Autocomplete hint (e.g.,[issue-number])disable-model-invocation: Settrueto prevent automatic invocationuser-invocable: Setfalseto hide from/menu (background knowledge only)allowed-tools: Tools allowed without permission prompts when skill is activemodel: Model to use when skill is activecontext: Set toforkto run in isolated subagent contextagent: Subagent type forcontext: fork(default:general-purpose)hooks: Lifecycle hooks scoped to this skill
Presentation System
See .claude/rules/presentation.md — all presentation work is delegated to the presentation-curator agent.
Hooks System
Cross-platform sound notification system in .claude/hooks/:
scripts/hooks.py: Main handler for Claude Code hook eventsconfig/hooks-config.json: Shared team configurationconfig/hooks-config.local.json: Personal overrides (git-ignored)sounds/: Audio files organized by hook event (generated via ElevenLabs TTS)
Hook events configured in .claude/settings.json: PreToolUse, PostToolUse, UserPromptSubmit, Notification, Stop, SubagentStart, SubagentStop, PreCompact, SessionStart, SessionEnd, Setup, PermissionRequest, TeammateIdle, TaskCompleted, ConfigChange.
Special handling: git commits trigger pretooluse-git-committing sound.
Critical Patterns
Subagent Orchestration
Subagents cannot invoke other subagents via bash commands. Use the Agent tool (renamed from Task in v2.1.63; Task(...) still works as an alias):
Agent(subagent_type="agent-name", description="...", prompt="...", model="haiku")Be explicit about tool usage in subagent definitions. Avoid vague terms like "launch" that could be misinterpreted as bash commands.
Subagent Definition Structure
Subagents in .claude/agents/*.md use YAML frontmatter:
name: Subagent identifierdescription: When to invoke (use "PROACTIVELY" for auto-invocation)tools: Comma-separated allowlist of tools (inherits all if omitted). SupportsAgent(agent_type)syntaxdisallowedTools: Tools to deny, removed from inherited or specified listmodel: Model alias:haiku,sonnet,opus, orinherit(default:inherit)permissionMode: Permission mode (e.g.,"acceptEdits","plan","bypassPermissions")maxTurns: Maximum agentic turns before the subagent stopsskills: List of skill names to preload into agent contextmcpServers: MCP servers for this subagent (server names or inline configs)hooks: Lifecycle hooks scoped to this subagent (all hook events are supported;PreToolUse,PostToolUse, andStopare the most common)memory: Persistent memory scope —user,project, orlocal(seereports/claude-agent-memory.md)background: Set totrueto always run as a background taskeffort: Effort level override:low,medium,high,max(default: inherits from session)isolation: Set to"worktree"to run in a temporary git worktreecolor: CLI output color for visual distinction
Configuration Hierarchy
- Managed (
managed-settings.json/ MDM plist / Registry): Organization-enforced, cannot be overridden - Command line arguments: Single-session overrides
.claude/settings.local.json: Personal project settings (git-ignored).claude/settings.json: Team-shared settings~/.claude/settings.json: Global personal defaultshooks-config.local.jsonoverrideshooks-config.json
Disable Hooks
Set "disableAllHooks": true in .claude/settings.local.json, or disable individual hooks in hooks-config.json.
Answering Best Practice Questions
When the user asks a Claude Code best practice question, always search this repo first (best-practice/, reports/, tips/, implementation/, and README.md) before relying on training knowledge or external sources. This repo is the authoritative source — only fall back to external docs or web search if the answer is not found here.
Workflow Best Practices
From experience with this repository:
- Keep CLAUDE.md under 200 lines per file for reliable adherence
- Use commands for workflows instead of standalone agents
- Create feature-specific subagents with skills (progressive disclosure) rather than general-purpose agents
- Perform manual
/compactat ~50% context usage - Start with plan mode for complex tasks
- Use human-gated task list workflow for multi-step tasks
- Break subtasks small enough to complete in under 50% context
Debugging Tips
- Use
/doctorfor diagnostics - Run long-running terminal commands as background tasks for better log visibility
- Use browser automation MCPs (Claude in Chrome, Playwright, Chrome DevTools) for Claude to inspect console logs
- Provide screenshots when reporting visual issues
Documentation
See .claude/rules/markdown-docs.md for documentation standards. Key docs:
best-practice/claude-subagents.md: Subagent frontmatter, hooks, and repository agentsbest-practice/claude-commands.md: Slash command patterns and built-in command referenceorchestration-workflow/orchestration-workflow.md: Weather system flow diagram
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

