diff --git a/01-slash-commands/README.md b/01-slash-commands/README.md index b712885..5def86c 100644 --- a/01-slash-commands/README.md +++ b/01-slash-commands/README.md @@ -18,14 +18,15 @@ Slash commands are shortcuts that control Claude's behavior during an interactiv ## Built-in Commands Reference -Built-in commands are shortcuts for common actions. There are **60+ built-in commands** and **5 bundled skills** available. Type `/` in Claude Code to see the full list, or type `/` followed by any letters to filter. +Built-in commands are shortcuts for common actions. There are **60+ built-in commands** and **10 bundled skills** available. Type `/` in Claude Code to see the full list, or type `/` followed by any letters to filter. | Command | Purpose | |---------|---------| | `/add-dir ` | Add working directory | | `/agents` | Manage agent configurations | | `/branch [name]` | Switch into a copy of the conversation at this point, preserving the original (return to it with `/resume`) | -| `/fork ` | Spawn a background subagent that inherits the full conversation and works on the directive while you keep going; its own row in `claude agents` | +| `/fork [prompt]` | Copy the current conversation into a new **background session** and keep working here; the two are independent from that point on and the copy gets its own row in `claude agents` (v2.1.212+) | +| `/subtask ` | Spawn a **forked subagent** that inherits the full conversation and works on the task while you keep going; its result returns to this conversation when it finishes (v2.1.212+) | | `/btw ` | Ask an ephemeral side question while Claude is working on the main task; doesn't pollute the main conversation context | | `/cd ` | Move the session to a new working directory without breaking the prompt cache (added v2.1.169) | | `/chrome` | Configure Chrome browser integration | @@ -55,7 +56,7 @@ Built-in commands are shortcuts for common actions. There are **60+ built-in com | `/install-github-app` | Set up GitHub Actions app | | `/install-slack-app` | Install Slack app | | `/keybindings` | Open keybindings configuration | -| `/less-permission-prompts` | Analyze recent Bash/MCP tool calls and add a prioritized allowlist to `.claude/settings.json` to reduce permission prompts (added v2.1.111) | +| `/fewer-permission-prompts` | Analyze recent Bash/MCP tool calls and add a prioritized allowlist to `.claude/settings.json` to reduce permission prompts (added v2.1.111) | | `/login` | Switch Anthropic accounts | | `/logout` | Sign out from your Anthropic account | | `/mcp` | Manage MCP servers and OAuth | @@ -121,15 +122,15 @@ These skills ship with Claude Code and are invoked like slash commands: | Command | Status | |---------|--------| -| `/output-style` | Deprecated since v2.1.73 | +| `/output-style` | Removed in v2.1.91 (deprecated v2.1.73) — use `/config` → Output style, or the `outputStyle` setting | | `/pr-comments` | Removed in v2.1.91 — ask Claude directly to view PR comments | | `/vim` | Removed in v2.1.92 — use /config → Editor mode | ### Recent Changes -- `/fork` was an alias for `/branch` from v2.1.77 until v2.1.161, when they became distinct commands: `/fork` now spawns a background subagent that inherits the conversation, while `/branch` switches you into a copy in place +- `/fork` and `/subtask` swapped roles in **v2.1.212**. `/fork` now copies the conversation into a new independent background session; the forked-subagent behavior it used to have moved to the new `/subtask` command. History: `/fork` was an alias for `/branch` from v2.1.77 to v2.1.161; from v2.1.161 to v2.1.211 it started a forked subagent (what `/subtask` does now). When agent view is turned off, `/subtask` is unavailable and `/fork` keeps the forked-subagent behavior - `/resume` (no arguments) opens a picker of past sessions — including ones removed from the visible list — and resumes the chosen one as a background session (v2.1.212) -- `/output-style` deprecated (v2.1.73) +- `/output-style` deprecated (v2.1.73) and removed (v2.1.91) — output styles are still available via `/config` → Output style or the `outputStyle` setting; the built-ins are Default, Proactive, Explanatory, and Learning - `/review ` now uses the same review engine as `/code-review medium` (v2.1.186) - `/effort` command added; `max` level available on Opus 4.6+ (originally Opus 4.6-only) - `/voice` command added for push-to-talk voice dictation @@ -151,7 +152,7 @@ These skills ship with Claude Code and are invoked like slash commands: - `/proactive` added as alias for `/loop` (v2.1.105) - `/effort` gained interactive arrow-key slider and new `xhigh` level between `high` and `max`; default effort raised to `xhigh` for Opus 4.7 plans (v2.1.111). On Opus 4.8 the default is `high` (v2.1.154); Opus 5 also defaults to `high` (v2.1.219) - `/ultrareview` added for comprehensive cloud-based multi-agent code review (v2.1.111) -- `/less-permission-prompts` added to analyze Bash/MCP tool calls and reduce permission prompts via an allowlist in `.claude/settings.json` (v2.1.111) +- `/fewer-permission-prompts` added to analyze Bash/MCP tool calls and reduce permission prompts via an allowlist in `.claude/settings.json` (v2.1.111) - Auto mode no longer requires the `--enable-auto-mode` flag for Max subscribers on Opus 4.7 (v2.1.112) - `/goal` added — session-level completion condition that Claude works toward across turns; live overlay shows elapsed time, turn count, and token usage (v2.1.139) - `/scroll-speed` added — tune mouse-wheel scroll speed of the TUI live-preview pane; persists per-machine (v2.1.139) @@ -633,7 +634,7 @@ If both exist with the same name, the **skill takes precedence**. Remove one or --- -**Last Updated**: July 29, 2026 +**Last Updated**: August 4, 2026 **Claude Code Version**: 2.1.220 **Sources**: - https://code.claude.com/docs/en/slash-commands @@ -648,6 +649,6 @@ If both exist with the same name, the **skill takes precedence**. Remove one or - https://github.com/anthropics/claude-code/releases/tag/v2.1.152 - https://github.com/anthropics/claude-code/releases/tag/v2.1.153 - https://github.com/anthropics/claude-code/releases/tag/v2.1.154 -**Compatible Models**: Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 *Part of the [Claude How To](../) guide series* diff --git a/01-slash-commands/commit.md b/01-slash-commands/commit.md index be8ef39..e5dfd16 100644 --- a/01-slash-commands/commit.md +++ b/01-slash-commands/commit.md @@ -26,4 +26,8 @@ Otherwise, analyze the changes and create an appropriate commit message followin - `chore:` for maintenance tasks --- -**Last Updated**: April 9, 2026 +**Last Updated**: August 4, 2026 +**Claude Code Version**: 2.1.220 +**Sources**: +- https://code.claude.com/docs/en/commands +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/01-slash-commands/doc-refactor.md b/01-slash-commands/doc-refactor.md index 3ff3f2e..849b305 100644 --- a/01-slash-commands/doc-refactor.md +++ b/01-slash-commands/doc-refactor.md @@ -1,7 +1,6 @@ --- -name: Documentation Refactor +name: doc-refactor description: Restructure project documentation for clarity and accessibility -tags: documentation, refactoring, organization --- # Documentation Refactor @@ -24,4 +23,8 @@ Refactor project documentation structure adapted to project type: Keep docs concise, scannable, and contextual to project type. --- -**Last Updated**: April 9, 2026 +**Last Updated**: August 4, 2026 +**Claude Code Version**: 2.1.220 +**Sources**: +- https://code.claude.com/docs/en/commands +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/01-slash-commands/generate-api-docs.md b/01-slash-commands/generate-api-docs.md index 3fde0f8..e58394b 100644 --- a/01-slash-commands/generate-api-docs.md +++ b/01-slash-commands/generate-api-docs.md @@ -19,4 +19,8 @@ Output format: - Add TypeScript types --- -**Last Updated**: April 9, 2026 +**Last Updated**: August 4, 2026 +**Claude Code Version**: 2.1.220 +**Sources**: +- https://code.claude.com/docs/en/commands +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/01-slash-commands/optimize.md b/01-slash-commands/optimize.md index fa3dc59..1e528fa 100644 --- a/01-slash-commands/optimize.md +++ b/01-slash-commands/optimize.md @@ -19,4 +19,8 @@ Format your response with: - Recommended fix with code example --- -**Last Updated**: April 9, 2026 +**Last Updated**: August 4, 2026 +**Claude Code Version**: 2.1.220 +**Sources**: +- https://code.claude.com/docs/en/commands +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/01-slash-commands/pr.md b/01-slash-commands/pr.md index 200acf0..d03e3d3 100644 --- a/01-slash-commands/pr.md +++ b/01-slash-commands/pr.md @@ -26,4 +26,8 @@ Before creating a PR, execute these steps: - Potential impacts --- -**Last Updated**: April 9, 2026 +**Last Updated**: August 4, 2026 +**Claude Code Version**: 2.1.220 +**Sources**: +- https://code.claude.com/docs/en/commands +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/01-slash-commands/push-all.md b/01-slash-commands/push-all.md index 0a5d2c8..aede4db 100644 --- a/01-slash-commands/push-all.md +++ b/01-slash-commands/push-all.md @@ -152,4 +152,8 @@ If user wants control, suggest: **⚠️ Remember**: Always review changes before pushing. When in doubt, use individual git commands for more control. --- -**Last Updated**: April 9, 2026 +**Last Updated**: August 4, 2026 +**Claude Code Version**: 2.1.220 +**Sources**: +- https://code.claude.com/docs/en/commands +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/01-slash-commands/setup-ci-cd.md b/01-slash-commands/setup-ci-cd.md index 88331b1..866a966 100644 --- a/01-slash-commands/setup-ci-cd.md +++ b/01-slash-commands/setup-ci-cd.md @@ -1,7 +1,6 @@ --- -name: Setup CI/CD Pipeline +name: setup-ci-cd description: Implement pre-commit hooks and GitHub Actions for quality assurance -tags: ci-cd, devops, automation --- # Setup CI/CD Pipeline @@ -25,4 +24,8 @@ Implement comprehensive DevOps quality gates adapted to project type: Use free/open-source tools. Respect existing configs. Keep execution fast. --- -**Last Updated**: April 9, 2026 +**Last Updated**: August 4, 2026 +**Claude Code Version**: 2.1.220 +**Sources**: +- https://code.claude.com/docs/en/commands +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/01-slash-commands/unit-test-expand.md b/01-slash-commands/unit-test-expand.md index 1ee3fff..6731364 100644 --- a/01-slash-commands/unit-test-expand.md +++ b/01-slash-commands/unit-test-expand.md @@ -1,7 +1,6 @@ --- -name: Expand Unit Tests +name: unit-test-expand description: Increase test coverage by targeting untested branches and edge cases -tags: testing, coverage, unit-tests --- # Expand Unit Tests @@ -25,4 +24,8 @@ Expand existing unit tests adapted to project's testing framework: Present new test code blocks only. Follow existing test patterns and naming conventions. --- -**Last Updated**: April 9, 2026 +**Last Updated**: August 4, 2026 +**Claude Code Version**: 2.1.220 +**Sources**: +- https://code.claude.com/docs/en/commands +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/02-memory/README.md b/02-memory/README.md index 71f4583..ec261fe 100644 --- a/02-memory/README.md +++ b/02-memory/README.md @@ -494,6 +494,18 @@ Auto memory requires **Claude Code v2.1.59 or later**. If you are on an older ve npm install -g @anthropic-ai/claude-code@latest ``` +### Turning Auto Memory On or Off + +Auto memory is **on by default**. The `autoMemoryEnabled` setting (default `true`) controls it; when `false`, Claude neither reads from nor writes to the auto memory directory. You can also toggle it with `/memory` during a session. + +```json +{ + "autoMemoryEnabled": false +} +``` + +To disable it via environment instead, set `CLAUDE_CODE_DISABLE_AUTO_MEMORY=1`. Setting it to `0` forces auto memory **on** even when `--bare` mode or `autoMemoryEnabled: false` would otherwise disable it. + ### Custom Auto Memory Directory By default, auto memory is stored in `~/.claude/projects//memory/`. You can change this location using the `autoMemoryDirectory` setting (available since **v2.1.74**): @@ -936,7 +948,7 @@ graph LR - **Don't be vague**: Avoid generic statements like "follow best practices" or "write good code" -- **Don't make it too long**: Keep individual memory files focused — keep it under a few hundred lines; shorter is better +- **Don't make it too long**: Target **under 200 lines** per CLAUDE.md. Longer files still load in full, but adherence drops — see [Keeping CLAUDE.md small](#keeping-claudemd-small) below - **Don't over-organize**: Use hierarchy strategically; don't create excessive subdirectory overrides @@ -944,6 +956,33 @@ graph LR - **Don't exceed nesting limits**: Memory imports support a maximum depth of 4 hops +### Keeping CLAUDE.md Small + +Anthropic's current guidance is the opposite of "put everything in CLAUDE.md". The file loads into **every** session, so every line you add is a line that competes for attention on tasks it has nothing to do with. + +**Rule of thumb: keep CLAUDE.md under 200 lines.** Longer files still load in full, but instruction adherence degrades as the file grows. + +When it starts growing, move content out rather than trimming prose: + +| Content | Where it belongs | Why | +|---------|------------------|-----| +| Multi-step procedures | A [skill](../03-skills/) | Loads on demand, only when relevant | +| Directory- or file-type-specific rules | `.claude/rules/*.md` with `paths:` frontmatter | Scoped by glob; loads only when you touch matching files | +| Reference material and long examples | A skill's `references/` directory | Read only when the skill needs it | +| Things Claude should remember about *you* | Auto memory (on by default) | Written and loaded automatically | + +> **Note**: `@path` imports organize a large CLAUDE.md but do **not** save context — imported files are pulled in at load time just the same. Splitting into path-scoped rules is what actually reduces what loads. + +`/doctor` (v2.1.206+) inspects your configuration and proposes trims when CLAUDE.md has grown past the point of usefulness. + +### Don't Write Verification Reminders + +Older guidance encouraged lines like "always run the tests before saying you're done" or "double-check your work". On **Claude Opus 5 and Fable 5 these now cause over-verification** — Claude re-checks work that was already correct, burning turns and tokens. + +Anthropic removed more than 80% of Claude Code's own system prompt for the Claude 5 generation with no measured regression. The same principle applies to your CLAUDE.md: prefer stating the goal and letting Claude exercise judgment over enumerating the checks it should perform. + +Delete verification reminders from existing CLAUDE.md files targeting Opus 5 or Fable 5. Keep genuinely non-obvious project requirements — "integration tests need Docker running" is information, not a reminder. + ### Memory Management Tips **Choose the right memory level:** @@ -1150,7 +1189,8 @@ Auto Memory is a separate mechanism (`~/.claude/projects//memory/`), no --- -**Last Updated**: 2026-07-22 -**Claude Code Version**: 2.1.217 +**Last Updated**: August 4, 2026 +**Claude Code Version**: 2.1.220 **Sources**: - https://code.claude.com/docs/en/memory +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/02-memory/directory-api-CLAUDE.md b/02-memory/directory-api-CLAUDE.md index a9a86bd..c25f269 100644 --- a/02-memory/directory-api-CLAUDE.md +++ b/02-memory/directory-api-CLAUDE.md @@ -1,6 +1,8 @@ # API Module Standards -This file overrides root CLAUDE.md for everything in /src/api/ +This file supplements root CLAUDE.md for everything in /src/api/. Memory files are +concatenated, not overridden — the root CLAUDE.md still applies, and Claude Code +loads this file on demand when it reads files in this subtree. ## API-Specific Standards @@ -61,4 +63,8 @@ Error responses: - Tag cache keys with resource type --- -**Last Updated**: April 9, 2026 +**Last Updated**: August 4, 2026 +**Claude Code Version**: 2.1.220 +**Sources**: +- https://code.claude.com/docs/en/memory +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/02-memory/personal-CLAUDE.md b/02-memory/personal-CLAUDE.md index 4570a37..2d0fc24 100644 --- a/02-memory/personal-CLAUDE.md +++ b/02-memory/personal-CLAUDE.md @@ -60,4 +60,8 @@ project/ - **Test Framework**: Jest with React Testing Library --- -**Last Updated**: April 9, 2026 +**Last Updated**: August 4, 2026 +**Claude Code Version**: 2.1.220 +**Sources**: +- https://code.claude.com/docs/en/memory +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/02-memory/project-CLAUDE.md b/02-memory/project-CLAUDE.md index 926400f..be6a89c 100644 --- a/02-memory/project-CLAUDE.md +++ b/02-memory/project-CLAUDE.md @@ -88,4 +88,8 @@ - Admin Panel: `/projects/admin` --- -**Last Updated**: April 9, 2026 +**Last Updated**: August 4, 2026 +**Claude Code Version**: 2.1.220 +**Sources**: +- https://code.claude.com/docs/en/memory +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/03-skills/README.md b/03-skills/README.md index 79b79e1..adae5f7 100644 --- a/03-skills/README.md +++ b/03-skills/README.md @@ -93,7 +93,7 @@ sequenceDiagram | **Project** | `.claude/skills//SKILL.md` | Team | Yes (via git) | Team standards | | **Plugin** | `/skills//SKILL.md` | Where enabled | Depends | Bundled with plugins | -When skills share the same name across levels, higher-priority locations win: **enterprise > personal > project**. Plugin skills use a `plugin-name:skill-name` namespace, so they cannot conflict. +When skills share the same name across levels, higher-priority locations win: **enterprise > project > personal**. Project skills override personal ones by default; the `skillOverrides` setting (v2.1.129+) tunes that behavior — see [Controlling Skill Override Behavior](#controlling-skill-override-behavior-skilloverrides). Plugin skills use a `plugin-name:skill-name` namespace, so they cannot conflict. > **Subagent skill discovery (v2.1.133+)**: Subagents now discover project, user, and plugin skills via the Skill tool the same way the main session does. Earlier versions limited subagents to their own embedded set, which meant skill+subagent workflows quietly degraded; from v2.1.133 the same skill catalog is visible to both. @@ -550,7 +550,7 @@ refactor/ ```yaml --- -name: code-refactor +name: refactor description: Systematic code refactoring based on Martin Fowler's methodology. Use when users ask to refactor code, improve code structure, reduce technical debt, or eliminate code smells. --- @@ -888,9 +888,10 @@ Once you start building skills seriously, two things become essential: a library --- -**Last Updated**: July 29, 2026 +**Last Updated**: August 4, 2026 **Claude Code Version**: 2.1.220 **Sources**: - https://code.claude.com/docs/en/skills - https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md - https://code.claude.com/docs/en/model-config +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/03-skills/blog-draft/SKILL.md b/03-skills/blog-draft/SKILL.md index ac75056..030447d 100644 --- a/03-skills/blog-draft/SKILL.md +++ b/03-skills/blog-draft/SKILL.md @@ -272,3 +272,11 @@ blog-posts/ - Use web search for up-to-date information when URLs are provided - If resources are insufficient, ask user for more or suggest additional research - Adapt tone based on target audience (technical, general, business, etc.) + +--- + +**Last Updated**: August 4, 2026 +**Claude Code Version**: 2.1.220 +**Sources**: +- https://code.claude.com/docs/en/skills +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/03-skills/blog-draft/templates/draft-template.md b/03-skills/blog-draft/templates/draft-template.md index 95a5c1a..e626344 100644 --- a/03-skills/blog-draft/templates/draft-template.md +++ b/03-skills/blog-draft/templates/draft-template.md @@ -65,3 +65,11 @@ --- *[Optional: Author bio or related posts suggestion]* + +--- + +**Last Updated**: August 4, 2026 +**Claude Code Version**: 2.1.220 +**Sources**: +- https://code.claude.com/docs/en/skills +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/03-skills/blog-draft/templates/outline-template.md b/03-skills/blog-draft/templates/outline-template.md index 60bbcec..4c4afc3 100644 --- a/03-skills/blog-draft/templates/outline-template.md +++ b/03-skills/blog-draft/templates/outline-template.md @@ -95,3 +95,11 @@ - [Any specific requirements or constraints] - [Things to emphasize] - [Things to avoid] + +--- + +**Last Updated**: August 4, 2026 +**Claude Code Version**: 2.1.220 +**Sources**: +- https://code.claude.com/docs/en/skills +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/03-skills/brand-voice/SKILL.md b/03-skills/brand-voice/SKILL.md index 83c0a17..66d4dc6 100644 --- a/03-skills/brand-voice/SKILL.md +++ b/03-skills/brand-voice/SKILL.md @@ -71,3 +71,11 @@ Why it works: Clear value, specific benefits, action-oriented "Claude leverages cutting-edge AI to provide comprehensive software development solutions." Why it doesn't work: Vague, corporate jargon, no specific value + +--- + +**Last Updated**: August 4, 2026 +**Claude Code Version**: 2.1.220 +**Sources**: +- https://code.claude.com/docs/en/skills +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/03-skills/brand-voice/tone-examples.md b/03-skills/brand-voice/tone-examples.md index 648f7ce..f4a5658 100644 --- a/03-skills/brand-voice/tone-examples.md +++ b/03-skills/brand-voice/tone-examples.md @@ -11,3 +11,11 @@ ## Educational Blog Post "Let's explore how agents improve code review workflows. Here's what we learned..." + +--- + +**Last Updated**: August 4, 2026 +**Claude Code Version**: 2.1.220 +**Sources**: +- https://code.claude.com/docs/en/skills +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/03-skills/claude-md/SKILL.md b/03-skills/claude-md/SKILL.md index 6ae7a5b..449aab2 100644 --- a/03-skills/claude-md/SKILL.md +++ b/03-skills/claude-md/SKILL.md @@ -193,10 +193,14 @@ Before finalizing, verify: If the user requests AGENTS.md creation/update: -AGENTS.md is used for defining specialized agent behaviors. Unlike CLAUDE.md (which is for project context), AGENTS.md defines: -- Custom agent roles and capabilities -- Agent-specific instructions and constraints -- Workflow definitions for multi-agent scenarios +**Claude Code does not read AGENTS.md directly.** To make it take effect, import it from CLAUDE.md with `@AGENTS.md`, or symlink `CLAUDE.md` to it. This is the single most common misunderstanding about the file. + +AGENTS.md is a cross-tool project-context file — the same *category* of document as CLAUDE.md, not an agent-definition format. It exists so several coding agents can share one set of project conventions: +- Build, test, and lint commands +- Code style and architectural conventions +- Repository layout and where things live + +Subagents are defined separately, in `.claude/agents/*.md` — not in AGENTS.md. Apply similar principles: - Keep focused and concise @@ -210,3 +214,11 @@ Apply similar principles: - The system reminder tells Claude that CLAUDE.md "may or may not be relevant" - the more noise, the more it gets ignored - Monorepos benefit most from clear WHAT/WHY/HOW structure - Directory-specific CLAUDE.md files should be even more focused + +--- + +**Last Updated**: August 4, 2026 +**Claude Code Version**: 2.1.220 +**Sources**: +- https://code.claude.com/docs/en/skills +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/03-skills/code-review-specialist/SKILL.md b/03-skills/code-review-specialist/SKILL.md index 1b21ac9..d5a8f92 100644 --- a/03-skills/code-review-specialist/SKILL.md +++ b/03-skills/code-review-specialist/SKILL.md @@ -77,3 +77,11 @@ List maintainability problems with improvements ## Version History - v1.0.0 (2024-12-10): Initial release with security, performance, quality, and maintainability analysis + +--- + +**Last Updated**: August 4, 2026 +**Claude Code Version**: 2.1.220 +**Sources**: +- https://code.claude.com/docs/en/skills +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/03-skills/code-review-specialist/templates/finding-template.md b/03-skills/code-review-specialist/templates/finding-template.md index 919d9d6..2b84bc3 100644 --- a/03-skills/code-review-specialist/templates/finding-template.md +++ b/03-skills/code-review-specialist/templates/finding-template.md @@ -110,3 +110,11 @@ When reviewing multiple findings, track: **Recommendation:** ✅ Approve / ⚠️ Request Changes / 🔄 Needs Discussion **Overall Code Quality:** 1-5 stars + +--- + +**Last Updated**: August 4, 2026 +**Claude Code Version**: 2.1.220 +**Sources**: +- https://code.claude.com/docs/en/skills +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/03-skills/code-review-specialist/templates/review-checklist.md b/03-skills/code-review-specialist/templates/review-checklist.md index 5d48b61..2db1418 100644 --- a/03-skills/code-review-specialist/templates/review-checklist.md +++ b/03-skills/code-review-specialist/templates/review-checklist.md @@ -45,3 +45,11 @@ - [ ] No flaky tests - [ ] Mock external dependencies - [ ] Clear test names + +--- + +**Last Updated**: August 4, 2026 +**Claude Code Version**: 2.1.220 +**Sources**: +- https://code.claude.com/docs/en/skills +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/03-skills/doc-generator/SKILL.md b/03-skills/doc-generator/SKILL.md index 82d9b23..bdb4aa9 100644 --- a/03-skills/doc-generator/SKILL.md +++ b/03-skills/doc-generator/SKILL.md @@ -18,7 +18,7 @@ description: Generate comprehensive, accurate API documentation from source code ### For Each Endpoint -```markdown +````markdown ## GET /api/v1/users/:id ### Description @@ -73,4 +73,12 @@ response = requests.get( ) user = response.json() ``` -``` +```` + +--- + +**Last Updated**: August 4, 2026 +**Claude Code Version**: 2.1.220 +**Sources**: +- https://code.claude.com/docs/en/skills +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/03-skills/refactor/SKILL.md b/03-skills/refactor/SKILL.md index 1f816d3..cc297f0 100644 --- a/03-skills/refactor/SKILL.md +++ b/03-skills/refactor/SKILL.md @@ -1,5 +1,5 @@ --- -name: code-refactor +name: refactor description: Systematic code refactoring based on Martin Fowler's methodology. Use when users ask to refactor code, improve code structure, reduce technical debt, clean up legacy code, eliminate code smells, or improve code maintainability. This skill guides through a phased approach with research, planning, and safe incremental implementation. --- @@ -424,3 +424,11 @@ function processOrder(order) { ## Version History - v1.0.0 (2025-01-15): Initial release with Fowler methodology, phased approach, user consultation points + +--- + +**Last Updated**: August 4, 2026 +**Claude Code Version**: 2.1.220 +**Sources**: +- https://code.claude.com/docs/en/skills +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/03-skills/refactor/references/code-smells.md b/03-skills/refactor/references/code-smells.md index 7cecba9..810a8fd 100644 --- a/03-skills/refactor/references/code-smells.md +++ b/03-skills/refactor/references/code-smells.md @@ -667,3 +667,11 @@ Use this checklist when scanning code: - Fowler, M. (2018). *Refactoring: Improving the Design of Existing Code* (2nd ed.) - Kerievsky, J. (2004). *Refactoring to Patterns* - Feathers, M. (2004). *Working Effectively with Legacy Code* + +--- + +**Last Updated**: August 4, 2026 +**Claude Code Version**: 2.1.220 +**Sources**: +- https://code.claude.com/docs/en/skills +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/03-skills/refactor/references/refactoring-catalog.md b/03-skills/refactor/references/refactoring-catalog.md index 0a9e675..eeae222 100644 --- a/03-skills/refactor/references/refactoring-catalog.md +++ b/03-skills/refactor/references/refactoring-catalog.md @@ -1021,3 +1021,11 @@ class TelephoneNumber { - Fowler, M. (2018). *Refactoring: Improving the Design of Existing Code* (2nd ed.) - Online catalog: https://refactoring.com/catalog/ + +--- + +**Last Updated**: August 4, 2026 +**Claude Code Version**: 2.1.220 +**Sources**: +- https://code.claude.com/docs/en/skills +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/03-skills/refactor/templates/refactoring-plan.md b/03-skills/refactor/templates/refactoring-plan.md index 046b04d..b315c40 100644 --- a/03-skills/refactor/templates/refactoring-plan.md +++ b/03-skills/refactor/templates/refactoring-plan.md @@ -282,3 +282,11 @@ refactor: [Describe the refactoring] - [Testing framework] - [Linting tools] - [Complexity analysis tools] + +--- + +**Last Updated**: August 4, 2026 +**Claude Code Version**: 2.1.220 +**Sources**: +- https://code.claude.com/docs/en/skills +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/04-subagents/README.md b/04-subagents/README.md index 44100cb..ec0c692 100644 --- a/04-subagents/README.md +++ b/04-subagents/README.md @@ -136,6 +136,7 @@ to solving problems. | `effort` | No | Reasoning effort level: `low`, `medium`, `high`, `xhigh`, or `max`. Overrides the session effort level; available levels depend on the model | | `isolation` | No | Set to `worktree` to give the subagent its own git worktree | | `initialPrompt` | No | Auto-submitted first turn when the subagent runs as the main agent | +| `color` | No | Display color for the subagent in the task list and transcript. Accepts `red`, `blue`, `green`, `yellow`, `purple`, `orange`, `pink`, or `cyan` | ### Main-Thread Agent Frontmatter Honoring (v2.1.117+/v2.1.119+) @@ -1127,6 +1128,38 @@ This folder contains ready-to-use example subagents: --- +### 8. Clean Code Reviewer (`clean-code-reviewer.md`) + +**Purpose**: Readability and maintainability review against clean-code principles + +**Tools**: Read, Grep, Glob, Bash + +**Specialization**: +- Naming, function length, and argument count +- Duplication and dead code +- Comment quality and intent +- Structural clarity over cleverness + +**Use When**: You want a style and maintainability pass distinct from correctness review + +--- + +### 9. Performance Optimizer (`performance-optimizer.md`) + +**Purpose**: Identify and remediate performance bottlenecks + +**Tools**: Read, Edit, Bash, Grep, Glob + +**Specialization**: +- Algorithmic complexity and hot paths +- Memory allocation and leaks +- Caching and query optimization +- Concurrency and I/O bottlenecks + +**Use When**: Code is measurably slow and you need targeted optimization + +--- + ## Installation Instructions ### Method 1: Ask Claude (Recommended) @@ -1196,7 +1229,9 @@ project/ │ ├── secure-reviewer.md │ ├── implementation-agent.md │ ├── debugger.md -│ └── data-scientist.md +│ ├── data-scientist.md +│ ├── clean-code-reviewer.md +│ └── performance-optimizer.md └── ... ``` @@ -1285,4 +1320,4 @@ See the OpenTelemetry section in [Advanced Features → Telemetry](../09-advance - https://github.com/anthropics/claude-code/releases/tag/v2.1.139 - https://github.com/anthropics/claude-code/releases/tag/v2.1.140 - https://code.claude.com/docs/en/model-config -**Compatible Models**: Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/04-subagents/clean-code-reviewer.md b/04-subagents/clean-code-reviewer.md index 35da765..6e51f55 100644 --- a/04-subagents/clean-code-reviewer.md +++ b/04-subagents/clean-code-reviewer.md @@ -66,4 +66,8 @@ Fix: [how to fix] **Core Philosophy**: Code is read 10x more than written. Optimize for readability, not cleverness. --- -**Last Updated**: April 9, 2026 +**Last Updated**: August 4, 2026 +**Claude Code Version**: 2.1.220 +**Sources**: +- https://code.claude.com/docs/en/sub-agents +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/04-subagents/code-reviewer.md b/04-subagents/code-reviewer.md index edb1aaf..8653420 100644 --- a/04-subagents/code-reviewer.md +++ b/04-subagents/code-reviewer.md @@ -61,4 +61,8 @@ Include specific examples of how to fix issues. - **Impact**: Response time increases linearly with data size --- -**Last Updated**: April 9, 2026 +**Last Updated**: August 4, 2026 +**Claude Code Version**: 2.1.220 +**Sources**: +- https://code.claude.com/docs/en/sub-agents +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/04-subagents/data-scientist.md b/04-subagents/data-scientist.md index 1aeade9..52e62d9 100644 --- a/04-subagents/data-scientist.md +++ b/04-subagents/data-scientist.md @@ -97,4 +97,8 @@ ORDER BY 1 DESC; - [ ] Recommendations provided --- -**Last Updated**: April 9, 2026 +**Last Updated**: August 4, 2026 +**Claude Code Version**: 2.1.220 +**Sources**: +- https://code.claude.com/docs/en/sub-agents +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/04-subagents/debugger.md b/04-subagents/debugger.md index 268fcc5..c0e3d3d 100644 --- a/04-subagents/debugger.md +++ b/04-subagents/debugger.md @@ -80,4 +80,8 @@ npm test -- --grep "test name" - [ ] No regressions introduced --- -**Last Updated**: April 9, 2026 +**Last Updated**: August 4, 2026 +**Claude Code Version**: 2.1.220 +**Sources**: +- https://code.claude.com/docs/en/sub-agents +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/04-subagents/documentation-writer.md b/04-subagents/documentation-writer.md index 6800db1..2a12312 100644 --- a/04-subagents/documentation-writer.md +++ b/04-subagents/documentation-writer.md @@ -61,7 +61,7 @@ For each documentation created: ## API Documentation Example -```markdown +````markdown ## GET /api/users/:id Retrieves a user by their unique identifier. @@ -95,7 +95,11 @@ Retrieves a user by their unique identifier. curl -X GET https://api.example.com/api/users/abc123 \ -H "Authorization: Bearer " ``` -``` +```` --- -**Last Updated**: April 9, 2026 +**Last Updated**: August 4, 2026 +**Claude Code Version**: 2.1.220 +**Sources**: +- https://code.claude.com/docs/en/sub-agents +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/04-subagents/implementation-agent.md b/04-subagents/implementation-agent.md index 243fa59..c0da75d 100644 --- a/04-subagents/implementation-agent.md +++ b/04-subagents/implementation-agent.md @@ -78,4 +78,8 @@ Before marking complete: - [ ] Error handling implemented --- -**Last Updated**: April 9, 2026 +**Last Updated**: August 4, 2026 +**Claude Code Version**: 2.1.220 +**Sources**: +- https://code.claude.com/docs/en/sub-agents +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/04-subagents/performance-optimizer.md b/04-subagents/performance-optimizer.md index 336e61c..e43b591 100644 --- a/04-subagents/performance-optimizer.md +++ b/04-subagents/performance-optimizer.md @@ -126,4 +126,8 @@ For each optimization delivered: - [ ] Monitoring / alerting recommended --- -**Last Updated**: April 9, 2026 +**Last Updated**: August 4, 2026 +**Claude Code Version**: 2.1.220 +**Sources**: +- https://code.claude.com/docs/en/sub-agents +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/04-subagents/secure-reviewer.md b/04-subagents/secure-reviewer.md index cb6dce0..006b0c4 100644 --- a/04-subagents/secure-reviewer.md +++ b/04-subagents/secure-reviewer.md @@ -75,4 +75,8 @@ For each vulnerability: - **Remediation**: How to fix it --- -**Last Updated**: April 9, 2026 +**Last Updated**: August 4, 2026 +**Claude Code Version**: 2.1.220 +**Sources**: +- https://code.claude.com/docs/en/sub-agents +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/04-subagents/test-engineer.md b/04-subagents/test-engineer.md index 06ac3f2..c1a02f0 100644 --- a/04-subagents/test-engineer.md +++ b/04-subagents/test-engineer.md @@ -74,4 +74,8 @@ describe('Feature: User Authentication', () => { ``` --- -**Last Updated**: April 9, 2026 +**Last Updated**: August 4, 2026 +**Claude Code Version**: 2.1.220 +**Sources**: +- https://code.claude.com/docs/en/sub-agents +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/05-mcp/README.md b/05-mcp/README.md index 9b2fd73..fec5171 100644 --- a/05-mcp/README.md +++ b/05-mcp/README.md @@ -324,11 +324,22 @@ This allows Claude to fetch and include MCP resource content inline as part of t MCP configurations can be stored at different scopes with varying levels of sharing: -| Scope | Location | Description | Shared With | Requires Approval | -|-------|----------|-------------|-------------|------------------| -| **Local** (default) | `~/.claude.json` (under project path) | Private to current user, current project only (was called `project` in older versions) | Just you | No | -| **Project** | `.mcp.json` | Checked into git repository | Team members | Yes (first use) | -| **User** | `~/.claude.json` | Available across all projects (was called `global` in older versions) | Just you | No | +| Scope | Flag | Location | Description | Shared With | Requires Approval | +|-------|------|----------|-------------|-------------|------------------| +| **Local** (default) | `--scope local` | `~/.claude.json` (under project path) | Private to current user, current project only (was called `project` in older versions) | Just you | No | +| **Project** | `--scope project` | `.mcp.json` | Checked into git repository | Team members | Yes (first use) | +| **User** | `--scope user` | `~/.claude.json` | Available across all projects (was called `global` in older versions) | Just you | No | + +Select a scope when adding a server with `--scope` (short form `-s`). Omit it and +Claude Code uses `local`: + +```bash +# Project scope — writes to .mcp.json so the team shares it +claude mcp add --scope project --transport http github https://api.github.com/mcp + +# User scope — available in every project +claude mcp add --scope user --transport stdio memory -- npx @modelcontextprotocol/server-memory +``` ### Using Project Scope @@ -378,8 +389,13 @@ claude mcp logout github # Import from Claude Desktop claude mcp add-from-claude-desktop + +# Add a server from a JSON blob (useful for scripted setup) +claude mcp add-json events-server '{"type":"stdio","command":"npx","args":["@modelcontextprotocol/server-events"]}' ``` +> **Note**: In JSON configs — `.mcp.json`, `~/.claude.json`, or `claude mcp add-json` — the `type` field accepts `streamable-http` as an alias for `http`. The MCP specification uses the name `streamable-http` for this transport, so configurations copied from a server's own documentation work unmodified. + `claude mcp login ` / `claude mcp logout ` are the non-interactive equivalent of the OAuth flow in the `/mcp` menu — authenticate or sign out without opening it. Add `--no-browser` to `login` to complete OAuth over SSH or in a headless session (it redirects the flow through stdin). ## Available MCP Servers Table @@ -503,7 +519,7 @@ Variables are expanded at runtime: "command": "npx", "args": ["@modelcontextprotocol/server-database"], "env": { - "DATABASE_URL": "postgresql://user:pass@localhost/mydb" + "DATABASE_URL": "${DATABASE_URL}" } } } @@ -1236,7 +1252,7 @@ export GITHUB_TOKEN="your_token" --- -**Last Updated**: July 29, 2026 +**Last Updated**: August 4, 2026 **Claude Code Version**: 2.1.220 **Sources**: - https://code.claude.com/docs/en/mcp @@ -1245,4 +1261,4 @@ export GITHUB_TOKEN="your_token" - https://github.com/anthropics/claude-code/releases/tag/v2.1.139 - https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md - https://code.claude.com/docs/en/model-config -**Compatible Models**: Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/05-mcp/database-mcp.json b/05-mcp/database-mcp.json index eaa832a..adaf255 100644 --- a/05-mcp/database-mcp.json +++ b/05-mcp/database-mcp.json @@ -1,10 +1,13 @@ { "mcpServers": { "database": { + "type": "stdio", "command": "npx", - "args": ["@modelcontextprotocol/server-database"], + "args": [ + "@modelcontextprotocol/server-database" + ], "env": { - "DATABASE_URL": "postgresql://user:pass@localhost/mydb" + "DATABASE_URL": "${DATABASE_URL}" } } } diff --git a/05-mcp/filesystem-mcp.json b/05-mcp/filesystem-mcp.json index c76fdf6..87de441 100644 --- a/05-mcp/filesystem-mcp.json +++ b/05-mcp/filesystem-mcp.json @@ -1,8 +1,12 @@ { "mcpServers": { "filesystem": { + "type": "stdio", "command": "npx", - "args": ["@modelcontextprotocol/server-filesystem", "/home/user/projects"] + "args": [ + "@modelcontextprotocol/server-filesystem", + "/home/user/projects" + ] } } } diff --git a/05-mcp/github-mcp.json b/05-mcp/github-mcp.json index 0f62131..829fbb9 100644 --- a/05-mcp/github-mcp.json +++ b/05-mcp/github-mcp.json @@ -1,8 +1,11 @@ { "mcpServers": { "github": { + "type": "stdio", "command": "npx", - "args": ["@modelcontextprotocol/server-github"], + "args": [ + "@modelcontextprotocol/server-github" + ], "env": { "GITHUB_TOKEN": "${GITHUB_TOKEN}" } diff --git a/05-mcp/multi-mcp.json b/05-mcp/multi-mcp.json index 62d8fa5..983a718 100644 --- a/05-mcp/multi-mcp.json +++ b/05-mcp/multi-mcp.json @@ -1,29 +1,42 @@ { "mcpServers": { "github": { + "type": "stdio", "command": "npx", - "args": ["@modelcontextprotocol/server-github"], + "args": [ + "@modelcontextprotocol/server-github" + ], "env": { "GITHUB_TOKEN": "${GITHUB_TOKEN}" } }, "database": { + "type": "stdio", "command": "npx", - "args": ["@modelcontextprotocol/server-database"], + "args": [ + "@modelcontextprotocol/server-database" + ], "env": { "DATABASE_URL": "${DATABASE_URL}" } }, "slack": { + "type": "stdio", "command": "npx", - "args": ["@modelcontextprotocol/server-slack"], + "args": [ + "@modelcontextprotocol/server-slack" + ], "env": { "SLACK_TOKEN": "${SLACK_TOKEN}" } }, "filesystem": { + "type": "stdio", "command": "npx", - "args": ["@modelcontextprotocol/server-filesystem", "/home/user/projects"] + "args": [ + "@modelcontextprotocol/server-filesystem", + "/home/user/projects" + ] } } } diff --git a/06-hooks/README.md b/06-hooks/README.md index 2d95464..4a4bcfb 100644 --- a/06-hooks/README.md +++ b/06-hooks/README.md @@ -299,8 +299,13 @@ Runs after Claude creates tool parameters and before processing. Use this to val **Common matchers:** `Task`, `Bash`, `Glob`, `Grep`, `Read`, `Edit`, `Write`, `WebFetch`, `WebSearch` **Output control:** -- `permissionDecision`: `"allow"`, `"deny"`, or `"ask"` -- `permissionDecisionReason`: Explanation for decision +- `permissionDecision`: `"allow"`, `"deny"`, `"ask"`, or `"defer"` + - `"allow"` skips the permission prompt (except for tools that require user interaction, and connector tools your organization set to `ask`) + - `"deny"` prevents the tool call + - `"ask"` prompts the user to confirm + - `"defer"` exits gracefully so the tool can be resumed later; `permissionDecisionReason`, `updatedInput` and `additionalContext` are all ignored for this value + - Deny and ask rules are still evaluated regardless of what the hook returns. When multiple `PreToolUse` hooks disagree, precedence is `deny` > `defer` > `ask` > `allow` +- `permissionDecisionReason`: Explanation for decision. Shown to the user (not Claude) for `"allow"` and `"ask"`; shown to Claude for `"deny"`; ignored for `"defer"` - `updatedInput`: Modified tool input parameters ### PostToolUse @@ -1512,9 +1517,10 @@ Edit `~/.claude/settings.json` or `.claude/settings.json` with the hook configur --- -**Last Updated**: July 29, 2026 +**Last Updated**: August 4, 2026 **Claude Code Version**: 2.1.220 **Sources**: - https://code.claude.com/docs/en/hooks - https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md - https://code.claude.com/docs/en/sub-agents +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/06-hooks/context-tracker-tiktoken.py b/06-hooks/context-tracker-tiktoken.py index 11786bf..56afe26 100644 --- a/06-hooks/context-tracker-tiktoken.py +++ b/06-hooks/context-tracker-tiktoken.py @@ -32,7 +32,7 @@ except ImportError: ) # Configuration -CONTEXT_LIMIT = 128000 # Claude's context window (adjust for your model) +CONTEXT_LIMIT = 1000000 # 1M on Opus 5, Sonnet 5, Opus 4.8, Sonnet 4.6; 200000 on Haiku 4.5 (adjust for your model) def get_state_file(session_id: str) -> str: diff --git a/06-hooks/context-tracker.py b/06-hooks/context-tracker.py index eb5daf9..ee582cb 100644 --- a/06-hooks/context-tracker.py +++ b/06-hooks/context-tracker.py @@ -19,7 +19,7 @@ import sys import tempfile # Configuration -CONTEXT_LIMIT = 128000 # Claude's context window (adjust for your model) +CONTEXT_LIMIT = 1000000 # 1M on Opus 5, Sonnet 5, Opus 4.8, Sonnet 4.6; 200000 on Haiku 4.5 (adjust for your model) def get_state_file(session_id: str) -> str: diff --git a/06-hooks/dependency-check.sh b/06-hooks/dependency-check.sh index c659b9f..e7cc1b1 100755 --- a/06-hooks/dependency-check.sh +++ b/06-hooks/dependency-check.sh @@ -1,15 +1,21 @@ #!/bin/bash # Check for known vulnerabilities in dependencies after manifest files are modified. -# Hook: PostToolUse:Write +# Hook: PostToolUse (matcher: Write) +# +# Reads the target file path from stdin JSON (Claude Code hook protocol). +# Source: https://code.claude.com/docs/en/hooks -FILE=$1 +# Read JSON input from stdin (Claude Code hook protocol) +INPUT=$(cat) + +# Extract file_path using sed (compatible with all platforms) +FILE=$(echo "$INPUT" | sed -n 's/.*"file_path"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' | head -1) if [ -z "$FILE" ]; then - echo "Usage: $0 " exit 0 fi -# Use basename for matching — $1 may be an absolute path +# Use basename for matching — file_path may be an absolute path BASENAME=$(basename "$FILE") # Only run when a dependency manifest is written diff --git a/06-hooks/format-code.sh b/06-hooks/format-code.sh index 9841b9e..9baaeb5 100644 --- a/06-hooks/format-code.sh +++ b/06-hooks/format-code.sh @@ -1,6 +1,6 @@ #!/bin/bash # Auto-format code after writing -# Hook: PostToolUse:Write +# Hook: PostToolUse (matcher: Write) # # Reads the target file path from stdin JSON and runs the appropriate formatter # in-place on the file after Claude writes it. diff --git a/06-hooks/log-bash.sh b/06-hooks/log-bash.sh index 2ca16d9..86b991d 100644 --- a/06-hooks/log-bash.sh +++ b/06-hooks/log-bash.sh @@ -1,6 +1,6 @@ #!/bin/bash # Log all bash commands -# Hook: PostToolUse:Bash +# Hook: PostToolUse (matcher: Bash) # # Reads the executed command from stdin JSON and logs it to a file. # diff --git a/06-hooks/pre-commit.sh b/06-hooks/pre-commit.sh index 2e9b27a..66d98a8 100644 --- a/06-hooks/pre-commit.sh +++ b/06-hooks/pre-commit.sh @@ -3,6 +3,10 @@ # Hook: PreToolUse (matcher: Bash) - checks if the command is a git commit # Note: There is no "PreCommit" hook event. Use PreToolUse with a Bash matcher # and inspect the command to detect git commit operations. +# +# Exit codes: 2 blocks the tool call and surfaces stderr as the block reason. +# Any other non-zero value is a NON-blocking error — the commit would proceed. +# Source: https://code.claude.com/docs/en/hooks echo "🧪 Running tests before commit..." @@ -11,8 +15,8 @@ if [ -f "package.json" ]; then if grep -q "\"test\":" package.json; then npm test if [ $? -ne 0 ]; then - echo "❌ Tests failed! Commit blocked." - exit 1 + echo "❌ Tests failed! Commit blocked." >&2 + exit 2 fi fi fi @@ -22,8 +26,8 @@ if [ -f "pytest.ini" ] || [ -f "setup.py" ]; then if command -v pytest &> /dev/null; then pytest if [ $? -ne 0 ]; then - echo "❌ Tests failed! Commit blocked." - exit 1 + echo "❌ Tests failed! Commit blocked." >&2 + exit 2 fi fi fi @@ -32,8 +36,8 @@ fi if [ -f "go.mod" ]; then go test ./... if [ $? -ne 0 ]; then - echo "❌ Tests failed! Commit blocked." - exit 1 + echo "❌ Tests failed! Commit blocked." >&2 + exit 2 fi fi @@ -41,8 +45,8 @@ fi if [ -f "Cargo.toml" ]; then cargo test if [ $? -ne 0 ]; then - echo "❌ Tests failed! Commit blocked." - exit 1 + echo "❌ Tests failed! Commit blocked." >&2 + exit 2 fi fi diff --git a/06-hooks/security-scan.sh b/06-hooks/security-scan.sh index 81e3a5b..b9a0be9 100644 --- a/06-hooks/security-scan.sh +++ b/06-hooks/security-scan.sh @@ -1,6 +1,6 @@ #!/bin/bash # Security scan on file write -# Hook: PostToolUse:Write +# Hook: PostToolUse (matcher: Write) # # Scans files for hardcoded secrets, API keys, and credentials. # Outputs a non-blocking warning via additionalContext when issues are found. diff --git a/06-hooks/session-end.sh b/06-hooks/session-end.sh index e5df24a..2fade38 100755 --- a/06-hooks/session-end.sh +++ b/06-hooks/session-end.sh @@ -92,3 +92,5 @@ echo "" echo " Saved to $PROGRESS_FILE" [ -n "$NOTES" ] && echo " Notes: $NOTES" echo "" + +exit 0 diff --git a/07-plugins/README.md b/07-plugins/README.md index 5eae653..a4aa0b7 100644 --- a/07-plugins/README.md +++ b/07-plugins/README.md @@ -386,7 +386,7 @@ This command initiates a complete pull request review including: --- name: security-reviewer description: Security-focused code review -tools: read, grep, diff +tools: Read, Grep, Bash --- # Security Reviewer @@ -466,7 +466,16 @@ documentation/ ## Plugin Marketplace -The official Anthropic-managed plugin directory is `anthropics/claude-plugins-official`. Enterprise admins can also create private plugin marketplaces for internal distribution. +The official Anthropic-managed plugin directory is `anthropics/claude-plugins-official`, auto-registered on first interactive launch. Enterprise admins can also create private plugin marketplaces for internal distribution. + +There is also a **community marketplace**, `anthropics/claude-plugins-community`, hosting third-party plugins that have passed Anthropic's automated validation and safety screening — each pinned to a specific commit SHA in the catalog. Unlike the official marketplace you add it manually: + +```bash +/plugin marketplace add anthropics/claude-plugins-community + +# Then install from it using the claude-community marketplace name +/plugin install @claude-community +``` ```mermaid graph TB @@ -941,7 +950,7 @@ Complete PR review workflow with security, testing, and documentation checks. ``` ## Requirements -- Claude Code 1.0+ +- Claude Code 2.1+ - GitHub access - CodeQL (optional) ``` @@ -1125,7 +1134,7 @@ The following Claude Code features work together with plugins: --- -**Last Updated**: July 29, 2026 +**Last Updated**: August 4, 2026 **Claude Code Version**: 2.1.220 **Sources**: - https://code.claude.com/docs/en/plugins @@ -1143,4 +1152,4 @@ The following Claude Code features work together with plugins: - https://github.com/anthropics/claude-code/releases/tag/v2.1.143 - https://code.claude.com/docs/en/cli-reference - https://code.claude.com/docs/en/model-config -**Compatible Models**: Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/07-plugins/devops-automation/README.md b/07-plugins/devops-automation/README.md index 6354ea4..01be83e 100644 --- a/07-plugins/devops-automation/README.md +++ b/07-plugins/devops-automation/README.md @@ -75,7 +75,7 @@ Complete DevOps automation for deployment, monitoring, and incident response. ## Requirements -- Claude Code 1.0+ +- Claude Code 2.1+ - Kubernetes CLI (kubectl) - Cluster access configured @@ -108,11 +108,11 @@ Result: --- -**Last Updated**: July 29, 2026 +**Last Updated**: August 4, 2026 **Claude Code Version**: 2.1.220 **Sources**: - https://code.claude.com/docs/en/plugins - https://github.com/anthropics/claude-code/releases/tag/v2.1.131 - https://github.com/anthropics/claude-code/releases/tag/v2.1.138 - https://code.claude.com/docs/en/model-config -**Compatible Models**: Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/07-plugins/devops-automation/agents/alert-analyzer.md b/07-plugins/devops-automation/agents/alert-analyzer.md index d455e24..f33153c 100644 --- a/07-plugins/devops-automation/agents/alert-analyzer.md +++ b/07-plugins/devops-automation/agents/alert-analyzer.md @@ -1,7 +1,7 @@ --- name: alert-analyzer description: Analyzes monitoring alerts and system metrics -tools: read, grep, bash +tools: Read, Grep, Bash --- # Alert Analyzer @@ -12,3 +12,11 @@ Analyzes system health and alerts: - Root cause identification - Metric visualization - Proactive issue detection + +--- + +**Last Updated**: August 4, 2026 +**Claude Code Version**: 2.1.220 +**Sources**: +- https://code.claude.com/docs/en/plugins +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/07-plugins/devops-automation/agents/deployment-specialist.md b/07-plugins/devops-automation/agents/deployment-specialist.md index 47fe3f7..333c25b 100644 --- a/07-plugins/devops-automation/agents/deployment-specialist.md +++ b/07-plugins/devops-automation/agents/deployment-specialist.md @@ -1,7 +1,7 @@ --- name: deployment-specialist description: Handles all deployment operations -tools: read, write, bash, grep +tools: Read, Write, Bash, Grep --- # Deployment Specialist @@ -12,3 +12,11 @@ Expert in deployment operations: - Rollback procedures - Health checks - Database migrations + +--- + +**Last Updated**: August 4, 2026 +**Claude Code Version**: 2.1.220 +**Sources**: +- https://code.claude.com/docs/en/plugins +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/07-plugins/devops-automation/agents/incident-commander.md b/07-plugins/devops-automation/agents/incident-commander.md index d73929c..8beab5e 100644 --- a/07-plugins/devops-automation/agents/incident-commander.md +++ b/07-plugins/devops-automation/agents/incident-commander.md @@ -1,7 +1,7 @@ --- name: incident-commander description: Coordinates incident response -tools: read, write, bash, grep +tools: Read, Write, Bash, Grep --- # Incident Commander @@ -12,3 +12,11 @@ Manages incident response: - Status updates - Resolution tracking - Post-mortem facilitation + +--- + +**Last Updated**: August 4, 2026 +**Claude Code Version**: 2.1.220 +**Sources**: +- https://code.claude.com/docs/en/plugins +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/07-plugins/devops-automation/commands/deploy.md b/07-plugins/devops-automation/commands/deploy.md index 4873ca3..31421e7 100644 --- a/07-plugins/devops-automation/commands/deploy.md +++ b/07-plugins/devops-automation/commands/deploy.md @@ -13,3 +13,11 @@ Execute deployment workflow: 4. Deploy to target environment 5. Run health checks 6. Notify team on Slack + +--- + +**Last Updated**: August 4, 2026 +**Claude Code Version**: 2.1.220 +**Sources**: +- https://code.claude.com/docs/en/plugins +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/07-plugins/devops-automation/commands/incident.md b/07-plugins/devops-automation/commands/incident.md index b5c0459..5b7b1c7 100644 --- a/07-plugins/devops-automation/commands/incident.md +++ b/07-plugins/devops-automation/commands/incident.md @@ -14,3 +14,11 @@ Structured incident response workflow: 5. Coordinate response efforts 6. Document resolution 7. Schedule post-mortem + +--- + +**Last Updated**: August 4, 2026 +**Claude Code Version**: 2.1.220 +**Sources**: +- https://code.claude.com/docs/en/plugins +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/07-plugins/devops-automation/commands/rollback.md b/07-plugins/devops-automation/commands/rollback.md index 2eb20a3..4d85e61 100644 --- a/07-plugins/devops-automation/commands/rollback.md +++ b/07-plugins/devops-automation/commands/rollback.md @@ -12,3 +12,11 @@ Rollback to previous stable version: 3. Execute rollback procedure 4. Run health checks 5. Notify team + +--- + +**Last Updated**: August 4, 2026 +**Claude Code Version**: 2.1.220 +**Sources**: +- https://code.claude.com/docs/en/plugins +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/07-plugins/devops-automation/commands/status.md b/07-plugins/devops-automation/commands/status.md index 6c2e670..7a0d27b 100644 --- a/07-plugins/devops-automation/commands/status.md +++ b/07-plugins/devops-automation/commands/status.md @@ -13,3 +13,11 @@ Check system health across all services: 4. Review error rates 5. Check resource utilization 6. Report overall health + +--- + +**Last Updated**: August 4, 2026 +**Claude Code Version**: 2.1.220 +**Sources**: +- https://code.claude.com/docs/en/plugins +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/07-plugins/documentation/README.md b/07-plugins/documentation/README.md index 75123d0..0bdf49c 100644 --- a/07-plugins/documentation/README.md +++ b/07-plugins/documentation/README.md @@ -66,7 +66,7 @@ Comprehensive documentation generation and maintenance for your project. ## Requirements -- Claude Code 1.0+ +- Claude Code 2.1+ - GitHub access (optional) ## Example Workflow @@ -120,11 +120,11 @@ export GITHUB_TOKEN="your_github_token" --- -**Last Updated**: July 29, 2026 +**Last Updated**: August 4, 2026 **Claude Code Version**: 2.1.220 **Sources**: - https://code.claude.com/docs/en/plugins - https://github.com/anthropics/claude-code/releases/tag/v2.1.131 - https://github.com/anthropics/claude-code/releases/tag/v2.1.138 - https://code.claude.com/docs/en/model-config -**Compatible Models**: Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/07-plugins/documentation/agents/api-documenter.md b/07-plugins/documentation/agents/api-documenter.md index 487c5a4..83d2d4a 100644 --- a/07-plugins/documentation/agents/api-documenter.md +++ b/07-plugins/documentation/agents/api-documenter.md @@ -1,7 +1,7 @@ --- name: api-documenter description: API documentation specialist -tools: read, write, grep +tools: Read, Write, Grep --- # API Documenter @@ -12,3 +12,11 @@ Creates comprehensive API documentation: - Response schemas - Code examples (curl, JS, Python) - Error codes + +--- + +**Last Updated**: August 4, 2026 +**Claude Code Version**: 2.1.220 +**Sources**: +- https://code.claude.com/docs/en/plugins +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/07-plugins/documentation/agents/code-commentator.md b/07-plugins/documentation/agents/code-commentator.md index a039443..af17b41 100644 --- a/07-plugins/documentation/agents/code-commentator.md +++ b/07-plugins/documentation/agents/code-commentator.md @@ -1,7 +1,7 @@ --- name: code-commentator description: Code comment and inline documentation specialist -tools: read, write, edit +tools: Read, Write, Edit --- # Code Commentator @@ -12,3 +12,11 @@ Improves code documentation: - Parameter descriptions - Return type documentation - Usage examples + +--- + +**Last Updated**: August 4, 2026 +**Claude Code Version**: 2.1.220 +**Sources**: +- https://code.claude.com/docs/en/plugins +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/07-plugins/documentation/agents/example-generator.md b/07-plugins/documentation/agents/example-generator.md index 1cd1c7e..5d7af0e 100644 --- a/07-plugins/documentation/agents/example-generator.md +++ b/07-plugins/documentation/agents/example-generator.md @@ -1,7 +1,7 @@ --- name: example-generator description: Code example and tutorial specialist -tools: read, write +tools: Read, Write --- # Example Generator @@ -12,3 +12,11 @@ Creates practical code examples: - Integration examples - Best practices - Troubleshooting scenarios + +--- + +**Last Updated**: August 4, 2026 +**Claude Code Version**: 2.1.220 +**Sources**: +- https://code.claude.com/docs/en/plugins +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/07-plugins/documentation/commands/generate-api-docs.md b/07-plugins/documentation/commands/generate-api-docs.md index a5bda46..f597109 100644 --- a/07-plugins/documentation/commands/generate-api-docs.md +++ b/07-plugins/documentation/commands/generate-api-docs.md @@ -13,3 +13,11 @@ Generate complete API documentation: 4. Create markdown with examples 5. Include request/response schemas 6. Add error documentation + +--- + +**Last Updated**: August 4, 2026 +**Claude Code Version**: 2.1.220 +**Sources**: +- https://code.claude.com/docs/en/plugins +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/07-plugins/documentation/commands/generate-readme.md b/07-plugins/documentation/commands/generate-readme.md index 119310a..ddb68f4 100644 --- a/07-plugins/documentation/commands/generate-readme.md +++ b/07-plugins/documentation/commands/generate-readme.md @@ -13,3 +13,11 @@ Generate comprehensive README: 4. API documentation links 5. Contributing guidelines 6. License information + +--- + +**Last Updated**: August 4, 2026 +**Claude Code Version**: 2.1.220 +**Sources**: +- https://code.claude.com/docs/en/plugins +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/07-plugins/documentation/commands/sync-docs.md b/07-plugins/documentation/commands/sync-docs.md index 9681cc8..0868098 100644 --- a/07-plugins/documentation/commands/sync-docs.md +++ b/07-plugins/documentation/commands/sync-docs.md @@ -12,3 +12,11 @@ Synchronize documentation with codebase: 3. Update affected docs 4. Verify examples still work 5. Update version numbers + +--- + +**Last Updated**: August 4, 2026 +**Claude Code Version**: 2.1.220 +**Sources**: +- https://code.claude.com/docs/en/plugins +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/07-plugins/documentation/commands/validate-docs.md b/07-plugins/documentation/commands/validate-docs.md index bd41f57..e6c252b 100644 --- a/07-plugins/documentation/commands/validate-docs.md +++ b/07-plugins/documentation/commands/validate-docs.md @@ -12,3 +12,11 @@ Validate documentation quality: 3. Ensure completeness 4. Check formatting 5. Validate against actual code + +--- + +**Last Updated**: August 4, 2026 +**Claude Code Version**: 2.1.220 +**Sources**: +- https://code.claude.com/docs/en/plugins +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/07-plugins/documentation/templates/adr-template.md b/07-plugins/documentation/templates/adr-template.md index 8cc3fc3..21d8bbd 100644 --- a/07-plugins/documentation/templates/adr-template.md +++ b/07-plugins/documentation/templates/adr-template.md @@ -37,3 +37,11 @@ Description and reason for not choosing. - Related ADRs - External documentation - Discussion links + +--- + +**Last Updated**: August 4, 2026 +**Claude Code Version**: 2.1.220 +**Sources**: +- https://code.claude.com/docs/en/plugins +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/07-plugins/documentation/templates/api-endpoint.md b/07-plugins/documentation/templates/api-endpoint.md index 33c3996..2ce1714 100644 --- a/07-plugins/documentation/templates/api-endpoint.md +++ b/07-plugins/documentation/templates/api-endpoint.md @@ -99,3 +99,11 @@ data = response.json() ## Related Endpoints - [GET /api/v1/related](#) - [POST /api/v1/related](#) + +--- + +**Last Updated**: August 4, 2026 +**Claude Code Version**: 2.1.220 +**Sources**: +- https://code.claude.com/docs/en/plugins +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/07-plugins/documentation/templates/function-docs.md b/07-plugins/documentation/templates/function-docs.md index b1e137d..3e3a69e 100644 --- a/07-plugins/documentation/templates/function-docs.md +++ b/07-plugins/documentation/templates/function-docs.md @@ -48,3 +48,11 @@ const result = functionName( ## See Also - [Related Function](#) - [API Documentation](#) + +--- + +**Last Updated**: August 4, 2026 +**Claude Code Version**: 2.1.220 +**Sources**: +- https://code.claude.com/docs/en/plugins +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/07-plugins/pr-review/README.md b/07-plugins/pr-review/README.md index dae7a75..b150da5 100644 --- a/07-plugins/pr-review/README.md +++ b/07-plugins/pr-review/README.md @@ -58,7 +58,7 @@ Complete PR review workflow with security, testing, and documentation checks. ## Requirements -- Claude Code 1.0+ +- Claude Code 2.1+ - GitHub access - Git repository @@ -92,11 +92,11 @@ Result: --- -**Last Updated**: July 29, 2026 +**Last Updated**: August 4, 2026 **Claude Code Version**: 2.1.220 **Sources**: - https://code.claude.com/docs/en/plugins - https://github.com/anthropics/claude-code/releases/tag/v2.1.131 - https://github.com/anthropics/claude-code/releases/tag/v2.1.138 - https://code.claude.com/docs/en/model-config -**Compatible Models**: Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/07-plugins/pr-review/agents/performance-analyzer.md b/07-plugins/pr-review/agents/performance-analyzer.md index 2f70938..4906f9a 100644 --- a/07-plugins/pr-review/agents/performance-analyzer.md +++ b/07-plugins/pr-review/agents/performance-analyzer.md @@ -1,7 +1,7 @@ --- name: performance-analyzer description: Performance impact analysis -tools: read, grep, bash +tools: Read, Grep, Bash --- # Performance Analyzer @@ -11,3 +11,11 @@ Evaluates performance impact of changes: - Database query efficiency - Memory usage - Caching opportunities + +--- + +**Last Updated**: August 4, 2026 +**Claude Code Version**: 2.1.220 +**Sources**: +- https://code.claude.com/docs/en/plugins +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/07-plugins/pr-review/agents/security-reviewer.md b/07-plugins/pr-review/agents/security-reviewer.md index 191b07d..b95aac7 100644 --- a/07-plugins/pr-review/agents/security-reviewer.md +++ b/07-plugins/pr-review/agents/security-reviewer.md @@ -1,7 +1,7 @@ --- name: security-reviewer description: Security-focused code review -tools: read, grep, bash +tools: Read, Grep, Bash --- # Security Reviewer @@ -11,3 +11,11 @@ Specializes in finding security vulnerabilities: - Data exposure - Injection attacks - Secure configuration + +--- + +**Last Updated**: August 4, 2026 +**Claude Code Version**: 2.1.220 +**Sources**: +- https://code.claude.com/docs/en/plugins +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/07-plugins/pr-review/agents/test-checker.md b/07-plugins/pr-review/agents/test-checker.md index 90a065d..b04a205 100644 --- a/07-plugins/pr-review/agents/test-checker.md +++ b/07-plugins/pr-review/agents/test-checker.md @@ -1,7 +1,7 @@ --- name: test-checker description: Test coverage and quality analysis -tools: read, bash, grep +tools: Read, Bash, Grep --- # Test Checker @@ -11,3 +11,11 @@ Analyzes test coverage and quality: - Missing test cases - Test quality assessment - Edge case identification + +--- + +**Last Updated**: August 4, 2026 +**Claude Code Version**: 2.1.220 +**Sources**: +- https://code.claude.com/docs/en/plugins +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/07-plugins/pr-review/commands/check-security.md b/07-plugins/pr-review/commands/check-security.md index 58d5a68..5192201 100644 --- a/07-plugins/pr-review/commands/check-security.md +++ b/07-plugins/pr-review/commands/check-security.md @@ -12,3 +12,11 @@ Perform focused security analysis on code changes: 3. Injection vulnerabilities 4. Cryptographic weaknesses 5. Sensitive data in logs + +--- + +**Last Updated**: August 4, 2026 +**Claude Code Version**: 2.1.220 +**Sources**: +- https://code.claude.com/docs/en/plugins +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/07-plugins/pr-review/commands/check-tests.md b/07-plugins/pr-review/commands/check-tests.md index 6674562..d1027b5 100644 --- a/07-plugins/pr-review/commands/check-tests.md +++ b/07-plugins/pr-review/commands/check-tests.md @@ -12,3 +12,11 @@ Analyze test coverage and quality: 3. Review test quality 4. Suggest missing test cases 5. Verify edge cases are covered + +--- + +**Last Updated**: August 4, 2026 +**Claude Code Version**: 2.1.220 +**Sources**: +- https://code.claude.com/docs/en/plugins +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/07-plugins/pr-review/commands/review-pr.md b/07-plugins/pr-review/commands/review-pr.md index 0078be3..79e6ea9 100644 --- a/07-plugins/pr-review/commands/review-pr.md +++ b/07-plugins/pr-review/commands/review-pr.md @@ -12,3 +12,11 @@ This command initiates a complete pull request review including: 3. Documentation updates 4. Code quality checks 5. Performance impact assessment + +--- + +**Last Updated**: August 4, 2026 +**Claude Code Version**: 2.1.220 +**Sources**: +- https://code.claude.com/docs/en/plugins +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/08-checkpoints/README.md b/08-checkpoints/README.md index 35144fc..cc7003f 100644 --- a/08-checkpoints/README.md +++ b/08-checkpoints/README.md @@ -214,15 +214,21 @@ Since checkpoints are created automatically, you can focus on your work without Checkpoints are a built-in default behavior in Claude Code and do not require any configuration to enable. Every user prompt automatically creates a checkpoint. -The only checkpoint-related setting is `cleanupPeriodDays`, which controls how long sessions and checkpoints are retained: +Two settings govern checkpoint behavior — whether snapshots are taken at all, and how long they are kept: ```json { + "fileCheckpointingEnabled": true, "cleanupPeriodDays": 30 } ``` -- `cleanupPeriodDays`: Number of days to retain session history and checkpoints (default: `30`) +| Setting | Default | Effect | +|---------|---------|--------| +| `fileCheckpointingEnabled` | `true` | Snapshot files before each edit so `/rewind` can restore them. Requires v2.1.119+. Surfaces in `/config` as **Rewind code (checkpoints)**. Env equivalent: `CLAUDE_CODE_DISABLE_FILE_CHECKPOINTING` | +| `cleanupPeriodDays` | `30` | Number of days to retain session history and checkpoints | + +Claude Code keeps snapshots for the **100 most recent checkpoints**; older ones are dropped even inside the retention window. > **v2.1.117 update**: `cleanupPeriodDays` now governs retention for four on-disk caches, not just checkpoints: > @@ -330,11 +336,11 @@ Remember: checkpoints are not a replacement for git. Use checkpoints for rapid e --- -**Last Updated**: July 29, 2026 +**Last Updated**: August 4, 2026 **Claude Code Version**: 2.1.220 **Sources**: - https://code.claude.com/docs/en/checkpointing - https://code.claude.com/docs/en/settings - https://github.com/anthropics/claude-code/releases/tag/v2.1.117 - https://code.claude.com/docs/en/model-config -**Compatible Models**: Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/08-checkpoints/checkpoint-examples.md b/08-checkpoints/checkpoint-examples.md index 7a5dd7d..a18cf4b 100644 --- a/08-checkpoints/checkpoint-examples.md +++ b/08-checkpoints/checkpoint-examples.md @@ -345,4 +345,4 @@ User: Now let's continue with the approach that worked. - https://code.claude.com/docs/en/checkpointing - https://code.claude.com/docs/en/changelog - https://code.claude.com/docs/en/model-config -**Compatible Models**: Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/09-advanced-features/README.md b/09-advanced-features/README.md index a839fc8..cbe3edd 100644 --- a/09-advanced-features/README.md +++ b/09-advanced-features/README.md @@ -22,22 +22,24 @@ Comprehensive guide to Claude Code's advanced capabilities including planning mo 11. [Headless Mode](#headless-mode) 12. [Session Management](#session-management) 13. [Interactive Features](#interactive-features) -14. [TUI Mode (Fullscreen)](#tui-mode-fullscreen) -15. [Voice Dictation](#voice-dictation) -16. [Channels](#channels) -17. [Chrome Integration](#chrome-integration) -18. [Remote Control](#remote-control) -19. [Web Sessions](#web-sessions) -20. [Desktop App](#desktop-app) -21. [Task List](#task-list) -22. [Prompt Suggestions](#prompt-suggestions) -23. [Git Worktrees](#git-worktrees) -24. [Sandboxing](#sandboxing) -25. [Managed Settings (Enterprise)](#managed-settings-enterprise) -26. [Configuration and Settings](#configuration-and-settings) -27. [Agent Teams](#agent-teams) -28. [Best Practices](#best-practices) -29. [Additional Resources](#additional-resources) +14. [Output Styles](#output-styles) +15. [Status Line](#status-line) +16. [TUI Mode (Fullscreen)](#tui-mode-fullscreen) +17. [Voice Dictation](#voice-dictation) +18. [Channels](#channels) +19. [Chrome Integration](#chrome-integration) +20. [Remote Control](#remote-control) +21. [Web Sessions](#web-sessions) +22. [Desktop App](#desktop-app) +23. [Task List](#task-list) +24. [Prompt Suggestions](#prompt-suggestions) +25. [Git Worktrees](#git-worktrees) +26. [Sandboxing](#sandboxing) +27. [Managed Settings (Enterprise)](#managed-settings-enterprise) +28. [Configuration and Settings](#configuration-and-settings) +29. [Agent Teams](#agent-teams) +30. [Best Practices](#best-practices) +31. [Additional Resources](#additional-resources) --- @@ -320,6 +322,14 @@ Separate from the [`fallbackModel` setting](#fallback-models-fallbackmodel) (whi Why this matters here: if you run [security-review subagents](../04-subagents/README.md) or CTF/pentest work on Opus 5, expect silent re-runs on Opus 4.8 (different effort ceiling and context window) for cybersecurity prompts, and outright refusals for biology-adjacent ones. Pin a different model explicitly if that behavior gets in the way. +**Controlling the switch** — the `switchModelsOnFlag` setting (v2.1.170+, default `true`) decides whether the fallback happens silently. Set it to `false` and Claude Code pauses instead, letting you choose between switching models and editing the prompt. It appears in `/config` as **Switch models when a message is flagged**. + +```json +{ + "switchModelsOnFlag": false +} +``` + ### Benefits of Extended Thinking - **Deep reasoning**: Spend more time thinking about complex problems @@ -900,7 +910,7 @@ Permission modes control what actions Claude can take without explicit approval. | `bypassPermissions` | All actions, no permission checks (dangerous) | | `dontAsk` | Only pre-approved tools execute; all others denied | -> **Note**: The interactive default mode was renamed from `default` to **Manual** in v2.1.200 (across the CLI, `--help`, VS Code, and JetBrains), and a grey ⏸ badge appears in the footer while it is active (v2.1.203). Both `--permission-mode manual` and `--permission-mode default` work, as do `"defaultMode": "manual"` and `"defaultMode": "default"` in settings — so the `"mode": "default"` values in the config examples below remain valid. +> **Note**: The interactive default mode was renamed from `default` to **Manual** in v2.1.200 (across the CLI, `--help`, VS Code, and JetBrains), and a grey ⏸ badge appears in the footer while it is active (v2.1.203). Both `--permission-mode manual` and `--permission-mode default` work, as do `"defaultMode": "manual"` and `"defaultMode": "default"` in settings. Note that the settings key is `permissions.defaultMode` — there is no `permissions.mode` key, so the examples below use the canonical spelling. Cycle through modes with `Shift+Tab` in the CLI. Set a default with the `--permission-mode` flag or the `permissions.defaultMode` setting. @@ -1136,7 +1146,8 @@ Manage multiple Claude Code sessions effectively. |---------|-------------| | `/resume` | Resume a conversation by ID or name | | `/rename` | Name the current session | -| `/fork ` | Spawn a background subagent that inherits the full conversation and works on the directive while you keep going | +| `/fork [prompt]` | Copy the conversation into a new independent background session and keep working here (v2.1.212+) | +| `/subtask ` | Spawn a forked subagent that inherits the full conversation and reports its result back here (v2.1.212+) | | `/branch [name]` | Switch into a copy of the conversation at this point, preserving the original | | `claude -c` | Continue most recent conversation | | `claude -r "session"` | Resume session by name or ID | @@ -1162,19 +1173,27 @@ claude -r "auth-refactor" "finish this PR" ### Forking and Branching Sessions -`/fork ` spawns a background subagent that inherits the full conversation and works on the directive while you keep working in the current session — its own row in `claude agents`, with the result returned to your conversation when it finishes: +Three commands make copies of a conversation, and they differ in *where the copy runs*: + +`/subtask ` spawns a forked subagent that inherits the full conversation and works on the task while you keep working — its own row in `claude agents`, with the result returned to your conversation when it finishes: ``` -/fork Investigate why the auth tests are flaky +/subtask Investigate why the auth tests are flaky ``` -To switch into a copy of the conversation yourself instead of delegating to a background subagent, use `/branch [name]`, which preserves the original and lets you return to it with `/resume`: +`/fork [prompt]` copies the conversation into a new **background session** instead. The copy starts with everything up to now and runs independently — nothing comes back to this conversation: + +``` +/fork Try the OAuth approach end to end +``` + +To switch into a copy yourself rather than delegating at all, use `/branch [name]`, which preserves the original and lets you return to it with `/resume`: ``` /branch try-oauth-instead ``` -> **Note**: Before v2.1.161, `/fork` was simply an alias for `/branch`. Since v2.1.161 they are distinct: `/fork` delegates to a background subagent, `/branch` switches you into a copy in place. +> **Note**: `/fork` and `/subtask` swapped roles in **v2.1.212**. Before v2.1.161 `/fork` was an alias for `/branch`; from v2.1.161 to v2.1.211 it started a forked subagent — the behavior now carried by `/subtask`. When agent view is turned off, `/subtask` is unavailable and `/fork` retains the forked-subagent behavior. Or fork from the CLI: ```bash @@ -1460,6 +1479,128 @@ Use this for quick command execution without switching contexts. --- +## Output Styles + +Output styles change **how** Claude responds, not what it knows. They modify the system prompt to set role, tone, and default response format. Reach for one when you keep re-prompting for the same voice every turn, or when you want Claude acting as something other than a software engineer. + +For instructions about your project or codebase, use [CLAUDE.md](../02-memory/) instead — that is a different mechanism with different tradeoffs. + +### Built-in styles + +| Style | Behavior | +|-------|----------| +| **Default** | The standard system prompt, tuned for completing software engineering tasks efficiently | +| **Proactive** | Claude executes immediately and makes reasonable assumptions instead of pausing for routine decisions. Stronger autonomous-execution guidance than auto mode, but it does **not** change your permission mode — you still see permission prompts | +| **Explanatory** | Adds educational "Insights" between steps, explaining implementation choices and codebase patterns | +| **Learning** | Collaborative learn-by-doing. Claude shares insights *and* leaves `TODO(human)` markers for you to implement small, strategic pieces yourself | + +### Selecting a style + +Run `/config` and choose **Output style**. The selection is saved to `.claude/settings.local.json`. To set it without the menu, edit the setting directly: + +```json +{ + "outputStyle": "Explanatory" +} +``` + +> **Note**: The standalone `/output-style` command was deprecated in v2.1.73 and **removed in v2.1.91**. Use `/config` or the `outputStyle` setting. + +Output style is part of the system prompt, which Claude Code reads once at session start — changes take effect after `/clear` or in a new session. + +### Custom output styles + +A custom style is a Markdown file with frontmatter, saved at one of three levels: + +- User: `~/.claude/output-styles/` +- Project: `.claude/output-styles/` +- Managed policy: `.claude/output-styles/` inside the managed settings directory + +Project styles load from every `.claude/output-styles/` between the working directory and the repo root. As of v2.1.178, when nested directories define the same style name, the one closest to the working directory wins. + +```markdown +--- +name: Diagrams first +description: Lead every explanation with a diagram +keep-coding-instructions: true +--- + +When explaining code, architecture, or data flow, start with a Mermaid diagram +showing the structure, then explain in prose. +``` + +| Frontmatter | Purpose | Default | +|-------------|---------|---------| +| `name` | Style name, if not the file name | Inherits from file name | +| `description` | Shown in the `/config` picker | None | +| `keep-coding-instructions` | Keep Claude Code's built-in software engineering instructions | `false` | +| `force-for-plugin` | Plugin styles only: apply automatically whenever the plugin is enabled, overriding the user's `outputStyle` | `false` | + +**Set `keep-coding-instructions: true`** when you are changing how Claude communicates but still want it coding the same way. Leave it out when Claude is not doing software engineering at all — a writing assistant or data analyst. + +### Scope and cost + +Output styles apply to the **main conversation only**. A subagent runs its own system prompt, so styles do not change how subagents respond; a fork is the exception, since it inherits the parent's full system prompt. + +Adding instructions increases input tokens, though prompt caching absorbs most of that after the first request. Explanatory and Learning produce longer responses by design, which increases output tokens. + +### How it compares + +| Feature | How it works | Use it when | +|---------|--------------|-------------| +| Output styles | Modifies the system prompt | You want a different role, tone, or format every turn | +| [CLAUDE.md](../02-memory/) | Adds a user message after the system prompt | Claude should always know your project conventions | +| `--append-system-prompt` | Appends to the system prompt without removing anything | A one-off addition for a single invocation | +| [Subagents](../04-subagents/) | Runs with its own system prompt, model, and tools | You want a separately scoped helper | +| [Skills](../03-skills/) | Loads task-specific instructions when invoked | You have a reusable workflow | + +--- + +## Status Line + +The status line is a custom command whose output renders at the bottom of the session. Configure it with `/statusline`, or set it directly: + +```json +{ + "statusLine": { + "type": "command", + "command": "~/.claude/statusline.sh", + "padding": 0 + } +} +``` + +`padding` defaults to `0`. Claude Code pipes a JSON object to the command on stdin, so the script decides what to display. + +### Available input fields + +| Group | Fields | +|-------|--------| +| Session | `session_id`, `session_name`, `prompt_id`, `transcript_path`, `cwd`, `version` | +| Model | `model.id`, `output_style.name`, `effort.level`, `fast_mode`, `thinking.enabled` | +| Agent | `agent.name`, `vim.mode` | +| Cost | `cost.total_cost_usd`, `cost.total_duration_ms`, `cost.total_api_duration_ms`, `cost.total_lines_added` | +| Context | `context_window.context_window_size`, `.current_usage`, `.remaining_percentage`, `.total_input_tokens`, `.used_percentage` | +| Limits | `rate_limits.five_hour.used_percentage`, `.resets_at` | +| Repo | `pr.number`, `pr.review_state`, `workspace.project_dir`, `workspace.added_dirs`, `workspace.git_worktree`, `workspace.repo.host` | +| Worktree | `worktree.name`, `.branch`, `.path`, `.original_branch`, `.original_cwd` | + +### Example + +```bash +#!/bin/bash +# ~/.claude/statusline.sh — model, context usage, and cost +input=$(cat) +model=$(echo "$input" | jq -r '.model.id') +used=$(echo "$input" | jq -r '.context_window.used_percentage') +cost=$(echo "$input" | jq -r '.cost.total_cost_usd') +printf '%s | ctx %.0f%% | $%.2f' "$model" "$used" "$cost" +``` + +> **Note**: `statusLine` requires workspace trust. Status-line scripts also receive `COLUMNS` and `LINES` in their environment (v2.1.153+) so they can size output to the terminal. + +--- + ## TUI Mode (Fullscreen) > **New in v2.1.110** @@ -2129,7 +2270,7 @@ Since v2.1.83, administrators can deploy multiple managed settings files into a ```json { "permissions": { - "mode": "default" + "defaultMode": "manual" }, "hooks": { "PreToolUse:Edit": "eslint --fix ${file_path}", @@ -2152,7 +2293,7 @@ Since v2.1.83, administrators can deploy multiple managed settings files into a ```json { "permissions": { - "mode": "default", + "defaultMode": "manual", "allowedTools": ["Bash(git log:*)", "Read"], "disallowedTools": ["Bash(rm -rf:*)"] }, @@ -2315,7 +2456,7 @@ Create `.claude/config.json` in your project: "PreToolUse": [{ "matcher": "Bash", "hooks": ["npm test && npm run lint"] }] }, "permissions": { - "mode": "default" + "defaultMode": "manual" }, "mcp": { "servers": { @@ -2447,7 +2588,7 @@ For more information about Claude Code and related features: --- -**Last Updated**: July 29, 2026 +**Last Updated**: August 4, 2026 **Claude Code Version**: 2.1.220 **Sources**: - https://code.claude.com/docs/en/settings @@ -2455,3 +2596,4 @@ For more information about Claude Code and related features: - https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md - https://code.claude.com/docs/en/model-config - https://code.claude.com/docs/en/permission-modes +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/09-advanced-features/config-examples.json b/09-advanced-features/config-examples.json index 354a49b..8b9ca0f 100644 --- a/09-advanced-features/config-examples.json +++ b/09-advanced-features/config-examples.json @@ -44,7 +44,7 @@ "config": { "model": "claude-sonnet-5", "permissions": { - "defaultMode": "default" + "defaultMode": "manual" }, "env": { "CLAUDE_CODE_EFFORT_LEVEL": "high" @@ -57,9 +57,9 @@ "name": "Production Deployment", "description": "Configuration for production operations with safety checks", "config": { - "model": "claude-opus-4-8", + "model": "claude-opus-5", "permissions": { - "defaultMode": "default", + "defaultMode": "manual", "deny": ["Bash(git push --force*)", "Bash(rm -rf*)"] }, "hooks": { @@ -95,7 +95,7 @@ "name": "Security Audit", "description": "Configuration for security-focused code analysis", "config": { - "model": "claude-opus-4-8", + "model": "claude-opus-5", "permissions": { "defaultMode": "plan" }, @@ -133,7 +133,7 @@ "config": { "model": "claude-sonnet-5", "permissions": { - "defaultMode": "default" + "defaultMode": "manual" }, "env": { "CLAUDE_CODE_EFFORT_LEVEL": "high" @@ -145,9 +145,9 @@ "name": "Large Refactoring", "description": "Configuration for major refactoring work: backup before edits, run related tests after", "config": { - "model": "claude-opus-4-8", + "model": "claude-opus-5", "permissions": { - "defaultMode": "default", + "defaultMode": "manual", "allow": ["Bash(npm test -- --findRelatedTests *)"] }, "fileCheckpointingEnabled": true, diff --git a/09-advanced-features/planning-mode-examples.md b/09-advanced-features/planning-mode-examples.md index dfa844a..cae3b92 100644 --- a/09-advanced-features/planning-mode-examples.md +++ b/09-advanced-features/planning-mode-examples.md @@ -539,4 +539,4 @@ Proceed with this plan? (yes/no/modify) - https://code.claude.com/docs/en/changelog - https://code.claude.com/docs/en/best-practices - https://code.claude.com/docs/en/model-config -**Compatible Models**: Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/10-cli/README.md b/10-cli/README.md index 52e79b7..5cb137d 100644 --- a/10-cli/README.md +++ b/10-cli/README.md @@ -1020,4 +1020,4 @@ claude -p --output-format json "query" - https://code.claude.com/docs/en/overview - https://code.claude.com/docs/en/sub-agents - https://code.claude.com/docs/en/headless -**Compatible Models**: Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/CATALOG.md b/CATALOG.md index f8402c2..ed19ed6 100644 --- a/CATALOG.md +++ b/CATALOG.md @@ -16,13 +16,13 @@ | Feature | Built-in | Examples | Total | Reference | |---------|----------|----------|-------|-----------| | **Slash Commands** | 60+ | 8 | 68+ | [01-slash-commands/](01-slash-commands/) | -| **Subagents** | 6 | 11 | 17 | [04-subagents/](04-subagents/) | +| **Subagents** | 6 | 9 | 15 | [04-subagents/](04-subagents/) | | **Skills** | 10 bundled | 6 | 16 | [03-skills/](03-skills/) | | **Plugins** | - | 3 | 3 | [07-plugins/](07-plugins/) | -| **MCP Servers** | 1 | 8 | 9 | [05-mcp/](05-mcp/) | -| **Hooks** | 29 events | 8 | 8 | [06-hooks/](06-hooks/) | -| **Memory** | 7 types | 3 | 3 | [02-memory/](02-memory/) | -| **Total** | **104** | **47** | **126** | | +| **MCP Servers** | 1 | 4 | 5 | [05-mcp/](05-mcp/) | +| **Hooks** | 31 events | 11 | 42 | [06-hooks/](06-hooks/) | +| **Memory** | 7 types | 3 | 10 | [02-memory/](02-memory/) | +| **Total** | **115** | **44** | **159** | | --- @@ -84,7 +84,8 @@ Commands are user-invoked shortcuts that execute specific actions. | `/theme` | Change color theme; v2.1.118 added custom named themes via `~/.claude/themes/.json` (plugins can ship a `themes/` dir) | Customize appearance | | `/usage` | Canonical command for usage/cost/stats — merged `/cost` and `/stats` into a single tabbed view (v2.1.118); as of v2.1.149 the cost view breaks spending down by category (skills, subagents, plugins, per-MCP-server). In the **VSCode extension** (v2.1.174), the `/usage` (Account & usage) dialog adds an attribution breakdown — cache misses, long-context cost, subagents, and per-skill / per-agent / per-plugin / per-MCP usage over 24h and 7d windows | Monitor quota and costs | | `/focus` | Toggle focus view (distraction-free output display) | Reduce visual noise during long tasks | -| `/fork` | Fork current conversation | Explore alternatives | +| `/fork` | Copy the conversation into a new independent background session (v2.1.212+) | Explore alternatives in parallel | +| `/subtask` | Spawn a forked subagent that inherits the conversation and reports back (v2.1.212+) | Delegate a side task without losing your place | | `/stats` | Shortcut alias that opens the stats tab of `/usage` (v2.1.118+) | Review session metrics | | `/statusline` | Configure status line | Customize status display | | `/stickers` | View session stickers | Fun rewards | @@ -95,7 +96,7 @@ Commands are user-invoked shortcuts that execute specific actions. | `/team-onboarding` | Generate a teammate ramp-up guide from this project's Claude Code usage | Onboarding new teammates (v2.1.101) | | `/ultraplan` | Hand a planning task to a Claude Code web session in plan mode | Heavy planning offload (Research Preview, v2.1.91+) | | `/ultrareview` | Run a cloud multi-agent code review over your current changes | Deep pre-merge review across multiple agents (v2.1.112) | -| `/less-permission-prompts` | Scan transcripts and propose a prioritized allowlist for common read-only tools | Reduce repeat permission prompts in a project (v2.1.112) | +| `/fewer-permission-prompts` | Scan transcripts and propose a prioritized allowlist for common read-only tools | Reduce repeat permission prompts in a project (v2.1.112) | ### Custom Commands (Examples) @@ -461,6 +462,9 @@ cp 02-memory/personal-CLAUDE.md ~/.claude/CLAUDE.md | **/tui** | Toggle fullscreen TUI (text user interface) mode for flicker-free rendering (v2.1.110) | Use `/tui` in fullscreen terminals or tmux | | **/undo** | Alias for `/rewind` — reverts to the previous checkpoint (v2.1.108) | Use `/undo` interchangeably with `/rewind` | | **Monitor Tool** | Watch a background command's stdout stream and react to events instead of polling (v2.1.98+) | Use the Monitor tool via [Advanced Features](09-advanced-features/) | +| **Output Styles** | Change Claude's role, tone, and default response format via the system prompt. Built-ins: Default, Proactive, Explanatory, Learning | `/config` → Output style, or set `outputStyle`. The `/output-style` command was removed in v2.1.91. See [Advanced Features](09-advanced-features/#output-styles) | +| **Status Line** | Render a custom status line from a command that receives session, model, cost, and context JSON on stdin | `/statusline` or the `statusLine` setting. See [Advanced Features](09-advanced-features/#status-line) | +| **Community Marketplace** | Third-party plugins that passed Anthropic's automated validation, each pinned to a commit SHA | `/plugin marketplace add anthropics/claude-plugins-community`, then `/plugin install @claude-community` | | **/team-onboarding** | Auto-generate a teammate ramp-up guide from the project's Claude Code setup (v2.1.101) | Run `/team-onboarding` in your project | | **Ultraplan auto-create** | Cloud environment created automatically on first `/ultraplan` invocation — no manual setup required (v2.1.101) | Use `/ultraplan ` | | **Remote Control** | Control Claude Code sessions remotely via API | Use the remote control API to send prompts and receive responses programmatically | @@ -545,7 +549,7 @@ chmod +x ~/.claude/hooks/*.sh --- -**Last Updated**: July 29, 2026 +**Last Updated**: August 4, 2026 **Claude Code Version**: 2.1.220 **Sources**: - https://code.claude.com/docs/en/sub-agents @@ -562,4 +566,4 @@ chmod +x ~/.claude/hooks/*.sh - https://code.claude.com/docs/en/cli-reference - https://code.claude.com/docs/en/model-config - https://code.claude.com/docs/en/skills -**Compatible Models**: Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/CHANGELOG.md b/CHANGELOG.md index a353478..bdd190b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,109 @@ # Changelog +## [v2.1.220-r2] — 2026-08-04 + +### Accuracy pass against Claude Code v2.1.220 (no upstream version change) + +v2.1.220 (2026-07-25) is still the current Claude Code release, so this entry +records **internal corrections**, not a version sync. An audit against the +official docs found no missing upstream features — every v2.1.218–v2.1.220 +capability was already documented. What it did find was broken example code, +counts and names that disagreed between files, and metadata drift. + +### Fixed + +- **`06-hooks/pre-commit.sh` never actually blocked a commit** — the script + printed "Commit blocked." and then `exit 1` at four places. Per this repo's own + exit-code table (`06-hooks/README.md`), exit 1 is a *non-blocking* error, so the + commit proceeded anyway; only exit 2 blocks. All four now `exit 2` and write the + reason to stderr, which is where Claude Code reads the block reason from. +- **`06-hooks/dependency-check.sh` never ran** — it read its target from `$1`, but + hooks receive JSON on stdin, so the path was always empty and the script exited + immediately. Now parses `file_path` from stdin, matching `format-code.sh`. +- **Nested-subagent depth said 5 in `claude_concepts_guide.md`** — stated "up to 5 + levels deep as of v2.1.172", contradicting the depth-3 default (v2.1.219) already + documented in four other files. Rewritten to lead with current behavior plus the + same three-era history note used in `04-subagents/README.md`. +- **Hook event count was 29 in five files** — `README.md`, `CATALOG.md`, + `QUICK_REFERENCE.md` (×4), `INDEX.md` and `resources.md` all said 29; the correct + figure is **31**, confirmed name-by-name against the official hook list. The + previous sync fixed two files and missed the rest. `README.md`'s event list also + enumerated only 25 names and `INDEX.md`'s only 29 — both now list all 31. +- **`/less-permission-prompts` is not a real command** — the built-in is + `/fewer-permission-prompts`. `CATALOG.md` had used *both* names in one file. +- **`/fork` and `/subtask` were documented with swapped meanings** — they exchanged + roles in v2.1.212. `/fork` now copies the conversation into a new independent + background session; the forked-subagent behavior moved to `/subtask`, which was + absent from the repo entirely. Corrected and added in four files. +- **`08-checkpoints/README.md` claimed `cleanupPeriodDays` was the only checkpoint + setting** — `fileCheckpointingEnabled` (default `true`) also exists, along with + `CLAUDE_CODE_DISABLE_FILE_CHECKPOINTING` and a 100-checkpoint retention cap. The + repo's own `config-examples.json` already used the key it denied existed. +- **`03-skills/refactor/SKILL.md` declared `name: code-refactor`** while living in + `refactor/` — the same defect fixed for `doc-generator` last sync. Renamed in the + English copy and mirrored to `ja/`, `zh/`, `uk/`, `vi/`. +- **`03-skills/README.md` stated skill precedence two contradictory ways** — + "enterprise > personal > project" in one place, "project wins by default" in + another. Now consistently **enterprise > project > personal**. +- **`claude-md` skill described AGENTS.md incorrectly** — called it an + agent-definition format. It is a cross-tool project-context file, and Claude Code + **does not read it directly**; it must be imported via `@AGENTS.md` or symlinked. +- **`02-memory/directory-api-CLAUDE.md` claimed it "overrides" root CLAUDE.md** — + memory files are concatenated, never overridden. +- **`INDEX.md` described `auto` and `dontAsk` backwards** — `dontAsk` was written up + as permissive ("accept all except risky") when it is the most restrictive mode: + it auto-denies anything not pre-approved. Corrected to the official definitions. +- **`permissions.mode` is not a settings key** — four config samples in + `09-advanced-features/README.md` and `claude_concepts_guide.md` used it (with the + superseded value `default`). All now use `permissions.defaultMode: "manual"`. +- **`09-advanced-features/config-examples.json` had no Opus 5** — still used + `claude-opus-4-8` for its three "most capable" profiles despite Opus 5 being the + default Opus since v2.1.219. +- **`05-mcp/database-mcp.json` hardcoded a credential** — + `postgresql://user:pass@localhost/mydb`, contradicting the module's own "don't + hardcode credentials" rule. Now `${DATABASE_URL}`. +- **`05-mcp/README.md` documented MCP scopes but never the `--scope` flag** — + readers had no way to actually select a scope. Added with examples. +- **`/output-style` was listed as deprecated** — it was *removed* in v2.1.91. + Output styles remain available via `/config` or the `outputStyle` setting. +- **Hook `permissionDecision` was missing `defer`** — the accepted values are + `allow`, `deny`, `ask`, `defer`, with precedence `deny` > `defer` > `ask` > `allow`. +- **Context-tracker hooks assumed a 128k window** — no current Claude model has one. + Default raised to 1M, with Haiku 4.5's 200k noted. +- **Local memory path was wrong in `claude_concepts_guide.md`** — + `.claude/local/CLAUDE.md` corrected to `./CLAUDE.local.md`. +- **Broken fence in `03-skills/doc-generator/SKILL.md`** — the outer ```` ```markdown ```` + block closed early and left a stray unclosed fence, so half the example rendered + as live markdown. Now uses a four-backtick outer fence. Neither validator caught + this, because `check_markdown_rendering.py` only scans README files. +- **Three command templates had invalid skill names** — `Documentation Refactor`, + `Setup CI/CD Pipeline` and `Expand Unit Tests` are not valid `name:` values + (lowercase/hyphens only), so they would fail if copied into `.claude/skills/` as + the README instructs. Also removed a non-standard `tags:` field. +- **Nine plugin agents used lowercase tool names** (`read, grep, bash`) while the + `04-subagents/` templates used canonical `Read, Grep, Bash`. Unified. +- **"Claude Code 1.0+" requirement in five files** — raised to 2.1+. +- **Miscounted inventories** — `CATALOG.md`'s summary table did not add up *and* + three of its Examples counts were wrong (Subagents 11→9, MCP 8→4, Hooks 8→11); + `INDEX.md` understated Plugins (27→39), Skills (21→23), Hooks (9→12), Subagents + (9→10) and Advanced (3→4), omitted three hook scripts and + `setup-auto-mode-permissions.py`, and mislabeled three hook events. All recounted + from the file tree. +- **`CONTRIBUTING.md` said "all four checks"** — there are five. +- **Two subagent templates were undocumented** — `clean-code-reviewer.md` and + `performance-optimizer.md` existed on disk but appeared in neither the example + list nor the file tree of `04-subagents/README.md`. +- **`resources.md` Mermaid diagrams used an off-guide palette** — remapped to the + five `STYLE_GUIDE.md` colors with the required `stroke`/`color`. +- **Metadata footers** — 61 files had a legacy `Last Updated`-only footer or none at + all; all now carry the full block. Four module READMEs were missing the + `Compatible Models` line, and `02-memory/README.md` was stranded at v2.1.217 with + an ISO-formatted date. All 87 in-scope markdown files now report **2.1.220**. +- **Smaller fixes** — explicit `exit 0` in `session-end.sh`; `# Hook: Event:Matcher` + shorthand (not real syntax) reworded in four scripts; `"type": "stdio"` added to + the four MCP example configs; a worked example that reported 42 PRs in one place + and 47 in another. + ## [v2.1.220] — 2026-07-29 ### Synced to Claude Code v2.1.220 diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 6ea4ede..85bfe93 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -217,4 +217,8 @@ If you have questions about this Code of Conduct, please reach out to the projec **Thank you for helping us create a welcoming, inclusive, and respectful community!** 🌟 --- -**Last Updated**: April 9, 2026 +**Last Updated**: August 4, 2026 +**Claude Code Version**: 2.1.220 +**Sources**: +- https://code.claude.com/docs/en/overview +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6fd9c07..125b572 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -68,7 +68,7 @@ git checkout -b docs/improvement-area ### 3. Set Up Your Environment -Pre-commit hooks run the same checks as CI locally before every commit. All four checks must pass before a PR will be accepted. +Pre-commit hooks run the same checks as CI locally before every commit. All five checks must pass before a PR will be accepted. **Required dependencies:** @@ -378,4 +378,8 @@ By contributing to this project, you agree that your contributions will be licen Thank you for contributing! 🙏 --- -**Last Updated**: April 9, 2026 +**Last Updated**: August 4, 2026 +**Claude Code Version**: 2.1.220 +**Sources**: +- https://code.claude.com/docs/en/overview +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/INDEX.md b/INDEX.md index e282af5..75eaa12 100644 --- a/INDEX.md +++ b/INDEX.md @@ -60,7 +60,7 @@ Persistent context and project standards. --- -## 03. Skills (21 files) +## 03. Skills (23 files) Auto-invoked capabilities with scripts and templates. @@ -158,20 +158,21 @@ blog-draft/ --- -## 04. Subagents (9 files) +## 04. Subagents (10 files) Specialized AI assistants with custom capabilities. | File | Description | Tools | Use Case | |------|-------------|-------|----------| -| `code-reviewer.md` | Code quality analysis | read, grep, diff, lint_runner | Comprehensive reviews | -| `test-engineer.md` | Test coverage analysis | read, write, bash, grep | Test automation | -| `documentation-writer.md` | Documentation creation | read, write, grep | Doc generation | -| `secure-reviewer.md` | Security review (read-only) | read, grep | Security audits | -| `implementation-agent.md` | Full implementation | read, write, bash, grep, edit, glob | Feature development | -| `debugger.md` | Debugging specialist | read, bash, grep | Bug investigation | -| `data-scientist.md` | Data analysis specialist | read, write, bash | Data workflows | -| `clean-code-reviewer.md` | Clean code standards | read, grep | Code quality | +| `code-reviewer.md` | Code quality analysis | Read, Grep, Glob, Bash | Comprehensive reviews | +| `test-engineer.md` | Test coverage analysis | Read, Write, Bash, Grep | Test automation | +| `documentation-writer.md` | Documentation creation | Read, Write, Grep | Doc generation | +| `secure-reviewer.md` | Security review (read-only) | Read, Grep | Security audits | +| `implementation-agent.md` | Full implementation | Read, Write, Edit, Bash, Grep, Glob | Feature development | +| `debugger.md` | Debugging specialist | Read, Edit, Bash, Grep, Glob | Bug investigation | +| `data-scientist.md` | Data analysis specialist | Bash, Read, Write | Data workflows | +| `clean-code-reviewer.md` | Clean code standards | Read, Grep, Glob, Bash | Code quality | +| `performance-optimizer.md` | Performance bottleneck analysis | Read, Edit, Bash, Grep, Glob | Optimization work | | `README.md` | Documentation | - | Setup and usage guide | **Installation Path**: `.claude/agents/` @@ -198,35 +199,38 @@ External tool and API integrations. --- -## 06. Hooks (9 files) +## 06. Hooks (12 files) Event-driven automation scripts that execute automatically. | File | Description | Event | Use Case | |------|-------------|-------|----------| -| `format-code.sh` | Auto-format code | PreToolUse:Write | Code formatting | -| `pre-commit.sh` | Run tests before commit | PreToolUse:Bash | Test automation | -| `security-scan.sh` | Security scanning | PostToolUse:Write | Security checks | -| `log-bash.sh` | Log bash commands | PostToolUse:Bash | Command logging | -| `validate-prompt.sh` | Validate prompts | PreToolUse | Input validation | -| `notify-team.sh` | Send notifications | Notification | Team notifications | -| `context-tracker.py` | Track context window usage | PostToolUse | Context monitoring | -| `context-tracker-tiktoken.py` | Token-based context tracking | PostToolUse | Precise token counting | +| `format-code.sh` | Auto-format code | PostToolUse (matcher: Write) | Code formatting | +| `pre-commit.sh` | Run tests before commit | PreToolUse (matcher: Bash) | Test automation | +| `pre-tool-check.sh` | Validate and audit commands before they run | PreToolUse (matcher: Bash) | Guardrails, audit log | +| `security-scan.sh` | Security scanning | PostToolUse (matcher: Write) | Security checks | +| `dependency-check.sh` | Scan dependency manifests for vulnerabilities | PostToolUse (matcher: Write) | Supply-chain checks | +| `log-bash.sh` | Log bash commands | PostToolUse (matcher: Bash) | Command logging | +| `notify-team.sh` | Send notifications | PostToolUse (matcher: Bash) | Team notifications | +| `validate-prompt.sh` | Validate prompts | UserPromptSubmit | Input validation | +| `session-end.sh` | Capture progress when a session ends | SessionEnd | Progress tracking | +| `context-tracker.py` | Track context window usage | UserPromptSubmit, Stop | Context monitoring | +| `context-tracker-tiktoken.py` | Token-based context tracking | UserPromptSubmit, Stop | Precise token counting | | `README.md` | Documentation | - | Setup and usage guide | **Installation Path**: Configure in `~/.claude/settings.json` **Usage**: Configured in settings, executed automatically -**Hook Types** (5 types, 29 events): +**Hook Types** (5 types, 31 events): - Tool Hooks: PreToolUse, PostToolUse, PostToolUseFailure, PostToolBatch, PermissionRequest, PermissionDenied - Session Hooks: SessionStart, Setup, SessionEnd, Stop, StopFailure, SubagentStart, SubagentStop -- Task Hooks: UserPromptSubmit, UserPromptExpansion, TaskCompleted, TaskCreated, TeammateIdle -- Lifecycle Hooks: ConfigChange, CwdChanged, FileChanged, PreCompact, PostCompact, WorktreeCreate, WorktreeRemove, Notification, InstructionsLoaded, Elicitation, ElicitationResult +- Task Hooks: UserPromptSubmit, UserPromptExpansion, MessageDisplay, TaskCompleted, TaskCreated, TeammateIdle +- Lifecycle Hooks: ConfigChange, CwdChanged, DirectoryAdded, FileChanged, PreCompact, PostCompact, WorktreeCreate, WorktreeRemove, Notification, InstructionsLoaded, Elicitation, ElicitationResult --- -## 07. Plugins (3 complete plugins, 27 files) +## 07. Plugins (3 complete plugins, 39 files) Bundled collections of features. @@ -358,7 +362,7 @@ Save conversation state and explore alternative approaches. --- -## 09. Advanced Features (3 files) +## 09. Advanced Features (4 files) Advanced capabilities for complex workflows. @@ -367,6 +371,7 @@ Advanced capabilities for complex workflows. | `README.md` | Complete guide | All advanced features documentation | | `config-examples.json` | Configuration examples | 10+ use-case-specific configurations | | `planning-mode-examples.md` | Planning examples | REST API, database migration, refactoring | +| `setup-auto-mode-permissions.py` | Seed `permissions.allow` for auto mode | Idempotent, `--dry-run` and opt-in flags | | Dynamic Workflows | Deterministic multi-agent orchestration via `/workflows` (v2.1.154) | Comprehensive audits, migrations, scale-out | | Scheduled Tasks | Recurring tasks with `/loop` and cron tools | Automated recurring workflows | | Chrome Integration | Browser automation via headless Chromium | Web testing and scraping | @@ -402,8 +407,8 @@ Advanced capabilities for complex workflows. - **manual**: Ask for approval on risky actions (renamed from `default` in v2.1.200; `default` still accepted) - **acceptEdits**: Auto-accept file edits, ask for others - **plan**: Read-only analysis, no modifications -- **auto**: Automatically approve safe actions, prompt for risky ones -- **dontAsk**: Accept all actions except risky ones +- **auto**: Everything, with background safety checks — a classifier reviews commands and protected-directory writes (configured via the `autoMode` settings object) +- **dontAsk**: Only pre-approved tools — auto-denies every call that would otherwise prompt. Claude runs only `permissions.allow` matches, read-only Bash commands, and calls approved by a `PreToolUse` hook - **bypassPermissions**: Accept all (requires `--dangerously-skip-permissions`) ### Headless Mode (`claude -p`) @@ -768,13 +773,13 @@ Run tests in background |----------|----------|--------|-----|-------|---------|-----------|------|--------|-------| | **01 Slash Commands** | 8 | - | - | - | - | - | 1 | 1 | **10** | | **02 Memory** | - | - | - | - | - | 3 | 1 | 2 | **6** | -| **03 Skills** | - | - | - | - | 5 | 9 | 7 | - | **21** | -| **04 Subagents** | - | 8 | - | - | - | - | 1 | - | **9** | +| **03 Skills** | - | - | - | - | 5 | 7 | 11 | - | **23** | +| **04 Subagents** | - | 9 | - | - | - | - | 1 | - | **10** | | **05 MCP** | - | - | 4 | - | - | - | 1 | - | **5** | -| **06 Hooks** | - | - | - | 8 | - | - | 1 | - | **9** | +| **06 Hooks** | - | - | - | 11 | - | - | 1 | - | **12** | | **07 Plugins** | 11 | 9 | 3 | 3 | 3 | 3 | 7 | - | **39** | | **08 Checkpoints** | - | - | - | - | - | - | 1 | 1 | **2** | -| **09 Advanced** | - | - | - | - | - | - | 1 | 2 | **3** | +| **09 Advanced** | - | - | - | - | 1 | 1 | 2 | - | **4** | | **10 CLI** | - | - | - | - | - | - | 1 | - | **1** | --- @@ -881,7 +886,7 @@ Want to add more examples? Follow the structure: --- -**Last Updated**: July 29, 2026 +**Last Updated**: August 4, 2026 **Claude Code Version**: 2.1.220 **Sources**: - https://code.claude.com/docs/en/overview @@ -892,9 +897,9 @@ Want to add more examples? Follow the structure: - https://github.com/anthropics/claude-code/releases/tag/v2.1.154 - https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md - https://code.claude.com/docs/en/model-config -**Compatible Models**: Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 **Total Examples**: 100+ files **Categories**: 10 features -**Hooks**: 9 automation scripts +**Hooks**: 11 automation scripts **Configuration Examples**: 10+ scenarios **Ready to Use**: All examples diff --git a/LEARNING-ROADMAP.md b/LEARNING-ROADMAP.md index 3715794..734b9e6 100644 --- a/LEARNING-ROADMAP.md +++ b/LEARNING-ROADMAP.md @@ -97,7 +97,7 @@ graph TD | Step | Feature | Complexity | Time | Level | Dependencies | Why Learn This | Key Benefits | |------|---------|-----------|------|-------|--------------|----------------|--------------| -| **1** | [Slash Commands](01-slash-commands/) | ⭐ Beginner | 30 min | Level 1 | None | Quick productivity wins (60+ built-in + 5 bundled skills) | Instant automation, team standards | +| **1** | [Slash Commands](01-slash-commands/) | ⭐ Beginner | 30 min | Level 1 | None | Quick productivity wins (60+ built-in + 10 bundled skills) | Instant automation, team standards | | **2** | [Memory](02-memory/) | ⭐⭐ Beginner+ | 45 min | Level 1 | None | Essential for all features | Persistent context, preferences | | **3** | [Checkpoints](08-checkpoints/) | ⭐⭐ Intermediate | 45 min | Level 1 | Session management | Safe exploration | Experimentation, recovery | | **4** | [CLI Basics](10-cli/) | ⭐⭐ Beginner+ | 30 min | Level 1 | None | Core CLI usage | Interactive & print mode | @@ -738,7 +738,7 @@ Once you've completed all milestones: --- -**Last Updated**: July 29, 2026 +**Last Updated**: August 4, 2026 **Claude Code Version**: 2.1.220 **Sources**: - https://code.claude.com/docs/en/overview @@ -747,7 +747,7 @@ Once you've completed all milestones: - https://github.com/anthropics/claude-code/releases/tag/v2.1.144 - https://github.com/anthropics/claude-code/releases/tag/v2.1.145 - https://code.claude.com/docs/en/model-config -**Compatible Models**: Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 **Maintained by**: Claude How-To Contributors **License**: Educational purposes, free to use and adapt diff --git a/QUICK_REFERENCE.md b/QUICK_REFERENCE.md index c96ba9b..b72ca0e 100644 --- a/QUICK_REFERENCE.md +++ b/QUICK_REFERENCE.md @@ -119,7 +119,7 @@ claude -r "session" # Resume session by name/ID | **Skills** | `.claude/skills/*/SKILL.md` | Auto-invoked | | **Subagents** | `.claude/agents/*.md` | Auto-delegated | | **MCP** | `.mcp.json` (project) or `~/.claude.json` (user) | `/mcp__server__action` | -| **Hooks (29 events)** | `~/.claude/hooks/*.sh` | Event-triggered (5 types) | +| **Hooks (31 events)** | `~/.claude/hooks/*.sh` | Event-triggered (5 types) | | **Plugins** | Via `/plugin install` | Bundles all | | **Checkpoints** | Built-in | `Esc+Esc` or `/rewind` | | **Planning Mode** | Built-in | `/plan ` | @@ -190,7 +190,7 @@ vim CLAUDE.md ### Automation & Hooks ```bash -# Install hooks (29 events, 5 types: command, http, mcp_tool, prompt, agent) +# Install hooks (31 events, 5 types: command, http, mcp_tool, prompt, agent) mkdir -p ~/.claude/hooks cp 06-hooks/*.sh ~/.claude/hooks/ chmod +x ~/.claude/hooks/*.sh @@ -390,7 +390,9 @@ cp -r 03-skills/code-review-specialist ~/.claude/skills/ | **Auto Mode** | Fully autonomous operation with background classifier; available by default on Bedrock/Vertex/Foundry as of v2.1.207 | `Shift+Tab` to cycle modes, or `--permission-mode auto` | | **Channels** | Discord and Telegram integration | `--channels` flag, Discord/Telegram bots | | **Voice Dictation** | Speak commands and context to Claude | `/voice` command | -| **Hooks (29 events)** | Expanded hook system with 5 types | command, http, mcp_tool, prompt, agent hook types | +| **Output Styles** | Change Claude's role, tone, and default response format | `/config` → Output style, or `outputStyle` setting. Built-ins: Default, Proactive, Explanatory, Learning | +| **Status Line** | Custom bottom-of-session status from a command | `/statusline`, or `statusLine` setting; receives session/model/cost/context JSON on stdin | +| **Hooks (31 events)** | Expanded hook system with 5 types | command, http, mcp_tool, prompt, agent hook types | | **MCP Elicitation** | MCP servers can request user input at runtime | Auto-prompted when server needs clarification | | **Plugin LSP** | Language Server Protocol support for plugins | `userConfig`, `${CLAUDE_PLUGIN_DATA}` variable | | **Remote Control** | Control Claude Code via WebSocket API | `claude --remote` for external integrations | @@ -453,7 +455,7 @@ echo $GITHUB_TOKEN | Auto workflow | Skill | `03-skills/code-review-specialist/` | | Specialized task | Subagent | `04-subagents/code-reviewer.md` | | External data | MCP (+ Elicitation) | `05-mcp/github-mcp.json` | -| Event automation | Hook (29 events, 5 types) | `06-hooks/pre-commit.sh` | +| Event automation | Hook (31 events, 5 types) | `06-hooks/pre-commit.sh` | | Complete solution | Plugin (+ LSP support) | `07-plugins/pr-review/` | | Safe experiment | Checkpoint | `08-checkpoints/checkpoint-examples.md` | | Fully autonomous | Auto Mode | `--permission-mode auto` or `Shift+Tab` | @@ -514,7 +516,7 @@ Getting started checklist: --- -**Last Updated**: July 29, 2026 +**Last Updated**: August 4, 2026 **Claude Code Version**: 2.1.220 **Sources**: - https://code.claude.com/docs/en/cli-reference @@ -522,4 +524,4 @@ Getting started checklist: - https://code.claude.com/docs/en/sub-agents - https://code.claude.com/docs/en/model-config - https://code.claude.com/docs/en/settings -**Compatible Models**: Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/README.md b/README.md index c6ad5e8..174d392 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ [![GitHub Stars](https://img.shields.io/github/stars/luongnv89/claude-howto?style=flat&color=gold)](https://github.com/luongnv89/claude-howto/stargazers) [![GitHub Forks](https://img.shields.io/github/forks/luongnv89/claude-howto?style=flat)](https://github.com/luongnv89/claude-howto/network/members) [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE) -[![Version](https://img.shields.io/badge/version-2.1.217-brightgreen)](CHANGELOG.md) +[![Version](https://img.shields.io/badge/version-2.1.220-brightgreen)](CHANGELOG.md) [![Claude Code](https://img.shields.io/badge/Claude_Code-2.1+-purple)](https://code.claude.com) 🌐 **Language / Ngôn ngữ / 语言 / Мова:** [English](README.md) | [Tiếng Việt](vi/README.md) | [中文](zh/README.md) | [Українська](uk/README.md) | [日本語](ja/README.md) @@ -102,7 +102,7 @@ Run `/lesson-quiz [topic]` after each module. The quiz pinpoints what you missed - **GitHub stars** from developers who use Claude Code daily - **Forks** from teams adapting this guide for their own workflows -- **Actively maintained** — synced with every Claude Code release (latest: v2.1.217, July 2026) +- **Actively maintained** — synced with every Claude Code release (latest: v2.1.220, July 2026) - **Community-driven** — contributions from developers who share their real-world configurations [![Star History Chart](https://api.star-history.com/svg?repos=luongnv89/claude-howto&type=Date)](https://star-history.com/#luongnv89/claude-howto&Date) @@ -201,7 +201,7 @@ cp -r 03-skills/code-review-specialist ~/.claude/skills/ Yes. MIT licensed, free forever. Use it in personal projects, at work, in your team — no restrictions beyond including the license notice. **Is this maintained?** -Actively. The guide is synced with every Claude Code release. Current version: v2.1.217 (July 2026), compatible with Claude Code 2.1+. +Actively. The guide is synced with every Claude Code release. Current version: v2.1.220 (July 2026), compatible with Claude Code 2.1+. **How is this different from the official docs?** The official docs are a feature reference. This guide is a tutorial with diagrams, production-ready templates, and a progressive learning path. They complement each other — start here to learn, reference the docs when you need specifics. @@ -482,11 +482,11 @@ Configure hooks in `~/.claude/settings.json`: **Usage**: Hooks execute automatically on events -**Hook Types** (5 types, 29 events): -- **Tool Hooks**: `PreToolUse`, `PostToolUse`, `PostToolUseFailure`, `PermissionRequest` -- **Session Hooks**: `SessionStart`, `SessionEnd`, `Stop`, `StopFailure`, `SubagentStart`, `SubagentStop` -- **Task Hooks**: `UserPromptSubmit`, `TaskCompleted`, `TaskCreated`, `TeammateIdle` -- **Lifecycle Hooks**: `ConfigChange`, `CwdChanged`, `FileChanged`, `PreCompact`, `PostCompact`, `WorktreeCreate`, `WorktreeRemove`, `Notification`, `InstructionsLoaded`, `Elicitation`, `ElicitationResult` +**Hook Types** (5 types, 31 events): +- **Tool Hooks**: `PreToolUse`, `PostToolUse`, `PostToolUseFailure`, `PostToolBatch`, `PermissionRequest`, `PermissionDenied` +- **Session Hooks**: `SessionStart`, `Setup`, `SessionEnd`, `Stop`, `StopFailure`, `SubagentStart`, `SubagentStop` +- **Task Hooks**: `UserPromptSubmit`, `UserPromptExpansion`, `MessageDisplay`, `TaskCompleted`, `TaskCreated`, `TeammateIdle` +- **Lifecycle Hooks**: `ConfigChange`, `CwdChanged`, `DirectoryAdded`, `FileChanged`, `PreCompact`, `PostCompact`, `WorktreeCreate`, `WorktreeRemove`, `Notification`, `InstructionsLoaded`, `Elicitation`, `ElicitationResult` @@ -871,7 +871,7 @@ MIT License - see [LICENSE](LICENSE). Free to use, modify, and distribute. The o --- -**Last Updated**: July 29, 2026 +**Last Updated**: August 4, 2026 **Claude Code Version**: 2.1.220 **Sources**: - https://code.claude.com/docs/en/overview @@ -882,4 +882,4 @@ MIT License - see [LICENSE](LICENSE). Free to use, modify, and distribute. The o - https://github.com/anthropics/claude-code/releases/tag/v2.1.154 - https://code.claude.com/docs/en/model-config - https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md -**Compatible Models**: Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/SECURITY.md b/SECURITY.md index f0bba24..3c1c262 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -326,7 +326,11 @@ This security policy is reviewed and updated: - When the project scope changes - Annually as a minimum -**Last Updated**: April 27, 2026 +**Last Updated**: August 4, 2026 +**Claude Code Version**: 2.1.220 +**Sources**: +- https://code.claude.com/docs/en/overview +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 **Next Review**: April 2027 --- diff --git a/STYLE_GUIDE.md b/STYLE_GUIDE.md index bdc461c..e73b6b8 100644 --- a/STYLE_GUIDE.md +++ b/STYLE_GUIDE.md @@ -599,7 +599,7 @@ Lesson READMEs end with a metadata block: --- **Last Updated**: July 29, 2026 **Claude Code Version**: 2.1.220 -**Compatible Models**: Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 ``` - Use month + day + year format (e.g., "May 20, 2026") @@ -638,4 +638,4 @@ Before submitting content, verify: - https://code.claude.com/docs/en/changelog - https://code.claude.com/docs/en/model-config - https://github.com/anthropics/claude-code/releases/tag/v2.1.154 -**Compatible Models**: Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/claude_concepts_guide.md b/claude_concepts_guide.md index 6b2d19b..60dd1bf 100644 --- a/claude_concepts_guide.md +++ b/claude_concepts_guide.md @@ -5,22 +5,28 @@ # Complete Guide to Claude Concepts -A comprehensive reference guide covering Slash Commands, Subagents, Memory, MCP Protocol, and Agent Skills with tables, diagrams, and practical examples. +A conceptual overview of how Claude Code's features work and fit together — architecture diagrams, decision tables, and comparisons across Slash Commands, Subagents, Memory, MCP, Skills, Plugins, Hooks, and more. + +> **How to use this guide**: this page explains the *concepts* — what each feature is, how it works internally, and when to reach for it. The **copy-paste templates and full reference material live in the numbered modules** (`01-` through `10-`), which each section links to. Start here to build a mental model, then go to the module to actually configure something. --- ## Table of Contents -1. [Slash Commands](#slash-commands) -2. [Subagents](#subagents) -3. [Memory](#memory) -4. [MCP Protocol](#mcp-protocol) -5. [Agent Skills](#agent-skills) -6. [Plugins](#claude-code-plugins) -7. [Hooks](#hooks) -8. [Checkpoints and Rewind](#checkpoints-and-rewind) -9. [Advanced Features](#advanced-features) -10. [Comparison & Integration](#comparison--integration) +1. [Slash Commands](#slash-commands) — [module](01-slash-commands/) +2. [Subagents](#subagents) — [module](04-subagents/) +3. [Memory](#memory) — [module](02-memory/) +4. [MCP Protocol](#mcp-protocol) — [module](05-mcp/) +5. [Agent Skills](#agent-skills) — [module](03-skills/) +6. [Plugins](#claude-code-plugins) — [module](07-plugins/) +7. [Comparison & Integration](#comparison--integration) +8. [Summary Table](#summary-table) +9. [Quick Start Guide](#quick-start-guide) +10. [Hooks](#hooks) — [module](06-hooks/) +11. [Checkpoints and Rewind](#checkpoints-and-rewind) — [module](08-checkpoints/) +12. [Advanced Features](#advanced-features) — [module](09-advanced-features/) +13. [Models and Reasoning Effort](#models-and-reasoning-effort) — [module](10-cli/) +14. [Resources](#resources) --- @@ -73,110 +79,9 @@ graph LR ### Practical Examples -#### Example 1: Code Optimization Command +Eight copy-paste command templates live in **[01-slash-commands/](01-slash-commands/)** — `/optimize`, `/pr`, `/commit`, `/push-all`, `/generate-api-docs`, `/doc-refactor`, `/setup-ci-cd`, and `/unit-test-expand`. -**File:** `.claude/commands/optimize.md` - -```markdown ---- -name: Code Optimization -description: Analyze code for performance issues and suggest optimizations -tags: performance, analysis ---- - -# Code Optimization - -Review the provided code for the following issues in order of priority: - -1. **Performance bottlenecks** - identify O(n²) operations, inefficient loops -2. **Memory leaks** - find unreleased resources, circular references -3. **Algorithm improvements** - suggest better algorithms or data structures -4. **Caching opportunities** - identify repeated computations -5. **Concurrency issues** - find race conditions or threading problems - -Format your response with: -- Issue severity (Critical/High/Medium/Low) -- Location in code -- Explanation -- Recommended fix with code example -``` - -**Usage:** -```bash -# User types in Claude Code -/optimize - -# Claude loads the prompt and waits for code input -``` - -#### Example 2: Pull Request Helper Command - -**File:** `.claude/commands/pr.md` - -```markdown ---- -name: Prepare Pull Request -description: Clean up code, stage changes, and prepare a pull request -tags: git, workflow ---- - -# Pull Request Preparation Checklist - -Before creating a PR, execute these steps: - -1. Run linting: `prettier --write .` -2. Run tests: `npm test` -3. Review git diff: `git diff HEAD` -4. Stage changes: `git add .` -5. Create commit message following conventional commits: - - `fix:` for bug fixes - - `feat:` for new features - - `docs:` for documentation - - `refactor:` for code restructuring - - `test:` for test additions - - `chore:` for maintenance - -6. Generate PR summary including: - - What changed - - Why it changed - - Testing performed - - Potential impacts -``` - -**Usage:** -```bash -/pr - -# Claude runs through checklist and prepares the PR -``` - -#### Example 3: Hierarchical Documentation Generator - -**File:** `.claude/commands/docs/generate-api-docs.md` - -```markdown ---- -name: Generate API Documentation -description: Create comprehensive API documentation from source code -tags: documentation, api ---- - -# API Documentation Generator - -Generate API documentation by: - -1. Scanning all files in `/src/api/` -2. Extracting function signatures and JSDoc comments -3. Organizing by endpoint/module -4. Creating markdown with examples -5. Including request/response schemas -6. Adding error documentation - -Output format: -- Markdown file in `/docs/api.md` -- Include curl examples for all endpoints -- Add TypeScript types -``` +**[01-slash-commands/README.md](01-slash-commands/README.md)** also carries the full built-in command reference (60+ commands) and the frontmatter field table. ### Command Lifecycle Diagram @@ -217,7 +122,7 @@ sequenceDiagram Subagents are specialized AI assistants with isolated context windows and customized system prompts. They enable delegated task execution while maintaining clean separation of concerns. -As of **v2.1.172**, subagents can spawn their own subagents, nested **up to 5 levels deep** — so the hierarchy is not limited to the single main → subagent layer shown below. Earlier versions did not allow any nesting. +Subagents can spawn their own subagents, **nested on by default up to depth 3 (v2.1.219)** — so the hierarchy is not limited to the single main → subagent layer shown below. Set `CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH` to change the limit, or `1` to turn nesting off. (History: v2.1.172–v2.1.216 nested by default up to 5 layers with no way to change it; v2.1.217 made nesting opt-in at depth 1; v2.1.219 set the default to 3.) ### Architecture Diagram @@ -283,224 +188,9 @@ graph TD ### Practical Examples -#### Example 1: Complete Subagent Setup +Nine ready-to-use subagent definitions live in **[04-subagents/](04-subagents/)** — `code-reviewer`, `clean-code-reviewer`, `secure-reviewer`, `test-engineer`, `documentation-writer`, `implementation-agent`, `performance-optimizer`, `debugger`, and `data-scientist`. -**File:** `.claude/agents/code-reviewer.md` - -```yaml ---- -name: code-reviewer -description: Comprehensive code quality and maintainability analysis -tools: read, grep, diff, lint_runner ---- - -# Code Reviewer Agent - -You are an expert code reviewer specializing in: -- Performance optimization -- Security vulnerabilities -- Code maintainability -- Testing coverage -- Design patterns - -## Review Priorities (in order) - -1. **Security Issues** - Authentication, authorization, data exposure -2. **Performance Problems** - O(n²) operations, memory leaks, inefficient queries -3. **Code Quality** - Readability, naming, documentation -4. **Test Coverage** - Missing tests, edge cases -5. **Design Patterns** - SOLID principles, architecture - -## Review Output Format - -For each issue: -- **Severity**: Critical / High / Medium / Low -- **Category**: Security / Performance / Quality / Testing / Design -- **Location**: File path and line number -- **Issue Description**: What's wrong and why -- **Suggested Fix**: Code example -- **Impact**: How this affects the system - -## Example Review - -### Issue: N+1 Query Problem -- **Severity**: High -- **Category**: Performance -- **Location**: src/user-service.ts:45 -- **Issue**: Loop executes database query in each iteration -- **Fix**: Use JOIN or batch query -``` - -**File:** `.claude/agents/test-engineer.md` - -```yaml ---- -name: test-engineer -description: Test strategy, coverage analysis, and automated testing -tools: read, write, bash, grep ---- - -# Test Engineer Agent - -You are expert at: -- Writing comprehensive test suites -- Ensuring high code coverage (>80%) -- Testing edge cases and error scenarios -- Performance benchmarking -- Integration testing - -## Testing Strategy - -1. **Unit Tests** - Individual functions/methods -2. **Integration Tests** - Component interactions -3. **End-to-End Tests** - Complete workflows -4. **Edge Cases** - Boundary conditions -5. **Error Scenarios** - Failure handling - -## Test Output Requirements - -- Use Jest for JavaScript/TypeScript -- Include setup/teardown for each test -- Mock external dependencies -- Document test purpose -- Include performance assertions when relevant - -## Coverage Requirements - -- Minimum 80% code coverage -- 100% for critical paths -- Report missing coverage areas -``` - -**File:** `.claude/agents/documentation-writer.md` - -```yaml ---- -name: documentation-writer -description: Technical documentation, API docs, and user guides -tools: read, write, grep ---- - -# Documentation Writer Agent - -You create: -- API documentation with examples -- User guides and tutorials -- Architecture documentation -- Changelog entries -- Code comment improvements - -## Documentation Standards - -1. **Clarity** - Use simple, clear language -2. **Examples** - Include practical code examples -3. **Completeness** - Cover all parameters and returns -4. **Structure** - Use consistent formatting -5. **Accuracy** - Verify against actual code - -## Documentation Sections - -### For APIs -- Description -- Parameters (with types) -- Returns (with types) -- Throws (possible errors) -- Examples (curl, JavaScript, Python) -- Related endpoints - -### For Features -- Overview -- Prerequisites -- Step-by-step instructions -- Expected outcomes -- Troubleshooting -- Related topics -``` - -#### Example 2: Subagent Delegation in Action - -```markdown -# Scenario: Building a Payment Feature - -## User Request -"Build a secure payment processing feature that integrates with Stripe" - -## Main Agent Flow - -1. **Planning Phase** - - Understands requirements - - Determines tasks needed - - Plans architecture - -2. **Delegates to Code Reviewer Subagent** - - Task: "Review the payment processing implementation for security" - - Context: Auth, API keys, token handling - - Reviews for: SQL injection, key exposure, HTTPS enforcement - -3. **Delegates to Test Engineer Subagent** - - Task: "Create comprehensive tests for payment flows" - - Context: Success scenarios, failures, edge cases - - Creates tests for: Valid payments, declined cards, network failures, webhooks - -4. **Delegates to Documentation Writer Subagent** - - Task: "Document the payment API endpoints" - - Context: Request/response schemas - - Produces: API docs with curl examples, error codes - -5. **Synthesis** - - Main agent collects all outputs - - Integrates findings - - Returns complete solution to user -``` - -#### Example 3: Tool Permission Scoping - -**Restrictive Setup - Limited to Specific Commands** - -```yaml ---- -name: secure-reviewer -description: Security-focused code review with minimal permissions -tools: read, grep ---- - -# Secure Code Reviewer - -Reviews code for security vulnerabilities only. - -This agent: -- ✅ Reads files to analyze -- ✅ Searches for patterns -- ❌ Cannot execute code -- ❌ Cannot modify files -- ❌ Cannot run tests - -This ensures the reviewer doesn't accidentally break anything. -``` - -**Extended Setup - All Tools for Implementation** - -```yaml ---- -name: implementation-agent -description: Full implementation capabilities for feature development -tools: read, write, bash, grep, edit, glob ---- - -# Implementation Agent - -Builds features from specifications. - -This agent: -- ✅ Reads specifications -- ✅ Writes new code files -- ✅ Runs build commands -- ✅ Searches codebase -- ✅ Edits existing files -- ✅ Finds files matching patterns - -Full capabilities for independent feature development. -``` +**[04-subagents/README.md](04-subagents/README.md)** documents the complete frontmatter reference, tool-access rules, nesting limits, and Agent Teams. ### Subagent Context Management @@ -573,7 +263,7 @@ graph TD B --> C["3. Project Rules
.claude/rules/*.md"] C --> D["4. User Memory
~/.claude/CLAUDE.md"] D --> E["5. User Rules
~/.claude/rules/*.md"] - E --> F["6. Local Memory
.claude/local/CLAUDE.md"] + E --> F["6. Local Memory
./CLAUDE.local.md"] F --> G["7. Auto Memory
Automatically captured preferences"] style A fill:#fce4ec,stroke:#333,color:#333 @@ -594,7 +284,7 @@ graph TD | 3. Project Rules | `.claude/rules/*.md` | Project | High | Team (Git) | Modular project conventions | | 4. User | `~/.claude/CLAUDE.md` | Personal | Medium | Individual | Personal preferences | | 5. User Rules | `~/.claude/rules/*.md` | Personal | Medium | Individual | Personal rule modules | -| 6. Local | `.claude/local/CLAUDE.md` | Local | Low | Not shared | Machine-specific settings | +| 6. Local | `./CLAUDE.local.md` | Local | Low | Not shared | Machine-specific settings | | 7. Auto Memory | Automatic | Session | Lowest | Individual | Learned preferences, patterns | ### Auto Memory @@ -629,262 +319,13 @@ sequenceDiagram ### Practical Examples -#### Example 1: Project Memory Structure +Copy-paste memory templates live in **[02-memory/](02-memory/)**: -**File:** `./CLAUDE.md` +- **`project-CLAUDE.md`** — team-wide project standards for `./CLAUDE.md` +- **`personal-CLAUDE.md`** — individual preferences for `~/.claude/CLAUDE.md` +- **`directory-api-CLAUDE.md`** — directory-scoped standards for a subtree -```markdown -# Project Configuration - -## Project Overview -- **Name**: E-commerce Platform -- **Tech Stack**: Node.js, PostgreSQL, React 18, Docker -- **Team Size**: 5 developers -- **Deadline**: Q4 2025 - -## Architecture -@docs/architecture.md -@docs/api-standards.md -@docs/database-schema.md - -## Development Standards - -### Code Style -- Use Prettier for formatting -- Use ESLint with airbnb config -- Maximum line length: 100 characters -- Use 2-space indentation - -### Naming Conventions -- **Files**: kebab-case (user-controller.js) -- **Classes**: PascalCase (UserService) -- **Functions/Variables**: camelCase (getUserById) -- **Constants**: UPPER_SNAKE_CASE (API_BASE_URL) -- **Database Tables**: snake_case (user_accounts) - -### Git Workflow -- Branch names: `feature/description` or `fix/description` -- Commit messages: Follow conventional commits -- PR required before merge -- All CI/CD checks must pass -- Minimum 1 approval required - -### Testing Requirements -- Minimum 80% code coverage -- All critical paths must have tests -- Use Jest for unit tests -- Use Cypress for E2E tests -- Test filenames: `*.test.ts` or `*.spec.ts` - -### API Standards -- RESTful endpoints only -- JSON request/response -- Use HTTP status codes correctly -- Version API endpoints: `/api/v1/` -- Document all endpoints with examples - -### Database -- Use migrations for schema changes -- Never hardcode credentials -- Use connection pooling -- Enable query logging in development -- Regular backups required - -### Deployment -- Docker-based deployment -- Kubernetes orchestration -- Blue-green deployment strategy -- Automatic rollback on failure -- Database migrations run before deploy - -## Common Commands - -| Command | Purpose | -|---------|---------| -| `npm run dev` | Start development server | -| `npm test` | Run test suite | -| `npm run lint` | Check code style | -| `npm run build` | Build for production | -| `npm run migrate` | Run database migrations | - -## Team Contacts -- Tech Lead: Sarah Chen (@sarah.chen) -- Product Manager: Mike Johnson (@mike.j) -- DevOps: Alex Kim (@alex.k) - -## Known Issues & Workarounds -- PostgreSQL connection pooling limited to 20 during peak hours -- Workaround: Implement query queuing -- Safari 14 compatibility issues with async generators -- Workaround: Use Babel transpiler - -## Related Projects -- Analytics Dashboard: `/projects/analytics` -- Mobile App: `/projects/mobile` -- Admin Panel: `/projects/admin` -``` - -#### Example 2: Directory-Specific Memory - -**File:** `./src/api/CLAUDE.md` - -~~~~markdown -# API Module Standards - -This file overrides root CLAUDE.md for everything in /src/api/ - -## API-Specific Standards - -### Request Validation -- Use Zod for schema validation -- Always validate input -- Return 400 with validation errors -- Include field-level error details - -### Authentication -- All endpoints require JWT token -- Token in Authorization header -- Token expires after 24 hours -- Implement refresh token mechanism - -### Response Format - -All responses must follow this structure: - -```json -{ - "success": true, - "data": { /* actual data */ }, - "timestamp": "2025-11-06T10:30:00Z", - "version": "1.0" -} -``` - -### Error responses: -```json -{ - "success": false, - "error": { - "code": "VALIDATION_ERROR", - "message": "User message", - "details": { /* field errors */ } - }, - "timestamp": "2025-11-06T10:30:00Z" -} -``` - -### Pagination -- Use cursor-based pagination (not offset) -- Include `hasMore` boolean -- Limit max page size to 100 -- Default page size: 20 - -### Rate Limiting -- 1000 requests per hour for authenticated users -- 100 requests per hour for public endpoints -- Return 429 when exceeded -- Include retry-after header - -### Caching -- Use Redis for session caching -- Cache duration: 5 minutes default -- Invalidate on write operations -- Tag cache keys with resource type -~~~~ - -#### Example 3: Personal Memory - -**File:** `~/.claude/CLAUDE.md` - -~~~~markdown -# My Development Preferences - -## About Me -- **Experience Level**: 8 years full-stack development -- **Preferred Languages**: TypeScript, Python -- **Communication Style**: Direct, with examples -- **Learning Style**: Visual diagrams with code - -## Code Preferences - -### Error Handling -I prefer explicit error handling with try-catch blocks and meaningful error messages. -Avoid generic errors. Always log errors for debugging. - -### Comments -Use comments for WHY, not WHAT. Code should be self-documenting. -Comments should explain business logic or non-obvious decisions. - -### Testing -I prefer TDD (test-driven development). -Write tests first, then implementation. -Focus on behavior, not implementation details. - -### Architecture -I prefer modular, loosely-coupled design. -Use dependency injection for testability. -Separate concerns (Controllers, Services, Repositories). - -## Debugging Preferences -- Use console.log with prefix: `[DEBUG]` -- Include context: function name, relevant variables -- Use stack traces when available -- Always include timestamps in logs - -## Communication -- Explain complex concepts with diagrams -- Show concrete examples before explaining theory -- Include before/after code snippets -- Summarize key points at the end - -## Project Organization -I organize my projects as: -``` -project/ - ├── src/ - │ ├── api/ - │ ├── services/ - │ ├── models/ - │ └── utils/ - ├── tests/ - ├── docs/ - └── docker/ -``` - -## Tooling -- **IDE**: VS Code with vim keybindings -- **Terminal**: Zsh with Oh-My-Zsh -- **Format**: Prettier (100 char line length) -- **Linter**: ESLint with airbnb config -- **Test Framework**: Jest with React Testing Library -~~~~ - -#### Example 4: Memory Update During Session - -**Session Interaction:** - -```markdown -User: Remember that I prefer using React hooks instead of class components - for all new components. - -Claude: I'm adding that to your memory. Which memory file should this go in? - 1. Project memory (./CLAUDE.md) - 2. Personal memory (~/.claude/CLAUDE.md) - -User: Project memory - -Claude: ✅ Memory saved! - -Added to ./CLAUDE.md: ---- - -### Component Development -- Use functional components with React Hooks -- Prefer hooks over class components -- Custom hooks for reusable logic -- Use useCallback for event handlers -- Use useMemo for expensive computations -``` +**[02-memory/README.md](02-memory/README.md)** covers the full hierarchy, import syntax, `.claude/rules/`, auto memory, and how to keep CLAUDE.md under 200 lines. ### Memory in Claude Web/Desktop @@ -899,35 +340,9 @@ graph LR E -->|24 hours later| F["Memory Refreshed"] ``` -**Example Memory Summary:** +### Auto Memory Contents -```markdown -## Claude's Memory of User - -### Professional Background -- Senior full-stack developer with 8 years experience -- Focus on TypeScript/Node.js backends and React frontends -- Active open source contributor -- Interested in AI and machine learning - -### Project Context -- Currently building e-commerce platform -- Tech stack: Node.js, PostgreSQL, React 18, Docker -- Working with team of 5 developers -- Using CI/CD and blue-green deployments - -### Communication Preferences -- Prefers direct, concise explanations -- Likes visual diagrams and examples -- Appreciates code snippets -- Explains business logic in comments - -### Current Goals -- Improve API performance -- Increase test coverage to 90% -- Implement caching strategy -- Document architecture -``` +Auto memory stores what Claude learns about you across sessions in `~/.claude/projects//memory/`, indexed by `MEMORY.md`. See **[02-memory/README.md](02-memory/README.md)** for the file layout, loading limits, and how to enable or disable it. ### Memory Features Comparison @@ -1020,179 +435,9 @@ sequenceDiagram ### Practical Examples -#### Example 1: GitHub MCP Configuration +Ready-to-use MCP server configurations live in **[05-mcp/](05-mcp/)**: `github-mcp.json`, `database-mcp.json`, `filesystem-mcp.json`, and `multi-mcp.json` (four servers in one file). -**File:** `.mcp.json` (project scope) or `~/.claude.json` (user scope) - -```json -{ - "mcpServers": { - "github": { - "command": "npx", - "args": ["@modelcontextprotocol/server-github"], - "env": { - "GITHUB_TOKEN": "${GITHUB_TOKEN}" - } - } - } -} -``` - -**Available GitHub MCP Tools:** - -~~~~markdown -# GitHub MCP Tools - -## Pull Request Management -- `list_prs` - List all PRs in repository -- `get_pr` - Get PR details including diff -- `create_pr` - Create new PR -- `update_pr` - Update PR description/title -- `merge_pr` - Merge PR to main branch -- `review_pr` - Add review comments - -Example request: -``` -/mcp__github__get_pr 456 - -# Returns: -Title: Add dark mode support -Author: @alice -Description: Implements dark theme using CSS variables -Status: OPEN -Reviewers: @bob, @charlie -``` - -## Issue Management -- `list_issues` - List all issues -- `get_issue` - Get issue details -- `create_issue` - Create new issue -- `close_issue` - Close issue -- `add_comment` - Add comment to issue - -## Repository Information -- `get_repo_info` - Repository details -- `list_files` - File tree structure -- `get_file_content` - Read file contents -- `search_code` - Search across codebase - -## Commit Operations -- `list_commits` - Commit history -- `get_commit` - Specific commit details -- `create_commit` - Create new commit -~~~~ - -#### Example 2: Database MCP Setup - -**Configuration:** - -```json -{ - "mcpServers": { - "database": { - "command": "npx", - "args": ["@modelcontextprotocol/server-database"], - "env": { - "DATABASE_URL": "postgresql://user:pass@localhost/mydb" - } - } - } -} -``` - -**Example Usage:** - -```markdown -User: Fetch all users with more than 10 orders - -Claude: I'll query your database to find that information. - -# Using MCP database tool: -SELECT u.*, COUNT(o.id) as order_count -FROM users u -LEFT JOIN orders o ON u.id = o.user_id -GROUP BY u.id -HAVING COUNT(o.id) > 10 -ORDER BY order_count DESC; - -# Results: -- Alice: 15 orders -- Bob: 12 orders -- Charlie: 11 orders -``` - -#### Example 3: Multi-MCP Workflow - -**Scenario: Daily Report Generation** - -```markdown -# Daily Report Workflow using Multiple MCPs - -## Setup -1. GitHub MCP - fetch PR metrics -2. Database MCP - query sales data -3. Slack MCP - post report -4. Filesystem MCP - save report - -## Workflow - -### Step 1: Fetch GitHub Data -/mcp__github__list_prs completed:true last:7days - -Output: -- Total PRs: 42 -- Average merge time: 2.3 hours -- Review turnaround: 1.1 hours - -### Step 2: Query Database -SELECT COUNT(*) as sales, SUM(amount) as revenue -FROM orders -WHERE created_at > NOW() - INTERVAL '1 day' - -Output: -- Sales: 247 -- Revenue: $12,450 - -### Step 3: Generate Report -Combine data into HTML report - -### Step 4: Save to Filesystem -Write report.html to /reports/ - -### Step 5: Post to Slack -Send summary to #daily-reports channel - -Final Output: -✅ Report generated and posted -📊 47 PRs merged this week -💰 $12,450 in daily sales -``` - -#### Example 4: Filesystem MCP Operations - -**Configuration:** - -```json -{ - "mcpServers": { - "filesystem": { - "command": "npx", - "args": ["@modelcontextprotocol/server-filesystem", "/home/user/projects"] - } - } -} -``` - -**Available Operations:** - -| Operation | Command | Purpose | -|-----------|---------|---------| -| List files | `ls ~/projects` | Show directory contents | -| Read file | `cat src/main.ts` | Read file contents | -| Write file | `create docs/api.md` | Create new file | -| Edit file | `edit src/app.ts` | Modify file | -| Search | `grep "async function"` | Search in files | -| Delete | `rm old-file.js` | Delete file | +**[05-mcp/README.md](05-mcp/README.md)** covers the full `claude mcp add` syntax, transports, scopes, OAuth, and enterprise allowlisting. ### MCP vs Memory: Decision Matrix @@ -1310,813 +555,36 @@ graph TB ### Bundled Skills -Claude Code now includes 5 bundled skills available out of the box: +Claude Code now includes 10 bundled skills available out of the box: | Skill | Command | Purpose | |-------|---------|---------| -| **Code Review** | `/code-review` | Review the current diff for correctness bugs at a chosen effort level. A distinct skill from `/simplify` (quality/reuse cleanups), which was split back out in v2.1.154 | | **Batch** | `/batch` | Run operations across multiple files or items | -| **Debug** | `/debug` | Systematic debugging of issues with root cause analysis | -| **Loop** | `/loop` | Schedule recurring tasks on a timer | | **Claude API** | `/claude-api` | Interact with the Anthropic API directly | +| **Code Review** | `/code-review` | Review the current diff for correctness bugs at a chosen effort level. A distinct skill from `/simplify` (quality/reuse cleanups), which was split back out in v2.1.154. Explicit invocation only since v2.1.215 | +| **Simplify** | `/simplify` | Quality, reuse, and cleanup review — distinct from `/code-review` again since v2.1.154 | +| **Debug** | `/debug` | Systematic debugging of issues with root cause analysis | +| **Fewer Permission Prompts** | `/fewer-permission-prompts` | Scan transcripts and propose a prioritized allowlist for common read-only tools | +| **Loop** | `/loop` | Schedule recurring tasks on a timer | +| **Run** | `/run` | Launch and drive the project's app to verify a change (v2.1.145+) | +| **Run Skill Generator** | `/run-skill-generator` | Scaffold a new skill from a description (v2.1.145+) | +| **Verify** | `/verify` | Verify that a change actually works (v2.1.145+). Explicit invocation only since v2.1.215 | These bundled skills are always available and do not require installation or configuration. ### Practical Examples -#### Example 1: Custom Code Review Skill +Six complete skills — with their scripts, templates, and reference files — live in **[03-skills/](03-skills/)**: -**Directory Structure:** +- **`code-review-specialist/`** — review checklist, finding template, and two Python metrics scripts +- **`refactor/`** — code-smell catalog, refactoring catalog, plan template, and two analysis scripts +- **`doc-generator/`** — API documentation generation from source +- **`blog-draft/`** — outline and draft templates with a versioned output convention +- **`brand-voice/`** — tone rules and message templates (demonstrates `user-invocable: false`) +- **`claude-md/`** — create, update, and audit CLAUDE.md files -``` -~/.claude/skills/code-review-specialist/ -├── SKILL.md -├── templates/ -│ ├── review-checklist.md -│ └── finding-template.md -└── scripts/ - ├── analyze-metrics.py - └── compare-complexity.py -``` +See **[03-skills/README.md](03-skills/README.md)** for the full frontmatter reference and progressive-disclosure model. -**File:** `~/.claude/skills/code-review-specialist/SKILL.md` - -```yaml ---- -name: Code Review Specialist -description: Comprehensive code review with security, performance, and quality analysis -version: "1.0.0" -tags: - - code-review - - quality - - security -when_to_use: When users ask to review code, analyze code quality, or evaluate pull requests -effort: high -shell: bash ---- - -# Code Review Skill - -This skill provides comprehensive code review capabilities focusing on: - -1. **Security Analysis** - - Authentication/authorization issues - - Data exposure risks - - Injection vulnerabilities - - Cryptographic weaknesses - - Sensitive data logging - -2. **Performance Review** - - Algorithm efficiency (Big O analysis) - - Memory optimization - - Database query optimization - - Caching opportunities - - Concurrency issues - -3. **Code Quality** - - SOLID principles - - Design patterns - - Naming conventions - - Documentation - - Test coverage - -4. **Maintainability** - - Code readability - - Function size (should be < 50 lines) - - Cyclomatic complexity - - Dependency management - - Type safety - -## Review Template - -For each piece of code reviewed, provide: - -### Summary -- Overall quality assessment (1-5) -- Key findings count -- Recommended priority areas - -### Critical Issues (if any) -- **Issue**: Clear description -- **Location**: File and line number -- **Impact**: Why this matters -- **Severity**: Critical/High/Medium -- **Fix**: Code example - -### Findings by Category - -#### Security (if issues found) -List security vulnerabilities with examples - -#### Performance (if issues found) -List performance problems with complexity analysis - -#### Quality (if issues found) -List code quality issues with refactoring suggestions - -#### Maintainability (if issues found) -List maintainability problems with improvements -``` -## Python Script: analyze-metrics.py - -```python -#!/usr/bin/env python3 -import re -import sys - -def analyze_code_metrics(code): - """Analyze code for common metrics.""" - - # Count functions - functions = len(re.findall(r'^def\s+\w+', code, re.MULTILINE)) - - # Count classes - classes = len(re.findall(r'^class\s+\w+', code, re.MULTILINE)) - - # Average line length - lines = code.split('\n') - avg_length = sum(len(l) for l in lines) / len(lines) if lines else 0 - - # Estimate complexity - complexity = len(re.findall(r'\b(if|elif|else|for|while|and|or)\b', code)) - - return { - 'functions': functions, - 'classes': classes, - 'avg_line_length': avg_length, - 'complexity_score': complexity - } - -if __name__ == '__main__': - with open(sys.argv[1], 'r') as f: - code = f.read() - metrics = analyze_code_metrics(code) - for key, value in metrics.items(): - print(f"{key}: {value:.2f}") -``` - -## Python Script: compare-complexity.py - -```python -#!/usr/bin/env python3 -""" -Compare cyclomatic complexity of code before and after changes. -Helps identify if refactoring actually simplifies code structure. -""" - -import re -import sys -from typing import Dict, Tuple - -class ComplexityAnalyzer: - """Analyze code complexity metrics.""" - - def __init__(self, code: str): - self.code = code - self.lines = code.split('\n') - - def calculate_cyclomatic_complexity(self) -> int: - """ - Calculate cyclomatic complexity using McCabe's method. - Count decision points: if, elif, else, for, while, except, and, or - """ - complexity = 1 # Base complexity - - # Count decision points - decision_patterns = [ - r'\bif\b', - r'\belif\b', - r'\bfor\b', - r'\bwhile\b', - r'\bexcept\b', - r'\band\b(?!$)', - r'\bor\b(?!$)' - ] - - for pattern in decision_patterns: - matches = re.findall(pattern, self.code) - complexity += len(matches) - - return complexity - - def calculate_cognitive_complexity(self) -> int: - """ - Calculate cognitive complexity - how hard is it to understand? - Based on nesting depth and control flow. - """ - cognitive = 0 - nesting_depth = 0 - - for line in self.lines: - # Track nesting depth - if re.search(r'^\s*(if|for|while|def|class|try)\b', line): - nesting_depth += 1 - cognitive += nesting_depth - elif re.search(r'^\s*(elif|else|except|finally)\b', line): - cognitive += nesting_depth - - # Reduce nesting when unindenting - if line and not line[0].isspace(): - nesting_depth = 0 - - return cognitive - - def calculate_maintainability_index(self) -> float: - """ - Maintainability Index ranges from 0-100. - > 85: Excellent - > 65: Good - > 50: Fair - < 50: Poor - """ - lines = len(self.lines) - cyclomatic = self.calculate_cyclomatic_complexity() - cognitive = self.calculate_cognitive_complexity() - - # Simplified MI calculation - mi = 171 - 5.2 * (cyclomatic / lines) - 0.23 * (cognitive) - 16.2 * (lines / 1000) - - return max(0, min(100, mi)) - - def get_complexity_report(self) -> Dict: - """Generate comprehensive complexity report.""" - return { - 'cyclomatic_complexity': self.calculate_cyclomatic_complexity(), - 'cognitive_complexity': self.calculate_cognitive_complexity(), - 'maintainability_index': round(self.calculate_maintainability_index(), 2), - 'lines_of_code': len(self.lines), - 'avg_line_length': round(sum(len(l) for l in self.lines) / len(self.lines), 2) if self.lines else 0 - } - - -def compare_files(before_file: str, after_file: str) -> None: - """Compare complexity metrics between two code versions.""" - - with open(before_file, 'r') as f: - before_code = f.read() - - with open(after_file, 'r') as f: - after_code = f.read() - - before_analyzer = ComplexityAnalyzer(before_code) - after_analyzer = ComplexityAnalyzer(after_code) - - before_metrics = before_analyzer.get_complexity_report() - after_metrics = after_analyzer.get_complexity_report() - - print("=" * 60) - print("CODE COMPLEXITY COMPARISON") - print("=" * 60) - - print("\nBEFORE:") - print(f" Cyclomatic Complexity: {before_metrics['cyclomatic_complexity']}") - print(f" Cognitive Complexity: {before_metrics['cognitive_complexity']}") - print(f" Maintainability Index: {before_metrics['maintainability_index']}") - print(f" Lines of Code: {before_metrics['lines_of_code']}") - print(f" Avg Line Length: {before_metrics['avg_line_length']}") - - print("\nAFTER:") - print(f" Cyclomatic Complexity: {after_metrics['cyclomatic_complexity']}") - print(f" Cognitive Complexity: {after_metrics['cognitive_complexity']}") - print(f" Maintainability Index: {after_metrics['maintainability_index']}") - print(f" Lines of Code: {after_metrics['lines_of_code']}") - print(f" Avg Line Length: {after_metrics['avg_line_length']}") - - print("\nCHANGES:") - cyclomatic_change = after_metrics['cyclomatic_complexity'] - before_metrics['cyclomatic_complexity'] - cognitive_change = after_metrics['cognitive_complexity'] - before_metrics['cognitive_complexity'] - mi_change = after_metrics['maintainability_index'] - before_metrics['maintainability_index'] - loc_change = after_metrics['lines_of_code'] - before_metrics['lines_of_code'] - - print(f" Cyclomatic Complexity: {cyclomatic_change:+d}") - print(f" Cognitive Complexity: {cognitive_change:+d}") - print(f" Maintainability Index: {mi_change:+.2f}") - print(f" Lines of Code: {loc_change:+d}") - - print("\nASSESSMENT:") - if mi_change > 0: - print(" ✅ Code is MORE maintainable") - elif mi_change < 0: - print(" ⚠️ Code is LESS maintainable") - else: - print(" ➡️ Maintainability unchanged") - - if cyclomatic_change < 0: - print(" ✅ Complexity DECREASED") - elif cyclomatic_change > 0: - print(" ⚠️ Complexity INCREASED") - else: - print(" ➡️ Complexity unchanged") - - print("=" * 60) - - -if __name__ == '__main__': - if len(sys.argv) != 3: - print("Usage: python compare-complexity.py ") - sys.exit(1) - - compare_files(sys.argv[1], sys.argv[2]) -``` - -## Template: review-checklist.md - -```markdown -# Code Review Checklist - -## Security Checklist -- [ ] No hardcoded credentials or secrets -- [ ] Input validation on all user inputs -- [ ] SQL injection prevention (parameterized queries) -- [ ] CSRF protection on state-changing operations -- [ ] XSS prevention with proper escaping -- [ ] Authentication checks on protected endpoints -- [ ] Authorization checks on resources -- [ ] Secure password hashing (bcrypt, argon2) -- [ ] No sensitive data in logs -- [ ] HTTPS enforced - -## Performance Checklist -- [ ] No N+1 queries -- [ ] Appropriate use of indexes -- [ ] Caching implemented where beneficial -- [ ] No blocking operations on main thread -- [ ] Async/await used correctly -- [ ] Large datasets paginated -- [ ] Database connections pooled -- [ ] Regular expressions optimized -- [ ] No unnecessary object creation -- [ ] Memory leaks prevented - -## Quality Checklist -- [ ] Functions < 50 lines -- [ ] Clear variable naming -- [ ] No duplicate code -- [ ] Proper error handling -- [ ] Comments explain WHY, not WHAT -- [ ] No console.logs in production -- [ ] Type checking (TypeScript/JSDoc) -- [ ] SOLID principles followed -- [ ] Design patterns applied correctly -- [ ] Self-documenting code - -## Testing Checklist -- [ ] Unit tests written -- [ ] Edge cases covered -- [ ] Error scenarios tested -- [ ] Integration tests present -- [ ] Coverage > 80% -- [ ] No flaky tests -- [ ] Mock external dependencies -- [ ] Clear test names -``` - -## Template: finding-template.md - -~~~~markdown -# Code Review Finding Template - -Use this template when documenting each issue found during code review. - ---- - -## Issue: [TITLE] - -### Severity -- [ ] Critical (blocks deployment) -- [ ] High (should fix before merge) -- [ ] Medium (should fix soon) -- [ ] Low (nice to have) - -### Category -- [ ] Security -- [ ] Performance -- [ ] Code Quality -- [ ] Maintainability -- [ ] Testing -- [ ] Design Pattern -- [ ] Documentation - -### Location -**File:** `src/components/UserCard.tsx` - -**Lines:** 45-52 - -**Function/Method:** `renderUserDetails()` - -### Issue Description - -**What:** Describe what the issue is. - -**Why it matters:** Explain the impact and why this needs to be fixed. - -**Current behavior:** Show the problematic code or behavior. - -**Expected behavior:** Describe what should happen instead. - -### Code Example - -#### Current (Problematic) - -```typescript -// Shows the N+1 query problem -const users = fetchUsers(); -users.forEach(user => { - const posts = fetchUserPosts(user.id); // Query per user! - renderUserPosts(posts); -}); -``` - -#### Suggested Fix - -```typescript -// Optimized with JOIN query -const usersWithPosts = fetchUsersWithPosts(); -usersWithPosts.forEach(({ user, posts }) => { - renderUserPosts(posts); -}); -``` - -### Impact Analysis - -| Aspect | Impact | Severity | -|--------|--------|----------| -| Performance | 100+ queries for 20 users | High | -| User Experience | Slow page load | High | -| Scalability | Breaks at scale | Critical | -| Maintainability | Hard to debug | Medium | - -### Related Issues - -- Similar issue in `AdminUserList.tsx` line 120 -- Related PR: #456 -- Related issue: #789 - -### Additional Resources - -- [N+1 Query Problem](https://en.wikipedia.org/wiki/N%2B1_problem) -- [Database Join Documentation](https://docs.example.com/joins) - -### Reviewer Notes - -- This is a common pattern in this codebase -- Consider adding this to the code style guide -- Might be worth creating a helper function - -### Author Response (for feedback) - -*To be filled by the code author:* - -- [ ] Fix implemented in commit: `abc123` -- [ ] Fix status: Complete / In Progress / Needs Discussion -- [ ] Questions or concerns: (describe) - ---- - -## Finding Statistics (for Reviewer) - -When reviewing multiple findings, track: - -- **Total Issues Found:** X -- **Critical:** X -- **High:** X -- **Medium:** X -- **Low:** X - -**Recommendation:** ✅ Approve / ⚠️ Request Changes / 🔄 Needs Discussion - -**Overall Code Quality:** 1-5 stars -~~~~ - -## Usage Example - -~~~~markdown -User: Review this React component code - -Claude: I'll conduct a comprehensive code review using my Code Review Skill. - -[Loads SKILL.md] -[Analyzes code against checklist] -[Runs Python metrics script] -[Applies templates] - -## Code Review Results - -### Summary -Quality Score: 3.5/5 -Key Findings: 7 items -Priority Areas: Performance optimization, error handling - -### Critical Issues: 1 - -**Issue**: N+1 Query Problem -**Location**: UserComponent.tsx, lines 45-52 -**Impact**: Renders 100+ database queries for list of 20 users -**Severity**: High -**Fix**: -```javascript -// Before: N+1 queries -const users = fetchUsers(); -users.forEach(user => fetchUserPosts(user.id)); // 20+ queries - -// After: Single query with JOIN -const users = fetchUsersWithPosts(); // 1 query -``` - -### Performance Findings -- Missing pagination on large lists -- Recommendation: Use React.memo() for items -- Database query: Could be optimized with index - -### Quality Findings -- Function in line 20 is 127 lines (max: 50) -- Missing error boundary -- Props should have TypeScript types -~~~~ - -#### Example 2: Brand Voice Skill - -**Directory Structure:** - -``` -.claude/skills/brand-voice/ -├── SKILL.md -├── brand-guidelines.md -├── tone-examples.md -└── templates/ - ├── email-template.txt - ├── social-post-template.txt - └── blog-post-template.md -``` - -**File:** `.claude/skills/brand-voice/SKILL.md` - -```yaml ---- -name: Brand Voice Consistency -description: Ensure all communication matches brand voice and tone guidelines -tags: - - brand - - writing - - consistency -when_to_use: When creating marketing copy, customer communications, or public-facing content ---- - -# Brand Voice Skill - -## Overview -This skill ensures all communications maintain consistent brand voice, tone, and messaging. - -## Brand Identity - -### Mission -Help teams automate their development workflows with AI - -### Values -- **Simplicity**: Make complex things simple -- **Reliability**: Rock-solid execution -- **Empowerment**: Enable human creativity - -### Tone of Voice -- **Friendly but professional** - approachable without being casual -- **Clear and concise** - avoid jargon, explain technical concepts simply -- **Confident** - we know what we're doing -- **Empathetic** - understand user needs and pain points - -## Writing Guidelines - -### Do's ✅ -- Use "you" when addressing readers -- Use active voice: "Claude generates reports" not "Reports are generated by Claude" -- Start with value proposition -- Use concrete examples -- Keep sentences under 20 words -- Use lists for clarity -- Include calls-to-action - -### Don'ts ❌ -- Don't use corporate jargon -- Don't patronize or oversimplify -- Don't use "we believe" or "we think" -- Don't use ALL CAPS except for emphasis -- Don't create walls of text -- Don't assume technical knowledge - -## Vocabulary - -### ✅ Preferred Terms -- Claude (not "the Claude AI") -- Code generation (not "auto-coding") -- Agent (not "bot") -- Streamline (not "revolutionize") -- Integrate (not "synergize") - -### ❌ Avoid Terms -- "Cutting-edge" (overused) -- "Game-changer" (vague) -- "Leverage" (corporate-speak) -- "Utilize" (use "use") -- "Paradigm shift" (unclear) -``` -## Examples - -### ✅ Good Example -"Claude automates your code review process. Instead of manually checking each PR, Claude reviews security, performance, and quality—saving your team hours every week." - -Why it works: Clear value, specific benefits, action-oriented - -### ❌ Bad Example -"Claude leverages cutting-edge AI to provide comprehensive software development solutions." - -Why it doesn't work: Vague, corporate jargon, no specific value - -## Template: Email - -``` -Subject: [Clear, benefit-driven subject] - -Hi [Name], - -[Opening: What's the value for them] - -[Body: How it works / What they'll get] - -[Specific example or benefit] - -[Call to action: Clear next step] - -Best regards, -[Name] -``` - -## Template: Social Media - -``` -[Hook: Grab attention in first line] -[2-3 lines: Value or interesting fact] -[Call to action: Link, question, or engagement] -[Emoji: 1-2 max for visual interest] -``` - -## File: tone-examples.md -``` -Exciting announcement: -"Save 8 hours per week on code reviews. Claude reviews your PRs automatically." - -Empathetic support: -"We know deployments can be stressful. Claude handles testing so you don't have to worry." - -Confident product feature: -"Claude doesn't just suggest code. It understands your architecture and maintains consistency." - -Educational blog post: -"Let's explore how agents improve code review workflows. Here's what we learned..." -``` - -#### Example 3: Documentation Generator Skill - -**File:** `.claude/skills/doc-generator/SKILL.md` - -~~~~yaml ---- -name: API Documentation Generator -description: Generate comprehensive, accurate API documentation from source code -version: "1.0.0" -tags: - - documentation - - api - - automation -when_to_use: When creating or updating API documentation ---- - -# API Documentation Generator Skill - -## Generates - -- OpenAPI/Swagger specifications -- API endpoint documentation -- SDK usage examples -- Integration guides -- Error code references -- Authentication guides - -## Documentation Structure - -### For Each Endpoint - -```markdown -## GET /api/v1/users/:id - -### Description -Brief explanation of what this endpoint does - -### Parameters - -| Name | Type | Required | Description | -|------|------|----------|-------------| -| id | string | Yes | User ID | - -### Response - -**200 Success** -```json -{ - "id": "usr_123", - "name": "John Doe", - "email": "john@example.com", - "created_at": "2025-01-15T10:30:00Z" -} -``` - -**404 Not Found** -```json -{ - "error": "USER_NOT_FOUND", - "message": "User does not exist" -} -``` - -### Examples - -**cURL** -```bash -curl -X GET "https://api.example.com/api/v1/users/usr_123" \ - -H "Authorization: Bearer YOUR_TOKEN" -``` - -**JavaScript** -```javascript -const user = await fetch('/api/v1/users/usr_123', { - headers: { 'Authorization': 'Bearer token' } -}).then(r => r.json()); -``` - -**Python** -```python -response = requests.get( - 'https://api.example.com/api/v1/users/usr_123', - headers={'Authorization': 'Bearer token'} -) -user = response.json() -``` - -## Python Script: generate-docs.py - -```python -#!/usr/bin/env python3 -import ast -import json -from typing import Dict, List - -class APIDocExtractor(ast.NodeVisitor): - """Extract API documentation from Python source code.""" - - def __init__(self): - self.endpoints = [] - - def visit_FunctionDef(self, node): - """Extract function documentation.""" - if node.name.startswith('get_') or node.name.startswith('post_'): - doc = ast.get_docstring(node) - endpoint = { - 'name': node.name, - 'docstring': doc, - 'params': [arg.arg for arg in node.args.args], - 'returns': self._extract_return_type(node) - } - self.endpoints.append(endpoint) - self.generic_visit(node) - - def _extract_return_type(self, node): - """Extract return type from function annotation.""" - if node.returns: - return ast.unparse(node.returns) - return "Any" - -def generate_markdown_docs(endpoints: List[Dict]) -> str: - """Generate markdown documentation from endpoints.""" - docs = "# API Documentation\n\n" - - for endpoint in endpoints: - docs += f"## {endpoint['name']}\n\n" - docs += f"{endpoint['docstring']}\n\n" - docs += f"**Parameters**: {', '.join(endpoint['params'])}\n\n" - docs += f"**Returns**: {endpoint['returns']}\n\n" - docs += "---\n\n" - - return docs - -if __name__ == '__main__': - import sys - with open(sys.argv[1], 'r') as f: - tree = ast.parse(f.read()) - - extractor = APIDocExtractor() - extractor.visit(tree) - - markdown = generate_markdown_docs(extractor.endpoints) - print(markdown) -~~~~ ### Skill Discovery & Invocation ```mermaid @@ -2238,7 +706,7 @@ tags: # Requirements requires: - - claude-code: ">=1.0.0" + - claude-code: ">=2.1.0" # Components bundled components: @@ -2294,124 +762,13 @@ my-plugin/ ### Practical Examples -#### Example 1: PR Review Plugin +Three complete, installable plugins live in **[07-plugins/](07-plugins/)**: -**File:** `.claude-plugin/plugin.json` +- **`pr-review/`** — review commands, three specialist agents, GitHub MCP, and a pre-review hook +- **`documentation/`** — doc generation commands, three agents, and reusable templates +- **`devops-automation/`** — deploy/rollback/status/incident commands, three agents, Kubernetes MCP, and shell scripts -```json -{ - "name": "pr-review", - "version": "1.0.0", - "description": "Complete PR review workflow with security, testing, and docs", - "author": { - "name": "Anthropic" - }, - "license": "MIT" -} -``` - -**File:** `commands/review-pr.md` - -```markdown ---- -name: Review PR -description: Start comprehensive PR review with security and testing checks ---- - -# PR Review - -This command initiates a complete pull request review including: - -1. Security analysis -2. Test coverage verification -3. Documentation updates -4. Code quality checks -5. Performance impact assessment -``` - -**File:** `agents/security-reviewer.md` - -```yaml ---- -name: security-reviewer -description: Security-focused code review -tools: read, grep, diff ---- - -# Security Reviewer - -Specializes in finding security vulnerabilities: -- Authentication/authorization issues -- Data exposure -- Injection attacks -- Secure configuration -``` - -**Installation:** - -```bash -/plugin install pr-review - -# Result: -# ✅ 3 slash commands installed -# ✅ 3 subagents configured -# ✅ 2 MCP servers connected -# ✅ 4 hooks registered -# ✅ Ready to use! -``` - -#### Example 2: DevOps Plugin - -**Components:** - -``` -devops-automation/ -├── commands/ -│ ├── deploy.md -│ ├── rollback.md -│ ├── status.md -│ └── incident.md -├── agents/ -│ ├── deployment-specialist.md -│ ├── incident-commander.md -│ └── alert-analyzer.md -├── mcp/ -│ ├── github-config.json -│ ├── kubernetes-config.json -│ └── prometheus-config.json -├── hooks/ -│ ├── pre-deploy.js -│ ├── post-deploy.js -│ └── on-error.js -└── scripts/ - ├── deploy.sh - ├── rollback.sh - └── health-check.sh -``` - -#### Example 3: Documentation Plugin - -**Bundled Components:** - -``` -documentation/ -├── commands/ -│ ├── generate-api-docs.md -│ ├── generate-readme.md -│ ├── sync-docs.md -│ └── validate-docs.md -├── agents/ -│ ├── api-documenter.md -│ ├── code-commentator.md -│ └── example-generator.md -├── mcp/ -│ ├── github-docs-config.json -│ └── slack-announce-config.json -└── templates/ - ├── api-endpoint.md - ├── function-docs.md - └── adr-template.md -``` +Each includes its `.claude-plugin/plugin.json` manifest and directory layout. ### Plugin Marketplace @@ -2511,44 +868,9 @@ graph TD 7. Published on marketplace 8. Users can install with one command -**Example submission:** +### Example Plugin README -~~~~markdown -# PR Review Plugin - -## Description -Complete PR review workflow with security, testing, and documentation checks. - -## What's Included -- 3 slash commands for different review types -- 3 specialized subagents -- GitHub and CodeQL MCP integration -- Automated security scanning hooks - -## Installation -```bash -/plugin install pr-review -``` - -## Features -✅ Security analysis -✅ Test coverage checking -✅ Documentation verification -✅ Code quality assessment -✅ Performance impact analysis - -## Usage -```bash -/review-pr -/check-security -/check-tests -``` - -## Requirements -- Claude Code 1.0+ -- GitHub access -- CodeQL (optional) -~~~~ +See the three complete plugins in **[07-plugins/](07-plugins/)** — `pr-review/`, `documentation/`, and `devops-automation/` each ship a full `README.md`, manifest, commands, agents, and MCP config you can copy wholesale. ### Plugin vs Manual Configuration @@ -3116,7 +1438,7 @@ Complete configuration example: "maxConcurrentTasks": 5 }, "permissions": { - "mode": "default" + "defaultMode": "manual" } } ``` @@ -3152,7 +1474,7 @@ Claude Code supports the following models with adaptive reasoning effort: - [Anthropic Cookbook](https://github.com/anthropics/anthropic-cookbook) --- -**Last Updated**: July 29, 2026 +**Last Updated**: August 4, 2026 **Claude Code Version**: 2.1.220 **Sources**: - https://www.anthropic.com/news/claude-sonnet-5 @@ -3160,4 +1482,4 @@ Claude Code supports the following models with adaptive reasoning effort: - https://code.claude.com/docs/en/model-config - https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md - https://code.claude.com/docs/en/hooks -**Compatible Models**: Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/clean-code-rules.md b/clean-code-rules.md index 85bf5f4..1fdf942 100644 --- a/clean-code-rules.md +++ b/clean-code-rules.md @@ -108,4 +108,8 @@ These rules guide code generation to produce maintainable, professional-quality **Core Philosophy**: Code is read 10x more than written. Optimize for readability and maintainability, not cleverness. --- -**Last Updated**: April 9, 2026 +**Last Updated**: August 4, 2026 +**Claude Code Version**: 2.1.220 +**Sources**: +- https://code.claude.com/docs/en/overview +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/ja/01-slash-commands/README.md b/ja/01-slash-commands/README.md index 04f0d77..503c34d 100644 --- a/ja/01-slash-commands/README.md +++ b/ja/01-slash-commands/README.md @@ -56,7 +56,7 @@ | `/install-github-app` | GitHub Actions アプリをセットアップ | | `/install-slack-app` | Slack アプリをインストール | | `/keybindings` | キーバインド設定を開く | -| `/less-permission-prompts` | 直近の Bash/MCP ツール呼び出しを分析し、優先度の高い許可リストを `.claude/settings.json` に追加して権限プロンプトを減らす(v2.1.111 で追加) | +| `/fewer-permission-prompts` | 直近の Bash/MCP ツール呼び出しを分析し、優先度の高い許可リストを `.claude/settings.json` に追加して権限プロンプトを減らす(v2.1.111 で追加) | | `/login` | Anthropic アカウントを切り替え | | `/logout` | Anthropic アカウントからサインアウト | | `/mcp` | MCP サーバーと OAuth を管理 | @@ -116,7 +116,7 @@ | コマンド | ステータス | |---------|----------| | `/review` | 非推奨 — `code-review` プラグインに置き換え | -| `/output-style` | v2.1.73 から非推奨 | +| `/output-style` | v2.1.91 で削除 — 出力スタイルは `/config` または `outputStyle` 設定から引き続き利用できる | | `/fork` | `/branch` に改名(エイリアスは引き続き有効、v2.1.77) | | `/pr-comments` | v2.1.91 で削除 — Claude に直接 PR コメントを見るよう依頼する | | `/vim` | v2.1.92 で削除 — /config → エディタモードを使う | @@ -124,7 +124,7 @@ ### 直近の変更点 - `/fork` を `/branch` に改名し、`/fork` はエイリアスとして残置(v2.1.77) -- `/output-style` を非推奨化(v2.1.73) +- `/output-style` を削除(v2.1.91)。出力スタイル自体は `/config` または `outputStyle` 設定で引き続き利用できる - `/review` を非推奨化、`code-review` プラグインを推奨 - `/effort` コマンドを追加。`max` レベルは Opus 4.7 が必要(当初は Opus 4.6 限定) - プッシュトゥトーク音声入力の `/voice` コマンドを追加 @@ -146,7 +146,7 @@ - `/proactive` を `/loop` のエイリアスとして追加(v2.1.105) - `/effort` がインタラクティブな矢印キースライダーを獲得し、`high` と `max` の間に新しい `xhigh` レベルを追加。Opus 4.7 プランではデフォルト思考量が `xhigh` に引き上げられた(v2.1.111) - 包括的なクラウドベースのマルチエージェントコードレビュー用に `/ultrareview` を追加(v2.1.111) -- Bash/MCP ツール呼び出しを分析し、`.claude/settings.json` の許可リストで権限プロンプトを減らす `/less-permission-prompts` を追加(v2.1.111) +- Bash/MCP ツール呼び出しを分析し、`.claude/settings.json` の許可リストで権限プロンプトを減らす `/fewer-permission-prompts` を追加(v2.1.111) - Opus 4.7 を利用する Max サブスクライバについて、Auto モードに `--enable-auto-mode` フラグが不要になった(v2.1.112) ### `/team-onboarding` — チームメイト向けランプアップガイド diff --git a/ja/01-slash-commands/doc-refactor.md b/ja/01-slash-commands/doc-refactor.md index 32feca2..dc4f5e3 100644 --- a/ja/01-slash-commands/doc-refactor.md +++ b/ja/01-slash-commands/doc-refactor.md @@ -3,9 +3,8 @@ --- -name: Documentation Refactor +name: doc-refactor description: プロジェクトドキュメントを再構成して明瞭性とアクセシビリティを高める -tags: documentation, refactoring, organization --- # ドキュメントリファクタリング diff --git a/ja/01-slash-commands/setup-ci-cd.md b/ja/01-slash-commands/setup-ci-cd.md index 1a94323..bf20aa0 100644 --- a/ja/01-slash-commands/setup-ci-cd.md +++ b/ja/01-slash-commands/setup-ci-cd.md @@ -3,9 +3,8 @@ --- -name: Setup CI/CD Pipeline +name: setup-ci-cd description: 品質保証のための pre-commit フックと GitHub Actions を導入する -tags: ci-cd, devops, automation --- # CI/CD パイプラインのセットアップ diff --git a/ja/01-slash-commands/unit-test-expand.md b/ja/01-slash-commands/unit-test-expand.md index 0f4a7b7..69148d9 100644 --- a/ja/01-slash-commands/unit-test-expand.md +++ b/ja/01-slash-commands/unit-test-expand.md @@ -3,9 +3,8 @@ --- -name: Expand Unit Tests +name: unit-test-expand description: 未テストの分岐やエッジケースを狙ってテストカバレッジを高める -tags: testing, coverage, unit-tests --- # ユニットテストの拡充 diff --git a/ja/02-memory/directory-api-CLAUDE.md b/ja/02-memory/directory-api-CLAUDE.md index 8b346b2..e9907d2 100644 --- a/ja/02-memory/directory-api-CLAUDE.md +++ b/ja/02-memory/directory-api-CLAUDE.md @@ -4,7 +4,9 @@ # API モジュール標準 -このファイルは /src/api/ 配下のすべてに対し、ルートの CLAUDE.md を上書きする。 +このファイルは /src/api/ 配下のすべてに対し、ルートの CLAUDE.md を補完する。メモリファイルは +連結されるものであり、上書きされるわけではない。ルートの CLAUDE.md は引き続き適用され、 +Claude Code はこのサブツリー内のファイルを読むときに本ファイルをオンデマンドで読み込む。 ## API 固有の標準 diff --git a/ja/03-skills/README.md b/ja/03-skills/README.md index 3053fcf..5b519d4 100644 --- a/ja/03-skills/README.md +++ b/ja/03-skills/README.md @@ -96,7 +96,7 @@ sequenceDiagram | **Project** | `.claude/skills//SKILL.md` | チーム | あり(git 経由) | チームの標準 | | **Plugin** | `/skills//SKILL.md` | 有効化された範囲 | プラグインに依存 | プラグインへのバンドル | -スキル名がレベル間で重複する場合、優先度の高い配置場所が優先される: **enterprise > personal > project**。プラグインスキルは `plugin-name:skill-name` の名前空間を用いるため衝突しない。 +スキル名がレベル間で重複する場合、優先度の高い配置場所が優先される: **enterprise > project > personal**。プロジェクトスキルはデフォルトで個人スキルを上書きする。プラグインスキルは `plugin-name:skill-name` の名前空間を用いるため衝突しない。 ### 自動検出 @@ -535,7 +535,7 @@ refactor/ ```yaml --- -name: code-refactor +name: refactor description: Systematic code refactoring based on Martin Fowler's methodology. Use when users ask to refactor code, improve code structure, reduce technical debt, or eliminate code smells. --- diff --git a/ja/03-skills/claude-md/SKILL.md b/ja/03-skills/claude-md/SKILL.md index d1fd184..bdb10e0 100644 --- a/ja/03-skills/claude-md/SKILL.md +++ b/ja/03-skills/claude-md/SKILL.md @@ -196,10 +196,14 @@ Brief one-line description. ユーザーが AGENTS.md の作成・更新を求めた場合: -AGENTS.md は専門エージェントの振る舞いを定義するために用いられる。プロジェクトコンテキスト用の CLAUDE.md と異なり、AGENTS.md では以下を定義する: -- カスタムエージェントの役割と能力 -- エージェント固有の命令と制約 -- マルチエージェントシナリオのワークフロー定義 +**Claude Code は AGENTS.md を直接読み込まない。** 有効にするには、CLAUDE.md から `@AGENTS.md` でインポートするか、`CLAUDE.md` をこのファイルへのシンボリックリンクにする。これはこのファイルに関する最もよくある誤解である。 + +AGENTS.md はツール横断のプロジェクトコンテキストファイルであり、CLAUDE.md と同じ *種類* のドキュメントである。エージェント定義フォーマットではない。複数のコーディングエージェントが 1 つのプロジェクト規約を共有できるようにするために存在する: +- ビルド、テスト、リントのコマンド +- コードスタイルとアーキテクチャ上の規約 +- リポジトリの構成と各要素の所在 + +サブエージェントは AGENTS.md ではなく、`.claude/agents/*.md` で別途定義する。 同様の原則を適用する: - 焦点を絞り簡潔に保つ diff --git a/ja/03-skills/doc-generator/SKILL.md b/ja/03-skills/doc-generator/SKILL.md index 15c66a6..bf20587 100644 --- a/ja/03-skills/doc-generator/SKILL.md +++ b/ja/03-skills/doc-generator/SKILL.md @@ -22,7 +22,7 @@ description: ソースコードから包括的かつ正確な API ドキュメ ### 各エンドポイントごと -```markdown +````markdown ## GET /api/v1/users/:id ### Description @@ -77,4 +77,4 @@ response = requests.get( ) user = response.json() ``` -``` +```` diff --git a/ja/03-skills/refactor/SKILL.md b/ja/03-skills/refactor/SKILL.md index 189b213..d0380c1 100644 --- a/ja/03-skills/refactor/SKILL.md +++ b/ja/03-skills/refactor/SKILL.md @@ -2,7 +2,7 @@ --- -name: code-refactor +name: refactor description: Martin Fowler の方法論に基づく体系的なコードリファクタリング。ユーザーがコードのリファクタリング、コード構造の改善、技術的負債の削減、レガシーコードのクリーンアップ、コードスメルの解消、コード保守性の向上を求めた際に使用する。本スキルは、リサーチ・計画・安全な段階的実装からなる段階的アプローチを案内する。 --- diff --git a/ja/04-subagents/README.md b/ja/04-subagents/README.md index f9003d7..37f6354 100644 --- a/ja/04-subagents/README.md +++ b/ja/04-subagents/README.md @@ -1112,6 +1112,40 @@ graph TB --- +### 8. Clean Code Reviewer(`clean-code-reviewer.md`) + +**目的**:クリーンコード原則に照らした可読性・保守性のレビュー + +**ツール**:Read、Grep、Glob、Bash + +**専門分野**: + +- 命名、関数の長さ、引数の数 +- 重複コードとデッドコード +- コメントの質と意図 +- 巧妙さより構造の明快さ + +**使用場面**:正しさのレビューとは別に、スタイルと保守性の観点で見直したいとき + +--- + +### 9. Performance Optimizer(`performance-optimizer.md`) + +**目的**:パフォーマンスのボトルネックを特定して改善する + +**ツール**:Read、Edit、Bash、Grep、Glob + +**専門分野**: + +- アルゴリズムの計算量とホットパス +- メモリ確保とリーク +- キャッシュとクエリの最適化 +- 並行処理と I/O のボトルネック + +**使用場面**:計測できるレベルで遅く、的を絞った最適化が必要なとき + +--- + ## インストール手順 ### 方法 1:/agents コマンドを使う(推奨) @@ -1184,7 +1218,9 @@ project/ │ ├── secure-reviewer.md │ ├── implementation-agent.md │ ├── debugger.md -│ └── data-scientist.md +│ ├── data-scientist.md +│ ├── clean-code-reviewer.md +│ └── performance-optimizer.md └── ... ``` diff --git a/ja/05-mcp/README.md b/ja/05-mcp/README.md index bff1d12..9c14236 100644 --- a/ja/05-mcp/README.md +++ b/ja/05-mcp/README.md @@ -261,11 +261,22 @@ MCP サーバーはスラッシュコマンドとして表示されるプロン MCP の設定は共有レベルの異なる複数のスコープに保存できる。 -| スコープ | 場所 | 説明 | 共有相手 | 承認の要否 | -|----------|------|------|----------|-----------| -| **Local**(デフォルト) | `~/.claude.json`(プロジェクトパス配下) | 現在のユーザー、現在のプロジェクトに非公開(旧バージョンでは `project` と呼ばれていた) | 自分のみ | 不要 | -| **Project** | `.mcp.json` | git リポジトリにチェックインされる | チームメンバー | 必要(初回使用時) | -| **User** | `~/.claude.json` | 全プロジェクトで利用可能(旧バージョンでは `global` と呼ばれていた) | 自分のみ | 不要 | +| スコープ | フラグ | 場所 | 説明 | 共有相手 | 承認の要否 | +|----------|--------|------|------|----------|-----------| +| **Local**(デフォルト) | `--scope local` | `~/.claude.json`(プロジェクトパス配下) | 現在のユーザー、現在のプロジェクトに非公開(旧バージョンでは `project` と呼ばれていた) | 自分のみ | 不要 | +| **Project** | `--scope project` | `.mcp.json` | git リポジトリにチェックインされる | チームメンバー | 必要(初回使用時) | +| **User** | `--scope user` | `~/.claude.json` | 全プロジェクトで利用可能(旧バージョンでは `global` と呼ばれていた) | 自分のみ | 不要 | + +サーバー追加時のスコープは `--scope`(短縮形 `-s`)で選択する。省略した場合、 +Claude Code は `local` を使う。 + +```bash +# Project スコープ — .mcp.json に書き込まれ、チームで共有される +claude mcp add --scope project --transport http github https://api.github.com/mcp + +# User スコープ — すべてのプロジェクトで利用できる +claude mcp add --scope user --transport stdio memory -- npx @modelcontextprotocol/server-memory +``` ### Project スコープの使用 @@ -432,7 +443,7 @@ MCP 設定は環境変数の展開とフォールバックデフォルトをサ "command": "npx", "args": ["@modelcontextprotocol/server-database"], "env": { - "DATABASE_URL": "postgresql://user:pass@localhost/mydb" + "DATABASE_URL": "${DATABASE_URL}" } } } diff --git a/ja/05-mcp/database-mcp.json b/ja/05-mcp/database-mcp.json index eaa832a..8b78836 100644 --- a/ja/05-mcp/database-mcp.json +++ b/ja/05-mcp/database-mcp.json @@ -1,10 +1,11 @@ { "mcpServers": { "database": { + "type": "stdio", "command": "npx", "args": ["@modelcontextprotocol/server-database"], "env": { - "DATABASE_URL": "postgresql://user:pass@localhost/mydb" + "DATABASE_URL": "${DATABASE_URL}" } } } diff --git a/ja/05-mcp/filesystem-mcp.json b/ja/05-mcp/filesystem-mcp.json index c76fdf6..6ea1e2a 100644 --- a/ja/05-mcp/filesystem-mcp.json +++ b/ja/05-mcp/filesystem-mcp.json @@ -1,6 +1,7 @@ { "mcpServers": { "filesystem": { + "type": "stdio", "command": "npx", "args": ["@modelcontextprotocol/server-filesystem", "/home/user/projects"] } diff --git a/ja/05-mcp/github-mcp.json b/ja/05-mcp/github-mcp.json index 0f62131..d2c3946 100644 --- a/ja/05-mcp/github-mcp.json +++ b/ja/05-mcp/github-mcp.json @@ -1,6 +1,7 @@ { "mcpServers": { "github": { + "type": "stdio", "command": "npx", "args": ["@modelcontextprotocol/server-github"], "env": { diff --git a/ja/05-mcp/multi-mcp.json b/ja/05-mcp/multi-mcp.json index 62d8fa5..ceb0e0d 100644 --- a/ja/05-mcp/multi-mcp.json +++ b/ja/05-mcp/multi-mcp.json @@ -1,6 +1,7 @@ { "mcpServers": { "github": { + "type": "stdio", "command": "npx", "args": ["@modelcontextprotocol/server-github"], "env": { @@ -8,6 +9,7 @@ } }, "database": { + "type": "stdio", "command": "npx", "args": ["@modelcontextprotocol/server-database"], "env": { @@ -15,6 +17,7 @@ } }, "slack": { + "type": "stdio", "command": "npx", "args": ["@modelcontextprotocol/server-slack"], "env": { @@ -22,6 +25,7 @@ } }, "filesystem": { + "type": "stdio", "command": "npx", "args": ["@modelcontextprotocol/server-filesystem", "/home/user/projects"] } diff --git a/ja/06-hooks/README.md b/ja/06-hooks/README.md index 3ea6aec..9156b07 100644 --- a/ja/06-hooks/README.md +++ b/ja/06-hooks/README.md @@ -179,14 +179,16 @@ LLM はプロンプトを評価し、構造化された判定を返す(詳細 ## フックイベント -Claude Code は **28 種類のフックイベント** をサポートする。 +Claude Code は **31 種類のフックイベント** をサポートする。 | イベント | 発火タイミング | マッチャー入力 | ブロック可否 | 用途例 | |----------|---------------|---------------|-------------|--------| | **SessionStart** | セッション開始/再開/clear/compact/fork | startup/resume/clear/compact/fork | 不可 | 環境セットアップ | +| **Setup** | 初回の環境セットアップ(セッションごとに1回) | (なし) | 不可 | ツールのプロビジョニング、依存関係のインストール | | **InstructionsLoaded** | CLAUDE.md やルールファイルが読み込まれた後 | (なし) | 不可 | 指示の修正/フィルタ | | **UserPromptSubmit** | ユーザーがプロンプトを送信 | (なし) | 可 | プロンプト検証 | | **UserPromptExpansion** | ユーザープロンプトが展開(`@` メンション、スラッシュコマンド解決など) | (なし) | 可 | 展開後のプロンプトを変換/検査 | +| **MessageDisplay** | アシスタントのメッセージ本文が表示される際 | (なし) | 不可 | 表示テキストの変換・非表示化(v2.1.152) | | **PreToolUse** | ツール実行前 | ツール名 | 可(allow/deny/ask) | 入力の検証・修正 | | **PermissionRequest** | 権限ダイアログ表示 | ツール名 | 可 | 自動承認/拒否 | | **PermissionDenied** | ユーザーが権限プロンプトを拒否 | ツール名 | 不可 | ロギング、解析、ポリシー強制 | @@ -203,6 +205,7 @@ Claude Code は **28 種類のフックイベント** をサポートする。 | **TaskCreated** | TaskCreate でタスク作成 | (なし) | 不可 | タスク追跡、ロギング | | **ConfigChange** | 設定ファイル変更 | (なし) | 可(ポリシーを除く) | 設定更新への反応 | | **CwdChanged** | 作業ディレクトリ変更 | (なし) | 不可 | ディレクトリ固有のセットアップ | +| **DirectoryAdded** | `/add-dir` または SDK の `register_repo_root` コントロールリクエストにより、セッション中に新しい作業ディレクトリが登録された時(v2.1.219) | (なし) | 不可 | 追加されたディレクトリ向けのツール設定 | | **FileChanged** | 監視ファイル変更 | (なし) | 不可 | ファイル監視、再ビルド | | **PreCompact** | コンテキスト圧縮前 | manual/auto | 不可 | 圧縮前の処理 | | **PostCompact** | 圧縮完了後 | (なし) | 不可 | 圧縮後の処理 | @@ -240,8 +243,13 @@ Claude がツールパラメータを生成した後、処理開始前に動作 **一般的なマッチャー:** `Task`、`Bash`、`Glob`、`Grep`、`Read`、`Edit`、`Write`、`WebFetch`、`WebSearch` **出力制御:** -- `permissionDecision`: `"allow"`、`"deny"`、`"ask"` -- `permissionDecisionReason`: 判定の理由 +- `permissionDecision`: `"allow"`、`"deny"`、`"ask"`、`"defer"` + - `"allow"` は権限プロンプトをスキップする(ユーザー操作が必須のツール、および組織が `ask` に設定したコネクタツールを除く) + - `"deny"` はツール呼び出しを阻止する + - `"ask"` はユーザーに確認を求める + - `"defer"` は正常終了して後でツールを再開できるようにする。この値では `permissionDecisionReason`、`updatedInput`、`additionalContext` はいずれも無視される + - フックが何を返しても deny/ask のルールは引き続き評価される。複数の `PreToolUse` フックの判定が食い違う場合、優先順位は `deny` > `defer` > `ask` > `allow` となる +- `permissionDecisionReason`: 判定の理由。`"allow"` と `"ask"` では(Claude ではなく)ユーザーに表示され、`"deny"` では Claude に表示される。`"defer"` では無視される - `updatedInput`: 修正されたツール入力パラメータ ### PostToolUse diff --git a/ja/06-hooks/dependency-check.sh b/ja/06-hooks/dependency-check.sh index a81bc34..e0ff007 100755 --- a/ja/06-hooks/dependency-check.sh +++ b/ja/06-hooks/dependency-check.sh @@ -1,15 +1,21 @@ #!/bin/bash # マニフェストファイルが変更された後に、依存関係の既知の脆弱性をチェックする。 -# フック:PostToolUse:Write +# フック:PostToolUse(matcher: Write) +# +# 対象ファイルパスは標準入力の JSON から読み取る(Claude Code フックプロトコル)。 +# 出典:https://code.claude.com/docs/en/hooks -FILE=$1 +# Claude Code フックプロトコルに従い、標準入力から JSON を読み取る +INPUT=$(cat) + +# sed で file_path を抽出(全プラットフォーム互換) +FILE=$(echo "$INPUT" | sed -n 's/.*"file_path"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' | head -1) if [ -z "$FILE" ]; then - echo "使い方: $0 " exit 0 fi -# マッチング用に basename を使う — $1 は絶対パスの可能性がある +# マッチング用に basename を使う — file_path は絶対パスの可能性がある BASENAME=$(basename "$FILE") # 依存関係マニフェストが書き換えられた場合のみ実行 diff --git a/ja/06-hooks/format-code.sh b/ja/06-hooks/format-code.sh index c96ef15..43c5f19 100644 --- a/ja/06-hooks/format-code.sh +++ b/ja/06-hooks/format-code.sh @@ -1,6 +1,6 @@ #!/bin/bash # 書き込み後にコードを自動整形する -# フック:PostToolUse:Write +# フック:PostToolUse(matcher: Write) # # 標準入力の JSON から対象ファイルパスを読み取り、Claude がファイルを書き込んだ # 後に、そのファイルに対して適切なフォーマッタをインプレースで実行する。 diff --git a/ja/06-hooks/log-bash.sh b/ja/06-hooks/log-bash.sh index 5df5c86..fc377eb 100644 --- a/ja/06-hooks/log-bash.sh +++ b/ja/06-hooks/log-bash.sh @@ -1,6 +1,6 @@ #!/bin/bash # すべての bash コマンドを記録する -# フック:PostToolUse:Bash +# フック:PostToolUse(matcher: Bash) # # 標準入力の JSON から実行コマンドを読み取り、ファイルに記録する。 # diff --git a/ja/06-hooks/pre-commit.sh b/ja/06-hooks/pre-commit.sh index bf15aea..3efda43 100644 --- a/ja/06-hooks/pre-commit.sh +++ b/ja/06-hooks/pre-commit.sh @@ -3,6 +3,10 @@ # フック:PreToolUse(matcher: Bash)— コマンドが git commit か判定する # 注:「PreCommit」フックイベントは存在しない。PreToolUse と Bash matcher の組み合わせで # コマンドを検査し、git commit を検出する。 +# +# 終了コード:2 はツール呼び出しをブロックし、stderr の内容をブロック理由として提示する。 +# それ以外の非ゼロ値は「ブロックしないエラー」であり、コミットはそのまま続行してしまう。 +# 出典:https://code.claude.com/docs/en/hooks echo "🧪 コミット前にテストを実行しています..." @@ -11,8 +15,8 @@ if [ -f "package.json" ]; then if grep -q "\"test\":" package.json; then npm test if [ $? -ne 0 ]; then - echo "❌ テスト失敗。コミットをブロックします。" - exit 1 + echo "❌ テスト失敗。コミットをブロックします。" >&2 + exit 2 fi fi fi @@ -22,8 +26,8 @@ if [ -f "pytest.ini" ] || [ -f "setup.py" ]; then if command -v pytest &> /dev/null; then pytest if [ $? -ne 0 ]; then - echo "❌ テスト失敗。コミットをブロックします。" - exit 1 + echo "❌ テスト失敗。コミットをブロックします。" >&2 + exit 2 fi fi fi @@ -32,8 +36,8 @@ fi if [ -f "go.mod" ]; then go test ./... if [ $? -ne 0 ]; then - echo "❌ テスト失敗。コミットをブロックします。" - exit 1 + echo "❌ テスト失敗。コミットをブロックします。" >&2 + exit 2 fi fi @@ -41,8 +45,8 @@ fi if [ -f "Cargo.toml" ]; then cargo test if [ $? -ne 0 ]; then - echo "❌ テスト失敗。コミットをブロックします。" - exit 1 + echo "❌ テスト失敗。コミットをブロックします。" >&2 + exit 2 fi fi diff --git a/ja/06-hooks/security-scan.sh b/ja/06-hooks/security-scan.sh index b4457e2..79c8fb6 100644 --- a/ja/06-hooks/security-scan.sh +++ b/ja/06-hooks/security-scan.sh @@ -1,6 +1,6 @@ #!/bin/bash # ファイル書き込み時のセキュリティスキャン -# フック:PostToolUse:Write +# フック:PostToolUse(matcher: Write) # # ハードコードされたシークレット・API キー・認証情報をファイルからスキャンする。 # 検出時は additionalContext を介して非ブロッキングの警告を出力する。 diff --git a/ja/06-hooks/session-end.sh b/ja/06-hooks/session-end.sh index fad1ebc..c75db6d 100755 --- a/ja/06-hooks/session-end.sh +++ b/ja/06-hooks/session-end.sh @@ -92,3 +92,5 @@ echo "" echo " $PROGRESS_FILE に保存しました" [ -n "$NOTES" ] && echo " メモ: $NOTES" echo "" + +exit 0 diff --git a/ja/07-plugins/README.md b/ja/07-plugins/README.md index 7d912c3..b29ada0 100644 --- a/ja/07-plugins/README.md +++ b/ja/07-plugins/README.md @@ -365,7 +365,7 @@ This command initiates a complete pull request review including: --- name: security-reviewer description: Security-focused code review -tools: read, grep, diff +tools: Read, Grep, Bash --- # Security Reviewer @@ -853,7 +853,7 @@ Complete PR review workflow with security, testing, and documentation checks. ``` ## Requirements -- Claude Code 1.0+ +- Claude Code 2.1+ - GitHub access - CodeQL (optional) ``` diff --git a/ja/07-plugins/devops-automation/agents/alert-analyzer.md b/ja/07-plugins/devops-automation/agents/alert-analyzer.md index 28a3aa6..1c44cc3 100644 --- a/ja/07-plugins/devops-automation/agents/alert-analyzer.md +++ b/ja/07-plugins/devops-automation/agents/alert-analyzer.md @@ -5,7 +5,7 @@ --- name: alert-analyzer description: 監視アラートとシステムメトリクスを解析する -tools: read, grep, bash +tools: Read, Grep, Bash --- # Alert Analyzer diff --git a/ja/07-plugins/devops-automation/agents/deployment-specialist.md b/ja/07-plugins/devops-automation/agents/deployment-specialist.md index 7a7d414..6470765 100644 --- a/ja/07-plugins/devops-automation/agents/deployment-specialist.md +++ b/ja/07-plugins/devops-automation/agents/deployment-specialist.md @@ -5,7 +5,7 @@ --- name: deployment-specialist description: あらゆるデプロイ作業を担当する -tools: read, write, bash, grep +tools: Read, Write, Bash, Grep --- # Deployment Specialist diff --git a/ja/07-plugins/devops-automation/agents/incident-commander.md b/ja/07-plugins/devops-automation/agents/incident-commander.md index 6854f39..e744d8b 100644 --- a/ja/07-plugins/devops-automation/agents/incident-commander.md +++ b/ja/07-plugins/devops-automation/agents/incident-commander.md @@ -5,7 +5,7 @@ --- name: incident-commander description: インシデントレスポンスを統括する -tools: read, write, bash, grep +tools: Read, Write, Bash, Grep --- # Incident Commander diff --git a/ja/07-plugins/documentation/agents/api-documenter.md b/ja/07-plugins/documentation/agents/api-documenter.md index 539b210..8bcb413 100644 --- a/ja/07-plugins/documentation/agents/api-documenter.md +++ b/ja/07-plugins/documentation/agents/api-documenter.md @@ -5,7 +5,7 @@ --- name: api-documenter description: API ドキュメンテーションのスペシャリスト -tools: read, write, grep +tools: Read, Write, Grep --- # API Documenter diff --git a/ja/07-plugins/documentation/agents/code-commentator.md b/ja/07-plugins/documentation/agents/code-commentator.md index e7362d9..95477f6 100644 --- a/ja/07-plugins/documentation/agents/code-commentator.md +++ b/ja/07-plugins/documentation/agents/code-commentator.md @@ -5,7 +5,7 @@ --- name: code-commentator description: コードコメントとインラインドキュメントのスペシャリスト -tools: read, write, edit +tools: Read, Write, Edit --- # Code Commentator diff --git a/ja/07-plugins/documentation/agents/example-generator.md b/ja/07-plugins/documentation/agents/example-generator.md index c78f642..1d52c0a 100644 --- a/ja/07-plugins/documentation/agents/example-generator.md +++ b/ja/07-plugins/documentation/agents/example-generator.md @@ -5,7 +5,7 @@ --- name: example-generator description: コード例とチュートリアルのスペシャリスト -tools: read, write +tools: Read, Write --- # Example Generator diff --git a/ja/07-plugins/pr-review/agents/performance-analyzer.md b/ja/07-plugins/pr-review/agents/performance-analyzer.md index e2142ed..7879d94 100644 --- a/ja/07-plugins/pr-review/agents/performance-analyzer.md +++ b/ja/07-plugins/pr-review/agents/performance-analyzer.md @@ -5,7 +5,7 @@ --- name: performance-analyzer description: パフォーマンス影響の解析 -tools: read, grep, bash +tools: Read, Grep, Bash --- # Performance Analyzer diff --git a/ja/07-plugins/pr-review/agents/security-reviewer.md b/ja/07-plugins/pr-review/agents/security-reviewer.md index 4cf54d6..12b5f02 100644 --- a/ja/07-plugins/pr-review/agents/security-reviewer.md +++ b/ja/07-plugins/pr-review/agents/security-reviewer.md @@ -5,7 +5,7 @@ --- name: security-reviewer description: セキュリティに特化したコードレビュー -tools: read, grep, bash +tools: Read, Grep, Bash --- # Security Reviewer diff --git a/ja/07-plugins/pr-review/agents/test-checker.md b/ja/07-plugins/pr-review/agents/test-checker.md index 237ce72..5797627 100644 --- a/ja/07-plugins/pr-review/agents/test-checker.md +++ b/ja/07-plugins/pr-review/agents/test-checker.md @@ -5,7 +5,7 @@ --- name: test-checker description: テストカバレッジと品質の解析 -tools: read, bash, grep +tools: Read, Bash, Grep --- # Test Checker diff --git a/ja/08-checkpoints/README.md b/ja/08-checkpoints/README.md index 10f5502..a733658 100644 --- a/ja/08-checkpoints/README.md +++ b/ja/08-checkpoints/README.md @@ -215,15 +215,21 @@ Claude Code はチェックポイントを自動管理する: チェックポイントは Claude Code の組み込み機能で、有効化のための設定は不要である。ユーザー入力のたびにチェックポイントが自動生成される。 -チェックポイントに関連する唯一の設定は `cleanupPeriodDays` で、セッションとチェックポイントの保持期間を制御する: +チェックポイントの挙動は 2 つの設定で制御する。スナップショットを取得するかどうかと、どれだけ保持するかである: ```json { + "fileCheckpointingEnabled": true, "cleanupPeriodDays": 30 } ``` -- `cleanupPeriodDays`: セッション履歴とチェックポイントの保持日数(デフォルト: `30`) +| 設定 | デフォルト | 効果 | +|------|-----------|------| +| `fileCheckpointingEnabled` | `true` | 各編集の前にファイルをスナップショットし、`/rewind` で復元できるようにする。v2.1.119 以降が必要。`/config` では **Rewind code (checkpoints)** として表示される。環境変数での同等指定は `CLAUDE_CODE_DISABLE_FILE_CHECKPOINTING` | +| `cleanupPeriodDays` | `30` | セッション履歴とチェックポイントの保持日数 | + +Claude Code がスナップショットを保持するのは **直近 100 件のチェックポイント** までで、それより古いものは保持期間内であっても削除される。 > **v2.1.117 のアップデート**: `cleanupPeriodDays` がチェックポイントだけでなく、ディスク上の 4 種類のキャッシュの保持期間を統合的に制御するようになった: > diff --git a/ja/09-advanced-features/README.md b/ja/09-advanced-features/README.md index 389b885..5fa6f8d 100644 --- a/ja/09-advanced-features/README.md +++ b/ja/09-advanced-features/README.md @@ -1904,7 +1904,7 @@ v2.1.83 以降、管理者は複数のマネージド設定ファイルを `mana ```json { "permissions": { - "mode": "default" + "defaultMode": "default" }, "hooks": { "PreToolUse:Edit": "eslint --fix ${file_path}", @@ -1927,7 +1927,7 @@ v2.1.83 以降、管理者は複数のマネージド設定ファイルを `mana ```json { "permissions": { - "mode": "default", + "defaultMode": "default", "allowedTools": ["Bash(git log:*)", "Read"], "disallowedTools": ["Bash(rm -rf:*)"] }, @@ -2034,7 +2034,7 @@ User: /config "PreToolUse": [{ "matcher": "Bash", "hooks": ["npm test && npm run lint"] }] }, "permissions": { - "mode": "default" + "defaultMode": "default" }, "mcp": { "servers": { diff --git a/ja/CATALOG.md b/ja/CATALOG.md index 1e5da56..1a345f3 100644 --- a/ja/CATALOG.md +++ b/ja/CATALOG.md @@ -20,13 +20,13 @@ | 機能 | 組み込み | 例 | 合計 | リファレンス | |---------|----------|----------|-------|-----------| | **スラッシュコマンド** | 60 個以上 | 8 | 68 個以上 | [01-slash-commands/](01-slash-commands/) | -| **サブエージェント** | 6 | 11 | 17 | [04-subagents/](04-subagents/) | -| **スキル** | バンドル 5 | 4 | 9 | [03-skills/](03-skills/) | +| **サブエージェント** | 6 | 9 | 15 | [04-subagents/](04-subagents/) | +| **スキル** | バンドル 10 | 6 | 16 | [03-skills/](03-skills/) | | **プラグイン** | - | 3 | 3 | [07-plugins/](07-plugins/) | -| **MCP サーバ** | 1 | 8 | 9 | [05-mcp/](05-mcp/) | -| **フック** | 28 イベント | 8 | 8 | [06-hooks/](06-hooks/) | -| **メモリ** | 7 種類 | 3 | 3 | [02-memory/](02-memory/) | -| **合計** | **99** | **45** | **119** | | +| **MCP サーバ** | 1 | 4 | 5 | [05-mcp/](05-mcp/) | +| **フック** | 31 イベント | 9 | 40 | [06-hooks/](06-hooks/) | +| **メモリ** | 7 種類 | 3 | 10 | [02-memory/](02-memory/) | +| **合計** | **115** | **42** | **157** | | --- @@ -97,7 +97,7 @@ | `/team-onboarding` | このプロジェクトの Claude Code 利用状況からオンボーディングガイドを生成 | 新メンバーのオンボーディング(v2.1.101) | | `/ultraplan` | プランニングタスクを Claude Code Web セッションに渡す(plan モード) | 重い計画作業のオフロード(Research Preview、v2.1.91+) | | `/ultrareview` | 現在の変更に対するクラウドのマルチエージェントコードレビューを実行 | マージ前の深いマルチエージェントレビュー(v2.1.112) | -| `/less-permission-prompts` | トランスクリプトをスキャンし、よく使う読取専用ツールの優先許可リストを提案 | プロジェクトでの権限プロンプト繰り返しを削減(v2.1.112) | +| `/fewer-permission-prompts` | トランスクリプトをスキャンし、よく使う読取専用ツールの優先許可リストを提案 | プロジェクトでの権限プロンプト繰り返しを削減(v2.1.112) | ### カスタムコマンド(例) diff --git a/ja/CONTRIBUTING.md b/ja/CONTRIBUTING.md index 42bddd4..08e813c 100644 --- a/ja/CONTRIBUTING.md +++ b/ja/CONTRIBUTING.md @@ -72,7 +72,7 @@ git checkout -b docs/improvement-area ### 3. 環境のセットアップ -pre-commit フックは、各コミット前に CI と同じチェックをローカルで実行する。すべての 4 チェックが通過しなければ PR は受理されない。 +pre-commit フックは、各コミット前に CI と同じチェックをローカルで実行する。すべての 5 チェックが通過しなければ PR は受理されない。 **必須の依存関係:** diff --git a/ja/INDEX.md b/ja/INDEX.md index efe50fe..16b5098 100644 --- a/ja/INDEX.md +++ b/ja/INDEX.md @@ -162,20 +162,21 @@ blog-draft/ --- -## 04. サブエージェント(9 ファイル) +## 04. サブエージェント(10 ファイル) カスタム能力を持つ専門特化 AI アシスタント。 | ファイル | 説明 | ツール | ユースケース | |------|-------------|-------|----------| -| `code-reviewer.md` | コード品質分析 | read, grep, diff, lint_runner | 包括的レビュー | -| `test-engineer.md` | テストカバレッジ分析 | read, write, bash, grep | テスト自動化 | -| `documentation-writer.md` | ドキュメント作成 | read, write, grep | ドキュメント生成 | -| `secure-reviewer.md` | セキュリティレビュー(読み取り専用) | read, grep | セキュリティ監査 | -| `implementation-agent.md` | フル実装 | read, write, bash, grep, edit, glob | 機能開発 | -| `debugger.md` | デバッグ専門家 | read, bash, grep | バグ調査 | -| `data-scientist.md` | データ分析専門家 | read, write, bash | データワークフロー | -| `clean-code-reviewer.md` | クリーンコード基準 | read, grep | コード品質 | +| `code-reviewer.md` | コード品質分析 | Read, Grep, Glob, Bash | 包括的レビュー | +| `test-engineer.md` | テストカバレッジ分析 | Read, Write, Bash, Grep | テスト自動化 | +| `documentation-writer.md` | ドキュメント作成 | Read, Write, Grep | ドキュメント生成 | +| `secure-reviewer.md` | セキュリティレビュー(読み取り専用) | Read, Grep | セキュリティ監査 | +| `implementation-agent.md` | フル実装 | Read, Write, Edit, Bash, Grep, Glob | 機能開発 | +| `debugger.md` | デバッグ専門家 | Read, Edit, Bash, Grep, Glob | バグ調査 | +| `data-scientist.md` | データ分析専門家 | Bash, Read, Write | データワークフロー | +| `clean-code-reviewer.md` | クリーンコード基準 | Read, Grep, Glob, Bash | コード品質 | +| `performance-optimizer.md` | パフォーマンスボトルネック分析 | Read, Edit, Bash, Grep, Glob | 最適化作業 | | `README.md` | ドキュメント | - | セットアップと使用ガイド | **インストール先**:`.claude/agents/` @@ -202,31 +203,32 @@ blog-draft/ --- -## 06. フック(9 ファイル) +## 06. フック(10 ファイル) 自動実行されるイベント駆動の自動化スクリプト。 | ファイル | 説明 | イベント | ユースケース | |------|-------------|-------|----------| -| `format-code.sh` | コード自動整形 | PreToolUse:Write | コード整形 | -| `pre-commit.sh` | コミット前のテスト実行 | PreToolUse:Bash | テスト自動化 | -| `security-scan.sh` | セキュリティスキャン | PostToolUse:Write | セキュリティチェック | -| `log-bash.sh` | bash コマンド記録 | PostToolUse:Bash | コマンドログ | -| `validate-prompt.sh` | プロンプト検証 | PreToolUse | 入力検証 | -| `notify-team.sh` | 通知送信 | Notification | チーム通知 | -| `context-tracker.py` | コンテキストウィンドウ使用量追跡 | PostToolUse | コンテキスト監視 | -| `context-tracker-tiktoken.py` | トークンベースのコンテキスト追跡 | PostToolUse | 精密なトークン計測 | +| `format-code.sh` | コード自動整形 | PostToolUse(matcher: Write) | コード整形 | +| `pre-commit.sh` | コミット前のテスト実行 | PreToolUse(matcher: Bash) | テスト自動化 | +| `pre-tool-check.sh` | 実行前のコマンド検証と監査 | PreToolUse(matcher: Bash) | ガードレール、監査ログ | +| `security-scan.sh` | セキュリティスキャン | PostToolUse(matcher: Write) | セキュリティチェック | +| `dependency-check.sh` | 依存関係マニフェストの脆弱性スキャン | PostToolUse(matcher: Write) | サプライチェーン検査 | +| `log-bash.sh` | bash コマンド記録 | PostToolUse(matcher: Bash) | コマンドログ | +| `notify-team.sh` | 通知送信 | PostToolUse(matcher: Bash) | チーム通知 | +| `validate-prompt.sh` | プロンプト検証 | UserPromptSubmit | 入力検証 | +| `session-end.sh` | セッション終了時に進捗を記録 | SessionEnd | 進捗トラッキング | | `README.md` | ドキュメント | - | セットアップと使用ガイド | **インストール先**:`~/.claude/settings.json` で設定 **使い方**:設定で構成し、自動実行される -**フックの種類**(5 系統、28 イベント): -- ツール系フック:PreToolUse、PostToolUse、PostToolUseFailure、PermissionRequest -- セッション系フック:SessionStart、SessionEnd、Stop、StopFailure、SubagentStart、SubagentStop -- タスク系フック:UserPromptSubmit、TaskCompleted、TaskCreated、TeammateIdle -- ライフサイクル系フック:ConfigChange、CwdChanged、FileChanged、PreCompact、PostCompact、WorktreeCreate、WorktreeRemove、Notification、InstructionsLoaded、Elicitation、ElicitationResult +**フックの種類**(5 系統、31 イベント): +- ツール系フック:PreToolUse、PostToolUse、PostToolUseFailure、PostToolBatch、PermissionRequest、PermissionDenied +- セッション系フック:SessionStart、Setup、SessionEnd、Stop、StopFailure、SubagentStart、SubagentStop +- タスク系フック:UserPromptSubmit、UserPromptExpansion、MessageDisplay、TaskCompleted、TaskCreated、TeammateIdle +- ライフサイクル系フック:ConfigChange、CwdChanged、DirectoryAdded、FileChanged、PreCompact、PostCompact、WorktreeCreate、WorktreeRemove、Notification、InstructionsLoaded、Elicitation、ElicitationResult --- @@ -399,8 +401,8 @@ documentation/ - **default**:危険な操作で承認を求める - **acceptEdits**:ファイル編集を自動承認、それ以外は確認 - **plan**:読み取り専用分析、変更なし -- **auto**:安全な操作を自動承認、危険なものは確認 -- **dontAsk**:危険なもの以外すべて承認 +- **auto**:バックグラウンドの安全チェック付きで全操作を実行 — 分類器がコマンドと保護ディレクトリへの書き込みを審査する(`autoMode` 設定オブジェクトで構成) +- **dontAsk**:事前承認済みのツールのみ — 本来プロンプトが出る呼び出しはすべて自動的に拒否される。Claude が実行できるのは `permissions.allow` に一致するもの、読み取り専用の Bash コマンド、`PreToolUse` フックが承認した呼び出しに限られる - **bypassPermissions**:すべて承認(`--dangerously-skip-permissions` が必要) ### ヘッドレスモード(`claude -p`) @@ -766,9 +768,9 @@ Run tests in background | **01 スラッシュコマンド** | 8 | - | - | - | - | - | 1 | 1 | **10** | | **02 メモリ** | - | - | - | - | - | 3 | 1 | 2 | **6** | | **03 スキル** | - | - | - | - | 5 | 9 | 1 | - | **28** | -| **04 サブエージェント** | - | 8 | - | - | - | - | 1 | - | **9** | +| **04 サブエージェント** | - | 9 | - | - | - | - | 1 | - | **10** | | **05 MCP** | - | - | 4 | - | - | - | 1 | - | **5** | -| **06 フック** | - | - | - | 8 | - | - | 1 | - | **9** | +| **06 フック** | - | - | - | 9 | - | - | 1 | - | **10** | | **07 プラグイン** | 11 | 9 | 3 | 3 | 3 | 3 | 4 | - | **40** | | **08 チェックポイント** | - | - | - | - | - | - | 1 | 1 | **2** | | **09 高度な機能** | - | - | - | - | - | - | 1 | 2 | **3** | diff --git a/ja/LEARNING-ROADMAP.md b/ja/LEARNING-ROADMAP.md index ef8e2fe..ace3605 100644 --- a/ja/LEARNING-ROADMAP.md +++ b/ja/LEARNING-ROADMAP.md @@ -106,7 +106,7 @@ graph TD | **3** | [チェックポイント](08-checkpoints/) | ⭐⭐ 中級 | 45 分 | レベル 1 | セッション管理 | 安全な探索 | 実験、復旧 | | **4** | [CLI 基礎](10-cli/) | ⭐⭐ 初級+ | 30 分 | レベル 1 | なし | コア CLI の使い方 | 対話モード・印字モード | | **5** | [スキル](03-skills/) | ⭐⭐ 中級 | 1 時間 | レベル 2 | スラッシュコマンド | 自動的な専門性 | 再利用、一貫性 | -| **6** | [フック](06-hooks/) | ⭐⭐ 中級 | 1 時間 | レベル 2 | ツール、コマンド | ワークフロー自動化(28 イベント、5 種類) | 検証、品質ゲート | +| **6** | [フック](06-hooks/) | ⭐⭐ 中級 | 1 時間 | レベル 2 | ツール、コマンド | ワークフロー自動化(31 イベント、5 種類) | 検証、品質ゲート | | **7** | [MCP](05-mcp/) | ⭐⭐⭐ 中級+ | 1 時間 | レベル 2 | 設定 | ライブデータアクセス | リアルタイム連携、API | | **8** | [サブエージェント](04-subagents/) | ⭐⭐⭐ 中級+ | 1.5 時間 | レベル 2 | メモリ、コマンド | 複雑タスクの処理(Bash 含む組み込み 6 個) | 委譲、専門性 | | **9** | [高度な機能](09-advanced-features/) | ⭐⭐⭐⭐⭐ 上級 | 2〜3 時間 | レベル 3 | これまでの全機能 | パワーユーザー向けツール | プランニング、Auto Mode、チャンネル、音声入力、権限 | @@ -239,7 +239,7 @@ cat error.log | claude -p "explain this error" #### 達成事項 ✅ YAML フロントマター(`effort` と `shell` フィールドを含む)で専門機能を自動起動 -✅ 28 個のフックイベントにまたがるイベント駆動自動化を構築 +✅ 31 個のフックイベントにまたがるイベント駆動自動化を構築 ✅ 5 種類のフック(command、http、mcp_tool、prompt、agent)を活用 ✅ コード品質基準を強制 ✅ ワークフロー向けカスタムフックを作成 diff --git a/ja/QUICK_REFERENCE.md b/ja/QUICK_REFERENCE.md index 272b721..fe3c08e 100644 --- a/ja/QUICK_REFERENCE.md +++ b/ja/QUICK_REFERENCE.md @@ -99,7 +99,7 @@ chmod +x ~/.claude/hooks/*.sh # default - 危険な操作で承認を求める # acceptEdits - ファイル編集を自動承認、それ以外は確認 # plan - 読み取り専用分析、変更なし -# dontAsk - 危険なもの以外すべて承認 +# dontAsk - 事前承認済みのツールのみ実行、それ以外はすべて拒否 # auto - バックグラウンド分類器が自動的に権限を判断 # bypassPermissions - すべて承認 (--dangerously-skip-permissions が必要) @@ -122,7 +122,7 @@ claude -r "session" # 名前 / ID でセッションを再開 | **スキル** | `.claude/skills/*/SKILL.md` | 自動起動 | | **サブエージェント** | `.claude/agents/*.md` | 自動委譲 | | **MCP** | `.mcp.json` (プロジェクト) または `~/.claude.json` (ユーザー) | `/mcp__server__action` | -| **フック (28 イベント)** | `~/.claude/hooks/*.sh` | イベントトリガー (5 種類) | +| **フック (31 イベント)** | `~/.claude/hooks/*.sh` | イベントトリガー (5 種類) | | **プラグイン** | `/plugin install` 経由 | すべてをバンドル | | **チェックポイント** | 組み込み | `Esc+Esc` または `/rewind` | | **プランニングモード** | 組み込み | `/plan ` | @@ -193,7 +193,7 @@ vim CLAUDE.md ### 自動化とフック ```bash -# フックをインストール (28 イベント、5 種類: command, http, mcp_tool, prompt, agent) +# フックをインストール (31 イベント、5 種類: command, http, mcp_tool, prompt, agent) mkdir -p ~/.claude/hooks cp 06-hooks/*.sh ~/.claude/hooks/ chmod +x ~/.claude/hooks/*.sh @@ -393,7 +393,7 @@ cp -r 03-skills/code-review-specialist ~/.claude/skills/ | **Auto Mode** | バックグラウンド分類器による完全自律動作 | `--enable-auto-mode` フラグ、`Shift+Tab` でモード切替 | | **チャンネル** | Discord と Telegram 統合 | `--channels` フラグ、Discord / Telegram ボット | | **音声入力** | コマンドとコンテキストを Claude に音声で伝える | `/voice` コマンド | -| **フック (28 イベント)** | 5 種類に拡張されたフックシステム | command、http、mcp_tool、prompt、agent の各フック種別 | +| **フック (31 イベント)** | 5 種類に拡張されたフックシステム | command、http、mcp_tool、prompt、agent の各フック種別 | | **MCP Elicitation** | MCP サーバが実行時にユーザー入力を要求できる | サーバが要明確化なら自動プロンプト | | **Plugin LSP** | プラグインの Language Server Protocol サポート | `userConfig`、`${CLAUDE_PLUGIN_DATA}` 変数 | | **リモートコントロール** | WebSocket API で Claude Code を制御 | 外部統合のための `claude --remote` | @@ -448,7 +448,7 @@ echo $GITHUB_TOKEN | 自動ワークフロー | スキル | `03-skills/code-review-specialist/` | | 専門タスク | サブエージェント | `04-subagents/code-reviewer.md` | | 外部データ | MCP(+ Elicitation) | `05-mcp/github-mcp.json` | -| イベント自動化 | フック (28 イベント、5 種類) | `06-hooks/pre-commit.sh` | +| イベント自動化 | フック (31 イベント、5 種類) | `06-hooks/pre-commit.sh` | | 完全ソリューション | プラグイン (+ LSP サポート) | `07-plugins/pr-review/` | | 安全な実験 | チェックポイント | `08-checkpoints/checkpoint-examples.md` | | 完全自律 | Auto Mode | `--enable-auto-mode` または `Shift+Tab` | diff --git a/ja/README.md b/ja/README.md index 8d04db9..67d4711 100644 --- a/ja/README.md +++ b/ja/README.md @@ -486,11 +486,11 @@ chmod +x ~/.claude/hooks/*.sh **使い方**:イベント発生時にフックが自動実行される -**フックの種類**(5 系統、28 イベント): -- **ツール系フック**:`PreToolUse`、`PostToolUse`、`PostToolUseFailure`、`PermissionRequest` -- **セッション系フック**:`SessionStart`、`SessionEnd`、`Stop`、`StopFailure`、`SubagentStart`、`SubagentStop` -- **タスク系フック**:`UserPromptSubmit`、`TaskCompleted`、`TaskCreated`、`TeammateIdle` -- **ライフサイクル系フック**:`ConfigChange`、`CwdChanged`、`FileChanged`、`PreCompact`、`PostCompact`、`WorktreeCreate`、`WorktreeRemove`、`Notification`、`InstructionsLoaded`、`Elicitation`、`ElicitationResult` +**フックの種類**(5 系統、31 イベント): +- **ツール系フック**:`PreToolUse`、`PostToolUse`、`PostToolUseFailure`、`PostToolBatch`、`PermissionRequest`、`PermissionDenied` +- **セッション系フック**:`SessionStart`、`Setup`、`SessionEnd`、`Stop`、`StopFailure`、`SubagentStart`、`SubagentStop` +- **タスク系フック**:`UserPromptSubmit`、`UserPromptExpansion`、`MessageDisplay`、`TaskCompleted`、`TaskCreated`、`TeammateIdle` +- **ライフサイクル系フック**:`ConfigChange`、`CwdChanged`、`DirectoryAdded`、`FileChanged`、`PreCompact`、`PostCompact`、`WorktreeCreate`、`WorktreeRemove`、`Notification`、`InstructionsLoaded`、`Elicitation`、`ElicitationResult` diff --git a/ja/claude_concepts_guide.md b/ja/claude_concepts_guide.md index 19f3657..4ea3c06 100644 --- a/ja/claude_concepts_guide.md +++ b/ja/claude_concepts_guide.md @@ -575,7 +575,7 @@ graph TD B --> C["3. Project Rules
.claude/rules/*.md"] C --> D["4. User Memory
~/.claude/CLAUDE.md"] D --> E["5. User Rules
~/.claude/rules/*.md"] - E --> F["6. Local Memory
.claude/local/CLAUDE.md"] + E --> F["6. Local Memory
./CLAUDE.local.md"] F --> G["7. Auto Memory
Automatically captured preferences"] style A fill:#fce4ec,stroke:#333,color:#333 @@ -596,7 +596,7 @@ graph TD | 3. Project Rules | `.claude/rules/*.md` | プロジェクト | 高 | チーム(Git) | プロジェクト規約のモジュール化 | | 4. User | `~/.claude/CLAUDE.md` | 個人 | 中 | 個人 | 個人の好み | | 5. User Rules | `~/.claude/rules/*.md` | 個人 | 中 | 個人 | 個人ルールのモジュール化 | -| 6. Local | `.claude/local/CLAUDE.md` | ローカル | 低 | 共有しない | マシン固有設定 | +| 6. Local | `./CLAUDE.local.md` | ローカル | 低 | 共有しない | マシン固有設定 | | 7. Auto Memory | 自動 | セッション | 最低 | 個人 | 学習された好み・パターン | ### Auto Memory @@ -1166,7 +1166,7 @@ Send summary to #daily-reports channel Final Output: ✅ Report generated and posted -📊 47 PRs merged this week +📊 42 PRs merged this week 💰 $12,450 in daily sales ``` @@ -2548,7 +2548,7 @@ Complete PR review workflow with security, testing, and documentation checks. ``` ## Requirements -- Claude Code 1.0+ +- Claude Code 2.1+ - GitHub access - CodeQL (optional) ~~~~ @@ -2813,7 +2813,7 @@ graph TD ### フックイベント -Claude Code は 5 種類(command、http、mcp_tool、prompt、agent)にわたる **28 種類のフックイベント** をサポートする: +Claude Code は 5 種類(command、http、mcp_tool、prompt、agent)にわたる **31 種類のフックイベント** をサポートする: | フックイベント | トリガー | ユースケース | |------------|---------|-----------| @@ -3113,7 +3113,7 @@ User: \ "maxConcurrentTasks": 5 }, "permissions": { - "mode": "default" + "defaultMode": "default" } } ``` diff --git a/ja/resources.md b/ja/resources.md index 5e65197..381ad14 100644 --- a/ja/resources.md +++ b/ja/resources.md @@ -149,11 +149,11 @@ graph TD S --> T[Test Automation] T --> U[Repository Ready] - style A fill:#e1f5ff - style G fill:#fff4e1 - style K fill:#f0ffe1 - style Q fill:#ffe1f5 - style U fill:#90EE90 + style A fill:#e1f5fe,stroke:#333,color:#333 + style G fill:#fff9c4,stroke:#333,color:#333 + style K fill:#e8f5e9,stroke:#333,color:#333 + style Q fill:#f3e5f5,stroke:#333,color:#333 + style U fill:#e8f5e9,stroke:#333,color:#333 ``` #### 既存リポジトリの場合 @@ -214,12 +214,12 @@ graph TD Y -->|Yes| H Y -->|No| Z[Workflow Complete] - style A fill:#e1f5ff - style C fill:#ffecec - style D fill:#fff4e1 - style P fill:#f0ffe1 - style T fill:#ffe1f5 - style Z fill:#90EE90 + style A fill:#e1f5fe,stroke:#333,color:#333 + style C fill:#fce4ec,stroke:#333,color:#333 + style D fill:#fff9c4,stroke:#333,color:#333 + style P fill:#e8f5e9,stroke:#333,color:#333 + style T fill:#f3e5f5,stroke:#333,color:#333 + style Z fill:#e8f5e9,stroke:#333,color:#333 ``` **Tips**: @@ -245,7 +245,7 @@ graph TD | **Extended Thinking** | `Alt+T`/`Option+T` または `MAX_THINKING_TOKENS` 環境変数による深い推論の切り替え | [高度な機能](09-advanced-features/) | | **Permission Modes** | きめ細かい制御:default、acceptEdits、plan、auto、dontAsk、bypassPermissions | [高度な機能](09-advanced-features/) | | **7-Tier Memory** | Managed Policy、Project、Project Rules、User、User Rules、Local、Auto Memory | [メモリガイド](02-memory/) | -| **Hook Events** | 28 イベント:PreToolUse、PostToolUse、PostToolUseFailure、Stop、StopFailure、SubagentStart、SubagentStop、Notification、Elicitation など | [フックガイド](06-hooks/) | +| **Hook Events** | 31 イベント:PreToolUse、PostToolUse、PostToolUseFailure、Stop、StopFailure、SubagentStart、SubagentStop、Notification、Elicitation など | [フックガイド](06-hooks/) | | **Agent Teams** | 複雑なタスクで複数のエージェントを協調させる | [サブエージェントガイド](04-subagents/) | | **Scheduled Tasks** | `/loop` と cron ツールで定期タスクをセットアップ | [高度な機能](09-advanced-features/) | | **Chrome Integration** | ヘッドレス Chromium によるブラウザ自動化 | [高度な機能](09-advanced-features/) | diff --git a/resources.md b/resources.md index fbfdde2..592ba0f 100644 --- a/resources.md +++ b/resources.md @@ -145,11 +145,11 @@ graph TD S --> T[Test Automation] T --> U[Repository Ready] - style A fill:#e1f5ff - style G fill:#fff4e1 - style K fill:#f0ffe1 - style Q fill:#ffe1f5 - style U fill:#90EE90 + style A fill:#e1f5fe,stroke:#333,color:#333 + style G fill:#fff9c4,stroke:#333,color:#333 + style K fill:#e8f5e9,stroke:#333,color:#333 + style Q fill:#f3e5f5,stroke:#333,color:#333 + style U fill:#e8f5e9,stroke:#333,color:#333 ``` #### For an Existing Repository @@ -210,12 +210,12 @@ graph TD Y -->|Yes| H Y -->|No| Z[Workflow Complete] - style A fill:#e1f5ff - style C fill:#ffecec - style D fill:#fff4e1 - style P fill:#f0ffe1 - style T fill:#ffe1f5 - style Z fill:#90EE90 + style A fill:#e1f5fe,stroke:#333,color:#333 + style C fill:#fce4ec,stroke:#333,color:#333 + style D fill:#fff9c4,stroke:#333,color:#333 + style P fill:#e8f5e9,stroke:#333,color:#333 + style T fill:#f3e5f5,stroke:#333,color:#333 + style Z fill:#e8f5e9,stroke:#333,color:#333 ``` **Tips**: @@ -241,7 +241,7 @@ These steps capture the core recommendations for smooth workflows with Claude Co | **Extended Thinking** | Deep reasoning toggle via `Alt+T`/`Option+T` or `MAX_THINKING_TOKENS` env var | [Advanced Features](09-advanced-features/) | | **Permission Modes** | Fine-grained control: manual (formerly default), acceptEdits, plan, auto, dontAsk, bypassPermissions | [Advanced Features](09-advanced-features/) | | **7-Tier Memory** | Managed Policy, Project, Project Rules, User, User Rules, Local, Auto Memory | [Memory Guide](02-memory/) | -| **Hook Events** | 29 events: PreToolUse, PostToolUse, PostToolUseFailure, Stop, StopFailure, SubagentStart, SubagentStop, Notification, Elicitation, and more | [Hooks Guide](06-hooks/) | +| **Hook Events** | 31 events: PreToolUse, PostToolUse, PostToolUseFailure, Stop, StopFailure, SubagentStart, SubagentStop, Notification, Elicitation, and more | [Hooks Guide](06-hooks/) | | **Agent Teams** | Coordinate multiple agents working together on complex tasks | [Subagents Guide](04-subagents/) | | **Scheduled Tasks** | Set up recurring tasks with `/loop` and cron tools | [Advanced Features](09-advanced-features/) | | **Chrome Integration** | Browser automation with headless Chromium | [Advanced Features](09-advanced-features/) | @@ -252,7 +252,7 @@ These steps capture the core recommendations for smooth workflows with Claude Co | **/run, /verify, /run-skill-generator** | Bundled skills to launch your project, confirm a fix works, and generate per-project run/verify skills (v2.1.145+) | [Skills Guide](03-skills/) | --- -**Last Updated**: July 29, 2026 +**Last Updated**: August 4, 2026 **Claude Code Version**: 2.1.220 **Sources**: - https://code.claude.com/docs/en/overview @@ -262,4 +262,4 @@ These steps capture the core recommendations for smooth workflows with Claude Co - https://github.com/anthropics/claude-code/releases/tag/v2.1.144 - https://github.com/anthropics/claude-code/releases/tag/v2.1.145 - https://code.claude.com/docs/en/model-config -**Compatible Models**: Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 +**Compatible Models**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5 diff --git a/uk/01-slash-commands/README.md b/uk/01-slash-commands/README.md index 0429321..261f066 100644 --- a/uk/01-slash-commands/README.md +++ b/uk/01-slash-commands/README.md @@ -108,7 +108,7 @@ | Команда | Статус | |---------|--------| | `/review` | Застаріла — замінена плагіном `code-review` | -| `/output-style` | Застаріла з v2.1.73 | +| `/output-style` | Видалена в v2.1.91 (застаріла з v2.1.73) — використовуйте `/config` → Output style або налаштування `outputStyle` | | `/fork` | Перейменована на `/branch` (аліас працює, v2.1.77) | | `/pr-comments` | Видалена в v2.1.91 — запитайте Claude напряму | | `/vim` | Видалена в v2.1.92 — використовуйте /config → Editor mode | @@ -116,7 +116,7 @@ ### Останні зміни - `/fork` перейменовано на `/branch`, `/fork` залишено як аліас (v2.1.77) -- `/output-style` застаріла (v2.1.73) +- `/output-style` застаріла (v2.1.73) і видалена (v2.1.91) — стилі виводу все ще доступні через `/config` → Output style або налаштування `outputStyle`; вбудовані: Default, Proactive, Explanatory, Learning - `/review` застаріла на користь плагіна `code-review` - Додано команду `/effort` з рівнем `max` для Opus 4.6 - Додано команду `/voice` для голосового вводу push-to-talk diff --git a/uk/01-slash-commands/doc-refactor.md b/uk/01-slash-commands/doc-refactor.md index e56a8a6..d519a52 100644 --- a/uk/01-slash-commands/doc-refactor.md +++ b/uk/01-slash-commands/doc-refactor.md @@ -1,7 +1,6 @@ --- -name: Documentation Refactor +name: doc-refactor description: Реструктуризація документації проєкту для ясності та доступності -tags: documentation, refactoring, organization --- # Рефакторинг документації diff --git a/uk/01-slash-commands/setup-ci-cd.md b/uk/01-slash-commands/setup-ci-cd.md index e6af565..aec9802 100644 --- a/uk/01-slash-commands/setup-ci-cd.md +++ b/uk/01-slash-commands/setup-ci-cd.md @@ -1,7 +1,6 @@ --- -name: Setup CI/CD Pipeline +name: setup-ci-cd description: Реалізація pre-commit хуків та GitHub Actions для забезпечення якості -tags: ci-cd, devops, automation --- # Налаштування CI/CD пайплайну diff --git a/uk/01-slash-commands/unit-test-expand.md b/uk/01-slash-commands/unit-test-expand.md index 6568ff4..7a63af0 100644 --- a/uk/01-slash-commands/unit-test-expand.md +++ b/uk/01-slash-commands/unit-test-expand.md @@ -1,7 +1,6 @@ --- -name: Expand Unit Tests +name: unit-test-expand description: Збільшення покриття тестами шляхом тестування невідстежених гілок та граничних випадків -tags: testing, coverage, unit-tests --- # Розширення юніт-тестів diff --git a/uk/02-memory/directory-api-CLAUDE.md b/uk/02-memory/directory-api-CLAUDE.md index f943c70..4cacb23 100644 --- a/uk/02-memory/directory-api-CLAUDE.md +++ b/uk/02-memory/directory-api-CLAUDE.md @@ -1,6 +1,8 @@ # Стандарти модуля API -Цей файл перевизначає кореневий CLAUDE.md для всього у /src/api/ +Цей файл доповнює кореневий CLAUDE.md для всього у /src/api/. Файли пам'яті +конкатенуються, а не перевизначаються — кореневий CLAUDE.md продовжує діяти, а Claude Code +завантажує цей файл за потреби, коли читає файли в цьому піддереві. ## Специфічні стандарти API diff --git a/uk/03-skills/README.md b/uk/03-skills/README.md index 0503d1b..bc6428a 100644 --- a/uk/03-skills/README.md +++ b/uk/03-skills/README.md @@ -96,7 +96,7 @@ sequenceDiagram | **Project** | `.claude/skills//SKILL.md` | Команда | Так (через git) | Командні стандарти | | **Plugin** | `/skills//SKILL.md` | Де увімкнено | Залежить | В складі плагінів | -Коли навички мають однакову назву на різних рівнях, вищі пріоритетні розташування перемагають: **enterprise > personal > project**. Навички плагінів використовують простір імен `plugin-name:skill-name`, тому конфлікти неможливі. +Коли навички мають однакову назву на різних рівнях, вищі пріоритетні розташування перемагають: **enterprise > project > personal**. Навички плагінів використовують простір імен `plugin-name:skill-name`, тому конфлікти неможливі. ### Автоматичне виявлення @@ -535,7 +535,7 @@ refactor/ ```yaml --- -name: code-refactor +name: refactor description: Systematic code refactoring based on Martin Fowler's methodology. Use when users ask to refactor code, improve code structure, reduce technical debt, or eliminate code smells. --- diff --git a/uk/03-skills/claude-md/SKILL.md b/uk/03-skills/claude-md/SKILL.md index 6e4b8b8..08b9480 100644 --- a/uk/03-skills/claude-md/SKILL.md +++ b/uk/03-skills/claude-md/SKILL.md @@ -193,10 +193,14 @@ For detailed build instructions, refer to `agent_docs/building_the_project.md` Якщо користувач запитує створення/оновлення AGENTS.md: -AGENTS.md використовується для визначення спеціалізованої поведінки агентів. На відміну від CLAUDE.md (який для контексту проєкту), AGENTS.md визначає: -- Кастомні ролі та можливості агентів -- Інструкції та обмеження для конкретних агентів -- Визначення робочих процесів для мультиагентних сценаріїв +**Claude Code не читає AGENTS.md напряму.** Щоб файл почав діяти, імпортуйте його з CLAUDE.md через `@AGENTS.md` або зробіть `CLAUDE.md` символічним посиланням на нього. Це найпоширеніше непорозуміння щодо цього файлу. + +AGENTS.md — це міжінструментальний файл контексту проєкту, тобто документ тієї ж *категорії*, що й CLAUDE.md, а не формат визначення агентів. Він існує для того, щоб кілька кодових агентів могли користуватися спільним набором конвенцій проєкту: +- Команди збірки, тестування та лінтингу +- Стиль коду та архітектурні конвенції +- Структура репозиторію та розташування компонентів + +Субагенти визначаються окремо — у `.claude/agents/*.md`, а не в AGENTS.md. Застосовуйте аналогічні принципи: - Тримайте зосередженим та лаконічним diff --git a/uk/03-skills/doc-generator/SKILL.md b/uk/03-skills/doc-generator/SKILL.md index 5435f83..2f0b99d 100644 --- a/uk/03-skills/doc-generator/SKILL.md +++ b/uk/03-skills/doc-generator/SKILL.md @@ -18,7 +18,7 @@ description: Генерація вичерпної, точної докумен ### Для кожного ендпоінту -```markdown +````markdown ## GET /api/v1/users/:id ### Опис @@ -73,4 +73,4 @@ response = requests.get( ) user = response.json() ``` -``` +```` diff --git a/uk/03-skills/refactor/SKILL.md b/uk/03-skills/refactor/SKILL.md index ab50114..f6d51b8 100644 --- a/uk/03-skills/refactor/SKILL.md +++ b/uk/03-skills/refactor/SKILL.md @@ -1,5 +1,5 @@ --- -name: code-refactor +name: refactor description: Систематичний рефакторинг коду на основі методології Мартіна Фаулера. Використовуйте, коли користувачі просять рефакторити код, покращити структуру коду, зменшити технічний борг, очистити застарілий код, усунути запахи коду (code smells) або покращити супровідність коду. Ця навичка проводить через поетапний підхід з дослідженням, плануванням та безпечною інкрементальною реалізацією. --- diff --git a/uk/04-subagents/README.md b/uk/04-subagents/README.md index 18ca6f1..de6585b 100644 --- a/uk/04-subagents/README.md +++ b/uk/04-subagents/README.md @@ -136,6 +136,7 @@ to solving problems. | `effort` | Ні | Рівень зусиль: `low`, `medium`, `high` або `max` | | `isolation` | Ні | `worktree` для власного git worktree | | `initialPrompt` | Ні | Автоматичний перший крок при запуску субагента як головного агента | +| `color` | Ні | Колір відображення субагента у списку завдань і транскрипті. Приймає `red`, `blue`, `green`, `yellow`, `purple`, `orange`, `pink` або `cyan` | ### Варіанти конфігурації інструментів @@ -988,6 +989,30 @@ graph TB --- +### 8. Clean Code Reviewer (`clean-code-reviewer.md`) + +**Призначення**: ревʼю читабельності та підтримуваності за принципами чистого коду + +**Інструменти**: Read, Grep, Glob, Bash + +**Спеціалізація**: іменування, довжина функцій та кількість аргументів, дублювання й мертвий код, якість і призначення коментарів, структурна ясність замість надмірної хитромудрості + +**Коли використовувати**: потрібен окремий прохід щодо стилю та підтримуваності, відмінний від ревʼю коректності + +--- + +### 9. Performance Optimizer (`performance-optimizer.md`) + +**Призначення**: виявлення та усунення вузьких місць продуктивності + +**Інструменти**: Read, Edit, Bash, Grep, Glob + +**Спеціалізація**: алгоритмічна складність та гарячі шляхи, виділення памʼяті й витоки, кешування та оптимізація запитів, вузькі місця конкурентності та вводу-виводу + +**Коли використовувати**: код вимірювано повільний і потрібна цільова оптимізація + +--- + ## Інструкції з встановлення ### Метод 1: Команда /agents (рекомендовано) @@ -1059,7 +1084,9 @@ project/ │ ├── secure-reviewer.md │ ├── implementation-agent.md │ ├── debugger.md -│ └── data-scientist.md +│ ├── data-scientist.md +│ ├── clean-code-reviewer.md +│ └── performance-optimizer.md └── ... ``` diff --git a/uk/05-mcp/README.md b/uk/05-mcp/README.md index 541d89f..e645364 100644 --- a/uk/05-mcp/README.md +++ b/uk/05-mcp/README.md @@ -259,11 +259,22 @@ MCP-сервери можуть надавати промпти, що відоб Конфігурації MCP можна зберігати на різних рівнях з різним ступенем поширення: -| Рівень | Розташування | Опис | Доступний для | Потребує підтвердження | -|--------|-------------|------|---------------|----------------------| -| **Local** (за замовч.) | `~/.claude.json` (під шляхом проєкту) | Приватний для поточного користувача, лише поточний проєкт (раніше називався `project`) | Лише ви | Ні | -| **Project** | `.mcp.json` | Комітиться в git-репозиторій | Члени команди | Так (при першому використанні) | -| **User** | `~/.claude.json` | Доступний у всіх проєктах (раніше називався `global`) | Лише ви | Ні | +| Рівень | Прапорець | Розташування | Опис | Доступний для | Потребує підтвердження | +|--------|-----------|-------------|------|---------------|----------------------| +| **Local** (за замовч.) | `--scope local` | `~/.claude.json` (під шляхом проєкту) | Приватний для поточного користувача, лише поточний проєкт (раніше називався `project`) | Лише ви | Ні | +| **Project** | `--scope project` | `.mcp.json` | Комітиться в git-репозиторій | Члени команди | Так (при першому використанні) | +| **User** | `--scope user` | `~/.claude.json` | Доступний у всіх проєктах (раніше називався `global`) | Лише ви | Ні | + +Обирайте рівень при додаванні сервера через `--scope` (коротка форма `-s`). Якщо +прапорець не вказано, Claude Code використовує `local`: + +```bash +# Рівень project — записує в .mcp.json, щоб конфігурацію бачила вся команда +claude mcp add --scope project --transport http github https://api.github.com/mcp + +# Рівень user — доступний у кожному проєкті +claude mcp add --scope user --transport stdio memory -- npx @modelcontextprotocol/server-memory +``` ### Використання рівня Project @@ -307,8 +318,13 @@ claude mcp reset-project-choices # Імпорт з Claude Desktop claude mcp add-from-claude-desktop + +# Додати сервер із JSON-блоку (зручно для скриптового налаштування) +claude mcp add-json events-server '{"type":"stdio","command":"npx","args":["@modelcontextprotocol/server-events"]}' ``` +> **Примітка**: у JSON-конфігураціях — `.mcp.json`, `~/.claude.json` або `claude mcp add-json` — поле `type` приймає `streamable-http` як аліас для `http`. Специфікація MCP називає цей транспорт `streamable-http`, тому конфігурації, скопійовані з документації самого сервера, працюють без змін. + ## Таблиця доступних MCP-серверів | MCP-сервер | Призначення | Типові інструменти | Авторизація | Реальний час | @@ -430,7 +446,7 @@ claude mcp add --transport stdio github -- npx @modelcontextprotocol/server-gith "command": "npx", "args": ["@modelcontextprotocol/server-database"], "env": { - "DATABASE_URL": "postgresql://user:pass@localhost/mydb" + "DATABASE_URL": "${DATABASE_URL}" } } } diff --git a/uk/05-mcp/database-mcp.json b/uk/05-mcp/database-mcp.json index eaa832a..adaf255 100644 --- a/uk/05-mcp/database-mcp.json +++ b/uk/05-mcp/database-mcp.json @@ -1,10 +1,13 @@ { "mcpServers": { "database": { + "type": "stdio", "command": "npx", - "args": ["@modelcontextprotocol/server-database"], + "args": [ + "@modelcontextprotocol/server-database" + ], "env": { - "DATABASE_URL": "postgresql://user:pass@localhost/mydb" + "DATABASE_URL": "${DATABASE_URL}" } } } diff --git a/uk/05-mcp/filesystem-mcp.json b/uk/05-mcp/filesystem-mcp.json index c76fdf6..87de441 100644 --- a/uk/05-mcp/filesystem-mcp.json +++ b/uk/05-mcp/filesystem-mcp.json @@ -1,8 +1,12 @@ { "mcpServers": { "filesystem": { + "type": "stdio", "command": "npx", - "args": ["@modelcontextprotocol/server-filesystem", "/home/user/projects"] + "args": [ + "@modelcontextprotocol/server-filesystem", + "/home/user/projects" + ] } } } diff --git a/uk/05-mcp/github-mcp.json b/uk/05-mcp/github-mcp.json index 0f62131..829fbb9 100644 --- a/uk/05-mcp/github-mcp.json +++ b/uk/05-mcp/github-mcp.json @@ -1,8 +1,11 @@ { "mcpServers": { "github": { + "type": "stdio", "command": "npx", - "args": ["@modelcontextprotocol/server-github"], + "args": [ + "@modelcontextprotocol/server-github" + ], "env": { "GITHUB_TOKEN": "${GITHUB_TOKEN}" } diff --git a/uk/05-mcp/multi-mcp.json b/uk/05-mcp/multi-mcp.json index 62d8fa5..983a718 100644 --- a/uk/05-mcp/multi-mcp.json +++ b/uk/05-mcp/multi-mcp.json @@ -1,29 +1,42 @@ { "mcpServers": { "github": { + "type": "stdio", "command": "npx", - "args": ["@modelcontextprotocol/server-github"], + "args": [ + "@modelcontextprotocol/server-github" + ], "env": { "GITHUB_TOKEN": "${GITHUB_TOKEN}" } }, "database": { + "type": "stdio", "command": "npx", - "args": ["@modelcontextprotocol/server-database"], + "args": [ + "@modelcontextprotocol/server-database" + ], "env": { "DATABASE_URL": "${DATABASE_URL}" } }, "slack": { + "type": "stdio", "command": "npx", - "args": ["@modelcontextprotocol/server-slack"], + "args": [ + "@modelcontextprotocol/server-slack" + ], "env": { "SLACK_TOKEN": "${SLACK_TOKEN}" } }, "filesystem": { + "type": "stdio", "command": "npx", - "args": ["@modelcontextprotocol/server-filesystem", "/home/user/projects"] + "args": [ + "@modelcontextprotocol/server-filesystem", + "/home/user/projects" + ] } } } diff --git a/uk/06-hooks/README.md b/uk/06-hooks/README.md index 42966ed..44d7d2f 100644 --- a/uk/06-hooks/README.md +++ b/uk/06-hooks/README.md @@ -121,6 +121,28 @@ Claude Code підтримує чотири типи хуків: - Маршрутизується через sandbox, коли sandbox увімкнено - Вимагає явного списку `allowedEnvVars` для будь-якої інтерполяції змінних оточення в URL +### MCP tool-хуки + +> Додано у v2.1.118. + +Тип `mcp_tool` викликає налаштований MCP-інструмент напряму; конфігурація посилається на ім'я MCP-сервера та інструмента, а не на shell-команду чи URL. Корисно, коли логіка валідації або реакції вже живе в налаштованому вами MCP-сервері. + +```json +{ + "matcher": "Edit", + "hooks": [{ + "type": "mcp_tool", + "server": "my-mcp-server", + "tool": "validate_edit" + }] +} +``` + +**Ключові властивості:** +- `"type": "mcp_tool"` — ідентифікує як MCP tool-хук +- `"server"` — ім'я налаштованого MCP-сервера +- `"tool"` — ім'я інструмента, який слід викликати на цьому сервері + ### Prompt-хуки Промпти, оцінювані LLM, де вміст хука є промптом, який оцінює Claude. Переважно використовуються з подіями `Stop` та `SubagentStop` для інтелектуальної перевірки завершення завдань. @@ -155,18 +177,22 @@ LLM оцінює промпт і повертає структуроване р ## Події хуків -Claude Code підтримує **26 подій хуків**: +Claude Code підтримує **31 подія хуків**: | Подія | Коли спрацьовує | Вхід matcher | Може блокувати | Типове використання | |-------|----------------|-------------|----------------|---------------------| | **SessionStart** | Початок/відновлення/очищення/компакція/форк сесії | startup/resume/clear/compact/fork | Ні | Налаштування середовища | +| **Setup** | Початкове налаштування середовища (один раз за сесію) | (немає) | Ні | Провізіонування інструментів, встановлення залежностей | | **InstructionsLoaded** | Після завантаження CLAUDE.md або файлу правил | (немає) | Ні | Модифікація/фільтрація інструкцій | | **UserPromptSubmit** | Користувач подає промпт | (немає) | Так | Валідація промптів | +| **UserPromptExpansion** | Промпт розгорнуто (наприклад, `@`-згадки, слеш-команди розв'язано) | (немає) | Так | Перетворення або перевірка розгорнутого промпту | +| **MessageDisplay** | Під час відображення тексту відповіді асистента | (немає) | Ні | Перетворення або приховування показаного тексту (v2.1.152) | | **PreToolUse** | Перед виконанням інструмента | Назва інструмента | Так (allow/deny/ask) | Валідація, модифікація вхідних даних | | **PermissionRequest** | Показ діалогу дозволів | Назва інструмента | Так | Автозатвердження/відхилення | | **PermissionDenied** | Користувач відхиляє запит дозволу | Назва інструмента | Ні | Логування, аналітика, політики | | **PostToolUse** | Після успішного виконання інструмента | Назва інструмента | Ні | Контекст, зворотний звʼязок | | **PostToolUseFailure** | Невдале виконання інструмента | Назва інструмента | Ні | Обробка помилок, логування | +| **PostToolBatch** | Після завершення пакета викликів інструментів | (немає) | Ні | Зведена звітність, пакетна валідація | | **Notification** | Надсилання сповіщення | Тип сповіщення | Ні | Кастомні сповіщення | | **SubagentStart** | Створення субагента | Назва типу агента | Ні | Налаштування субагента | | **SubagentStop** | Завершення субагента | Назва типу агента | Так | Валідація субагента | @@ -177,6 +203,7 @@ Claude Code підтримує **26 подій хуків**: | **TaskCreated** | Завдання створене через TaskCreate | (немає) | Ні | Відстеження завдань, логування | | **ConfigChange** | Зміна файлу конфігурації | (немає) | Так (крім policy) | Реакція на оновлення конфігурації | | **CwdChanged** | Зміна робочого каталогу | (немає) | Ні | Налаштування для каталогу | +| **DirectoryAdded** | Новий робочий каталог зареєстровано під час сесії через `/add-dir` або control-запит SDK `register_repo_root` (v2.1.219) | (немає) | Ні | Налаштування інструментів для доданого каталогу | | **FileChanged** | Зміна відстежуваного файлу | (немає) | Ні | Моніторинг файлів, перебудова | | **PreCompact** | Перед компакцією контексту | manual/auto | Ні | Дії перед компакцією | | **PostCompact** | Після завершення компакції | (немає) | Ні | Дії після компакції | @@ -212,8 +239,13 @@ Claude Code підтримує **26 подій хуків**: **Типові matcher:** `Task`, `Bash`, `Glob`, `Grep`, `Read`, `Edit`, `Write`, `WebFetch`, `WebSearch` **Управління виводом:** -- `permissionDecision`: `"allow"`, `"deny"` або `"ask"` -- `permissionDecisionReason`: Пояснення рішення +- `permissionDecision`: `"allow"`, `"deny"`, `"ask"` або `"defer"` + - `"allow"` пропускає запит дозволу (крім інструментів, які потребують взаємодії з користувачем, та інструментів конекторів, для яких організація встановила `ask`) + - `"deny"` блокує виклик інструмента + - `"ask"` просить користувача підтвердити + - `"defer"` коректно завершує роботу, щоб інструмент можна було відновити пізніше; `permissionDecisionReason`, `updatedInput` та `additionalContext` для цього значення ігноруються + - Правила deny та ask обчислюються незалежно від того, що повертає хук. Якщо кілька хуків `PreToolUse` дають різні рішення, пріоритет такий: `deny` > `defer` > `ask` > `allow` +- `permissionDecisionReason`: Пояснення рішення. Показується користувачеві (не Claude) для `"allow"` та `"ask"`; показується Claude для `"deny"`; ігнорується для `"defer"` - `updatedInput`: Модифіковані вхідні параметри інструмента ### PostToolUse @@ -750,7 +782,7 @@ import sys import tempfile # Конфігурація -CONTEXT_LIMIT = 128000 # Контекстне вікно Claude (налаштуйте для вашої моделі) +CONTEXT_LIMIT = 1000000 # 1M у Opus 5, Sonnet 5, Opus 4.8, Sonnet 4.6; 200000 у Haiku 4.5 (налаштуйте для вашої моделі) USE_TIKTOKEN = False # Встановіть True, якщо tiktoken встановлено для кращої точності diff --git a/uk/06-hooks/context-tracker-tiktoken.py b/uk/06-hooks/context-tracker-tiktoken.py index 11786bf..56afe26 100644 --- a/uk/06-hooks/context-tracker-tiktoken.py +++ b/uk/06-hooks/context-tracker-tiktoken.py @@ -32,7 +32,7 @@ except ImportError: ) # Configuration -CONTEXT_LIMIT = 128000 # Claude's context window (adjust for your model) +CONTEXT_LIMIT = 1000000 # 1M on Opus 5, Sonnet 5, Opus 4.8, Sonnet 4.6; 200000 on Haiku 4.5 (adjust for your model) def get_state_file(session_id: str) -> str: diff --git a/uk/06-hooks/context-tracker.py b/uk/06-hooks/context-tracker.py index eb5daf9..ee582cb 100644 --- a/uk/06-hooks/context-tracker.py +++ b/uk/06-hooks/context-tracker.py @@ -19,7 +19,7 @@ import sys import tempfile # Configuration -CONTEXT_LIMIT = 128000 # Claude's context window (adjust for your model) +CONTEXT_LIMIT = 1000000 # 1M on Opus 5, Sonnet 5, Opus 4.8, Sonnet 4.6; 200000 on Haiku 4.5 (adjust for your model) def get_state_file(session_id: str) -> str: diff --git a/uk/06-hooks/dependency-check.sh b/uk/06-hooks/dependency-check.sh index c659b9f..e7cc1b1 100644 --- a/uk/06-hooks/dependency-check.sh +++ b/uk/06-hooks/dependency-check.sh @@ -1,15 +1,21 @@ #!/bin/bash # Check for known vulnerabilities in dependencies after manifest files are modified. -# Hook: PostToolUse:Write +# Hook: PostToolUse (matcher: Write) +# +# Reads the target file path from stdin JSON (Claude Code hook protocol). +# Source: https://code.claude.com/docs/en/hooks -FILE=$1 +# Read JSON input from stdin (Claude Code hook protocol) +INPUT=$(cat) + +# Extract file_path using sed (compatible with all platforms) +FILE=$(echo "$INPUT" | sed -n 's/.*"file_path"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' | head -1) if [ -z "$FILE" ]; then - echo "Usage: $0 " exit 0 fi -# Use basename for matching — $1 may be an absolute path +# Use basename for matching — file_path may be an absolute path BASENAME=$(basename "$FILE") # Only run when a dependency manifest is written diff --git a/uk/06-hooks/format-code.sh b/uk/06-hooks/format-code.sh index 9841b9e..9baaeb5 100644 --- a/uk/06-hooks/format-code.sh +++ b/uk/06-hooks/format-code.sh @@ -1,6 +1,6 @@ #!/bin/bash # Auto-format code after writing -# Hook: PostToolUse:Write +# Hook: PostToolUse (matcher: Write) # # Reads the target file path from stdin JSON and runs the appropriate formatter # in-place on the file after Claude writes it. diff --git a/uk/06-hooks/log-bash.sh b/uk/06-hooks/log-bash.sh index 2ca16d9..86b991d 100644 --- a/uk/06-hooks/log-bash.sh +++ b/uk/06-hooks/log-bash.sh @@ -1,6 +1,6 @@ #!/bin/bash # Log all bash commands -# Hook: PostToolUse:Bash +# Hook: PostToolUse (matcher: Bash) # # Reads the executed command from stdin JSON and logs it to a file. # diff --git a/uk/06-hooks/pre-commit.sh b/uk/06-hooks/pre-commit.sh index 2e9b27a..66d98a8 100644 --- a/uk/06-hooks/pre-commit.sh +++ b/uk/06-hooks/pre-commit.sh @@ -3,6 +3,10 @@ # Hook: PreToolUse (matcher: Bash) - checks if the command is a git commit # Note: There is no "PreCommit" hook event. Use PreToolUse with a Bash matcher # and inspect the command to detect git commit operations. +# +# Exit codes: 2 blocks the tool call and surfaces stderr as the block reason. +# Any other non-zero value is a NON-blocking error — the commit would proceed. +# Source: https://code.claude.com/docs/en/hooks echo "🧪 Running tests before commit..." @@ -11,8 +15,8 @@ if [ -f "package.json" ]; then if grep -q "\"test\":" package.json; then npm test if [ $? -ne 0 ]; then - echo "❌ Tests failed! Commit blocked." - exit 1 + echo "❌ Tests failed! Commit blocked." >&2 + exit 2 fi fi fi @@ -22,8 +26,8 @@ if [ -f "pytest.ini" ] || [ -f "setup.py" ]; then if command -v pytest &> /dev/null; then pytest if [ $? -ne 0 ]; then - echo "❌ Tests failed! Commit blocked." - exit 1 + echo "❌ Tests failed! Commit blocked." >&2 + exit 2 fi fi fi @@ -32,8 +36,8 @@ fi if [ -f "go.mod" ]; then go test ./... if [ $? -ne 0 ]; then - echo "❌ Tests failed! Commit blocked." - exit 1 + echo "❌ Tests failed! Commit blocked." >&2 + exit 2 fi fi @@ -41,8 +45,8 @@ fi if [ -f "Cargo.toml" ]; then cargo test if [ $? -ne 0 ]; then - echo "❌ Tests failed! Commit blocked." - exit 1 + echo "❌ Tests failed! Commit blocked." >&2 + exit 2 fi fi diff --git a/uk/06-hooks/security-scan.sh b/uk/06-hooks/security-scan.sh index 81e3a5b..b9a0be9 100644 --- a/uk/06-hooks/security-scan.sh +++ b/uk/06-hooks/security-scan.sh @@ -1,6 +1,6 @@ #!/bin/bash # Security scan on file write -# Hook: PostToolUse:Write +# Hook: PostToolUse (matcher: Write) # # Scans files for hardcoded secrets, API keys, and credentials. # Outputs a non-blocking warning via additionalContext when issues are found. diff --git a/uk/07-plugins/README.md b/uk/07-plugins/README.md index 8b11d9f..9bd7644 100644 --- a/uk/07-plugins/README.md +++ b/uk/07-plugins/README.md @@ -341,7 +341,7 @@ This command initiates a complete pull request review including: --- name: security-reviewer description: Security-focused code review -tools: read, grep, diff +tools: Read, Grep, Bash --- # Security Reviewer @@ -765,7 +765,7 @@ Complete PR review workflow with security, testing, and documentation checks. ``` ## Requirements -- Claude Code 1.0+ +- Claude Code 2.1+ - GitHub access - CodeQL (optional) ``` diff --git a/uk/07-plugins/devops-automation/README.md b/uk/07-plugins/devops-automation/README.md index 8ed82af..71bf5ee 100644 --- a/uk/07-plugins/devops-automation/README.md +++ b/uk/07-plugins/devops-automation/README.md @@ -75,7 +75,7 @@ ## Вимоги -- Claude Code 1.0+ +- Claude Code 2.1+ - Kubernetes CLI (kubectl) - Налаштований доступ до кластера diff --git a/uk/07-plugins/devops-automation/agents/alert-analyzer.md b/uk/07-plugins/devops-automation/agents/alert-analyzer.md index cea8b9f..efc4a09 100644 --- a/uk/07-plugins/devops-automation/agents/alert-analyzer.md +++ b/uk/07-plugins/devops-automation/agents/alert-analyzer.md @@ -1,7 +1,7 @@ --- name: alert-analyzer description: Аналізує алерти моніторингу та метрики системи -tools: read, grep, bash +tools: Read, Grep, Bash --- # Аналізатор алертів diff --git a/uk/07-plugins/devops-automation/agents/deployment-specialist.md b/uk/07-plugins/devops-automation/agents/deployment-specialist.md index 4871c26..97a54ee 100644 --- a/uk/07-plugins/devops-automation/agents/deployment-specialist.md +++ b/uk/07-plugins/devops-automation/agents/deployment-specialist.md @@ -1,7 +1,7 @@ --- name: deployment-specialist description: Обробляє всі операції розгортання -tools: read, write, bash, grep +tools: Read, Write, Bash, Grep --- # Спеціаліст з розгортання diff --git a/uk/07-plugins/devops-automation/agents/incident-commander.md b/uk/07-plugins/devops-automation/agents/incident-commander.md index 4610d7a..980ff6b 100644 --- a/uk/07-plugins/devops-automation/agents/incident-commander.md +++ b/uk/07-plugins/devops-automation/agents/incident-commander.md @@ -1,7 +1,7 @@ --- name: incident-commander description: Координує реагування на інциденти -tools: read, write, bash, grep +tools: Read, Write, Bash, Grep --- # Командир інцидентів diff --git a/uk/07-plugins/documentation/README.md b/uk/07-plugins/documentation/README.md index a2b75cb..cd8648b 100644 --- a/uk/07-plugins/documentation/README.md +++ b/uk/07-plugins/documentation/README.md @@ -66,7 +66,7 @@ ## Вимоги -- Claude Code 1.0+ +- Claude Code 2.1+ - Доступ до GitHub (опціонально) ## Приклад робочого процесу diff --git a/uk/07-plugins/documentation/agents/api-documenter.md b/uk/07-plugins/documentation/agents/api-documenter.md index 50848fc..3d89963 100644 --- a/uk/07-plugins/documentation/agents/api-documenter.md +++ b/uk/07-plugins/documentation/agents/api-documenter.md @@ -1,7 +1,7 @@ --- name: api-documenter description: Спеціаліст з API-документації -tools: read, write, grep +tools: Read, Write, Grep --- # API-документатор diff --git a/uk/07-plugins/documentation/agents/code-commentator.md b/uk/07-plugins/documentation/agents/code-commentator.md index 9d01e52..391a0a8 100644 --- a/uk/07-plugins/documentation/agents/code-commentator.md +++ b/uk/07-plugins/documentation/agents/code-commentator.md @@ -1,7 +1,7 @@ --- name: code-commentator description: Спеціаліст з коментарів коду та інлайн-документації -tools: read, write, edit +tools: Read, Write, Edit --- # Коментатор коду diff --git a/uk/07-plugins/documentation/agents/example-generator.md b/uk/07-plugins/documentation/agents/example-generator.md index 59a5800..46b4ffa 100644 --- a/uk/07-plugins/documentation/agents/example-generator.md +++ b/uk/07-plugins/documentation/agents/example-generator.md @@ -1,7 +1,7 @@ --- name: example-generator description: Спеціаліст з прикладів коду та туторіалів -tools: read, write +tools: Read, Write --- # Генератор прикладів diff --git a/uk/07-plugins/pr-review/README.md b/uk/07-plugins/pr-review/README.md index 651167f..1cdd8a9 100644 --- a/uk/07-plugins/pr-review/README.md +++ b/uk/07-plugins/pr-review/README.md @@ -58,7 +58,7 @@ ## Вимоги -- Claude Code 1.0+ +- Claude Code 2.1+ - Доступ до GitHub - Git-репозиторій diff --git a/uk/07-plugins/pr-review/agents/performance-analyzer.md b/uk/07-plugins/pr-review/agents/performance-analyzer.md index f8ab5cc..59d6cc9 100644 --- a/uk/07-plugins/pr-review/agents/performance-analyzer.md +++ b/uk/07-plugins/pr-review/agents/performance-analyzer.md @@ -1,7 +1,7 @@ --- name: performance-analyzer description: Аналіз впливу на продуктивність -tools: read, grep, bash +tools: Read, Grep, Bash --- # Аналізатор продуктивності diff --git a/uk/07-plugins/pr-review/agents/security-reviewer.md b/uk/07-plugins/pr-review/agents/security-reviewer.md index 4723d9a..f50d7cc 100644 --- a/uk/07-plugins/pr-review/agents/security-reviewer.md +++ b/uk/07-plugins/pr-review/agents/security-reviewer.md @@ -1,7 +1,7 @@ --- name: security-reviewer description: Код-рев'ю з фокусом на безпеці -tools: read, grep, bash +tools: Read, Grep, Bash --- # Рецензент безпеки diff --git a/uk/07-plugins/pr-review/agents/test-checker.md b/uk/07-plugins/pr-review/agents/test-checker.md index fb2ce12..19df114 100644 --- a/uk/07-plugins/pr-review/agents/test-checker.md +++ b/uk/07-plugins/pr-review/agents/test-checker.md @@ -1,7 +1,7 @@ --- name: test-checker description: Аналіз покриття тестами та їх якості -tools: read, bash, grep +tools: Read, Bash, Grep --- # Перевірник тестів diff --git a/uk/08-checkpoints/README.md b/uk/08-checkpoints/README.md index 781d855..42db5e5 100644 --- a/uk/08-checkpoints/README.md +++ b/uk/08-checkpoints/README.md @@ -221,15 +221,21 @@ Claude Code автоматично управляє контрольними т Контрольні точки — вбудована поведінка Claude Code за замовчуванням, не потребує конфігурації. Кожен промпт автоматично створює контрольну точку. -Єдине налаштування — `cleanupPeriodDays`, що контролює тривалість зберігання: +Поведінкою контрольних точок керують два налаштування — чи взагалі створюються знімки та як довго вони зберігаються: ```json { + "fileCheckpointingEnabled": true, "cleanupPeriodDays": 30 } ``` -- `cleanupPeriodDays`: Кількість днів зберігання історії сесій та контрольних точок (за замовчуванням: `30`) +| Налаштування | За замовчуванням | Дія | +|--------------|------------------|-----| +| `fileCheckpointingEnabled` | `true` | Створювати знімок файлів перед кожним редагуванням, щоб `/rewind` міг їх відновити. Потребує v2.1.119+. У `/config` відображається як **Rewind code (checkpoints)**. Еквівалент змінної середовища: `CLAUDE_CODE_DISABLE_FILE_CHECKPOINTING` | +| `cleanupPeriodDays` | `30` | Кількість днів зберігання історії сесій та контрольних точок | + +Claude Code зберігає знімки для **100 найновіших контрольних точок**; старіші видаляються навіть у межах періоду зберігання. ## Обмеження diff --git a/uk/09-advanced-features/README.md b/uk/09-advanced-features/README.md index 5d32c56..b1dbe16 100644 --- a/uk/09-advanced-features/README.md +++ b/uk/09-advanced-features/README.md @@ -1684,7 +1684,7 @@ claude --no-sandbox # Вимкнути пісочницю ```json { "permissions": { - "mode": "default" + "defaultMode": "manual" }, "hooks": { "PreToolUse:Edit": "eslint --fix ${file_path}", @@ -1707,7 +1707,7 @@ claude --no-sandbox # Вимкнути пісочницю ```json { "permissions": { - "mode": "default", + "defaultMode": "manual", "allowedTools": ["Bash(git log:*)", "Read"], "disallowedTools": ["Bash(rm -rf:*)"] }, @@ -1809,7 +1809,7 @@ User: /config "PreToolUse": [{ "matcher": "Bash", "hooks": ["npm test && npm run lint"] }] }, "permissions": { - "mode": "default" + "defaultMode": "manual" }, "mcp": { "servers": { diff --git a/uk/CATALOG.md b/uk/CATALOG.md index b725c25..96621c6 100644 --- a/uk/CATALOG.md +++ b/uk/CATALOG.md @@ -19,14 +19,14 @@ | Функція | Вбудовані | Приклади | Разом | Довідник | |---------|-----------|----------|-------|----------| -| **Слеш-команди** | 55+ | 8 | 63+ | [01-slash-commands/](../01-slash-commands/) | -| **Субагенти** | 6 | 11 | 17 | [04-subagents/](../04-subagents/) | -| **Навички (Skills)** | 5 вбудованих | 4 | 9 | [03-skills/](../03-skills/) | +| **Слеш-команди** | 60+ | 8 | 68+ | [01-slash-commands/](../01-slash-commands/) | +| **Субагенти** | 6 | 9 | 15 | [04-subagents/](../04-subagents/) | +| **Навички (Skills)** | 10 вбудованих | 6 | 16 | [03-skills/](../03-skills/) | | **Плагіни** | - | 3 | 3 | [07-plugins/](../07-plugins/) | -| **MCP-сервери** | 1 | 8 | 9 | [05-mcp/](../05-mcp/) | -| **Хуки** | 25 подій | 8 | 8 | [06-hooks/](../06-hooks/) | -| **Пам'ять** | 7 типів | 3 | 3 | [02-memory/](../02-memory/) | -| **Разом** | **99** | **45** | **119** | | +| **MCP-сервери** | 1 | 4 | 5 | [05-mcp/](../05-mcp/) | +| **Хуки** | 31 подія | 10 | 41 | [06-hooks/](../06-hooks/) | +| **Пам'ять** | 7 типів | 3 | 10 | [02-memory/](../02-memory/) | +| **Разом** | **115** | **43** | **158** | | --- diff --git a/uk/CONTRIBUTING.md b/uk/CONTRIBUTING.md index 682dbc7..a4c4f10 100644 --- a/uk/CONTRIBUTING.md +++ b/uk/CONTRIBUTING.md @@ -72,7 +72,7 @@ git checkout -b docs/improvement-area ### 3. Налаштування середовища -Pre-commit хуки запускають ті ж перевірки, що й CI, локально перед кожним комітом. Усі чотири перевірки повинні пройти перед прийняттям PR. +Pre-commit хуки запускають ті ж перевірки, що й CI, локально перед кожним комітом. Усі п'ять перевірок повинні пройти перед прийняттям PR. **Необхідні залежності:** diff --git a/uk/INDEX.md b/uk/INDEX.md index 5832b7e..ca592aa 100644 --- a/uk/INDEX.md +++ b/uk/INDEX.md @@ -64,7 +64,7 @@ --- -## 03. Навички (Skills) (28 файлів) +## 03. Навички (Skills) (23 файли) Автоматично викликані можливості зі скриптами та шаблонами. @@ -168,20 +168,21 @@ blog-draft/ --- -## 04. Субагенти (9 файлів) +## 04. Субагенти (10 файлів) Спеціалізовані AI-помічники з налаштованими можливостями. | Файл | Опис | Інструменти | Сценарій | |------|------|-------------|----------| -| `code-reviewer.md` | Аналіз якості коду | read, grep, diff, lint_runner | Комплексне ревʼю | -| `test-engineer.md` | Аналіз покриття тестами | read, write, bash, grep | Автоматизація тестування | -| `documentation-writer.md` | Створення документації | read, write, grep | Генерація документації | -| `secure-reviewer.md` | Ревʼю безпеки (лише читання) | read, grep | Аудит безпеки | -| `implementation-agent.md` | Повна реалізація | read, write, bash, grep, edit, glob | Розробка функцій | -| `debugger.md` | Спеціаліст з налагодження | read, bash, grep | Дослідження помилок | -| `data-scientist.md` | Спеціаліст з аналізу даних | read, write, bash | Робота з даними | -| `clean-code-reviewer.md` | Стандарти чистого коду | read, grep | Якість коду | +| `code-reviewer.md` | Аналіз якості коду | Read, Grep, Glob, Bash | Комплексне ревʼю | +| `test-engineer.md` | Аналіз покриття тестами | Read, Write, Bash, Grep | Автоматизація тестування | +| `documentation-writer.md` | Створення документації | Read, Write, Grep | Генерація документації | +| `secure-reviewer.md` | Ревʼю безпеки (лише читання) | Read, Grep | Аудит безпеки | +| `implementation-agent.md` | Повна реалізація | Read, Write, Edit, Bash, Grep, Glob | Розробка функцій | +| `debugger.md` | Спеціаліст з налагодження | Read, Edit, Bash, Grep, Glob | Дослідження помилок | +| `data-scientist.md` | Спеціаліст з аналізу даних | Bash, Read, Write | Робота з даними | +| `clean-code-reviewer.md` | Стандарти чистого коду | Read, Grep, Glob, Bash | Якість коду | +| `performance-optimizer.md` | Аналіз вузьких місць продуктивності | Read, Edit, Bash, Grep, Glob | Робота з оптимізації | | `README.md` | Документація | - | Керівництво | **Шлях встановлення**: `.claude/agents/` @@ -208,36 +209,38 @@ blog-draft/ --- -## 06. Хуки (9 файлів) +## 06. Хуки (11 файлів) Скрипти автоматизації, що виконуються при певних подіях. | Файл | Опис | Подія | Сценарій | |------|------|-------|----------| -| `format-code.sh` | Автоформатування коду | PreToolUse:Write | Форматування коду | -| `pre-commit.sh` | Тести перед комітом | PreToolUse:Bash | Автоматизація тестів | -| `security-scan.sh` | Сканування безпеки | PostToolUse:Write | Перевірка безпеки | -| `log-bash.sh` | Логування bash-команд | PostToolUse:Bash | Журналювання команд | -| `validate-prompt.sh` | Валідація промптів | PreToolUse | Валідація вводу | -| `notify-team.sh` | Надсилання сповіщень | Notification | Сповіщення команди | -| `context-tracker.py` | Відстеження контекстного вікна | PostToolUse | Моніторинг контексту | -| `context-tracker-tiktoken.py` | Підрахунок токенів | PostToolUse | Точний підрахунок токенів | +| `format-code.sh` | Автоформатування коду | PostToolUse (matcher: Write) | Форматування коду | +| `pre-commit.sh` | Тести перед комітом | PreToolUse (matcher: Bash) | Автоматизація тестів | +| `pre-tool-check.sh` | Валідація та аудит команд перед виконанням | PreToolUse (matcher: Bash) | Захисні бар'єри, журнал аудиту | +| `security-scan.sh` | Сканування безпеки | PostToolUse (matcher: Write) | Перевірка безпеки | +| `dependency-check.sh` | Сканування маніфестів залежностей на вразливості | PostToolUse (matcher: Write) | Перевірки ланцюга постачання | +| `log-bash.sh` | Логування bash-команд | PostToolUse (matcher: Bash) | Журналювання команд | +| `notify-team.sh` | Надсилання сповіщень | PostToolUse (matcher: Bash) | Сповіщення команди | +| `validate-prompt.sh` | Валідація промптів | UserPromptSubmit | Валідація вводу | +| `context-tracker.py` | Відстеження контекстного вікна | UserPromptSubmit, Stop | Моніторинг контексту | +| `context-tracker-tiktoken.py` | Підрахунок токенів | UserPromptSubmit, Stop | Точний підрахунок токенів | | `README.md` | Документація | - | Керівництво | **Шлях встановлення**: Конфігурація в `~/.claude/settings.json` **Використання**: Налаштовуються в settings, виконуються автоматично -**Типи хуків** (4 типи, 25 подій): +**Типи хуків** (5 типів, 31 подія): -- Хуки інструментів: PreToolUse, PostToolUse, PostToolUseFailure, PermissionRequest -- Хуки сесії: SessionStart, SessionEnd, Stop, StopFailure, SubagentStart, SubagentStop -- Хуки завдань: UserPromptSubmit, TaskCompleted, TaskCreated, TeammateIdle -- Хуки життєвого циклу: ConfigChange, CwdChanged, FileChanged, PreCompact, PostCompact, WorktreeCreate, WorktreeRemove, Notification, InstructionsLoaded, Elicitation, ElicitationResult +- Хуки інструментів: PreToolUse, PostToolUse, PostToolUseFailure, PostToolBatch, PermissionRequest, PermissionDenied +- Хуки сесії: SessionStart, Setup, SessionEnd, Stop, StopFailure, SubagentStart, SubagentStop +- Хуки завдань: UserPromptSubmit, UserPromptExpansion, MessageDisplay, TaskCompleted, TaskCreated, TeammateIdle +- Хуки життєвого циклу: ConfigChange, CwdChanged, DirectoryAdded, FileChanged, PreCompact, PostCompact, WorktreeCreate, WorktreeRemove, Notification, InstructionsLoaded, Elicitation, ElicitationResult --- -## 07. Плагіни (3 повних плагіни, 40 файлів) +## 07. Плагіни (3 повних плагіни, 39 файлів) Пакетні набори функціональності. @@ -374,7 +377,7 @@ documentation/ --- -## 09. Розширені функції (3 файли) +## 09. Розширені функції (4 файли) Просунуті можливості для складних робочих процесів. @@ -383,6 +386,7 @@ documentation/ | `README.md` | Повний посібник | Документація всіх розширених функцій | | `config-examples.json` | Приклади конфігурації | 10+ конфігурацій для різних сценаріїв | | `planning-mode-examples.md` | Приклади планування | REST API, міграція БД, рефакторинг | +| `setup-auto-mode-permissions.py` | Початкове заповнення `permissions.allow` для режиму auto | Ідемпотентний, `--dry-run` та явні прапорці | | Заплановані завдання | Повторювані завдання з `/loop` та cron | Автоматичні повторювані процеси | | Інтеграція з Chrome | Автоматизація браузера через headless Chromium | Веб-тестування та скрейпінг | | Віддалене керування (розширено) | Методи підключення, безпека, порівняння | Управління віддаленими сесіями | @@ -414,8 +418,8 @@ documentation/ - **default**: Запитувати дозвіл на ризиковані дії - **acceptEdits**: Автоматично приймати редагування, запитувати інше - **plan**: Лише аналіз, без змін (тільки читання) -- **auto**: Автоматично схвалювати безпечні дії, запитувати ризиковані -- **dontAsk**: Приймати всі дії, крім ризикованих +- **auto**: Виконує все з фоновими перевірками безпеки — класифікатор перевіряє команди та запис у захищені каталоги (налаштовується через об'єкт `autoMode` у налаштуваннях) +- **dontAsk**: Лише попередньо затверджені інструменти — автоматично відхиляє кожен виклик, який інакше вимагав би запиту. Claude виконує лише збіги з `permissions.allow`, Bash-команди лише для читання та виклики, схвалені хуком `PreToolUse` - **bypassPermissions**: Приймати все (потребує `--dangerously-skip-permissions`) ### Headless-режим (`claude -p`) @@ -798,13 +802,13 @@ Run tests in background |-----------|---------|--------|-----|------|---------|---------|------|------------|-------| | **01 Слеш-команди** | 8 | - | - | - | - | - | 1 | 1 | **10** | | **02 Пам'ять** | - | - | - | - | - | 3 | 1 | 2 | **6** | -| **03 Навички** | - | - | - | - | 5 | 9 | 1 | - | **28** | -| **04 Субагенти** | - | 8 | - | - | - | - | 1 | - | **9** | +| **03 Навички** | - | - | - | - | 5 | 7 | 11 | - | **23** | +| **04 Субагенти** | - | 9 | - | - | - | - | 1 | - | **10** | | **05 MCP** | - | - | 4 | - | - | - | 1 | - | **5** | -| **06 Хуки** | - | - | - | 8 | - | - | 1 | - | **9** | -| **07 Плагіни** | 11 | 9 | 3 | 3 | 3 | 3 | 4 | - | **40** | +| **06 Хуки** | - | - | - | 10 | - | - | 1 | - | **11** | +| **07 Плагіни** | 11 | 9 | 3 | 3 | 3 | 3 | 7 | - | **39** | | **08 Контрольні точки** | - | - | - | - | - | - | 1 | 1 | **2** | -| **09 Розширені** | - | - | - | - | - | - | 1 | 2 | **3** | +| **09 Розширені** | - | - | - | - | 1 | 1 | 2 | - | **4** | | **10 CLI** | - | - | - | - | - | - | 1 | - | **1** | --- diff --git a/uk/LEARNING-ROADMAP.md b/uk/LEARNING-ROADMAP.md index 1772cfb..41298e5 100644 --- a/uk/LEARNING-ROADMAP.md +++ b/uk/LEARNING-ROADMAP.md @@ -107,7 +107,7 @@ graph TD | **3** | [Контрольні точки](../08-checkpoints/) | ⭐⭐ Середній | 45 хв | Рівень 1 | Управління сесіями | Безпечне дослідження | Експериментування, відновлення | | **4** | [Основи CLI](../10-cli/) | ⭐⭐ Початківець+ | 30 хв | Рівень 1 | Немає | Базове використання CLI | Інтерактивний та print mode | | **5** | [Навички](../03-skills/) | ⭐⭐ Середній | 1 год | Рівень 2 | Слеш-команди | Автоматична експертиза | Повторювані можливості | -| **6** | [Хуки](../06-hooks/) | ⭐⭐ Середній | 1 год | Рівень 2 | Інструменти, Команди | Автоматизація процесів (25 подій, 4 типи) | Валідація, контроль якості | +| **6** | [Хуки](../06-hooks/) | ⭐⭐ Середній | 1 год | Рівень 2 | Інструменти, Команди | Автоматизація процесів (31 подія, 5 типів) | Валідація, контроль якості | | **7** | [MCP](../05-mcp/) | ⭐⭐⭐ Середній+ | 1 год | Рівень 2 | Конфігурація | Доступ до даних у реальному часі | Інтеграція, API | | **8** | [Субагенти](../04-subagents/) | ⭐⭐⭐ Середній+ | 1.5 год | Рівень 2 | Пам'ять, Команди | Складні завдання (6 вбудованих) | Делегування, спеціалізація | | **9** | [Розширені функції](../09-advanced-features/) | ⭐⭐⭐⭐⭐ Просунутий | 2-3 год | Рівень 3 | Усі попередні | Інструменти експерта | Планування, Auto Mode, канали | @@ -248,7 +248,7 @@ cat error.log | claude -p "explain this error" #### Що ви досягнете ✅ Автовиклик спеціалізованих можливостей з YAML-фронтматером (включно з полями `effort` та `shell`) -✅ Налаштування автоматизації на основі подій через 25 подій хуків +✅ Налаштування автоматизації на основі подій через 31 подія хуків ✅ Використання всіх 4 типів хуків (command, http, prompt, agent) ✅ Забезпечення стандартів якості коду ✅ Створення кастомних хуків для ваших процесів diff --git a/uk/QUICK_REFERENCE.md b/uk/QUICK_REFERENCE.md index 5b306a7..bdc0359 100644 --- a/uk/QUICK_REFERENCE.md +++ b/uk/QUICK_REFERENCE.md @@ -108,7 +108,7 @@ chmod +x ~/.claude/hooks/*.sh # default - Запитувати дозвіл на ризиковані дії # acceptEdits - Автоприйняття редагувань, запит на інше # plan - Лише аналіз, без змін (тільки читання) -# dontAsk - Приймати все, крім ризикованого +# dontAsk - Лише попередньо затверджені інструменти; решта відхиляється # auto - Фоновий класифікатор вирішує автоматично # bypassPermissions - Приймати все (потребує --dangerously-skip-permissions) @@ -131,7 +131,7 @@ claude -r "session" # Відновити сесію за назвою/ID | **Навички** | `.claude/skills/*/SKILL.md` | Автовиклик | | **Субагенти** | `.claude/agents/*.md` | Автоделегування | | **MCP** | `.mcp.json` (проект) або `~/.claude.json` (користувач) | `/mcp__server__action` | -| **Хуки (25 подій)** | `~/.claude/hooks/*.sh` | Тригер на подію (4 типи) | +| **Хуки (31 подія)** | `~/.claude/hooks/*.sh` | Тригер на подію (5 типів) | | **Плагіни** | Через `/plugin install` | Пакет всього | | **Контрольні точки** | Вбудовано | `Esc+Esc` або `/rewind` | | **Режим планування** | Вбудовано | `/plan <завдання>` | @@ -207,7 +207,7 @@ vim CLAUDE.md ### Автоматизація та хуки ```bash -# Встановити хуки (25 подій, 4 типи: command, http, prompt, agent) +# Встановити хуки (31 подія, 5 типів: command, http, mcp_tool, prompt, agent) mkdir -p ~/.claude/hooks cp 06-hooks/*.sh ~/.claude/hooks/ chmod +x ~/.claude/hooks/*.sh @@ -421,7 +421,7 @@ cp -r 03-skills/code-review-specialist ~/.claude/skills/ | **Auto Mode** | Повністю автономна робота з фоновим класифікатором | Прапорець `--enable-auto-mode`, `Shift+Tab` для зміни режимів | | **Канали** | Інтеграція з Discord та Telegram | Прапорець `--channels`, боти Discord/Telegram | | **Голосовий ввід** | Голосові команди та контекст для Claude | Команда `/voice` | -| **Хуки (26 подій)** | Розширена система хуків з 4 типами | Типи: command, http, prompt, agent | +| **Хуки (31 подія)** | Розширена система хуків з 5 типами | Типи: command, http, mcp_tool, prompt, agent | | **MCP Elicitation** | MCP-сервери можуть запитувати ввід під час виконання | Автозапит при потребі сервера | | **Plugin LSP** | Підтримка Language Server Protocol для плагінів | `userConfig`, змінна `${CLAUDE_PLUGIN_DATA}` | | **Віддалене керування** | Керування Claude Code через WebSocket API | `claude --remote` для зовнішніх інтеграцій | @@ -479,7 +479,7 @@ echo $GITHUB_TOKEN | Автоматичний процес | Навичка | `03-skills/code-review-specialist/` | | Спеціалізоване завдання | Субагент | `04-subagents/code-reviewer.md` | | Зовнішні дані | MCP (+ Elicitation) | `05-mcp/github-mcp.json` | -| Автоматизація подій | Хук (26 подій, 4 типи) | `06-hooks/pre-commit.sh` | +| Автоматизація подій | Хук (31 подія, 5 типів) | `06-hooks/pre-commit.sh` | | Комплексне рішення | Плагін (+ LSP) | `07-plugins/pr-review/` | | Безпечний експеримент | Контрольна точка | `08-checkpoints/checkpoint-examples.md` | | Повна автономія | Auto Mode | `--enable-auto-mode` або `Shift+Tab` | diff --git a/uk/README.md b/uk/README.md index 5b0c8ad..77862ec 100644 --- a/uk/README.md +++ b/uk/README.md @@ -438,11 +438,11 @@ chmod +x ~/.claude/hooks/*.sh **Використання**: Хуки виконуються автоматично за подіями -**Типи хуків** (4 типи, 25 подій): -- **Хуки інструментів**: `PreToolUse`, `PostToolUse`, `PostToolUseFailure`, `PermissionRequest` -- **Хуки сесій**: `SessionStart`, `SessionEnd`, `Stop`, `StopFailure`, `SubagentStart`, `SubagentStop` -- **Хуки завдань**: `UserPromptSubmit`, `TaskCompleted`, `TaskCreated`, `TeammateIdle` -- **Хуки життєвого циклу**: `ConfigChange`, `CwdChanged`, `FileChanged`, `PreCompact`, `PostCompact`, `WorktreeCreate`, `WorktreeRemove`, `Notification`, `InstructionsLoaded`, `Elicitation`, `ElicitationResult` +**Типи хуків** (5 типів, 31 подія): +- **Хуки інструментів**: `PreToolUse`, `PostToolUse`, `PostToolUseFailure`, `PostToolBatch`, `PermissionRequest`, `PermissionDenied` +- **Хуки сесій**: `SessionStart`, `Setup`, `SessionEnd`, `Stop`, `StopFailure`, `SubagentStart`, `SubagentStop` +- **Хуки завдань**: `UserPromptSubmit`, `UserPromptExpansion`, `MessageDisplay`, `TaskCompleted`, `TaskCreated`, `TeammateIdle` +- **Хуки життєвого циклу**: `ConfigChange`, `CwdChanged`, `DirectoryAdded`, `FileChanged`, `PreCompact`, `PostCompact`, `WorktreeCreate`, `WorktreeRemove`, `Notification`, `InstructionsLoaded`, `Elicitation`, `ElicitationResult` diff --git a/uk/claude_concepts_guide.md b/uk/claude_concepts_guide.md index 11105d2..b3a5b30 100644 --- a/uk/claude_concepts_guide.md +++ b/uk/claude_concepts_guide.md @@ -571,7 +571,7 @@ graph TD B --> C["3. Project Rules
.claude/rules/*.md"] C --> D["4. User Memory
~/.claude/CLAUDE.md"] D --> E["5. User Rules
~/.claude/rules/*.md"] - E --> F["6. Local Memory
.claude/local/CLAUDE.md"] + E --> F["6. Local Memory
./CLAUDE.local.md"] F --> G["7. Auto Memory
Automatically captured preferences"] style A fill:#fce4ec,stroke:#333,color:#333 @@ -592,7 +592,7 @@ graph TD | 3. Правила проєкту | `.claude/rules/*.md` | Проєкт | Високий | Команда (Git) | Модульні конвенції проєкту | | 4. Користувач | `~/.claude/CLAUDE.md` | Персональний | Середній | Індивідуальний | Особисті налаштування | | 5. Правила користувача | `~/.claude/rules/*.md` | Персональний | Середній | Індивідуальний | Персональні модулі правил | -| 6. Локальний | `.claude/local/CLAUDE.md` | Локальний | Низький | Не спільний | Налаштування конкретної машини | +| 6. Локальний | `./CLAUDE.local.md` | Локальний | Низький | Не спільний | Налаштування конкретної машини | | 7. Авто-пам'ять | Автоматичний | Сесія | Найнижчий | Індивідуальний | Засвоєні вподобання, патерни | ### Авто-пам'ять @@ -2543,7 +2543,7 @@ Complete PR review workflow with security, testing, and documentation checks. ``` ## Requirements -- Claude Code 1.0+ +- Claude Code 2.1+ - GitHub access - CodeQL (optional) ~~~~ @@ -2808,7 +2808,7 @@ graph TD ### Події хуків -Claude Code підтримує **25 подій хуків** у чотирьох типах хуків (command, http, prompt, agent): +Claude Code підтримує **31 подія хуків** у п'яти типах хуків (command, http, mcp_tool, prompt, agent): | Подія хука | Тригер | Сценарії використання | |------------|---------|-----------| @@ -2817,6 +2817,7 @@ Claude Code підтримує **25 подій хуків** у чотирьох | **UserPromptSubmit** | Користувач надсилає промпт | Валідація вводу, фільтрація промптів | | **PreToolUse** | Перед запуском будь-якого інструменту | Валідація, шлюзи затвердження, логування | | **PermissionRequest** | Показано діалог дозволу | Авто-затвердження/відхилення | +| **PermissionDenied** | Користувач відхилив запит дозволу | Логування, аналітика, політики | | **PostToolUse** | Після успішного виконання інструменту | Авто-форматування, сповіщення, очищення | | **PostToolUseFailure** | Помилка виконання інструменту | Обробка помилок, логування | | **Notification** | Надіслано сповіщення | Алертинг, зовнішні інтеграції | @@ -3108,7 +3109,7 @@ User: \ "maxConcurrentTasks": 5 }, "permissions": { - "mode": "default" + "defaultMode": "manual" } } ``` diff --git a/uk/resources.md b/uk/resources.md index e0486af..0684799 100644 --- a/uk/resources.md +++ b/uk/resources.md @@ -149,11 +149,11 @@ graph TD S --> T[Test Automation] T --> U[Repository Ready] - style A fill:#e1f5ff - style G fill:#fff4e1 - style K fill:#f0ffe1 - style Q fill:#ffe1f5 - style U fill:#90EE90 + style A fill:#e1f5fe,stroke:#333,color:#333 + style G fill:#fff9c4,stroke:#333,color:#333 + style K fill:#e8f5e9,stroke:#333,color:#333 + style Q fill:#f3e5f5,stroke:#333,color:#333 + style U fill:#e8f5e9,stroke:#333,color:#333 ``` #### Для існуючого репозиторію @@ -214,12 +214,12 @@ graph TD Y -->|Yes| H Y -->|No| Z[Workflow Complete] - style A fill:#e1f5ff - style C fill:#ffecec - style D fill:#fff4e1 - style P fill:#f0ffe1 - style T fill:#ffe1f5 - style Z fill:#90EE90 + style A fill:#e1f5fe,stroke:#333,color:#333 + style C fill:#fce4ec,stroke:#333,color:#333 + style D fill:#fff9c4,stroke:#333,color:#333 + style P fill:#e8f5e9,stroke:#333,color:#333 + style T fill:#f3e5f5,stroke:#333,color:#333 + style Z fill:#e8f5e9,stroke:#333,color:#333 ``` **Поради**: @@ -245,7 +245,7 @@ graph TD | **Extended Thinking** | Перемикання глибокого мислення через `Alt+T`/`Option+T` або змінну `MAX_THINKING_TOKENS` | [Просунуті функції](09-advanced-features/) | | **Permission Modes** | Тонке управління: default, acceptEdits, plan, auto, dontAsk, bypassPermissions | [Просунуті функції](09-advanced-features/) | | **7-Tier Memory** | Managed Policy, Project, Project Rules, User, User Rules, Local, Auto Memory | [Посібник з пам'яті](02-memory/) | -| **Hook Events** | 25 подій: PreToolUse, PostToolUse, PostToolUseFailure, Stop, StopFailure, SubagentStart, SubagentStop, Notification, Elicitation та інші | [Посібник з хуків](06-hooks/) | +| **Hook Events** | 31 подія: PreToolUse, PostToolUse, PostToolUseFailure, Stop, StopFailure, SubagentStart, SubagentStop, Notification, Elicitation та інші | [Посібник з хуків](06-hooks/) | | **Agent Teams** | Координація кількох агентів для складних завдань | [Посібник з субагентів](04-subagents/) | | **Scheduled Tasks** | Налаштування повторюваних завдань з `/loop` та cron | [Просунуті функції](09-advanced-features/) | | **Chrome Integration** | Автоматизація браузера з headless Chromium | [Просунуті функції](09-advanced-features/) | diff --git a/vi/01-slash-commands/README.md b/vi/01-slash-commands/README.md index bbc3427..6843a97 100644 --- a/vi/01-slash-commands/README.md +++ b/vi/01-slash-commands/README.md @@ -18,13 +18,15 @@ Lệnh slash là các lối tắt để điều khiển hành vi của Claude tr ## Tham Khảo Lệnh Tích Hợp Sẵn -Lệnh tích hợp sẵn là các lối tắt cho các hành động phổ biến. Có **60+ lệnh tích hợp sẵn** và **5 skills được gói** sẵn. Gõ `/` trong Claude Code để xem danh sách đầy đủ, hoặc gõ `/` theo sau bởi bất kỳ chữ cái nào để lọc. +Lệnh tích hợp sẵn là các lối tắt cho các hành động phổ biến. Có **60+ lệnh tích hợp sẵn** và **10 skills được gói** sẵn. Gõ `/` trong Claude Code để xem danh sách đầy đủ, hoặc gõ `/` theo sau bởi bất kỳ chữ cái nào để lọc. | Lệnh | Mục Đích | |---------|---------| | `/add-dir ` | Thêm thư mục làm việc | | `/agents` | Quản lý cấu hình tác nhân | -| `/branch [name]` | Phân nhánh cuộc hội thoại vào phiên mới (bí danh: `/fork`). Lưu ý: `/fork` đã đổi tên thành `/branch` trong v2.1.77 | +| `/branch [name]` | Chuyển sang một bản sao của cuộc hội thoại tại thời điểm này, giữ nguyên bản gốc (quay lại bằng `/resume`) | +| `/fork [prompt]` | Sao chép cuộc hội thoại hiện tại thành một **phiên nền** mới và bạn vẫn tiếp tục ở đây; từ thời điểm đó hai phiên độc lập nhau và bản sao có dòng riêng trong `claude agents` (v2.1.212+) | +| `/subtask ` | Spawn một **subagent được fork** kế thừa toàn bộ cuộc hội thoại và làm việc trên tác vụ trong khi bạn tiếp tục; kết quả trả về cuộc hội thoại này khi hoàn thành (v2.1.212+) | | `/btw ` | Câu hỏi phụ không thêm vào lịch sử | | `/chrome` | Cấu hình tích hợp trình duyệt Chrome | | `/clear` | Xóa cuộc hội thoại (bí danh: `/reset`, `/new`) | @@ -103,15 +105,14 @@ Những skills này được gửi kèm với Claude Code và được gọi nh | Lệnh | Trạng Thái | |---------|--------| | `/review` | Đã lỗi thời — được thay thế bởi plugin `code-review` | -| `/output-style` | Đã lỗi thời kể từ v2.1.73 | -| `/fork` | Đổi tên thành `/branch` (bí danh vẫn hoạt động, v2.1.77) | +| `/output-style` | Đã xóa trong v2.1.91 (lỗi thời từ v2.1.73) — dùng `/config` → Output style, hoặc setting `outputStyle` | | `/pr-comments` | Đã xóa trong v2.1.91 — hỏi Claude trực tiếp để xem bình luận PR | | `/vim` | Đã xóa trong v2.1.92 — sử dụng /config → Editor mode | ### Thay Đổi Gần Đây -- `/fork` đổi tên thành `/branch` với `/fork` được giữ lại làm bí danh (v2.1.77) -- `/output-style` đã lỗi thời (v2.1.73) +- `/fork` và `/subtask` hoán đổi vai trò trong **v2.1.212**. `/fork` giờ sao chép cuộc hội thoại thành một phiên nền độc lập mới; hành vi subagent-được-fork mà nó từng có đã chuyển sang lệnh mới `/subtask`. Lịch sử: `/fork` là bí danh của `/branch` từ v2.1.77 đến v2.1.161; từ v2.1.161 đến v2.1.211 nó khởi chạy một subagent được fork (việc mà `/subtask` làm bây giờ). Khi tắt agent view, `/subtask` không khả dụng và `/fork` giữ hành vi subagent-được-fork +- `/output-style` đã lỗi thời (v2.1.73) và bị xóa (v2.1.91) — output styles vẫn có sẵn qua `/config` → Output style hoặc setting `outputStyle`; các bản tích hợp sẵn là Default, Proactive, Explanatory, và Learning - `/review` đã lỗi thời thay vào đó là plugin `code-review` - Lệnh `/effort` được thêm với mức `max` yêu cầu Opus 4.6 - Lệnh `/voice` được thêm cho nhập liệu giọng nói push-to-talk diff --git a/vi/01-slash-commands/doc-refactor.md b/vi/01-slash-commands/doc-refactor.md index e5cd02e..31bc94e 100644 --- a/vi/01-slash-commands/doc-refactor.md +++ b/vi/01-slash-commands/doc-refactor.md @@ -1,7 +1,6 @@ --- -name: Documentation Refactor +name: doc-refactor description: Cấu trúc lại tài liệu dự án để rõ ràng và dễ truy cập -tags: documentation, refactoring, organization --- # Documentation Refactor diff --git a/vi/01-slash-commands/setup-ci-cd.md b/vi/01-slash-commands/setup-ci-cd.md index 6510b2b..65feb5d 100644 --- a/vi/01-slash-commands/setup-ci-cd.md +++ b/vi/01-slash-commands/setup-ci-cd.md @@ -1,7 +1,6 @@ --- -name: Setup CI/CD Pipeline +name: setup-ci-cd description: Triển khai pre-commit hooks và GitHub Actions để đảm bảo chất lượng -tags: ci-cd, devops, automation --- # Thiết Lập Pipeline CI/CD diff --git a/vi/01-slash-commands/unit-test-expand.md b/vi/01-slash-commands/unit-test-expand.md index ec7bf23..0f3ddd5 100644 --- a/vi/01-slash-commands/unit-test-expand.md +++ b/vi/01-slash-commands/unit-test-expand.md @@ -1,7 +1,6 @@ --- -name: Expand Unit Tests +name: unit-test-expand description: Tăng vùng phủ test bằng cách nhắm vào các nhánh chưa được test và các trường hợp ngoại lệ -tags: testing, coverage, unit-tests --- # Mở Rộng Unit Tests diff --git a/vi/02-memory/directory-api-CLAUDE.md b/vi/02-memory/directory-api-CLAUDE.md index 590636d..443edf5 100644 --- a/vi/02-memory/directory-api-CLAUDE.md +++ b/vi/02-memory/directory-api-CLAUDE.md @@ -1,6 +1,8 @@ # API Module Standards -This file overrides root CLAUDE.md for everything in /src/api/ +This file supplements root CLAUDE.md for everything in /src/api/. Memory files are +concatenated, not overridden — the root CLAUDE.md still applies, and Claude Code +loads this file on demand when it reads files in this subtree. ## API-Specific Standards diff --git a/vi/03-skills/README.md b/vi/03-skills/README.md index a02dee8..437ea81 100644 --- a/vi/03-skills/README.md +++ b/vi/03-skills/README.md @@ -92,7 +92,7 @@ sequenceDiagram | **Project** | `.claude/skills//SKILL.md` | Đội | Có (qua git) | Tiêu chuẩn đội | | **Plugin** | `/skills//SKILL.md` | Nơi được bật | Phụ thuộc | Được gói với plugins | -Khi skills chia sẻ cùng tên qua các cấp, vị trí ưu tiên cao hơn thắng: **enterprise > personal > project**. Plugin skills sử dụng namespace `plugin-name:skill-name`, vì vậy chúng không thể xung đột. +Khi skills chia sẻ cùng tên qua các cấp, vị trí ưu tiên cao hơn thắng: **enterprise > project > personal**. Skills cấp project ghi đè skills cá nhân theo mặc định; setting `skillOverrides` (v2.1.129+) điều chỉnh hành vi đó. Plugin skills sử dụng namespace `plugin-name:skill-name`, vì vậy chúng không thể xung đột. ### Khám Phá Tự Động @@ -529,7 +529,7 @@ refactor/ ```yaml --- -name: code-refactor +name: refactor description: Systematic code refactoring based on Martin Fowler's methodology. Use when users ask to refactor code, improve code structure, reduce technical debt, or eliminate code smells. --- diff --git a/vi/03-skills/claude-md/SKILL.md b/vi/03-skills/claude-md/SKILL.md index 9569e07..2807a8a 100644 --- a/vi/03-skills/claude-md/SKILL.md +++ b/vi/03-skills/claude-md/SKILL.md @@ -193,10 +193,14 @@ Trước khi hoàn thành, xác minh: Nếu người dùng yêu cầu tạo/cập nhật AGENTS.md: -AGENTS.md được sử dụng để định nghĩa các hành vi tác nhân chuyên biệt. Không giống CLAUDE.md (dành cho bối cảnh dự án), AGENTS.md định nghĩa: -- Các vai trò và khả năng tác nhân tùy chỉnh -- Hướng dẫn và ràng buộc cụ thể tác nhân -- Định nghĩa workflow cho các kịch bản đa tác nhân +**Claude Code KHÔNG đọc AGENTS.md trực tiếp.** Để nó có hiệu lực, hãy import từ CLAUDE.md bằng `@AGENTS.md`, hoặc symlink `CLAUDE.md` tới nó. Đây là hiểu lầm phổ biến nhất về file này. + +AGENTS.md là file bối cảnh dự án dùng chung giữa nhiều công cụ — cùng *loại* tài liệu với CLAUDE.md, không phải định dạng định nghĩa tác nhân. Nó tồn tại để nhiều coding agent có thể dùng chung một bộ quy ước dự án: +- Các lệnh build, test, và lint +- Quy ước code style và kiến trúc +- Bố cục repository và vị trí của các thành phần + +Subagents được định nghĩa riêng, trong `.claude/agents/*.md` — không phải trong AGENTS.md. Áp dụng các nguyên tắc tương tự: - Giữ tập trung và ngắn gọn diff --git a/vi/03-skills/refactor/SKILL.md b/vi/03-skills/refactor/SKILL.md index c6b0844..4dc3ea1 100644 --- a/vi/03-skills/refactor/SKILL.md +++ b/vi/03-skills/refactor/SKILL.md @@ -1,5 +1,5 @@ --- -name: code-refactor +name: refactor description: Refactor code có hệ thống dựa trên phương pháp luận của Martin Fowler. Sử dụng khi người dùng yêu cầu refactor code, cải thiện cấu trúc code, giảm nợ kỹ thuật, dọn code legacy, loại bỏ code smells, hoặc cải thiện khả năng duy trì code. Skill này hướng dẫn qua cách tiếp theo từng giai đoạn với nghiên cứu, lập kế hoạch, và triển khai tăng dần an toàn. --- diff --git a/vi/05-mcp/README.md b/vi/05-mcp/README.md index 2420bfc..8eb933d 100644 --- a/vi/05-mcp/README.md +++ b/vi/05-mcp/README.md @@ -259,11 +259,22 @@ Ví dụ, để tham khảo một tài nguyên database cụ thể: Cấu hình MCP có thể được lưu trữ tại các phạm vi khác nhau với các mức độ chia sẻ khác nhau: -| Phạm Vi | Vị Trí | Mô Tả | Chia Sẻ Với | Yêu Cầu Chấp Thuận | -|-------|----------|-------------|-------------|------------------| -| **Local** (mặc định) | `~/.claude.json` (dưới đường dẫn project) | Riêng tư cho người dùng hiện tại, project hiện tại chỉ (được gọi là `project` trong các phiên bản cũ hơn) | Chỉ bạn | Không | -| **Project** | `.mcp.json` | Được check vào git repository | Các thành viên nhóm | Có (lần sử dụng đầu) | -| **User** | `~/.claude.json` | Có sẵn trên tất cả các projects (được gọi là `global` trong các phiên bản cũ hơn) | Chỉ bạn | Không | +| Phạm Vi | Cờ | Vị Trí | Mô Tả | Chia Sẻ Với | Yêu Cầu Chấp Thuận | +|-------|------|----------|-------------|-------------|------------------| +| **Local** (mặc định) | `--scope local` | `~/.claude.json` (dưới đường dẫn project) | Riêng tư cho người dùng hiện tại, project hiện tại chỉ (được gọi là `project` trong các phiên bản cũ hơn) | Chỉ bạn | Không | +| **Project** | `--scope project` | `.mcp.json` | Được check vào git repository | Các thành viên nhóm | Có (lần sử dụng đầu) | +| **User** | `--scope user` | `~/.claude.json` | Có sẵn trên tất cả các projects (được gọi là `global` trong các phiên bản cũ hơn) | Chỉ bạn | Không | + +Chọn phạm vi khi thêm server bằng `--scope` (dạng ngắn `-s`). Nếu bỏ qua, Claude +Code sử dụng `local`: + +```bash +# Phạm vi project — ghi vào .mcp.json để cả nhóm dùng chung +claude mcp add --scope project --transport http github https://api.github.com/mcp + +# Phạm vi user — có sẵn trong mọi project +claude mcp add --scope user --transport stdio memory -- npx @modelcontextprotocol/server-memory +``` ### Sử Dụng Phạm Vi Project / Using Project Scope @@ -430,7 +441,7 @@ Các biến được mở rộng tại runtime: "command": "npx", "args": ["@modelcontextprotocol/server-database"], "env": { - "DATABASE_URL": "postgresql://user:pass@localhost/mydb" + "DATABASE_URL": "${DATABASE_URL}" } } } diff --git a/vi/05-mcp/database-mcp.json b/vi/05-mcp/database-mcp.json index eaa832a..8b78836 100644 --- a/vi/05-mcp/database-mcp.json +++ b/vi/05-mcp/database-mcp.json @@ -1,10 +1,11 @@ { "mcpServers": { "database": { + "type": "stdio", "command": "npx", "args": ["@modelcontextprotocol/server-database"], "env": { - "DATABASE_URL": "postgresql://user:pass@localhost/mydb" + "DATABASE_URL": "${DATABASE_URL}" } } } diff --git a/vi/05-mcp/filesystem-mcp.json b/vi/05-mcp/filesystem-mcp.json index c76fdf6..6ea1e2a 100644 --- a/vi/05-mcp/filesystem-mcp.json +++ b/vi/05-mcp/filesystem-mcp.json @@ -1,6 +1,7 @@ { "mcpServers": { "filesystem": { + "type": "stdio", "command": "npx", "args": ["@modelcontextprotocol/server-filesystem", "/home/user/projects"] } diff --git a/vi/05-mcp/github-mcp.json b/vi/05-mcp/github-mcp.json index 0f62131..d2c3946 100644 --- a/vi/05-mcp/github-mcp.json +++ b/vi/05-mcp/github-mcp.json @@ -1,6 +1,7 @@ { "mcpServers": { "github": { + "type": "stdio", "command": "npx", "args": ["@modelcontextprotocol/server-github"], "env": { diff --git a/vi/05-mcp/multi-mcp.json b/vi/05-mcp/multi-mcp.json index 62d8fa5..ceb0e0d 100644 --- a/vi/05-mcp/multi-mcp.json +++ b/vi/05-mcp/multi-mcp.json @@ -1,6 +1,7 @@ { "mcpServers": { "github": { + "type": "stdio", "command": "npx", "args": ["@modelcontextprotocol/server-github"], "env": { @@ -8,6 +9,7 @@ } }, "database": { + "type": "stdio", "command": "npx", "args": ["@modelcontextprotocol/server-database"], "env": { @@ -15,6 +17,7 @@ } }, "slack": { + "type": "stdio", "command": "npx", "args": ["@modelcontextprotocol/server-slack"], "env": { @@ -22,6 +25,7 @@ } }, "filesystem": { + "type": "stdio", "command": "npx", "args": ["@modelcontextprotocol/server-filesystem", "/home/user/projects"] } diff --git a/vi/06-hooks/README.md b/vi/06-hooks/README.md index 0035277..822e285 100644 --- a/vi/06-hooks/README.md +++ b/vi/06-hooks/README.md @@ -14,7 +14,7 @@ Hooks là các hành động tự động (lệnh shell, HTTP webhooks, prompts **Tính năng chính:** - Tự động hóa dựa trên sự kiện - Đầu vào/ra dựa trên JSON -- Hỗ trợ cho các loại hook command, prompt, HTTP, và agent +- Hỗ trợ cho các loại hook command, prompt, HTTP, mcp_tool, và agent - Khớp mẫu cho các hooks cụ thể theo công cụ ## Cấu Hình / Configuration @@ -55,7 +55,7 @@ Hooks được cấu hình trong các file settings với cấu trúc cụ thể |-------|-------------|---------| | `matcher` | Mẫu để khớp tên công cụ (phân biệt hoa/thường) | `"Write"`, `"Edit\|Write"`, `"*"` | | `hooks` | Mảng định nghĩa hook | `[{ "type": "command", ... }]` | -| `type` | Loại hook: `"command"` (bash), `"prompt"` (LLM), `"http"` (webhook), hoặc `"agent"` (subagent) | `"command"` | +| `type` | Loại hook: `"command"` (bash), `"prompt"` (LLM), `"http"` (webhook), `"mcp_tool"` (gọi công cụ MCP, từ v2.1.118), hoặc `"agent"` (subagent) | `"command"` | | `command` | Lệnh shell để thực thi | `"$CLAUDE_PROJECT_DIR/.claude/hooks/format.sh"` | | `timeout` | Timeout tùy chọn tính bằng giây (mặc định 60) | `30` | | `once` | Nếu `true`, chạy hook chỉ một lần mỗi phiên | `true` | @@ -71,7 +71,7 @@ Hooks được cấu hình trong các file settings với cấu trúc cụ thể ## Các Loại Hook / Hook Types -Claude Code hỗ trợ bốn loại hook: +Claude Code hỗ trợ năm loại hook: ### Command Hooks / Hooks Lệnh @@ -109,6 +109,28 @@ Các endpoints webhook từ xa nhận cùng đầu vào JSON như command hooks. - Được định tuyến qua sandbox khi sandbox được bật - Yêu cầu danh sách `allowedEnvVars` rõ ràng cho bất kỳ nội suy biến môi trường nào trong URL +### MCP Tool Hooks / Hooks Công Cụ MCP + +> Được thêm vào từ v2.1.118. + +Loại `mcp_tool` gọi trực tiếp một công cụ MCP đã được cấu hình; cấu hình tham chiếu đến tên MCP server và tên công cụ thay vì một lệnh shell hay URL. Hữu ích khi logic xác thực hoặc phản hồi đã nằm sẵn trong một MCP server bạn đã cấu hình. + +```json +{ + "matcher": "Edit", + "hooks": [{ + "type": "mcp_tool", + "server": "my-mcp-server", + "tool": "validate_edit" + }] +} +``` + +**Các thuộc tính chính:** +- `"type": "mcp_tool"` -- xác định đây là một MCP tool hook +- `"server"` -- tên MCP server đã cấu hình +- `"tool"` -- tên công cụ cần gọi trên server đó + ### Prompt Hooks / Hooks Prompt Prompts được đánh giá bởi LLM nơi nội dung hook là một prompt mà Claude đánh giá. Chủ yếu được sử dụng với các sự kiện `Stop` và `SubagentStop` để kiểm tra hoàn thành tác vụ thông minh. @@ -143,17 +165,22 @@ Hooks xác thực dựa trên subagent mà spawn một agent chuyên dụng đ ## Các Sự Kiện Hook / Hook Events -Claude Code hỗ trợ **25 sự kiện hook**: +Claude Code hỗ trợ **31 sự kiện hook**: | Sự Kiện | Khi Được Kích Hoạt | Matcher Input | Có Chặn | Sử Dụng Phổ Biến | |-------|---------------|---------------|-----------|------------| | **SessionStart** | Phiên bắt đầu/tiếp tục/xóa/dồn/fork | startup/resume/clear/compact/fork | Không | Thiết lập môi trường | +| **Setup** | Thiết lập môi trường ban đầu (một lần mỗi phiên) | (none) | Không | Cài đặt công cụ, cài dependencies | | **InstructionsLoaded** | Sau khi CLAUDE.md hoặc file rules được tải | (none) | Không | Sửa đổi/bộ lọc hướng dẫn | | **UserPromptSubmit** | Người dùng gửi prompt | (none) | Có | Xác thực prompts | +| **UserPromptExpansion** | Prompt được mở rộng (ví dụ: `@` mentions, slash commands được phân giải) | (none) | Có | Biến đổi hoặc kiểm tra prompt đã mở rộng | +| **MessageDisplay** | Trong khi văn bản phản hồi của assistant được hiển thị | (none) | Không | Biến đổi hoặc ẩn văn bản hiển thị (v2.1.152) | | **PreToolUse** | Trước khi thực thi công cụ | Tên công cụ | Có (allow/deny/ask) | Xác thực, sửa đổi đầu vào | | **PermissionRequest** | Hộp thoại quyền được hiển thị | Tên công cụ | Có | Tự động phê duyệt/từ chối | | **PostToolUse** | Sau khi công cụ thành công | Tên công cụ | Không | Thêm ngữ cảnh, feedback | | **PostToolUseFailure** | Thực thi công cụ thất bại | Tên công cụ | Không | Xử lý lỗi, logging | +| **PostToolBatch** | Sau khi một lô lệnh gọi công cụ hoàn tất | (none) | Không | Báo cáo tổng hợp, xác thực theo lô | +| **PermissionDenied** | Người dùng từ chối một hộp thoại quyền | Tên công cụ | Không | Logging, phân tích, thực thi chính sách | | **Notification** | Thông báo được gửi | Loại thông báo | Không | Thông báo tùy chỉnh | | **SubagentStart** | Subagent được spawn | Tên loại agent | Không | Thiết lập subagent | | **SubagentStop** | Subagent hoàn thành | Tên loại agent | Có | Xác thực subagent | @@ -164,6 +191,7 @@ Claude Code hỗ trợ **25 sự kiện hook**: | **TaskCreated** | Nhiệm vụ được tạo qua TaskCreate | (none) | Không | Theo dõi nhiệm vụ, logging | | **ConfigChange** | File config thay đổi | (none) | Có (trừ policy) | Phản hồi cập nhật config | | **CwdChanged** | Thư mục làm việc thay đổi | (none) | Không | Thiết lập cụ thể thư mục | +| **DirectoryAdded** | Thư mục làm việc mới được đăng ký giữa phiên qua `/add-dir` hoặc control request `register_repo_root` của SDK (v2.1.219) | (none) | Không | Thiết lập công cụ cho thư mục vừa thêm | | **FileChanged** | File được watch thay đổi | (none) | Không | Giám sát file, rebuild | | **PreCompact** | Trước khi dồn ngữ cảnh | manual/auto | Không | Hành động pre-dồn | | **PostCompact** | Sau khi dồn hoàn thành | (none) | Không | Hành động post-dồn | @@ -199,8 +227,13 @@ Chạy sau khi Claude tạo tham số công cụ và trước khi xử lý. Sử **Các matcher phổ biến:** `Task`, `Bash`, `Glob`, `Grep`, `Read`, `Edit`, `Write`, `WebFetch`, `WebSearch` **Điều khiển đầu ra:** -- `permissionDecision`: `"allow"`, `"deny"`, hoặc `"ask"` -- `permissionDecisionReason`: Giải thích cho quyết định +- `permissionDecision`: `"allow"`, `"deny"`, `"ask"`, hoặc `"defer"` + - `"allow"` bỏ qua prompt quyền (trừ các công cụ yêu cầu tương tác người dùng, và các công cụ connector mà tổ chức của bạn đặt thành `ask`) + - `"deny"` ngăn lệnh gọi công cụ + - `"ask"` nhắc người dùng xác nhận + - `"defer"` thoát êm để công cụ có thể được tiếp tục sau; `permissionDecisionReason`, `updatedInput` và `additionalContext` đều bị bỏ qua với giá trị này + - Các quy tắc deny và ask vẫn được đánh giá bất kể hook trả về gì. Khi nhiều hook `PreToolUse` bất đồng, thứ tự ưu tiên là `deny` > `defer` > `ask` > `allow` +- `permissionDecisionReason`: Giải thích cho quyết định. Hiển thị cho người dùng (không phải Claude) với `"allow"` và `"ask"`; hiển thị cho Claude với `"deny"`; bị bỏ qua với `"defer"` - `updatedInput`: Các tham số đầu vào công cụ đã sửa đổi ### PostToolUse diff --git a/vi/06-hooks/context-tracker-tiktoken.py b/vi/06-hooks/context-tracker-tiktoken.py index 11786bf..2182467 100644 --- a/vi/06-hooks/context-tracker-tiktoken.py +++ b/vi/06-hooks/context-tracker-tiktoken.py @@ -32,7 +32,7 @@ except ImportError: ) # Configuration -CONTEXT_LIMIT = 128000 # Claude's context window (adjust for your model) +CONTEXT_LIMIT = 1000000 # 1M trên Opus 5, Sonnet 5, Opus 4.8, Sonnet 4.6; 200000 trên Haiku 4.5 (điều chỉnh theo model của bạn) def get_state_file(session_id: str) -> str: diff --git a/vi/06-hooks/context-tracker.py b/vi/06-hooks/context-tracker.py index eb5daf9..9540271 100644 --- a/vi/06-hooks/context-tracker.py +++ b/vi/06-hooks/context-tracker.py @@ -19,7 +19,7 @@ import sys import tempfile # Configuration -CONTEXT_LIMIT = 128000 # Claude's context window (adjust for your model) +CONTEXT_LIMIT = 1000000 # 1M trên Opus 5, Sonnet 5, Opus 4.8, Sonnet 4.6; 200000 trên Haiku 4.5 (điều chỉnh theo model của bạn) def get_state_file(session_id: str) -> str: diff --git a/vi/06-hooks/format-code.sh b/vi/06-hooks/format-code.sh index 090d8d6..04bc76c 100644 --- a/vi/06-hooks/format-code.sh +++ b/vi/06-hooks/format-code.sh @@ -1,6 +1,6 @@ #!/bin/bash # Auto-format code before writing -# Hook: PreToolUse:Write +# Hook: PreToolUse (matcher: Write) FILE=$1 diff --git a/vi/06-hooks/log-bash.sh b/vi/06-hooks/log-bash.sh index 59b9efe..9e373d4 100644 --- a/vi/06-hooks/log-bash.sh +++ b/vi/06-hooks/log-bash.sh @@ -1,6 +1,6 @@ #!/bin/bash # Log all bash commands -# Hook: PostToolUse:Bash +# Hook: PostToolUse (matcher: Bash) COMMAND="$1" TIMESTAMP=$(date "+%Y-%m-%d %H:%M:%S") diff --git a/vi/06-hooks/pre-commit.sh b/vi/06-hooks/pre-commit.sh index 2e9b27a..6521ac2 100644 --- a/vi/06-hooks/pre-commit.sh +++ b/vi/06-hooks/pre-commit.sh @@ -3,6 +3,10 @@ # Hook: PreToolUse (matcher: Bash) - checks if the command is a git commit # Note: There is no "PreCommit" hook event. Use PreToolUse with a Bash matcher # and inspect the command to detect git commit operations. +# +# Mã thoát: 2 chặn lệnh gọi tool và hiển thị stderr làm lý do chặn. +# Bất kỳ giá trị khác 0 nào khác đều là lỗi KHÔNG chặn — commit vẫn tiếp tục. +# Nguồn: https://code.claude.com/docs/en/hooks echo "🧪 Running tests before commit..." @@ -11,8 +15,8 @@ if [ -f "package.json" ]; then if grep -q "\"test\":" package.json; then npm test if [ $? -ne 0 ]; then - echo "❌ Tests failed! Commit blocked." - exit 1 + echo "❌ Tests failed! Commit blocked." >&2 + exit 2 fi fi fi @@ -22,8 +26,8 @@ if [ -f "pytest.ini" ] || [ -f "setup.py" ]; then if command -v pytest &> /dev/null; then pytest if [ $? -ne 0 ]; then - echo "❌ Tests failed! Commit blocked." - exit 1 + echo "❌ Tests failed! Commit blocked." >&2 + exit 2 fi fi fi @@ -32,8 +36,8 @@ fi if [ -f "go.mod" ]; then go test ./... if [ $? -ne 0 ]; then - echo "❌ Tests failed! Commit blocked." - exit 1 + echo "❌ Tests failed! Commit blocked." >&2 + exit 2 fi fi @@ -41,8 +45,8 @@ fi if [ -f "Cargo.toml" ]; then cargo test if [ $? -ne 0 ]; then - echo "❌ Tests failed! Commit blocked." - exit 1 + echo "❌ Tests failed! Commit blocked." >&2 + exit 2 fi fi diff --git a/vi/06-hooks/security-scan.sh b/vi/06-hooks/security-scan.sh index 58ff56c..1d2d65a 100644 --- a/vi/06-hooks/security-scan.sh +++ b/vi/06-hooks/security-scan.sh @@ -1,6 +1,6 @@ #!/bin/bash # Security scan on file write -# Hook: PostToolUse:Write +# Hook: PostToolUse (matcher: Write) FILE=$1 diff --git a/vi/07-plugins/README.md b/vi/07-plugins/README.md index 02ea36a..f78c61b 100644 --- a/vi/07-plugins/README.md +++ b/vi/07-plugins/README.md @@ -336,7 +336,7 @@ Lệnh này khởi tạo một pull request review hoàn chỉnh bao gồm: --- name: security-reviewer description: Security-focused code review -tools: read, grep, diff +tools: Read, Grep, Bash --- # Security Reviewer @@ -760,7 +760,7 @@ Workflow PR review hoàn chỉnh với các kiểm tra bảo mật, testing, và ``` ## Yêu Cầu -- Claude Code 1.0+ +- Claude Code 2.1+ - Truy cập GitHub - CodeQL (tùy chọn) ``` diff --git a/vi/07-plugins/devops-automation/README.md b/vi/07-plugins/devops-automation/README.md index 877ed7e..489f12b 100644 --- a/vi/07-plugins/devops-automation/README.md +++ b/vi/07-plugins/devops-automation/README.md @@ -75,7 +75,7 @@ Complete DevOps automation for deployment, monitoring, and incident response. ## Requirements -- Claude Code 1.0+ +- Claude Code 2.1+ - Kubernetes CLI (kubectl) - Cluster access configured diff --git a/vi/07-plugins/devops-automation/agents/alert-analyzer.md b/vi/07-plugins/devops-automation/agents/alert-analyzer.md index d455e24..31622e8 100644 --- a/vi/07-plugins/devops-automation/agents/alert-analyzer.md +++ b/vi/07-plugins/devops-automation/agents/alert-analyzer.md @@ -1,7 +1,7 @@ --- name: alert-analyzer description: Analyzes monitoring alerts and system metrics -tools: read, grep, bash +tools: Read, Grep, Bash --- # Alert Analyzer diff --git a/vi/07-plugins/devops-automation/agents/deployment-specialist.md b/vi/07-plugins/devops-automation/agents/deployment-specialist.md index 47fe3f7..be667d5 100644 --- a/vi/07-plugins/devops-automation/agents/deployment-specialist.md +++ b/vi/07-plugins/devops-automation/agents/deployment-specialist.md @@ -1,7 +1,7 @@ --- name: deployment-specialist description: Handles all deployment operations -tools: read, write, bash, grep +tools: Read, Write, Bash, Grep --- # Deployment Specialist diff --git a/vi/07-plugins/devops-automation/agents/incident-commander.md b/vi/07-plugins/devops-automation/agents/incident-commander.md index d73929c..f986f9a 100644 --- a/vi/07-plugins/devops-automation/agents/incident-commander.md +++ b/vi/07-plugins/devops-automation/agents/incident-commander.md @@ -1,7 +1,7 @@ --- name: incident-commander description: Coordinates incident response -tools: read, write, bash, grep +tools: Read, Write, Bash, Grep --- # Incident Commander diff --git a/vi/07-plugins/documentation/README.md b/vi/07-plugins/documentation/README.md index 7ea4c74..6b6c338 100644 --- a/vi/07-plugins/documentation/README.md +++ b/vi/07-plugins/documentation/README.md @@ -66,7 +66,7 @@ Comprehensive documentation generation and maintenance for your project. ## Requirements -- Claude Code 1.0+ +- Claude Code 2.1+ - GitHub access (optional) ## Example Workflow diff --git a/vi/07-plugins/documentation/agents/api-documenter.md b/vi/07-plugins/documentation/agents/api-documenter.md index 487c5a4..10b34f9 100644 --- a/vi/07-plugins/documentation/agents/api-documenter.md +++ b/vi/07-plugins/documentation/agents/api-documenter.md @@ -1,7 +1,7 @@ --- name: api-documenter description: API documentation specialist -tools: read, write, grep +tools: Read, Write, Grep --- # API Documenter diff --git a/vi/07-plugins/documentation/agents/code-commentator.md b/vi/07-plugins/documentation/agents/code-commentator.md index a039443..0f91bc4 100644 --- a/vi/07-plugins/documentation/agents/code-commentator.md +++ b/vi/07-plugins/documentation/agents/code-commentator.md @@ -1,7 +1,7 @@ --- name: code-commentator description: Code comment and inline documentation specialist -tools: read, write, edit +tools: Read, Write, Edit --- # Code Commentator diff --git a/vi/07-plugins/documentation/agents/example-generator.md b/vi/07-plugins/documentation/agents/example-generator.md index 1cd1c7e..9f6cb95 100644 --- a/vi/07-plugins/documentation/agents/example-generator.md +++ b/vi/07-plugins/documentation/agents/example-generator.md @@ -1,7 +1,7 @@ --- name: example-generator description: Code example and tutorial specialist -tools: read, write +tools: Read, Write --- # Example Generator diff --git a/vi/07-plugins/pr-review/README.md b/vi/07-plugins/pr-review/README.md index 633b99e..763fd6a 100644 --- a/vi/07-plugins/pr-review/README.md +++ b/vi/07-plugins/pr-review/README.md @@ -58,7 +58,7 @@ Complete PR review workflow with security, testing, and documentation checks. ## Requirements -- Claude Code 1.0+ +- Claude Code 2.1+ - GitHub access - Git repository diff --git a/vi/07-plugins/pr-review/agents/performance-analyzer.md b/vi/07-plugins/pr-review/agents/performance-analyzer.md index 2f70938..db038f2 100644 --- a/vi/07-plugins/pr-review/agents/performance-analyzer.md +++ b/vi/07-plugins/pr-review/agents/performance-analyzer.md @@ -1,7 +1,7 @@ --- name: performance-analyzer description: Performance impact analysis -tools: read, grep, bash +tools: Read, Grep, Bash --- # Performance Analyzer diff --git a/vi/07-plugins/pr-review/agents/security-reviewer.md b/vi/07-plugins/pr-review/agents/security-reviewer.md index 191b07d..fe51e3a 100644 --- a/vi/07-plugins/pr-review/agents/security-reviewer.md +++ b/vi/07-plugins/pr-review/agents/security-reviewer.md @@ -1,7 +1,7 @@ --- name: security-reviewer description: Security-focused code review -tools: read, grep, bash +tools: Read, Grep, Bash --- # Security Reviewer diff --git a/vi/07-plugins/pr-review/agents/test-checker.md b/vi/07-plugins/pr-review/agents/test-checker.md index 90a065d..f14f1d5 100644 --- a/vi/07-plugins/pr-review/agents/test-checker.md +++ b/vi/07-plugins/pr-review/agents/test-checker.md @@ -1,7 +1,7 @@ --- name: test-checker description: Test coverage and quality analysis -tools: read, bash, grep +tools: Read, Bash, Grep --- # Test Checker diff --git a/vi/08-checkpoints/README.md b/vi/08-checkpoints/README.md index cbba937..4ed32e9 100644 --- a/vi/08-checkpoints/README.md +++ b/vi/08-checkpoints/README.md @@ -207,15 +207,21 @@ Vì checkpoints được tạo tự động, bạn có thể tập trung vào c ## Cấu Hình / Configuration -Bạn có thể bật/tắt checkpoints tự động trong settings của bạn: +Hai setting chi phối hành vi checkpoint — có chụp snapshot hay không, và giữ chúng bao lâu: ```json { - "autoCheckpoint": true + "fileCheckpointingEnabled": true, + "cleanupPeriodDays": 30 } ``` -- `autoCheckpoint`: Bật hoặc tắt tạo checkpoint tự động trên mọi prompt người dùng (mặc định: `true`) +| Setting | Mặc Định | Tác Dụng | +|---------|---------|--------| +| `fileCheckpointingEnabled` | `true` | Chụp snapshot file trước mỗi lần chỉnh sửa để `/rewind` có thể khôi phục. Yêu cầu v2.1.119+. Hiển thị trong `/config` dưới tên **Rewind code (checkpoints)**. Biến môi trường tương đương: `CLAUDE_CODE_DISABLE_FILE_CHECKPOINTING` | +| `cleanupPeriodDays` | `30` | Số ngày giữ lịch sử phiên và checkpoints | + +Claude Code giữ snapshot cho **100 checkpoint gần nhất**; các checkpoint cũ hơn bị loại bỏ ngay cả khi còn trong thời hạn lưu giữ. ## Hạn Chế / Limitations @@ -233,7 +239,7 @@ Checkpoints có các hạn chế sau: **Giải Pháp**: - Kiểm tra nếu checkpoints đã bị xóa -- Xác minh rằng `autoCheckpoint` được bật trong settings của bạn +- Xác minh rằng `fileCheckpointingEnabled` được bật trong settings của bạn - Kiểm tra dung lượng đĩa ### Rewind Thất Bại / Rewind Failed diff --git a/vi/09-advanced-features/README.md b/vi/09-advanced-features/README.md index 0f7a6b6..2155a78 100644 --- a/vi/09-advanced-features/README.md +++ b/vi/09-advanced-features/README.md @@ -1672,7 +1672,7 @@ Since v2.1.83, administrators can deploy multiple managed settings files into a ```json { "permissions": { - "mode": "default" + "defaultMode": "manual" }, "hooks": { "PreToolUse:Edit": "eslint --fix ${file_path}", @@ -1695,7 +1695,7 @@ Since v2.1.83, administrators can deploy multiple managed settings files into a ```json { "permissions": { - "mode": "default", + "defaultMode": "manual", "allowedTools": ["Bash(git log:*)", "Read"], "disallowedTools": ["Bash(rm -rf:*)"] }, @@ -1797,7 +1797,7 @@ Create `.claude/config.json` in your project: "PreToolUse": [{ "matcher": "Bash", "hooks": ["npm test && npm run lint"] }] }, "permissions": { - "mode": "default" + "defaultMode": "manual" }, "mcp": { "servers": { diff --git a/vi/CATALOG.md b/vi/CATALOG.md index 5c57b50..f63852f 100644 --- a/vi/CATALOG.md +++ b/vi/CATALOG.md @@ -15,14 +15,14 @@ | Tính Năng | Built-in | Ví Dụ | Tổng | Tham Chiếu | |---------|----------|----------|-------|-----------| -| **Lệnh Slash** | 55+ | 8 | 63+ | [01-slash-commands/](../01-slash-commands/) | -| **Tác Nhân Con** | 6 | 10 | 16 | [04-subagents/](../04-subagents/) | -| **Skills** | 5 bundled | 4 | 9 | [03-skills/](../03-skills/) | +| **Lệnh Slash** | 60+ | 8 | 68+ | [01-slash-commands/](../01-slash-commands/) | +| **Tác Nhân Con** | 6 | 6 | 12 | [04-subagents/](../04-subagents/) | +| **Skills** | 10 bundled | 5 | 15 | [03-skills/](../03-skills/) | | **Plugins** | - | 3 | 3 | [07-plugins/](../07-plugins/) | -| **MCP Servers** | 1 | 8 | 9 | [05-mcp/](../05-mcp/) | -| **Hooks** | 25 sự kiện | 7 | 7 | [06-hooks/](../06-hooks/) | -| **Bộ Nhớ** | 7 loại | 3 | 3 | [02-memory/](../02-memory/) | -| **Tổng** | **99** | **43** | **117** | | +| **MCP Servers** | 1 | 4 | 5 | [05-mcp/](../05-mcp/) | +| **Hooks** | 31 sự kiện | 9 | 40 | [06-hooks/](../06-hooks/) | +| **Bộ Nhớ** | 7 loại | 3 | 10 | [02-memory/](../02-memory/) | +| **Tổng** | **115** | **38** | **153** | | --- @@ -79,7 +79,8 @@ Commands là các lệnh tắt do người dùng gọi thực hiện các hành | `/desktop` | Mở Claude Desktop app | Chuyển sang interface desktop | | `/theme` | Đổi màu theme | Tùy chỉnh giao diện | | `/usage` | Hiển thị thống kê usage API | Giám sát quota và chi phí | -| `/fork` | Fork conversation hiện tại | Khám phá alternatives | +| `/fork` | Sao chép cuộc hội thoại thành một phiên nền độc lập mới (v2.1.212+) | Khám phá alternatives song song | +| `/subtask` | Spawn một subagent được fork kế thừa cuộc hội thoại và báo cáo lại (v2.1.212+) | Giao một tác vụ phụ mà không mất chỗ đang làm | | `/stats` | Hiển thị thống kê session | Review metrics session | | `/statusline` | Cấu hình status line | Tùy chỉnh hiển thị trạng thái | | `/stickers` | Xem stickers của session | Phần thưởng vui | diff --git a/vi/CLAUDE.md b/vi/CLAUDE.md index 351cc55..073405a 100644 --- a/vi/CLAUDE.md +++ b/vi/CLAUDE.md @@ -12,7 +12,7 @@ Claude How To là một repository tutorial về các tính năng của Claude C ### Kiểm Tra Chất Lượng Pre-commit -Tất cả documentation phải vượt qua bốn kiểm tra chất lượng trước khi commit (các kiểm tra này chạy tự động qua pre-commit hooks): +Tất cả documentation phải vượt qua năm kiểm tra chất lượng trước khi commit (các kiểm tra này chạy tự động qua pre-commit hooks): ```bash # Cài đặt pre-commit hooks (chạy trên mỗi commit) @@ -22,7 +22,7 @@ pre-commit install pre-commit run --all-files ``` -Bốn kiểm tra là: +Năm kiểm tra là: 1. **markdown-lint** — Cấu trúc và định dạng Markdown qua `markdownlint` 2. **cross-references** — Liên kết nội bộ, anchors, cú pháp code fence (Python script) 3. **mermaid-syntax** — Xác thực tất cả sơ đồ Mermaid parse đúng (Python script) @@ -141,7 +141,7 @@ Mỗi thư mục đánh số tuân theo pattern: 2. **Scripts là các tiện ích, không phải sản phẩm** — Các script Python trong `scripts/` hỗ trợ chất lượng documentation và tạo EPUB. Nội dung thực tế nằm trong các thư mục module đánh số. -3. **Pre-commit là người gác cổng** — Tất cả bốn kiểm tra chất lượng phải pass trước khi PR được chấp nhận. CI pipeline chạy các kiểm tra tương tự như lần thứ hai. +3. **Pre-commit là người gác cổng** — Tất cả năm kiểm tra chất lượng phải pass trước khi PR được chấp nhận. CI pipeline chạy các kiểm tra tương tự như lần thứ hai. 4. **Mermaid rendering cần network** — EPUB build gọi Kroki.io API để render diagrams. Các lỗi build ở đây thường là vấn đề network hoặc cú pháp Mermaid không hợp lệ. diff --git a/vi/CONTRIBUTING.md b/vi/CONTRIBUTING.md index 148fe37..d9d9c50 100644 --- a/vi/CONTRIBUTING.md +++ b/vi/CONTRIBUTING.md @@ -68,7 +68,7 @@ git checkout -b docs/improvement-area ### 3. Thiết Lập Môi Trường Của Bạn -Pre-commit hooks chạy cùng các kiểm tra như CI cục bộ trước mỗi commit. Tất cả bốn kiểm tra phải pass trước khi PR được chấp nhận. +Pre-commit hooks chạy cùng các kiểm tra như CI cục bộ trước mỗi commit. Tất cả năm kiểm tra phải pass trước khi PR được chấp nhận. **Dependencies được yêu cầu:** diff --git a/vi/INDEX.md b/vi/INDEX.md index be9547f..71ee426 100644 --- a/vi/INDEX.md +++ b/vi/INDEX.md @@ -218,11 +218,11 @@ Các script tự động hóa dựa trên sự kiện thực thi tự động. **Cách Dùng**: Cấu hình trong settings, thực thi tự động -**Hook Types** (4 types, 25 events): -- Tool Hooks: PreToolUse, PostToolUse, PostToolUseFailure, PermissionRequest -- Session Hooks: SessionStart, SessionEnd, Stop, StopFailure, SubagentStart, SubagentStop -- Task Hooks: UserPromptSubmit, TaskCompleted, TaskCreated, TeammateIdle -- Lifecycle Hooks: ConfigChange, CwdChanged, FileChanged, PreCompact, PostCompact, WorktreeCreate, WorktreeRemove, Notification, InstructionsLoaded, Elicitation, ElicitationResult +**Hook Types** (5 types, 31 events): +- Tool Hooks: PreToolUse, PostToolUse, PostToolUseFailure, PostToolBatch, PermissionRequest, PermissionDenied +- Session Hooks: SessionStart, Setup, SessionEnd, Stop, StopFailure, SubagentStart, SubagentStop +- Task Hooks: UserPromptSubmit, UserPromptExpansion, MessageDisplay, TaskCompleted, TaskCreated, TeammateIdle +- Lifecycle Hooks: ConfigChange, CwdChanged, DirectoryAdded, FileChanged, PreCompact, PostCompact, WorktreeCreate, WorktreeRemove, Notification, InstructionsLoaded, Elicitation, ElicitationResult --- @@ -393,8 +393,8 @@ Các khả năng nâng cao cho workflows phức tạp. - **default**: Hỏi phê duyệt cho hành động rủi ro - **acceptEdits**: Tự động chấp nhận edits file, hỏi cho các khác - **plan**: Phân tích read-only, không sửa đổi -- **auto**: Tự động phê duyệt hành động an toàn, hỏi cho rủi ro -- **dontAsk**: Chấp nhận tất cả trừ rủi ro +- **auto**: Mọi thứ, với kiểm tra an toàn chạy nền — một classifier review các lệnh và thao tác ghi vào thư mục được bảo vệ (cấu hình qua đối tượng settings `autoMode`) +- **dontAsk**: Chỉ các tool đã được phê duyệt trước — tự động từ chối mọi lệnh gọi lẽ ra sẽ hỏi. Claude chỉ chạy các mục khớp `permissions.allow`, các lệnh Bash chỉ-đọc, và các lệnh gọi được hook `PreToolUse` phê duyệt - **bypassPermissions**: Chấp nhận tất cả (yêu cầu `--dangerously-skip-permissions`) ### Headless Mode (`claude -p`) diff --git a/vi/LEARNING-ROADMAP.md b/vi/LEARNING-ROADMAP.md index 751512e..493d558 100644 --- a/vi/LEARNING-ROADMAP.md +++ b/vi/LEARNING-ROADMAP.md @@ -92,12 +92,12 @@ graph TD | Bước | Tính Năng | Độ Phức Tạp | Thời Gian | Cấp Độ | Dependencies | Tại Sao Học Cái Này | Lợi Ích Chính | |------|---------|-----------|----------|-------|--------------|------------------|--------------| -| **1** | [Lệnh Slash](../01-slash-commands/) | ⭐ Người mới | 30 phút | Level 1 | None | Gains năng suất nhanh (55+ built-in + 5 bundled skills) | Tự động hóa tức thì, tiêu chuẩn team | +| **1** | [Lệnh Slash](../01-slash-commands/) | ⭐ Người mới | 30 phút | Level 1 | None | Gains năng suất nhanh (55+ built-in + 10 bundled skills) | Tự động hóa tức thì, tiêu chuẩn team | | **2** | [Bộ Nhớ](../02-memory/) | ⭐⭐ Người mới+ | 45 phút | Level 1 | None | Thiết yếu cho tất cả tính năng | Ngữ cảnh lưu trữ, sở thích | | **3** | [Checkpoints](../08-checkpoints/) | ⭐⭐ Trung cấp | 45 phút | Level 1 | Quản lý session | Khám phá an toàn | Thử nghiệm, phục hồi | | **4** | [CLI Cơ Bản](../10-cli/) | ⭐⭐ Người mới+ | 30 phút | Level 1 | None | Sử dụng CLI cốt | Mode tương tác & print | | **5** | [Skills](../03-skills/) | ⭐⭐ Trung cấp | 1 giờ | Level 2 | Lệnh Slash | Chuyên môn tự động | Khả năng tái sử dụng, nhất quán | -| **6** | [Hooks](../06-hooks/) | ⭐⭐ Trung cấp | 1 giờ | Level 2 | Tools, Commands | Tự động hóa workflow (25 sự kiện, 4 types) | Xác thực, cổng chất lượng | +| **6** | [Hooks](../06-hooks/) | ⭐⭐ Trung cấp | 1 giờ | Level 2 | Tools, Commands | Tự động hóa workflow (31 sự kiện, 5 types) | Xác thực, cổng chất lượng | | **7** | [MCP](../05-mcp/) | ⭐⭐⭐ Trung cấp+ | 1 giờ | Level 2 | Cấu hình | Truy cập dữ liệu trực tiếp | Tích hợp thời gian thực, APIs | | **8** | [Tác Nhân Con](../04-subagents/) | ⭐⭐⭐ Trung cấp+ | 1.5 giờ | Level 2 | Bộ Nhớ, Commands | Xử lý task phức tạp (6 built-in bao gồm Bash) | Ủy quyền, chuyên môn hóa | | **9** | [Tính Năng Nâng Cao](../09-advanced-features/) | ⭐⭐⭐⭐⭐ Nâng cao | 2-3 giờ | Level 3 | Tất cả trước | Công cụ power user | Planning, Auto Mode, Channels, Voice Dictation, permissions | diff --git a/vi/QUICK_REFERENCE.md b/vi/QUICK_REFERENCE.md index 5b93a9c..93e3e89 100644 --- a/vi/QUICK_REFERENCE.md +++ b/vi/QUICK_REFERENCE.md @@ -95,7 +95,7 @@ chmod +x ~/.claude/hooks/*.sh # default - Hỏi phê duyệt cho các hành động rủi ro # acceptEdits - Tự động chấp nhận chỉnh sửa file, hỏi cho các hành động khác # plan - Chỉ đọc phân tích, không sửa đổi -# dontAsk - Chấp nhận tất cả hành động trừ các hành động rủi ro +# dontAsk - Chỉ các tool đã phê duyệt trước được chạy; mọi thứ khác bị từ chối # auto - Bộ phân loại nền quyết định quyền tự động # bypassPermissions - Chấp nhận tất cả hành động (yêu cầu --dangerously-skip-permissions) @@ -118,7 +118,7 @@ claude -r "session" # Tiếp tục phiên theo tên/ID | **Skills** | `.claude/skills/*/SKILL.md` | Tự động gọi | | **Tác Nhân Con** | `.claude/agents/*.md` | Tự động ủy quyền | | **MCP** | `.mcp.json` (dự án) hoặc `~/.claude.json` (người dùng) | `/mcp__server__action` | -| **Hooks (25 sự kiện)** | `~/.claude/hooks/*.sh` | Kích hoạt sự kiện (4 loại) | +| **Hooks (31 sự kiện)** | `~/.claude/hooks/*.sh` | Kích hoạt sự kiện (5 loại) | | **Plugins** | Thông qua `/plugin install` | Gói tất cả | | **Checkpoints** | Được tích hợp sẵn | `Esc+Esc` hoặc `/rewind` | | **Chế Độ Lập Kế Hoạch** | Được tích hợp sẵn | `/plan ` | @@ -189,7 +189,7 @@ vim CLAUDE.md ### Tự Động Hóa & Hooks ```bash -# Cài đặt hooks (25 sự kiện, 4 loại: command, http, prompt, agent) +# Cài đặt hooks (31 sự kiện, 5 loại: command, http, mcp_tool, prompt, agent) mkdir -p ~/.claude/hooks cp 06-hooks/*.sh ~/.claude/hooks/ chmod +x ~/.claude/hooks/*.sh @@ -389,7 +389,7 @@ cp -r 03-skills/code-review-specialist ~/.claude/skills/ | **Chế Độ Tự Động** | Vận hành hoàn toàn tự chủ với bộ phân loại nền | Cờ `--enable-auto-mode`, `Shift+Tab` để chuyển đổi chế độ | | **Kênh** | Tích hợp Discord và Telegram | Cờ `--channels`, bot Discord/Telegram | | **Nhập Liệu Giọng Nói** | Nói lệnh và bối cảnh cho Claude | Lệnh `/voice` | -| **Hooks (25 sự kiện)** | Hệ thống hook mở rộng với 4 loại | Các loại hook command, http, prompt, agent | +| **Hooks (31 sự kiện)** | Hệ thống hook mở rộng với 5 loại | Các loại hook command, http, mcp_tool, prompt, agent | | **MCP Elicitation** | MCP servers có thể yêu cầu input người dùng tại runtime | Tự động nhắc khi server cần làm rõ | | **WebSocket MCP** | Vận chuyển WebSocket cho kết nối MCP | Cấu hình trong `.mcp.json` với URL `ws://` | | **Plugin LSP** | Hỗ trợ Language Server Protocol cho plugins | `userConfig`, biến `${CLAUDE_PLUGIN_DATA}` | @@ -445,7 +445,7 @@ echo $GITHUB_TOKEN | Workflow tự động | Skill | `03-skills/code-review-specialist/` | | Tác vụ chuyên biệt | Tác Nhân Con | `04-subagents/code-reviewer.md` | | Dữ liệu bên ngoài | MCP (+ Elicitation, WebSocket) | `05-mcp/github-mcp.json` | -| Tự động hóa sự kiện | Hook (25 sự kiện, 4 loại) | `06-hooks/pre-commit.sh` | +| Tự động hóa sự kiện | Hook (31 sự kiện, 5 loại) | `06-hooks/pre-commit.sh` | | Giải pháp hoàn chỉnh | Plugin (+ hỗ trợ LSP) | `07-plugins/pr-review/` | | Thử nghiệm an toàn | Checkpoint | `08-checkpoints/checkpoint-examples.md` | | Hoàn toàn tự chủ | Chế Độ Tự Động | `--enable-auto-mode` hoặc `Shift+Tab` | diff --git a/vi/resources.md b/vi/resources.md index 03e451e..e14ef29 100644 --- a/vi/resources.md +++ b/vi/resources.md @@ -144,11 +144,11 @@ graph TD S --> T[Test Automation] T --> U[Repository Ready] - style A fill:#e1f5ff - style G fill:#fff4e1 - style K fill:#f0ffe1 - style Q fill:#ffe1f5 - style U fill:#90EE90 + style A fill:#e1f5fe,stroke:#333,color:#333 + style G fill:#fff9c4,stroke:#333,color:#333 + style K fill:#e8f5e9,stroke:#333,color:#333 + style Q fill:#f3e5f5,stroke:#333,color:#333 + style U fill:#e8f5e9,stroke:#333,color:#333 ``` #### Cho Repository Hiện Có / For an Existing Repository @@ -209,12 +209,12 @@ graph TD Y -->|Yes| H Y -->|No| Z[Workflow Complete] - style A fill:#e1f5ff - style C fill:#ffecec - style D fill:#fff4e1 - style P fill:#f0ffe1 - style T fill:#ffe1f5 - style Z fill:#90EE90 + style A fill:#e1f5fe,stroke:#333,color:#333 + style C fill:#fce4ec,stroke:#333,color:#333 + style D fill:#fff9c4,stroke:#333,color:#333 + style P fill:#e8f5e9,stroke:#333,color:#333 + style T fill:#f3e5f5,stroke:#333,color:#333 + style Z fill:#e8f5e9,stroke:#333,color:#333 ``` **Tips**: @@ -240,7 +240,7 @@ Các bước này capture các core recommendations cho smooth workflows với C | **Extended Thinking** | Deep reasoning toggle qua `Alt+T`/`Option+T` hoặc `MAX_THINKING_TOKENS` env var | [Advanced Features](09-advanced-features/) | | **Permission Modes** | Fine-grained control: default, acceptEdits, plan, auto, dontAsk, bypassPermissions | [Advanced Features](09-advanced-features/) | | **7-Tier Memory** | Managed Policy, Project, Project Rules, User, User Rules, Local, Auto Memory | [Memory Guide](02-memory/) | -| **Hook Events** | 25 events: PreToolUse, PostToolUse, PostToolUseFailure, Stop, StopFailure, SubagentStart, SubagentStop, Notification, Elicitation, và nhiều hơn | [Hooks Guide](06-hooks/) | +| **Hook Events** | 31 events: PreToolUse, PostToolUse, PostToolUseFailure, Stop, StopFailure, SubagentStart, SubagentStop, Notification, Elicitation, và nhiều hơn | [Hooks Guide](06-hooks/) | | **Agent Teams** | Phối hợp nhiều agents làm việc cùng nhau trên các complex tasks | [Subagents Guide](04-subagents/) | | **Scheduled Tasks** | Thiết lập recurring tasks với `/loop` và cron tools | [Advanced Features](09-advanced-features/) | | **Chrome Integration** | Browser automation với headless Chromium | [Advanced Features](09-advanced-features/) | diff --git a/zh/01-slash-commands/README.md b/zh/01-slash-commands/README.md index 70848f0..c92b04e 100644 --- a/zh/01-slash-commands/README.md +++ b/zh/01-slash-commands/README.md @@ -24,7 +24,9 @@ Claude Code 目前提供 55+ 个内置命令和 5 个内置 Skills。你可以 |---------|---------| | `/add-dir ` | 添加工作目录 | | `/agents` | 管理 agent 配置 | -| `/branch [name]` | 将当前对话分支到新会话(别名:`/fork`。注意:`/fork` 在 v2.1.77 中更名为 `/branch`) | +| `/branch [name]` | 切换到当前对话的一个副本,原对话保持不变 | +| `/fork [prompt]` | 把当前对话复制到一个新的**后台会话**,你可以继续在这里工作;从这一刻起两者互相独立,副本会在 `claude agents` 里占一行(v2.1.212+) | +| `/subtask ` | 派生一个**forked subagent**,它继承完整对话并去执行该任务,你可以继续工作;任务完成后结果会返回到本对话(v2.1.212+) | | `/btw ` | 额外问题,不写入历史 | | `/chrome` | 配置 Chrome 浏览器集成 | | `/clear` | 清空对话(别名:`/reset`、`/new`) | @@ -100,14 +102,13 @@ Claude Code 目前提供 55+ 个内置命令和 5 个内置 Skills。你可以 | 命令 | 状态 | |---------|--------| | `/review` | 已弃用,已被 `code-review` 插件替代 | -| `/output-style` | 自 v2.1.73 起弃用 | -| `/fork` | 已重命名为 `/branch`(别名仍可用,v2.1.77) | +| `/output-style` | 已于 v2.1.91 移除(v2.1.73 起弃用)— 改用 `/config` → Output style,或 `outputStyle` 设置 | | `/vim` | 自 v2.1.92 起移除;改用 `/config → Editor mode` | ### 最近变化 -- `/fork` 已更名为 `/branch`,但保留 `/fork` 作为别名(v2.1.77) -- `/output-style` 已弃用(v2.1.73) +- `/fork` 与 `/subtask` 在 **v2.1.212** 互换了角色。`/fork` 现在是把对话复制到一个独立的后台会话;原来的 forked subagent 行为转移到了新命令 `/subtask`。历史:v2.1.77–v2.1.161 期间 `/fork` 是 `/branch` 的别名;v2.1.161–v2.1.211 期间它启动 forked subagent(即现在 `/subtask` 的行为)。关闭 agent view 时 `/subtask` 不可用,`/fork` 仍保留 forked subagent 行为 +- `/output-style` 已弃用(v2.1.73)并于 v2.1.91 移除 — output styles 仍可通过 `/config` → Output style 或 `outputStyle` 设置使用 - `/review` 已弃用,推荐改用 `code-review` 插件 - 新增 `/effort`,其中 `max` 级别需要 Opus 4.6 - 新增 `/voice`,用于按住说话语音输入 diff --git a/zh/01-slash-commands/doc-refactor.md b/zh/01-slash-commands/doc-refactor.md index 4569912..d477458 100644 --- a/zh/01-slash-commands/doc-refactor.md +++ b/zh/01-slash-commands/doc-refactor.md @@ -1,7 +1,6 @@ --- -name: 文档重构 +name: doc-refactor description: 为项目重新组织文档结构,以提升清晰度和可访问性 -tags: documentation, refactoring, organization --- # 文档重构 diff --git a/zh/01-slash-commands/setup-ci-cd.md b/zh/01-slash-commands/setup-ci-cd.md index 7e21df8..163d12f 100644 --- a/zh/01-slash-commands/setup-ci-cd.md +++ b/zh/01-slash-commands/setup-ci-cd.md @@ -1,7 +1,6 @@ --- -name: 设置 CI/CD 流水线 +name: setup-ci-cd description: 实现 pre-commit hooks 和 GitHub Actions 质量保障 -tags: ci-cd, devops, automation --- # 设置 CI/CD 流水线 diff --git a/zh/01-slash-commands/unit-test-expand.md b/zh/01-slash-commands/unit-test-expand.md index 9867ec0..8a8bfc1 100644 --- a/zh/01-slash-commands/unit-test-expand.md +++ b/zh/01-slash-commands/unit-test-expand.md @@ -1,7 +1,6 @@ --- -name: 扩充单元测试 +name: unit-test-expand description: 通过覆盖未测试分支和边界情况来提高测试覆盖率 -tags: testing, coverage, unit-tests --- # 扩充单元测试 diff --git a/zh/02-memory/directory-api-CLAUDE.md b/zh/02-memory/directory-api-CLAUDE.md index 200187d..1c7f110 100644 --- a/zh/02-memory/directory-api-CLAUDE.md +++ b/zh/02-memory/directory-api-CLAUDE.md @@ -1,6 +1,6 @@ # API 模块规范 -本文件会覆盖 `/src/api/` 下所有内容对应的根目录 `CLAUDE.md`。 +本文件是对根目录 `CLAUDE.md` 的补充,作用于 `/src/api/` 下的所有内容。memory 文件是拼接(concatenate)而不是覆盖 — 根目录 `CLAUDE.md` 依然生效,Claude Code 会在读取该子目录下的文件时按需加载本文件。 ## API 专属规范 diff --git a/zh/03-skills/claude-md/SKILL.md b/zh/03-skills/claude-md/SKILL.md index 82db31b..ec954db 100644 --- a/zh/03-skills/claude-md/SKILL.md +++ b/zh/03-skills/claude-md/SKILL.md @@ -193,10 +193,14 @@ agent_docs/ 如果用户请求创建或更新 AGENTS.md: -AGENTS.md 用于定义专门的 agent 行为。与 CLAUDE.md(项目上下文)不同,AGENTS.md 定义的是: -- 自定义 agent 角色和能力 -- agent 级约束与说明 -- 多 agent 场景下的工作流定义 +**Claude Code 不会直接读取 AGENTS.md。** 要让它生效,需要在 CLAUDE.md 中用 `@AGENTS.md` 导入,或者把 `CLAUDE.md` 软链接到它。这是关于这个文件最常见的误解。 + +AGENTS.md 是一个跨工具的项目上下文文件 — 和 CLAUDE.md 属于同一*类*文档,而不是 agent 定义格式。它的存在是为了让多个编码 agent 共用同一套项目约定: +- 构建、测试和 lint 命令 +- 代码风格与架构约定 +- 仓库结构以及各部分所在位置 + +Subagents 是单独定义的,放在 `.claude/agents/*.md` 里 — 不在 AGENTS.md 中。 同样适用以下原则: - 保持聚焦和简洁 diff --git a/zh/03-skills/doc-generator/SKILL.md b/zh/03-skills/doc-generator/SKILL.md index 3f4dcb8..852c4c7 100644 --- a/zh/03-skills/doc-generator/SKILL.md +++ b/zh/03-skills/doc-generator/SKILL.md @@ -18,7 +18,7 @@ description: 从源代码生成全面且准确的 API 文档。适用于创建 ### 每个端点的写法 -```markdown +````markdown ## GET /api/v1/users/:id ### 描述 @@ -73,4 +73,4 @@ response = requests.get( ) user = response.json() ``` -``` +```` diff --git a/zh/03-skills/refactor/SKILL.md b/zh/03-skills/refactor/SKILL.md index 8edb205..7af372c 100644 --- a/zh/03-skills/refactor/SKILL.md +++ b/zh/03-skills/refactor/SKILL.md @@ -1,5 +1,5 @@ --- -name: code-refactor +name: refactor description: 基于 Martin Fowler 方法论的系统化代码重构 skill。适用于用户请求重构代码、改进代码结构、减少技术债、清理旧代码、消除 code smell 或提升可维护性时。这个 skill 采用分阶段、带研究与计划的安全增量实施方式。 --- diff --git a/zh/06-hooks/README.md b/zh/06-hooks/README.md index f7b3342..2b6a50f 100644 --- a/zh/06-hooks/README.md +++ b/zh/06-hooks/README.md @@ -22,12 +22,12 @@ Hooks 是事件驱动的自动化机制。它们会在 Claude Code 发生某些 ## Hook 类型 -Claude Code 提供 4 类、25 个事件: +Claude Code 支持 31 个 hook 事件,按用途分为以下 4 组。事件的 handler 类型共 5 种:`command`、`http`、`mcp_tool`、`prompt`、`agent`。 -- **Tool Hooks**:`PreToolUse`、`PostToolUse`、`PostToolUseFailure`、`PermissionRequest` -- **Session Hooks**:`SessionStart`、`SessionEnd`、`Stop`、`StopFailure`、`SubagentStart`、`SubagentStop` -- **Task Hooks**:`UserPromptSubmit`、`TaskCompleted`、`TaskCreated`、`TeammateIdle` -- **Lifecycle Hooks**:`ConfigChange`、`CwdChanged`、`FileChanged`、`PreCompact`、`PostCompact`、`WorktreeCreate`、`WorktreeRemove`、`Notification`、`InstructionsLoaded`、`Elicitation`、`ElicitationResult` +- **Tool Hooks**:`PreToolUse`、`PostToolUse`、`PostToolUseFailure`、`PostToolBatch`、`PermissionRequest`、`PermissionDenied` +- **Session Hooks**:`SessionStart`、`Setup`、`SessionEnd`、`Stop`、`StopFailure`、`SubagentStart`、`SubagentStop` +- **Task Hooks**:`UserPromptSubmit`、`UserPromptExpansion`、`MessageDisplay`、`TaskCompleted`、`TaskCreated`、`TeammateIdle` +- **Lifecycle Hooks**:`ConfigChange`、`CwdChanged`、`DirectoryAdded`、`FileChanged`、`PreCompact`、`PostCompact`、`WorktreeCreate`、`WorktreeRemove`、`Notification`、`InstructionsLoaded`、`Elicitation`、`ElicitationResult` ## 安装 diff --git a/zh/07-plugins/README.md b/zh/07-plugins/README.md index 9e28a6c..4df21c2 100644 --- a/zh/07-plugins/README.md +++ b/zh/07-plugins/README.md @@ -323,7 +323,7 @@ description: 启动包含安全和测试检查的完整 PR 审查 --- name: security-reviewer description: 面向安全的代码审查 -tools: read, grep, diff +tools: Read, Grep, Bash --- # Security Reviewer @@ -747,7 +747,7 @@ claude --plugin-dir ./my-plugin --plugin-dir ./another-plugin ``` ## 要求 -- Claude Code 1.0+ +- Claude Code 2.1+ - GitHub 访问权限 - CodeQL(可选) ``` diff --git a/zh/07-plugins/devops-automation/README.md b/zh/07-plugins/devops-automation/README.md index 0131c53..d293d95 100644 --- a/zh/07-plugins/devops-automation/README.md +++ b/zh/07-plugins/devops-automation/README.md @@ -81,7 +81,7 @@ tags: plugins, devops, automation ## 要求 -- Claude Code 1.0+ +- Claude Code 2.1+ - Kubernetes CLI(kubectl) - 已配置集群访问 diff --git a/zh/07-plugins/devops-automation/agents/alert-analyzer.md b/zh/07-plugins/devops-automation/agents/alert-analyzer.md index 647094d..25d794a 100644 --- a/zh/07-plugins/devops-automation/agents/alert-analyzer.md +++ b/zh/07-plugins/devops-automation/agents/alert-analyzer.md @@ -1,7 +1,7 @@ --- name: alert-analyzer description: 分析监控告警和系统指标 -tools: read, grep, bash +tools: Read, Grep, Bash --- # 告警分析器 diff --git a/zh/07-plugins/devops-automation/agents/deployment-specialist.md b/zh/07-plugins/devops-automation/agents/deployment-specialist.md index 4b5f116..90941e2 100644 --- a/zh/07-plugins/devops-automation/agents/deployment-specialist.md +++ b/zh/07-plugins/devops-automation/agents/deployment-specialist.md @@ -1,7 +1,7 @@ --- name: deployment-specialist description: 处理所有部署操作 -tools: read, write, bash, grep +tools: Read, Write, Bash, Grep --- # 部署专家 diff --git a/zh/07-plugins/devops-automation/agents/incident-commander.md b/zh/07-plugins/devops-automation/agents/incident-commander.md index a749580..ba567db 100644 --- a/zh/07-plugins/devops-automation/agents/incident-commander.md +++ b/zh/07-plugins/devops-automation/agents/incident-commander.md @@ -1,7 +1,7 @@ --- name: incident-commander description: 协调事故响应 -tools: read, write, bash, grep +tools: Read, Write, Bash, Grep --- # 事故指挥官 diff --git a/zh/07-plugins/documentation/README.md b/zh/07-plugins/documentation/README.md index 670d7ec..79440ca 100644 --- a/zh/07-plugins/documentation/README.md +++ b/zh/07-plugins/documentation/README.md @@ -74,7 +74,7 @@ tags: plugins, documentation, automation ## 需求 -- Claude Code 1.0+ +- Claude Code 2.1+ - GitHub 访问权限(可选) ## 示例工作流 diff --git a/zh/07-plugins/documentation/agents/api-documenter.md b/zh/07-plugins/documentation/agents/api-documenter.md index 40343de..99e7d7d 100644 --- a/zh/07-plugins/documentation/agents/api-documenter.md +++ b/zh/07-plugins/documentation/agents/api-documenter.md @@ -1,7 +1,7 @@ --- name: api-documenter description: API 文档专家 -tools: read, write, grep +tools: Read, Write, Grep --- # API 文档专家 diff --git a/zh/07-plugins/documentation/agents/code-commentator.md b/zh/07-plugins/documentation/agents/code-commentator.md index 8b0d9f2..962af98 100644 --- a/zh/07-plugins/documentation/agents/code-commentator.md +++ b/zh/07-plugins/documentation/agents/code-commentator.md @@ -1,7 +1,7 @@ --- name: code-commentator description: 代码注释与内联文档专家 -tools: read, write, edit +tools: Read, Write, Edit --- # 代码注释专家 diff --git a/zh/07-plugins/documentation/agents/example-generator.md b/zh/07-plugins/documentation/agents/example-generator.md index abbc01c..8cfaab6 100644 --- a/zh/07-plugins/documentation/agents/example-generator.md +++ b/zh/07-plugins/documentation/agents/example-generator.md @@ -1,7 +1,7 @@ --- name: example-generator description: 代码示例与教程专家 -tools: read, write +tools: Read, Write --- # 示例生成专家 diff --git a/zh/07-plugins/pr-review/README.md b/zh/07-plugins/pr-review/README.md index b60dcc1..a833580 100644 --- a/zh/07-plugins/pr-review/README.md +++ b/zh/07-plugins/pr-review/README.md @@ -62,7 +62,7 @@ tags: plugins, code-review, pull-request ## 要求 -- Claude Code 1.0+ +- Claude Code 2.1+ - GitHub 访问权限 - Git 仓库 diff --git a/zh/07-plugins/pr-review/agents/performance-analyzer.md b/zh/07-plugins/pr-review/agents/performance-analyzer.md index 5eaccb3..09fda7c 100644 --- a/zh/07-plugins/pr-review/agents/performance-analyzer.md +++ b/zh/07-plugins/pr-review/agents/performance-analyzer.md @@ -1,7 +1,7 @@ --- name: performance-analyzer description: 性能影响分析 -tools: read, grep, bash +tools: Read, Grep, Bash --- # 性能分析器 diff --git a/zh/07-plugins/pr-review/agents/security-reviewer.md b/zh/07-plugins/pr-review/agents/security-reviewer.md index 3b8a0ea..1d257bd 100644 --- a/zh/07-plugins/pr-review/agents/security-reviewer.md +++ b/zh/07-plugins/pr-review/agents/security-reviewer.md @@ -1,7 +1,7 @@ --- name: security-reviewer description: 面向安全的代码审查 -tools: read, grep, bash +tools: Read, Grep, Bash --- # 安全审查员 diff --git a/zh/07-plugins/pr-review/agents/test-checker.md b/zh/07-plugins/pr-review/agents/test-checker.md index 6344b83..90881c9 100644 --- a/zh/07-plugins/pr-review/agents/test-checker.md +++ b/zh/07-plugins/pr-review/agents/test-checker.md @@ -1,7 +1,7 @@ --- name: test-checker description: 测试覆盖率与质量分析 -tools: read, bash, grep +tools: Read, Bash, Grep --- # 测试检查器 diff --git a/zh/09-advanced-features/README.md b/zh/09-advanced-features/README.md index d46db51..50c4df6 100644 --- a/zh/09-advanced-features/README.md +++ b/zh/09-advanced-features/README.md @@ -470,7 +470,8 @@ echo "hello" | claude -p "translate to Chinese" - `/resume` - `/rename` -- `/fork` +- `/fork` — 把对话复制到一个新的独立后台会话(v2.1.212+) +- `/subtask` — 派生一个继承完整对话的 forked subagent,完成后把结果返回本对话(v2.1.212+) - `claude -c` - `claude -r` diff --git a/zh/CATALOG.md b/zh/CATALOG.md index f6e2f96..214b148 100644 --- a/zh/CATALOG.md +++ b/zh/CATALOG.md @@ -15,14 +15,14 @@ | 功能 | 内置 | 示例 | 总数 | 参考 | |---------|----------|----------|-------|-----------| -| **Slash Commands** | 55+ | 8 | 63+ | [01-slash-commands/README.md](01-slash-commands/README.md) | -| **Subagents** | 6 | 10 | 16 | [04-subagents/README.md](04-subagents/README.md) | -| **Skills** | 5 个内置 | 4 | 9 | [03-skills/README.md](03-skills/README.md) | +| **Slash Commands** | 60+ | 8 | 68+ | [01-slash-commands/README.md](01-slash-commands/README.md) | +| **Subagents** | 6 | 8 | 14 | [04-subagents/README.md](04-subagents/README.md) | +| **Skills** | 10 个内置 | 6 | 16 | [03-skills/README.md](03-skills/README.md) | | **Plugins** | - | 3 | 3 | [07-plugins/README.md](07-plugins/README.md) | -| **MCP Servers** | 1 | 8 | 9 | [05-mcp/README.md](05-mcp/README.md) | -| **Hooks** | 25 个事件 | 7 | 7 | [06-hooks/README.md](06-hooks/README.md) | -| **Memory** | 7 种类型 | 3 | 3 | [02-memory/README.md](02-memory/README.md) | -| **总计** | **99** | **43** | **117** | | +| **MCP Servers** | 1 | 0 | 1 | [05-mcp/README.md](05-mcp/README.md) | +| **Hooks** | 31 个事件 | 0 | 31 | [06-hooks/README.md](06-hooks/README.md) | +| **Memory** | 7 种类型 | 3 | 10 | [02-memory/README.md](02-memory/README.md) | +| **总计** | **115** | **28** | **143** | | --- @@ -78,7 +78,8 @@ | `/desktop` | 打开 Claude Desktop 应用 | 切换桌面界面 | | `/theme` | 更改颜色主题 | 自定义外观 | | `/usage` | 显示 API 使用统计 | 监控配额和消耗 | -| `/fork` | 分叉当前对话 | 探索替代方案 | +| `/fork` | 把当前对话复制到一个新的独立后台会话(v2.1.212+) | 并行探索替代方案 | +| `/subtask` | 派生一个继承当前对话的 forked subagent,完成后把结果返回给本对话(v2.1.212+) | 委派支线任务而不打断当前思路 | | `/stats` | 显示会话统计 | 查看会话指标 | | `/statusline` | 配置状态栏 | 自定义状态显示 | | `/stickers` | 查看会话贴纸 | 趣味奖励 | @@ -234,6 +235,11 @@ cp -r 03-skills/* ~/.claude/skills/ | `/debug` | 调试失败的测试/错误 | 调试会话 | | `/loop` | 按间隔运行提示词 | 周期性任务 | | `/claude-api` | 使用 Claude API 构建应用 | API 开发 | +| `/code-review` | 按指定强度审查当前 diff 的正确性问题(例如 `/code-review high`);加 `--comment` 可把结论发成 PR 行内评论。自 v2.1.218 起以**后台 subagent** 运行 | 写完代码后、合并 PR 前 | +| `/fewer-permission-prompts` | 扫描历史记录并给出按优先级排序的允许列表建议 | 减少重复的权限提示 | +| `/run` *(v2.1.145+)* | 启动当前项目的应用,直观看到改动效果 | 在真实应用里验证改动 | +| `/run-skill-generator` *(v2.1.145+)* | 教会 `/run`、`/verify` 如何处理某个具体项目 | 首次为项目配置 `/run` | +| `/verify` *(v2.1.145+)* | 构建、运行并观察应用,确认修复真的生效 | 端到端验证修复 | --- diff --git a/zh/INDEX.md b/zh/INDEX.md index a1d0dc3..ac1666a 100644 --- a/zh/INDEX.md +++ b/zh/INDEX.md @@ -214,11 +214,11 @@ blog-draft/ **使用方式**:在设置中配置后自动执行 -**Hook 类型**(4 类,25 个事件): -- 工具 Hook:`PreToolUse`、`PostToolUse`、`PostToolUseFailure`、`PermissionRequest` -- 会话 Hook:`SessionStart`、`SessionEnd`、`Stop`、`StopFailure`、`SubagentStart`、`SubagentStop` -- 任务 Hook:`UserPromptSubmit`、`TaskCompleted`、`TaskCreated`、`TeammateIdle` -- 生命周期 Hook:`ConfigChange`、`CwdChanged`、`FileChanged`、`PreCompact`、`PostCompact`、`WorktreeCreate`、`WorktreeRemove`、`Notification`、`InstructionsLoaded`、`Elicitation`、`ElicitationResult` +**Hook 类型**(5 类,31 个事件): +- 工具 Hook:`PreToolUse`、`PostToolUse`、`PostToolUseFailure`、`PostToolBatch`、`PermissionRequest`、`PermissionDenied` +- 会话 Hook:`SessionStart`、`Setup`、`SessionEnd`、`Stop`、`StopFailure`、`SubagentStart`、`SubagentStop` +- 任务 Hook:`UserPromptSubmit`、`UserPromptExpansion`、`MessageDisplay`、`TaskCompleted`、`TaskCreated`、`TeammateIdle` +- 生命周期 Hook:`ConfigChange`、`CwdChanged`、`DirectoryAdded`、`FileChanged`、`PreCompact`、`PostCompact`、`WorktreeCreate`、`WorktreeRemove`、`Notification`、`InstructionsLoaded`、`Elicitation`、`ElicitationResult` --- @@ -391,8 +391,8 @@ documentation/ - **default**:风险操作需要审批 - **acceptEdits**:自动接受文件编辑,其他操作仍需审批 - **plan**:只读分析,不做修改 -- **auto**:自动批准安全操作,风险操作仍提示 -- **dontAsk**:除危险操作外全部接受 +- **auto**:所有操作都执行,附带后台安全检查 — 由分类器审查命令和受保护目录的写入(通过 `autoMode` 设置对象配置) +- **dontAsk**:只允许预先批准的工具 — 任何本来会弹出提示的调用都会被自动拒绝。Claude 只运行 `permissions.allow` 匹配项、只读 Bash 命令,以及被 `PreToolUse` hook 批准的调用 - **bypassPermissions**:全部接受(需要 `--dangerously-skip-permissions`) #### Headless Mode(`claude -p`) diff --git a/zh/LEARNING-ROADMAP.md b/zh/LEARNING-ROADMAP.md index c1b26d7..4f2e09f 100644 --- a/zh/LEARNING-ROADMAP.md +++ b/zh/LEARNING-ROADMAP.md @@ -103,7 +103,7 @@ graph TD | **3** | [Checkpoints](08-checkpoints/README.md) | ⭐⭐ Intermediate | 45 分钟 | Level 1 | 会话管理 | 安全探索 | 试验、恢复 | | **4** | [CLI Basics](10-cli/README.md) | ⭐⭐ Beginner+ | 30 分钟 | Level 1 | 无 | 核心 CLI 用法 | 交互式与 print mode | | **5** | [Skills](03-skills/README.md) | ⭐⭐ Intermediate | 1 小时 | Level 2 | Slash Commands | 自动化专业能力 | 可复用能力、一致性 | -| **6** | [Hooks](06-hooks/README.md) | ⭐⭐ Intermediate | 1 小时 | Level 2 | 工具、命令 | 工作流自动化(25 个事件、4 种类型) | 校验、质量门禁 | +| **6** | [Hooks](06-hooks/README.md) | ⭐⭐ Intermediate | 1 小时 | Level 2 | 工具、命令 | 工作流自动化(31 个事件、5 种类型) | 校验、质量门禁 | | **7** | [MCP](05-mcp/README.md) | ⭐⭐⭐ Intermediate+ | 1 小时 | Level 2 | 配置 | 实时数据访问 | 实时集成、API | | **8** | [Subagents](04-subagents/README.md) | ⭐⭐⭐ Intermediate+ | 1.5 小时 | Level 2 | Memory、命令 | 处理复杂任务(包含 Bash 在内的 6 个内置 agent) | 委派、专业分工 | | **9** | [Advanced Features](09-advanced-features/README.md) | ⭐⭐⭐⭐⭐ Advanced | 2-3 小时 | Level 3 | 前面所有内容 | 高阶工具 | Planning、自动模式(Auto Mode)、通道(Channels)、语音输入、权限控制 | diff --git a/zh/QUICK_REFERENCE.md b/zh/QUICK_REFERENCE.md index 9843e5c..8e1de55 100644 --- a/zh/QUICK_REFERENCE.md +++ b/zh/QUICK_REFERENCE.md @@ -95,7 +95,7 @@ chmod +x ~/.claude/hooks/*.sh # default - 风险操作需要审批 # acceptEdits - 自动接受文件编辑,其他操作仍需审批 # plan - 只读分析,不做修改 -# dontAsk - 除危险操作外全部接受 +# dontAsk - 只运行预先批准的工具,其余一律拒绝 # auto - 后台分类器自动决定权限 # bypassPermissions - 全部接受(需要 --dangerously-skip-permissions) @@ -118,7 +118,7 @@ claude -r "session" # 按名称/ID 恢复会话 | **Skills** | `.claude/skills/*/SKILL.md` | 自动触发 | | **Subagents** | `.claude/agents/*.md` | 自动委派 | | **MCP** | `.mcp.json`(项目)或 `~/.claude.json`(用户) | `/mcp__server__action` | -| **Hooks(25 个事件)** | `~/.claude/hooks/*.sh` | 事件触发(4 类) | +| **Hooks(31 个事件)** | `~/.claude/hooks/*.sh` | 事件触发(5 类) | | **Plugins** | 通过 `/plugin install` | 打包所有能力 | | **Checkpoints** | 内置 | `Esc+Esc` 或 `/rewind` | | **Planning Mode** | 内置 | `/plan ` | @@ -189,7 +189,7 @@ vim CLAUDE.md ### 自动化与 Hooks ```bash -# 安装 hooks(25 个事件,4 类:command、http、prompt、agent) +# 安装 hooks(31 个事件,5 类:command、http、mcp_tool、prompt、agent) mkdir -p ~/.claude/hooks cp 06-hooks/*.sh ~/.claude/hooks/ chmod +x ~/.claude/hooks/*.sh @@ -389,7 +389,7 @@ cp -r 03-skills/code-review-specialist ~/.claude/skills/ | **Auto Mode** | 通过后台分类器实现完全自治 | `--enable-auto-mode` 参数,`Shift+Tab` 切换模式 | | **Channels** | Discord 和 Telegram 集成 | `--channels` 参数,Discord / Telegram bot | | **Voice Dictation** | 对 Claude 说出命令和上下文 | `/voice` 命令 | -| **Hooks(25 个事件)** | 扩展后的 hook 系统,包含 4 类 | command、http、prompt、agent hook 类型 | +| **Hooks(31 个事件)** | 扩展后的 hook 系统,包含 5 类 | command、http、mcp_tool、prompt、agent hook 类型 | | **MCP Elicitation** | MCP server 可在运行时请求用户输入 | 当 server 需要澄清时自动提示 | | **WebSocket MCP** | MCP 的 WebSocket 传输 | 在 `.mcp.json` 中配置 `ws://` URL | | **Plugin LSP** | 插件支持 Language Server Protocol | `userConfig`、`${CLAUDE_PLUGIN_DATA}` 变量 | @@ -445,7 +445,7 @@ echo $GITHUB_TOKEN | 自动化工作流 | Skill | `03-skills/code-review-specialist/` | | 专门任务 | Subagent | `04-subagents/code-reviewer.md` | | 外部数据 | MCP(+ Elicitation、WebSocket) | `05-mcp/github-mcp.json` | -| 事件自动化 | Hook(25 个事件、4 类) | `06-hooks/pre-commit.sh` | +| 事件自动化 | Hook(31 个事件、5 类) | `06-hooks/pre-commit.sh` | | 完整方案 | Plugin(+ LSP 支持) | `07-plugins/pr-review/` | | 安全实验 | Checkpoint | `08-checkpoints/checkpoint-examples.md` | | 完全自治 | Auto Mode | `--enable-auto-mode` 或 `Shift+Tab` | diff --git a/zh/README.md b/zh/README.md index d119e31..84568bb 100644 --- a/zh/README.md +++ b/zh/README.md @@ -478,11 +478,11 @@ chmod +x ~/.claude/hooks/*.sh **使用方法**: hooks 会在事件发生时自动执行 -**Hook 类型**(4 类,25 个事件): -- **工具 Hook**: `PreToolUse`, `PostToolUse`, `PostToolUseFailure`, `PermissionRequest` -- **会话 Hook**: `SessionStart`, `SessionEnd`, `Stop`, `StopFailure`, `SubagentStart`, `SubagentStop` -- **任务 Hook**: `UserPromptSubmit`, `TaskCompleted`, `TaskCreated`, `TeammateIdle` -- **生命周期 Hook**: `ConfigChange`, `CwdChanged`, `FileChanged`, `PreCompact`, `PostCompact`, `WorktreeCreate`, `WorktreeRemove`, `Notification`, `InstructionsLoaded`, `Elicitation`, `ElicitationResult` +**Hook 类型**(5 类,31 个事件): +- **工具 Hook**: `PreToolUse`, `PostToolUse`, `PostToolUseFailure`, `PostToolBatch`, `PermissionRequest`, `PermissionDenied` +- **会话 Hook**: `SessionStart`, `Setup`, `SessionEnd`, `Stop`, `StopFailure`, `SubagentStart`, `SubagentStop` +- **任务 Hook**: `UserPromptSubmit`, `UserPromptExpansion`, `MessageDisplay`, `TaskCompleted`, `TaskCreated`, `TeammateIdle` +- **生命周期 Hook**: `ConfigChange`, `CwdChanged`, `DirectoryAdded`, `FileChanged`, `PreCompact`, `PostCompact`, `WorktreeCreate`, `WorktreeRemove`, `Notification`, `InstructionsLoaded`, `Elicitation`, `ElicitationResult` diff --git a/zh/claude_concepts_guide.md b/zh/claude_concepts_guide.md index e2a53ae..e0ec7ef 100644 --- a/zh/claude_concepts_guide.md +++ b/zh/claude_concepts_guide.md @@ -495,7 +495,7 @@ graph TD B --> C["3. Project Rules
.claude/rules/*.md"] C --> D["4. User Memory
~/.claude/CLAUDE.md"] D --> E["5. User Rules
~/.claude/rules/*.md"] - E --> F["6. Local Memory
.claude/local/CLAUDE.md"] + E --> F["6. Local Memory
./CLAUDE.local.md"] F --> G["7. Auto Memory
自动捕获的偏好"] ``` @@ -508,7 +508,7 @@ graph TD | 3. Project Rules | `.claude/rules/*.md` | 项目级 | 高 | 团队(Git) | 模块化项目约定 | | 4. User | `~/.claude/CLAUDE.md` | 个人级 | 中 | 个人 | 个人偏好 | | 5. User Rules | `~/.claude/rules/*.md` | 个人级 | 中 | 个人 | 个人规则模块 | -| 6. Local | `.claude/local/CLAUDE.md` | 本地 | 低 | 不共享 | 机器相关设置 | +| 6. Local | `./CLAUDE.local.md` | 本地 | 低 | 不共享 | 机器相关设置 | | 7. Auto Memory | 自动生成 | 会话级 | 最低 | 个人 | 学到的偏好与模式 | ### Auto Memory @@ -751,7 +751,7 @@ sequenceDiagram "command": "npx", "args": ["@modelcontextprotocol/server-database"], "env": { - "DATABASE_URL": "postgresql://user:pass@localhost/mydb" + "DATABASE_URL": "${DATABASE_URL}" } } } @@ -1460,7 +1460,7 @@ claude -p "Should we use microservices or monolith?" | `acceptEdits` | 自动接受文件编辑 | 信任编辑工作流 | | `plan` | 只分析不改文件 | 审查、规划 | | `auto` | 自动批准安全操作 | 平衡自治与安全 | -| `dontAsk` | 不再提示确认 | 资深用户 / 自动化 | +| `dontAsk` | 只运行预先批准的工具,其余一律自动拒绝 | 资深用户 / 自动化 | | `bypassPermissions` | 完全不受限 | CI/CD、可信脚本 | ### Headless Mode(Print Mode) @@ -1517,7 +1517,7 @@ claude -r "Feature" "maxConcurrentTasks": 5 }, "permissions": { - "mode": "default" + "defaultMode": "manual" } } ``` diff --git a/zh/resources.md b/zh/resources.md index 1612546..b894c64 100644 --- a/zh/resources.md +++ b/zh/resources.md @@ -241,7 +241,7 @@ graph TD | **Extended Thinking** | 通过 `Alt+T` / `Option+T` 或 `MAX_THINKING_TOKENS` 环境变量切换深度推理 | [高级功能](09-advanced-features/README.md) | | **Permission Modes** | 精细权限控制:default、acceptEdits、plan、auto、dontAsk、bypassPermissions | [高级功能](09-advanced-features/README.md) | | **7-Tier Memory** | Managed Policy、Project、Project Rules、User、User Rules、Local、Auto Memory | [记忆指南](02-memory/README.md) | -| **Hook Events** | 25 个事件:PreToolUse、PostToolUse、PostToolUseFailure、Stop、StopFailure、SubagentStart、SubagentStop、Notification、Elicitation 等 | [Hooks 指南](06-hooks/README.md) | +| **Hook Events** | 31 个事件:PreToolUse、PostToolUse、PostToolUseFailure、Stop、StopFailure、SubagentStart、SubagentStop、Notification、Elicitation 等 | [Hooks 指南](06-hooks/README.md) | | **Agent Teams** | 协调多个 agent 共同处理复杂任务 | [Subagents 指南](04-subagents/README.md) | | **Scheduled Tasks** | 用 `/loop` 和 cron 工具设置周期性任务 | [高级功能](09-advanced-features/README.md) | | **Chrome Integration** | 使用无头 Chromium 做浏览器自动化 | [高级功能](09-advanced-features/README.md) |