CLAUDE.md
CLAUDE.mdCLAUDE.mdroot
Quality
84/100
Scores the file, not the repository.Length
955 words
17 headings · 1 code blocksRepository
64k
— · pushed 0 days agoLast changed
3 days ago
First indexed 3 days ago.1# CLAUDE.md23This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.45## Repository Overview67This 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.89## Key Components1011### Weather System (Example Workflow)12A demonstration of two distinct skill patterns via the **Command → Agent → Skill** architecture:13- `/weather-orchestrator` command (`.claude/commands/weather-orchestrator.md`): Entry point — asks user for C/F, invokes agent, then invokes SVG skill14- `weather-agent` agent (`.claude/agents/weather-agent.md`): Fetches temperature using its preloaded `weather-fetcher` skill (agent skill pattern)15- `weather-fetcher` skill (`.claude/skills/weather-fetcher/SKILL.md`): Preloaded into agent — instructions for fetching temperature from Open-Meteo16- `weather-svg-creator` skill (`.claude/skills/weather-svg-creator/SKILL.md`): Skill — creates SVG weather card, writes `orchestration-workflow/weather.svg` and `orchestration-workflow/output.md`1718Two 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.1920### Skill Definition Structure21Skills in `.claude/skills/<name>/SKILL.md` use YAML frontmatter:22- `name`: Display name and `/slash-command` (defaults to directory name)23- `description`: When to invoke (recommended for auto-discovery)24- `argument-hint`: Autocomplete hint (e.g., `[issue-number]`)25- `disable-model-invocation`: Set `true` to prevent automatic invocation26- `user-invocable`: Set `false` to hide from `/` menu (background knowledge only)27- `allowed-tools`: Tools allowed without permission prompts when skill is active28- `model`: Model to use when skill is active29- `context`: Set to `fork` to run in isolated subagent context30- `agent`: Subagent type for `context: fork` (default: `general-purpose`)31- `hooks`: Lifecycle hooks scoped to this skill3233### Presentation System34See `.claude/rules/presentation.md` — presentation work is delegated per-presentation to `presentation-vibe-coding` (for `presentation/vibe-coding-to-agentic-engineering/`) or `presentation-claude-gemini` (for `presentation/2026-04-25-gdg-kolachi-cli-claude-code-gemini/`).3536### Hooks System37Cross-platform sound notification system in `.claude/hooks/`:38- `scripts/hooks.py`: Main handler for Claude Code hook events39- `config/hooks-config.json`: Shared team configuration40- `config/hooks-config.local.json`: Personal overrides (git-ignored)41- `sounds/`: Audio files organized by hook event (generated via ElevenLabs TTS)4243Hook events configured in `.claude/settings.json`: PreToolUse, PostToolUse, UserPromptSubmit, Notification, Stop, SubagentStart, SubagentStop, PreCompact, SessionStart, SessionEnd, Setup, PermissionRequest, TeammateIdle, TaskCompleted, ConfigChange.4445Special handling: git commits trigger `pretooluse-git-committing` sound.4647## Critical Patterns4849### Subagent Orchestration50Subagents **cannot** invoke other subagents via bash commands. Use the Agent tool (renamed from Task in v2.1.63; `Task(...)` still works as an alias):51```52Agent(subagent_type="agent-name", description="...", prompt="...", model="haiku")53```5455Be explicit about tool usage in subagent definitions. Avoid vague terms like "launch" that could be misinterpreted as bash commands.5657### Subagent Definition Structure58Subagents in `.claude/agents/*.md` use YAML frontmatter:59- `name`: Subagent identifier60- `description`: When to invoke (use "PROACTIVELY" for auto-invocation)61- `tools`: Comma-separated allowlist of tools (inherits all if omitted). Supports `Agent(agent_type)` syntax62- `disallowedTools`: Tools to deny, removed from inherited or specified list63- `model`: Model alias: `haiku`, `sonnet`, `opus`, or `inherit` (default: `inherit`)64- `permissionMode`: Permission mode (e.g., `"acceptEdits"`, `"plan"`, `"bypassPermissions"`)65- `maxTurns`: Maximum agentic turns before the subagent stops66- `skills`: List of skill names to preload into agent context67- `mcpServers`: MCP servers for this subagent (server names or inline configs)68- `hooks`: Lifecycle hooks scoped to this subagent (all hook events are supported; `PreToolUse`, `PostToolUse`, and `Stop` are the most common)69- `memory`: Persistent memory scope — `user`, `project`, or `local` (see `reports/claude-agent-memory.md`)70- `background`: Set to `true` to always run as a background task71- `effort`: Effort level override: `low`, `medium`, `high`, `max` (default: inherits from session)72- `isolation`: Set to `"worktree"` to run in a temporary git worktree73- `color`: CLI output color for visual distinction7475### Configuration Hierarchy761. **Managed** (`managed-settings.json` / MDM plist / Registry): Organization-enforced, cannot be overridden772. Command line arguments: Single-session overrides783. `.claude/settings.local.json`: Personal project settings (git-ignored)794. `.claude/settings.json`: Team-shared settings805. `~/.claude/settings.json`: Global personal defaults816. `hooks-config.local.json` overrides `hooks-config.json`8283### Disable Hooks84Set `"disableAllHooks": true` in `.claude/settings.local.json`, or disable individual hooks in `hooks-config.json`.8586## Answering Best Practice Questions8788When 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.8990## Workflow Best Practices9192From experience with this repository:9394- Keep CLAUDE.md under 200 lines per file for reliable adherence95- `.claude/rules/*.md` with `paths:` YAML frontmatter are lazy-loaded only when Claude touches matching files; without frontmatter they load into every session like CLAUDE.md96- Use commands for workflows instead of standalone agents97- Create feature-specific subagents with skills (progressive disclosure) rather than general-purpose agents98- Perform manual `/compact` at ~50% context usage99- Start with plan mode for complex tasks100- Use human-gated task list workflow for multi-step tasks101- Break subtasks small enough to complete in under 50% context102103### Debugging Tips104105- Use `/doctor` for diagnostics106- Run long-running terminal commands as background tasks for better log visibility107- Use browser automation MCPs (Claude in Chrome, Playwright, Chrome DevTools) for Claude to inspect console logs108- Provide screenshots when reporting visual issues109110## Git Commit Rules111112When committing changes, **create separate commits per file**. Do NOT bundle multiple file changes into a single commit. Each file gets its own commit with a descriptive message specific to that file's changes.113114For example, if `README.md`, `best-practice/claude-subagents.md`, and a skill file all changed:115- Commit 1: `git add README.md` → commit with README-specific message116- Commit 2: `git add best-practice/claude-subagents.md` → commit with subagents-doc-specific message117- Commit 3: `git add .claude/skills/weather-fetcher/SKILL.md` → commit with skill-specific message118119This makes the git history cleaner and easier to review, revert, or cherry-pick individual changes.120121## Documentation122123See `.claude/rules/markdown-docs.md` for documentation standards. Key docs:124- `best-practice/claude-subagents.md`: Subagent frontmatter, hooks, and repository agents125- `best-practice/claude-commands.md`: Slash command patterns and built-in command reference126- `orchestration-workflow/orchestration-workflow.md`: Weather system flow diagram127
