A comprehensive, production-ready configuration for Claude Code demonstrating best practices for customization and automation.
- 9 Commands: Common workflows (audit, create agents/skills, git automation)
- 3 Agents: Specialized assistants (bash scripting, evaluator, test runner)
- 18 Skills: Advanced capabilities (auditing, authoring, git, PDF processing)
- 6 Hooks: Automation (validation, formatting, logging, notifications)
- Complete Documentation: Guides, references, and examples
Clone this repository to your ~/.claude directory:
git clone https://github.com/philoserf/claude-code-setup.git ~/.claudeAfter installation, review and customize:
- Edit
settings.json- Adjust tool permissions for your needs - Modify
CLAUDE.md- Add your personal coding principles and preferences - Adjust hooks - Enable/disable automation in
hooks/andsettings.json - Add your own - Create custom commands, skills, and agents
CLAUDE.md contains my personal coding principles and preferences as examples. Feel free to adapt these to your own style or replace with your own guidelines.
See CONTRIBUTING.md for guidelines on submitting improvements, bug reports, or new customizations.
MIT License - see LICENSE for details.
This is the global configuration directory for Claude Code (~/.claude). Settings and customizations here apply across all projects unless overridden by project-specific configurations.
| File | Purpose |
|---|---|
settings.json |
Global permissions, MCP servers, cleanup policies, and tool approvals |
~/.config.json |
User preferences and application state (not tracked in git) |
CLAUDE.md |
Instructions for Claude Code when working in this repository |
.gitignore |
Git ignore rules for this configuration directory |
| Directory | Purpose | Tracked in Git |
|---|---|---|
agents/ |
Specialized AI agents for specific tasks | Yes |
commands/ |
Custom slash commands (e.g., /commit, /review) |
Yes |
skills/ |
Custom skills and capabilities | Yes |
hooks/ |
Event-driven automation hooks | Yes |
references/ |
Shared reference files for customizations | Yes |
| Directory | Purpose |
|---|---|
projects/ |
Per-project metadata (encoded directory names) |
todos/ |
Session todo lists (UUID-named JSON files) |
plans/ |
Implementation plans from plan mode |
file-history/ |
Change tracking for edited files |
session-env/ |
Environment snapshots per session |
logs/ |
Session logs and commit history |
debug/ |
Session debug logs |
shell-snapshots/ |
Zsh environment captures |
ide/ |
IDE connection state |
statsig/ |
Feature flag evaluation cache |
history.jsonl |
Conversation history across sessions |
Claude Code uses a permission system defined in settings.json:
- Allowed Operations: Tools and file patterns that don't require user approval
- Denied Operations: Blocked operations (e.g., reading
.envfiles,sudocommands) - Ask First: Everything else requires explicit user approval
Claude Code tracks projects in the projects/ directory using encoded directory names (e.g., -Users-markayers-source-mine-go). Each project stores:
- Session costs and token usage
- File counts and modification stats
- Cache performance metrics
- Sessions are identified by UUIDs
- Session data persists for 30 days (configurable via
cleanupPeriodDays) - Todos, plans, and file history are session-scoped
- Shell snapshots capture environment state per session
- Create a markdown file in
commands/(e.g.,commands/mycommand.md) - Define the command behavior in the markdown content
- Restart Claude Code to register the command
- Use with
/mycommandin any session
- Create a directory in
skills/with skill name (verb-noun format) - Create
SKILL.mdas the main skill file with frontmatter metadata - Add reference files in
references/subdirectory if needed - Skills auto-register on restart
Example structure:
skills/fix-typos/
|-- SKILL.md # Main skill with frontmatter (name: fix-typos)
+-- references/ # Optional supporting docs
+-- examples.md
- Create a hook definition in
hooks/directory - Configure trigger events (e.g., before tool calls, after file changes)
- Hooks execute automatically on matching events
This configuration includes 6 active hooks that automate workflows and enforce quality standards:
Run before tool execution and can block operations if needed.
Trigger: Before any Bash command
Purpose: Logs all git, gh, and dot (dotfiles) commands to stderr for tracking
Behavior: Informational only - never blocks execution
Timeout: 5 seconds
Example output: [Hook] Git command: git status
Trigger: Before any Bash command
Purpose: Suggests better alternatives when using bash for operations that have dedicated tools
Behavior: Informational only - never blocks execution
Timeout: 5 seconds
Examples:
- Suggests
Readtool instead ofcat,head,tail - Suggests
Greptool instead ofgrep,rg - Suggests
Edittool instead ofsed,awk - Suggests
Globtool instead offindfor file searches
Trigger: Before any Edit or Write operation
Purpose: Validates YAML frontmatter in Claude Code customization files
Behavior: Can block operations if YAML is invalid in agents, skills, or commands
Timeout: 5 seconds
Checks:
- YAML frontmatter syntax in
agents/*.md,skills/*/SKILL.md,commands/*.md - Required fields presence (name, description, etc.)
- Proper frontmatter delimiters (
---)
Run after tool execution completes successfully.
Trigger: After any Edit or Write operation
Purpose: Automatically formats code files using appropriate formatters
Behavior: Silent formatting - never blocks or reports errors
Timeout: 10 seconds
Supported formatters:
gofmtfor.gofilesprettierfor.js,.jsx,.ts,.tsx,.json,.mdfiles
Run when specific events occur during the session.
Trigger: When Claude is idle and waiting for user input
Purpose: Sends macOS desktop notification when prompt is ready
Behavior: Uses osascript to display notification
Timeout: 5 seconds
Notification: "Claude Code" - "Ready for your input"
Run once when a new Claude Code session starts.
Trigger: At session startup
Purpose: Injects git repository context for awareness
Behavior: Checks for .git directory and outputs repository status
Timeout: 10 seconds
Provides:
- Current git branch
- Working tree status
- Recent commit information
All hooks are configured in settings.json with:
- Matchers: Regular expressions to determine when hooks run
- Timeouts: Maximum execution time before hook is killed
- Exit codes: 0 = allow operation, 2 = block operation
Hooks are designed to fail gracefully - if a hook errors, it exits with code 0 to avoid blocking operations.
Edit settings.json to add tool or file pattern permissions:
{
"permissions": {
"allowed": ["Read", "Bash(git:*)", "Write(*.md)"],
"denied": ["Read(.env*)", "Bash(sudo:*)"]
}
}For project-specific permissions, create settings.local.json in the project directory.
.env*files are blocked from reading via permissions- Lock files (
go.sum,package-lock.json, etc.) are write-protected sudocommands are denied by default- Sensitive Data:
.mcp.jsoncontains API credentials (GitHub token) - not tracked in git - History:
history.jsonlmay contain sensitive conversation context - not tracked in git
# Check recent session logs
tail -n 50 logs/session-log.txt
# View commit history
cat logs/commit-log.txt# List tracked projects
ls -l projects/
# View specific project stats
cat projects/-Users-markayers-source-mine-go/meta.json | jqClaude Code automatically cleans data older than 30 days. For manual cleanup:
# Remove old session data
find todos/ -name "*.json" -mtime +30 -delete
find debug/ -name "*.txt" -mtime +30 -deleteLast Updated: 2025-12-30