claude-code-mastery: Hooks, Skills, and CLAUDE.md Templates for Claude Code (V2, Now Obsolete)
The complete guide to Claude Code: CLAUDE.md, hooks, skills, MCP servers, and commands
At a glance
- What is it?
- The claude-code-mastery repository provides shell hooks, skill files, and global CLAUDE.md templates for configuring Claude Code. The README marks V2 as obsolete and recommends the newer Claude Code Mastery Starter Kit instead. The core ideas it introduces remain relevant: hooks enforce rules deterministically, CLAUDE.md provides suggestions the model may or may not follow, and mixing topics in a single chat measurably reduces accuracy.
- Who is it for?
- Developers configuring Claude Code for the first time will find the hook files and global CLAUDE.md template in this repository useful as concrete examples of enforcement patterns, even though the README marks V2 as obsolete. The specific files (block-secrets.py, block-dangerous-commands.sh, and settings.json) are copy-paste ready and implement patterns the README explains with evidence.
- Can I use it commercially?
- Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository last received commits 146 days ago.
- What is it written in?
- Mainly Shell, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on September 28, 2026, and from our analysis. They are not legal advice.
Editorial analysis
What claude-code-mastery covers and its current status
The claude-code-mastery repository is a guide and template collection for configuring Claude Code: Anthropic's command-line AI coding tool. Version 2 of the guide covers global CLAUDE.md configuration, MCP server integration, custom commands, hook scripts, and skills.
The README opens with two notices before presenting any content. The first advertises MDD (Manual-Driven Development), a standalone npm package with 21 structured workflow modes. The second announces the Claude Code Mastery Starter Kit, which the README describes as baking everything from V1 to V5 into a production-ready project template with 16 slash commands and three-layer security. The V2 guide that follows is labelled "Obsolete" in the heading.
Despite the obsolete label, the V2 repository remains useful as a documented example of specific hook patterns and as the source of files that can be copied directly into a Claude Code configuration. The README's explanation of why hooks matter and how hook exit codes work is a concise, accurate reference that applies to any version of Claude Code.
The last push to the repository was on 2026-05-07. The project is not archived.
Why hooks enforce rules where CLAUDE.md only suggests
The README states the central argument directly: CLAUDE.md rules are suggestions, hooks are enforcement.
When CLAUDE.md contains a rule like "don't edit .env files," that text is parsed by the language model, weighed against the rest of the context window, and may or may not be followed. A PreToolUse hook that blocks .env file access runs outside the model entirely. It intercepts the tool call at the harness level, checks the target path, and returns exit code 2 to block the operation before the model ever executes it.
The README cites a community member's observation: a PreToolUse hook blocked Claude from accessing secrets files multiple times per week, while CLAUDE.md rules addressing the same restriction were not reliably followed.
Hook exit codes define three outcomes: 0 allows the operation, 1 reports an error visible to the user only, and 2 blocks the operation and feeds the stderr content back to Claude as context. Exit code 2 is the enforcement mechanism, and the hooks in this repository use it for secrets access and dangerous shell commands.
The hook files and how to install them
The repository ships five hook scripts in hooks/: block-secrets.py, block-dangerous-commands.sh, end-of-turn.sh, after-edit.sh, and one additional script visible in the repository tree. The quick-start sequence from the README:
git clone https://github.com/TheDecipherist/claude-code-mastery.git
cd claude-code-mastery
mkdir -p ~/.claude/hooks
cp hooks/* ~/.claude/hooks/
chmod +x ~/.claude/hooks/*.shThen copy the settings template that wires those hooks to the correct trigger events:
cp templates/settings.json ~/.claude/settings.jsonThe block-secrets.py script is a PreToolUse hook written in Python. It intercepts file operations and blocks access to .env files. The block-dangerous-commands.sh script intercepts shell commands and blocks patterns like rm -rf. The end-of-turn.sh script runs quality gates after each Claude Code turn. The after-edit.sh script runs formatters after file edits.
After copying hooks and settings, install the skills:
mkdir -p ~/.claude/skills
cp -r skills/* ~/.claude/skills/Then set up the global CLAUDE.md template and verify the installation:
cp templates/global-claude.md ~/.claude/CLAUDE.md
claudeSingle-purpose chats and the research behind the 39% figure
The README dedicates a section to why mixing topics in a single Claude Code chat reduces performance. It cites three external studies: a multi-turn conversation study showing a 39% performance drop when topics are mixed, a context-rot paper from Chroma showing that recall decreases as context grows, and a context-pollution paper showing that 2% early misalignment leads to a 40% failure rate.
The practical recommendation from these findings is: one task, one chat. Each chat session in Claude Code starts with a fresh context window. If a debugging session on a data pipeline accumulates irrelevant context about an earlier authentication problem in the same chat, the model's performance on the pipeline task degrades measurably.
This is not a claim specific to Claude Code. The README presents it as a general finding about large language models in multi-turn settings. The implication for Claude Code configuration is that automated workflows (hooks and commands that chain operations) should be structured to minimize context pollution, not simply to maximize what the model can see.
Global CLAUDE.md as the security gatekeeper
The global CLAUDE.md file lives at ~/.claude/CLAUDE.md and is read by Claude Code at the start of every session, in every project directory. The README describes it as simultaneously a security gatekeeper and a project scaffolding blueprint.
As a security gatekeeper, CLAUDE.md lists things Claude should refuse: writing to sensitive files, running certain shell commands, revealing configuration details. As noted in the hooks section, these are suggestions rather than hard blocks, which is why hooks exist alongside CLAUDE.md.
As a scaffolding blueprint, the global CLAUDE.md can contain project-structure conventions that apply across all repositories: directory naming, test file conventions, commit message formats, documentation patterns. The templates/global-claude.md file in this repository provides a starting point that can be customized with specifics.
The README also covers project-level CLAUDE.md files (./CLAUDE.md), which override or extend the global file for a specific repository. The templates/project-claude.md file provides a starter template for per-project rules.
The successor: Starter Kit and MDD package
The README points to two more current alternatives from the same author.
The Claude Code Mastery Starter Kit at thedecipherist.github.io/claude-code-mastery-project-starter-kit is described as a production-ready project template with 16 slash commands, deterministic hook enforcement, a MongoDB wrapper, live AI monitoring, and three-layer security. The README characterizes it as the practical replacement for the V2 guide.
The MDD (Manual-Driven Development) package is available on npm as @thedecipherist/mdd. The README describes it as 21 modes covering build, audit, planning, and ops runbooks, all invoked via /mdd in a Claude Code session. It installs with two commands: `npm install -g @thedecipherist/mdd` followed by `mdd install`. MDD is a separate project with its own repository at https://github.com/TheDecipherist/mdd.
For developers who want to understand hook mechanics from documented examples before adopting the Starter Kit, the V2 repository's hook files remain a clearer starting point than the more complete but more complex Starter Kit.
Maintenance status and licence
The last push to the repository was on 2026-05-07. The repository is not archived. There are no GitHub releases.
The project is MIT-licensed. The README links to V3, V4, and V5 of the guide on thedecipherist.com, which are web articles rather than versioned repository branches.
Python 3.8 or later is required for the block-secrets.py hook. The jq command-line JSON parser is required for the shell hooks that parse tool-call JSON payloads. The README lists both as prerequisites.
Editorial conclusion
Developers configuring Claude Code for the first time will find the hook files and global CLAUDE.md template in this repository useful as concrete examples of enforcement patterns, even though the README marks V2 as obsolete. The specific files (block-secrets.py, block-dangerous-commands.sh, and settings.json) are copy-paste ready and implement patterns the README explains with evidence. For a production-ready starting point, the README explicitly redirects to the Claude Code Mastery Starter Kit at thedecipherist.github.io/claude-code-mastery-project-starter-kit. Running /hooks and /skills in Claude Code after setup confirms whether the files were loaded correctly.
Frequently asked questions
What is the difference between CLAUDE.md and hooks in Claude Code?
CLAUDE.md provides instructions the language model reads and may or may not follow, depending on context. Hooks are scripts that run outside the model at the harness level. A PreToolUse hook returning exit code 2 blocks an operation unconditionally, regardless of what CLAUDE.md says.
What does the block-secrets.py hook in claude-code-mastery do?
The block-secrets.py script is a PreToolUse hook that intercepts file operations and blocks access to .env files. The README notes that a community member's hook blocked Claude from accessing secrets files multiple times per week in cases where CLAUDE.md rules addressing the same restriction were not reliably followed.
Should I use claude-code-mastery V2 or the newer Starter Kit?
The README marks V2 as obsolete and recommends the Claude Code Mastery Starter Kit at thedecipherist.github.io/claude-code-mastery-project-starter-kit, which bakes the V1 through V5 patterns into a production-ready project template. The V2 repository remains a useful reference for understanding how specific hooks work.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/thedecipherist-claude-code-mastery)