← Back to claude-code

The .claude folder: setup to turn Claude into a full dev team

Set up the .claude folder so Claude Code works like a real dev team: agents, commands, hooks, rules, skills, and settings.json.

Manthan Patel (@LeadGenMan) has used Claude Code for over a year and shares the exact setup for turning Claude into a full dev team. Each agent is a specialist, and Claude automatically delegates work to the right agent.

The .claude Folder Structure

.claude/
├── agents/       ← AI team members (specialists)
├── commands/     ← Custom slash commands
├── hooks/        ← Rules Claude MUST follow
├── rules/        ← Context-aware instructions
├── skills/       ← Situational intelligence
├── settings.json ← Control center
CLAUDE.md         ← Project brain (root)

1. Agents: Your AI Team

Each agent is a specialist. Claude automatically delegates work to the right agent. For example, 6 agents: code-reviewer, debugger, test-writer, refactorer, doc-writer, security-auditor.

FieldPurpose
toolsThe tools the agent is allowed to use
modelsonnet, opus, or haiku
memoryRemembers context across sessions
maxTurnsMaximum number of steps before stopping
---
name: code-reviewer
description: Reviews code for bugs and security issues before merge.
tools: Read, Glob, Grep, Bash
model: sonnet
memory: project
---
You are a senior code reviewer.
Step 1: Run `git diff HEAD~1`, read every changed file.
Step 2: Security scan -- grep for hardcoded keys, check Zod validation, verify auth.
Step 3: Performance -- no unnecessary re-renders, images use next/image.
Step 4: Quality -- no `any` types, functions under 50 lines, no duplication.
Step 5: Report as CRITICAL / WARNING / SUGGESTION. Block if CRITICAL found.

2. Commands: No Need to Retype Your Prompt

Set up the prompt once, run it anytime. For example, 3 commands: /fix-issue, /deploy, /pr-review.

---
name: fix-issue
argument-hint: [issue-number]
---
Fix GitHub issue #$ARGUMENTS:
1. `gh issue view $ARGUMENTS` -- read the issue
2. Find relevant source files
3. Implement the minimal fix
4. Write a regression test
5. `npm test` -- all green
6. Commit: "fix: description (closes #$ARGUMENTS)"

Usage: Type /fix-issue 42 and Claude handles the rest.

3. Hooks: Rules Claude CANNOT Break

Scripts run before/after every action. Exit code 2 = block. Exit code 0 = allow.

#!/bin/bash
# Before EVERY commit: type check → lint → test
# If anything fails, commit is BLOCKED.

npx tsc --noEmit || exit 2
npx eslint $(git diff --cached --name-only | grep -E "\.(ts|tsx)$") --quiet || exit 2
npm test -- --silent || exit 2
echo "All checks passed!"
exit 0

e.g., pre-commit.sh (blocks bad commits), lint-on-save.sh (auto-formats after edits).

4. Rules: Context-Aware Instructions

Claude only loads the rules relevant to the file being edited.

---
paths:
  - "components/**/*.tsx"
  - "app/**/*.tsx"
---
# Frontend Rules
- Functional components + hooks only
- shadcn/ui for primitives, never build from scratch
- Tailwind CSS, dark mode first
- Zustand for global state, no prop drilling
- cn() for conditional classes
- next/image for all images

e.g., frontend.md, database.md, api.md. Claude auto-loads them based on the files being touched.

5. Skills: Situational Intelligence

Instruction sets that Claude applies when it detects a specific situation. Can be invoked manually.

---
name: frontend-design
description: Apply my exact design standards to any UI
user-invocable: true
---
Colors: #FF6B35 primary, #0A0A0F background
Typography: Inter, -0.02em tracking, 48-64px hero, 15-16px body
Spacing: 64px sections, 24px card padding, 16px border radius
Dark mode: Never flat black. Depth through gradients, glows, borders.

6. CLAUDE.md: Project Brain

Loaded EVERY session. Put your stack, commands, and conventions here.

# Project Brain

## Stack
Next.js 14, Tailwind + shadcn/ui, Supabase, Stripe, Vercel

## Commands
npm run dev | npm run build | npm test | npm run lint

## Conventions
- TypeScript strict, no `any`
- Zustand for state
- Dark mode first
- Auto-commit after every change

7. settings.json: Control Center

Controls permissions, hooks, and model config.

{
  "permissions": {
    "allow": ["Bash(npm run lint)", "Bash(npm run test *)", "Bash(npm run build)", "Bash(git diff *)", "Bash(gh issue *)"],
    "deny": ["Read(.env)", "Read(.env.*)", "Bash(rm -rf *)", "Bash(git push --force *)"]
  },
  "hooks": {
    "PreToolUse": [{ "matcher": "Bash", "hooks": [{ "type": "command", "command": ".claude/hooks/pre-commit.sh" }] }],
    "PostToolUse": [{ "matcher": "Edit|Write", "hooks": [{ "type": "command", "command": ".claude/hooks/lint-on-save.sh" }] }]
  },
  "model": "claude-sonnet-4-6",
  "autoMemoryEnabled": true
}

Quick Setup: One Command Creates the Entire Structure

mkdir -p .claude/{agents,commands,hooks,rules,skills/frontend-design}
touch .claude/agents/{code-reviewer,debugger,test-writer,refactorer,doc-writer,security-auditor}.md
touch .claude/commands/{fix-issue,deploy,pr-review}.md
touch .claude/hooks/{pre-commit,lint-on-save}.sh
touch .claude/rules/{frontend,database,api}.md
touch .claude/skills/frontend-design/SKILL.md
touch .claude/settings.json CLAUDE.md
chmod +x .claude/hooks/*.sh

Then paste the content from each section into its matching file. Done!

Summary

This setup turns Claude from an AI chat tool → a full dev team with:

  • 🔧 Agents: a specialist for each job (review, debug, test...)
  • Commands: reusable prompts for your everyday workflow
  • 🛡️ Hooks: quality gates that block bad commits
  • 📋 Rules: conventions automatically applied based on context
  • 🎯 Skills: design system and standards ready to go
  • 🧠 CLAUDE.md: project brain that is always loaded
  • ⚙️ settings.json: permissions & model config

📖 Original article: LeadGenMan: Claude Folder Setup Guide