claude-code-mastery
БесплатноЗапускает вложенные скриптыНе проверенOptimizes CLAUDE.md files, scaffolds skills and subagents, wires hooks and measures context budget for Claude Code. Use when writing or trimming a CLAUDE.md…
от borghei★ 1 250 звёзд на GitHubОб этом скилле
Claude Code Mastery
Expert skill for Claude Code CLI -- CLAUDE.md optimization, skill authoring, subagent creation, hooks automation, and context engineering.
Core Capabilities
- CLAUDE.md optimization — audit, restructure, compress, and hierarchize config files for token efficiency.
- Skill authoring — scaffold and write discoverable skill packages with correct layout and frontmatter.
- Subagent creation — write
.claude/agents/<name>.mdfiles with atoolsallowlist and a Markdown-body system prompt. - Hooks automation — wire
PreToolUse/PostToolUse/Stoplifecycle scripts via.claude/settings.json. - Context engineering — measure and manage the context-window token budget across a codebase.
When to Use
- Authoring, structuring, or optimizing a CLAUDE.md file for any project.
- Scaffolding a new skill package or creating a Claude Code subagent.
- Configuring hooks for automated quality, security, or workflow steps.
- Auditing and reducing context-window consumption.
Clarify First
Before scaffolding or optimizing, settle the inputs below. When one is missing or vague and would change the result, ask about it; when it wouldn't, use a sensible default and say which one you used.
- Which task: scaffold a new skill, optimize a CLAUDE.md, create a subagent, or analyze context budget (selects
skill_scaffolder.pyvsclaudemd_optimizer.pyvscontext_analyzer.py). - Target identity: for a new skill: its name, domain, and one-line description; for optimization: the file or project path (the inputs the scripts require).
- Token budget: the target ceiling (sets
--token-limitand what counts as over-budget).
Ask about the two or three inputs that matter most for this request, not the whole list. If the user wants a result straight away, produce it and state your assumptions at the top.
Workflow
# Score a CLAUDE.md for structure, token cost and redundancy (default budget 6000 tokens)
python scripts/claudemd_optimizer.py CLAUDE.md --token-limit 4000
# Estimate how much of the context window a project's files would take, by category
python scripts/context_analyzer.py . --max-depth 4 --context-window 200000
# Scaffold a skill package into an existing parent directory
python scripts/skill_scaffolder.py my-skill -d engineering -o /tmp --description "Scores API specs for breaking changes"
All three accept --json. Full flags and output fields: references/tool-reference.md.
claudemd_optimizer.pyreports a 0–100 score, the token estimate against--token-limit, duplicated or vague sections, and concrete cuts.context_analyzer.pydefaults to a 200K window as a conservative floor. Pass the real window of the model you run, or the percentages will overstate the pressure.skill_scaffolder.pycreates<-o DIR>/<skill-name>/withSKILL.md,scripts/,references/andassets/.-o(--output) is the parent directory, which must already exist; it defaults to the current directory, so pass-oto keep the scaffold out of the repo you are standing in. If the description has no "Use when" clause it appends a placeholder so you fill in the triggers before shipping.
Exit codes (all three): 0 report or scaffold written; 2 missing file or path, output directory that does not exist, or a skill folder that already exists. They are advisory, not gates: an over-budget CLAUDE.md still exits 0.
Done when: the CLAUDE.md fits its budget and every line is something the model could not infer from the code; a new skill's description says what it does and when to use it in under 240 characters; a hook has been triggered once on purpose and blocked or passed as intended.
Anti-Patterns
CLAUDE.md as a wiki
Mistake: Pasting architecture essays, full style guides and onboarding notes into CLAUDE.md. Why it happens: It is the one file the agent always reads, so everything lands there. Instead: Keep commands, conventions and traps the code does not reveal; link to longer docs and let the agent read them when needed. Every line costs tokens on every turn.
Hooks that fail open
Mistake: A PreToolUse guard that exits 1 on a violation and assumes the tool call was blocked. Why it happens: Exit 1 means "error" in most CLIs. Instead: A PreToolUse hook blocks only on exit 2 (stderr goes back to the model). Test the hook against a real violating command before relying on it. See references/hooks-cookbook.md.
Subagents with every tool
Mistake: A review subagent with no tools allowlist, so it can edit files and run shell commands.
Why it happens: Omitting tools is the shortest working file.
Instead: Give each subagent the smallest tool list its job needs; a reviewer gets read and search tools only.
Files
scripts/claudemd_optimizer.py,scripts/context_analyzer.py,scripts/skill_scaffolder.py— the three CLIs above.
Установить claude-code-mastery в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл claude-code-mastery?
Optimizes CLAUDE.md files, scaffolds skills and subagents, wires hooks and measures context budget for Claude Code. Use when writing or trimming a CLAUDE.md, creating a skill, subagent or hook, or auditing token usage.
Как установить скилл claude-code-mastery?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл claude-code-mastery запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic