Thanks to visit codestin.com
Credit goes to github.com

Skip to content

johan--/claude-code-mastery

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

33 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Claude Code Mastery

The complete guide to maximizing Claude Code: Global CLAUDE.md, MCP Servers, Commands, Hooks, Skills, and Why Single-Purpose Chats Matter.

🌐 Read the Guide on Our Website ← Best reading experience

TL;DR: Your global ~/.claude/CLAUDE.md is a security gatekeeper AND project scaffolding blueprint. MCP servers extend Claude's capabilities. Custom commands automate workflows. Hooks enforce rules deterministically (where CLAUDE.md can fail). Skills package reusable expertise. And research shows mixing topics in a single chat causes 39% performance degradation.


πŸ“š Table of Contents


πŸš€ Quick Start

# Clone this repo
git clone https://github.com/TheDecipherist/claude-code-mastery.git
cd claude-code-mastery

# Copy hooks to your Claude config
mkdir -p ~/.claude/hooks
cp hooks/* ~/.claude/hooks/
chmod +x ~/.claude/hooks/*.sh

# Copy the settings template (review and customize first!)
cp templates/settings.json ~/.claude/settings.json

# Copy skills
mkdir -p ~/.claude/skills
cp -r skills/* ~/.claude/skills/

πŸ“– The Guide

πŸ“± Read on Website (recommended) | πŸ“„ View GUIDE.md

What's Covered

Part Topic Key Takeaway
1 Global CLAUDE.md as Security Gatekeeper Define once, inherit everywhere
2 Project Scaffolding Rules Every project follows same structure
3 MCP Servers External tool integrations
4 Context7 Live documentation access
5 Custom Commands Workflow automation
6 Single-Purpose Chats 39% degradation from topic mixing
7 Skills & Hooks Enforcement over suggestion

πŸ“ Repository Contents

claude-code-mastery/
β”œβ”€β”€ GUIDE.md                    # The complete guide
β”œβ”€β”€ templates/
β”‚   β”œβ”€β”€ global-claude.md        # ~/.claude/CLAUDE.md template
β”‚   β”œβ”€β”€ project-claude.md       # ./CLAUDE.md starter
β”‚   β”œβ”€β”€ settings.json           # Hook configuration template
β”‚   └── .gitignore              # Recommended .gitignore
β”œβ”€β”€ hooks/
β”‚   β”œβ”€β”€ block-secrets.py        # PreToolUse: Block .env access
β”‚   β”œβ”€β”€ block-dangerous-commands.sh  # PreToolUse: Block rm -rf, etc.
β”‚   β”œβ”€β”€ end-of-turn.sh          # Stop: Quality gates
β”‚   β”œβ”€β”€ after-edit.sh           # PostToolUse: Run formatters
β”‚   └── notify.sh               # Notification: Desktop alerts
β”œβ”€β”€ skills/
β”‚   β”œβ”€β”€ commit-messages/        # Generate conventional commits
β”‚   β”‚   └── SKILL.md
β”‚   └── security-audit/         # Security vulnerability checks
β”‚       └── SKILL.md
└── commands/
    β”œβ”€β”€ new-project.md          # /new-project scaffold
    β”œβ”€β”€ security-check.md       # /security-check audit
    └── pre-commit.md           # /pre-commit quality gates

πŸ”§ Installation

Prerequisites

  • Claude Code installed
  • Python 3.8+ (for Python hooks)
  • jq (for JSON parsing in shell hooks)

Step-by-Step

1. Install Hooks

# Create hooks directory
mkdir -p ~/.claude/hooks

# Copy hook scripts
cp hooks/block-secrets.py ~/.claude/hooks/
cp hooks/block-dangerous-commands.sh ~/.claude/hooks/
cp hooks/end-of-turn.sh ~/.claude/hooks/

# Make shell scripts executable
chmod +x ~/.claude/hooks/*.sh

2. Configure Settings

# If you don't have settings.json yet
cp templates/settings.json ~/.claude/settings.json

# If you already have settings.json, merge the hooks section manually

3. Install Skills

# Create skills directory
mkdir -p ~/.claude/skills

# Copy skills
cp -r skills/* ~/.claude/skills/

4. Set Up Global CLAUDE.md

# Copy template
cp templates/global-claude.md ~/.claude/CLAUDE.md

# Customize with your details
$EDITOR ~/.claude/CLAUDE.md

5. Verify Installation

# Start Claude Code
claude

# Check hooks are loaded
/hooks

# Check skills are loaded
/skills

πŸ”’ Why Hooks Matter

CLAUDE.md rules are suggestions. Hooks are enforcement.

CLAUDE.md saying "don't edit .env"
  β†’ Parsed by LLM
  β†’ Weighed against other context
  β†’ Maybe followed

PreToolUse hook blocking .env edits
  β†’ Always runs
  β†’ Returns exit code 2
  β†’ Operation blocked. Period.

Real-world example from a community member:

"My PreToolUse hook blocks Claude from accessing secrets (.env files) a few times per week. Claude does not respect CLAUDE.md rules very rigorously."

Hook Exit Codes

Code Meaning
0 Success, allow operation
1 Error (shown to user only)
2 Block operation, feed stderr to Claude

🧠 Why Single-Purpose Chats

Research consistently shows topic mixing destroys accuracy:

Study Finding
Multi-turn conversations 39% performance drop when mixing topics
Context rot Recall decreases as context grows
Context pollution 2% early misalignment β†’ 40% failure rate

Golden Rule: One Task, One Chat


🀝 Contributing

Contributions welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Add your hooks, skills, or improvements
  4. Submit a PR with description

Ideas for Contributions

  • More language-specific hooks (Go, Rust, Ruby)
  • Additional skills (code review, documentation, testing)
  • Framework-specific scaffolding templates
  • MCP server configuration examples

πŸ“š Sources

Official Documentation

Research

Community


πŸ“„ License

MIT License - See LICENSE


Built with ❀️ by TheDecipherist and the Claude Code community

About

The complete guide to Claude Code: CLAUDE.md, hooks, skills, MCP servers, and commands

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 68.4%
  • Python 31.6%