claude-code-starter-kit

Drop-in rules, hooks, agents, and commands that make Claude Code smarter on any project. Copy the .claude/ folder into your repo and start vibe coding with guardrails.

What's Inside

.claude/
├── agents/          4 specialist AI agents
│   ├── security-reviewer.md    # OWASP security audit (read-only)
│   ├── code-reviewer.md        # Convention compliance (read-only)
│   ├── test-writer.md          # Auto-generate tests
│   └── refactor-splitter.md    # Split oversized files
├── commands/        7 slash commands
│   ├── verify.md               # /verify — lint + typecheck + test + build
│   ├── learn.md                # /learn — capture patterns into docs
│   ├── audit-docs.md           # /audit-docs — find documentation gaps
│   ├── security-review.md      # /security-review — run security audit
│   ├── review.md               # /review — run code review
│   ├── write-tests.md          # /write-tests — generate tests
│   └── split-file.md           # /split-file — split large files
├── hooks/           6 automated scripts
│   ├── block-destructive.sh    # PreToolUse: blocks rm -rf, force push, curl|sh
│   ├── check-file-length.sh    # PostToolUse: max 150 lines per file
│   ├── check-no-any.sh         # PostToolUse: no 'any' type
│   ├── check-console-log.sh    # PostToolUse: no console.log
│   ├── auto-lint-on-edit.sh    # PostToolUse: auto-format after edits
│   └── session-start.sh        # SessionStart: inject git status + context
├── rules/
│   └── example.md              # Example path-filtered rule (customize)
└── settings.json               # Wires all hooks together
tasks/
├── todo.md          # Task planning + progress tracking
└── lessons.md       # Self-improvement log (mistakes → rules)
CLAUDE.md            # Agent behavior rules + project template

Quick Start

Option 1: Copy into existing project

# Clone this repo
git clone https://github.com/FirasLatrech/claude-code-starter-kit.git

# Copy into your project
cp -r claude-code-starter-kit/.claude your-project/
cp -r claude-code-starter-kit/tasks your-project/
cp claude-code-starter-kit/CLAUDE.md your-project/

# Make hooks executable
chmod +x your-project/.claude/hooks/*.sh

Option 2: Use as template

Click "Use this template" on GitHub, then customize CLAUDE.md for your project.

Option 3: Cherry-pick what you need

Only want the hooks? Copy .claude/hooks/ and .claude/settings.json. Only want the agents? Copy .claude/agents/. Mix and match.

Customize

After copying, edit these files for your project:

  1. CLAUDE.md — Replace the placeholder sections (Project, Structure, Commands) with your actual project info
  2. .claude/rules/example.md — Delete it and create rules for your stack (see examples inside)
  3. .claude/hooks/auto-lint-on-edit.sh — Uncomment your linter (Biome, ESLint, or Prettier)
  4. .claude/hooks/check-file-length.sh — Adjust MAX_LINES if 150 is too strict

What Each Piece Does

Hooks (Deterministic Enforcement)

Hooks are shell scripts that run automatically. They can't be ignored by AI.

HookWhenWhat
block-destructive.shBefore bash commandsBlocks rm -rf /, git push --force main, curl|sh, DROP TABLE
check-file-length.shAfter file editsRejects files over 150 lines
check-no-any.shAfter file editsRejects TypeScript any type
check-console-log.shAfter file editsRejects console.log (skips test files)
auto-lint-on-edit.shAfter file editsAuto-runs your linter/formatter
session-start.shSession startsShows git status, current task, lesson count

Agents (Specialist Workers)

Agents are AI workers with restricted permissions. Read-only agents can't accidentally modify your code.

AgentCan Edit?Purpose
security-reviewerNoOWASP Top 10 audit, injection, auth, secrets
code-reviewerNoConventions, DRY, performance, types
test-writerYesWrites + runs tests matching your patterns
refactor-splitterYesSplits large files, fixes all imports

Commands (Slash Workflows)

Type these in Claude Code to trigger workflows:

CommandWhat it does
/verifyRun full verification: lint + typecheck + test + build
/learn [topic]Capture a gotcha or pattern into the right doc file
/audit-docsCompare codebase against docs, find undocumented gaps
/security-review [area]Run OWASP security audit via agent
/review [file]Run convention compliance check via agent
/write-tests [file]Generate tests for untested code
/split-file [file]Split files exceeding 150 lines

Agent Behavior Rules (in CLAUDE.md)

These 7 rules change how Claude thinks, not just what code it writes:

  1. Plan Mode Default — Plans in tasks/todo.md before coding, waits for approval
  2. Subagent Strategy — Offloads research to subagents, keeps context clean
  3. Self-Improvement Loop — After corrections → writes to tasks/lessons.md → never repeats
  4. Verification Before Done — Must prove code works before saying "done"
  5. Demand Elegance — Pauses to think on non-trivial changes
  6. Autonomous Bug Fixing — Just fixes bugs, no hand-holding
  7. Core Principles — Simplicity first, no laziness, no guessing

Task Management (tasks/)

FilePurpose
tasks/todo.mdClaude writes plans here, tracks progress with checkboxes
tasks/lessons.mdMistakes are logged with rules to prevent them. Reviewed every session

Rules System

Create .claude/rules/<name>.md files with YAML frontmatter for path-filtered rules:

---
globs: "src/components/**/*.tsx"
---

# React Component Rules

- Use functional components with hooks
- Import UI from shared library
- Add loading states for async data

Rules only load when Claude works on files matching the glob pattern. See .claude/rules/example.md for more examples.

FAQ

Q: Will this work with Cursor/Windsurf/other AI editors? A: The CLAUDE.md and tasks/ system works anywhere. The .claude/ directory (hooks, agents, commands, rules) is specific to Claude Code.

Q: Can I use this with any programming language? A: Yes. The hooks check for .ts/.tsx/.js/.jsx by default — edit them for your language. The agents, commands, and behavior rules are language-agnostic.

Q: Will the hooks slow down Claude? A: No. They're lightweight bash scripts that run in milliseconds.

Q: How do I disable a specific hook? A: Remove its entry from .claude/settings.json.

Contributing

Found a useful pattern? Open a PR. The goal is a collection of battle-tested rules that help anyone vibe code with confidence.

License

MIT