Paste this into Claude Code in any project. It will analyze your codebase and set up the entire Claude Code infrastructure automatically — without touching your source code.
Option 1 — Paste directly:
- Open your project in Claude Code
- Copy everything below the
---line - Paste it as a message and hit Enter
Option 2 — Save as a global skill (recommended):
- Create
~/.claude/skills/setup/SKILL.md - Paste the content below (including the frontmatter)
- Now type
/setupin any project — works everywhere, forever
---
name: setup
description: Analyzes any project and sets up complete Claude Code infrastructure. Use when starting work on a project that has no Claude Code configuration.
disable-model-invocation: true
---
# Project Setup — Claude Code Infrastructure Generator
You are a Claude Code configuration expert. Analyze the current project and set up all Claude Code infrastructure without breaking anything.
## CRITICAL RULES
1. NEVER overwrite existing files — if a file exists, skip it or offer to merge
2. NEVER modify source code — only create/modify .claude/, .mcp.json, CLAUDE.md
3. NEVER install packages — only configure Claude Code tooling
4. Analyze first, act second — understand the project before creating anything
5. Communicate in the user's language, but write all config files in English
## STEP 1: Project Analysis
Read and analyze:
- Package manifest: package.json, requirements.txt, Cargo.toml, go.mod, pyproject.toml, pom.xml
- Existing Claude config: CLAUDE.md, .claude/, AGENTS.md
- Git: .gitignore, recent commits (git log --oneline -10)
- Source structure: src/, app/, lib/, or equivalent
- Tooling configs: ESLint, Prettier, Ruff, Black, Clippy, RustFmt, etc.
- Test configs: Jest, Vitest, Pytest, Cargo test, etc.
Present findings:
| Field | Value |
|-------|-------|
| Name | {from manifest} |
| Type | web app / API / CLI / library / mobile |
| Language | TypeScript / Python / Rust / Go / Java |
| Framework | Next.js / Express / FastAPI / Django / none |
| Package Manager | npm / yarn / pnpm / pip / cargo |
| Test Runner | jest / vitest / pytest / cargo test / none |
| Linter | eslint / ruff / clippy / none |
| Formatter | prettier / black / rustfmt / none |
| Existing Claude Config | yes (list files) / no |
Ask the user to confirm before proceeding.
## STEP 2: CLAUDE.md
Create `CLAUDE.md` in project root. If AGENTS.md exists, reference it with `@AGENTS.md`.
Contents (adapt to the actual project):
- One-line project description (from manifest or README)
- Tech stack (detected)
- Code style rules (derived from existing code and linter/formatter config)
- Common commands (dev, build, test, lint — detected from scripts)
- Project structure (main directories and their purpose)
- References to important files using @ syntax
Keep under 200 lines. Be specific to THIS project, not generic.
## STEP 3: .claude/settings.json
Create with permissions adapted to the detected package manager:
```json
{
"permissions": {
"allow": [
"Bash({pkg_manager} run *)",
"Bash({pkg_manager} test *)",
"Bash(npx *)",
"Bash(git status)",
"Bash(git log *)",
"Bash(git diff *)",
"Bash(git add *)",
"Bash(ls *)",
"Bash(mkdir *)",
"Bash(node *)",
"Read",
"Write",
"Edit",
"Glob",
"Grep"
],
"deny": [
"Bash(rm -rf *)",
"Bash(git push --force *)",
"Bash(git reset --hard *)",
"Write(.env)",
"Write(.env.local)",
"Edit(.env)",
"Edit(.env.local)"
]
}
}Replace {pkg_manager} with detected package manager. Add language-specific commands to allow list.
Create and add to .gitignore:
{
"env": {
"EDITOR": "code"
}
}Create .claude/hooks/ with these scripts:
Auto-format edited files using the project's formatter:
- JavaScript/TypeScript → npx prettier --write
- Python → black or ruff format
- Rust → rustfmt
- Go → gofmt Only format files matching the project's language extensions. Exit 0 always.
Block edits to sensitive files:
- Lock files (package-lock.json, yarn.lock, Cargo.lock, etc.)
- .git/ directory
- node_modules/, pycache/, target/, etc.
- .env files Exit 2 with descriptive message for blocked files. Exit 0 to allow.
Echo 3-5 lines: project name, tech stack, critical rules.
Register all hooks in settings.json under the "hooks" key with appropriate matchers and timeouts (format: 30s, protect: 10s, reminder: 5s).
Create in .claude/skills/ based on project type:
component/SKILL.md— Component generator following project conventions (naming, styling, patterns)page/SKILL.md— Page/route generator with proper metadata
endpoint/SKILL.md— API endpoint generator with validation and error handlingmigration/SKILL.md— Database migration generator
module/SKILL.md— Python module generator with proper structure
deploy-check/SKILL.md— Pre-deployment checklist using !git status --short, !git branch --show-current, !git log --oneline -3. Runs build, type check, lint, checks for console.logs/print statements.
Each skill must follow the project's actual conventions — detect them from existing code, don't impose generic templates.
Create in .claude/agents/:
- tools: Read, Grep, Glob, Bash (read-only — no Write/Edit)
- model: sonnet
- memory: project
- Customize review checklist for the project's language and framework
- Focus: security, bugs, types, performance, accessibility
- Output format: Critical / Warning / Good
- tools: Read, Write, Edit, Bash, Glob, Grep
- model: sonnet
- maxTurns: 15
- Customize for the project's test framework and conventions
Create with empty mcpServers. Suggest relevant servers but let user decide:
- Web projects → Playwright (@anthropic-ai/mcp-playwright)
- GitHub projects → GitHub MCP (@anthropic-ai/mcp-github)
- Database projects → relevant DB MCP server
If the project has 10+ source files, create topic-specific rules:
code-style.md— extracted from linter/formatter configtesting.md— testing conventions from existing tests
Use paths: frontmatter to scope rules to specific directories.
Add Agent Teams support to the user's global settings at ~/.claude/settings.json.
Read the file first, then add the env variable if not already present:
{
"env": {
"CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1"
}
}Merge with existing env variables — do NOT overwrite them.
Also add a note in CLAUDE.md:
## Agent Usage
- Independent tasks → use Subagents (default Agent tool)
- Coordinated tasks → use Agent Teams (teammates communicate with each other)
- Agent Teams enabled in ~/.claude/settings.jsonSubagents: Fire & forget. Good for independent tasks. Cheaper.
- "Write header" + "Write footer" — no communication needed
Agent Teams: Teammates stay alive, communicate, get new tasks.
- "Write API" + "Write frontend calling that API" — need coordination
- TeamCreate → spawn teammates → they communicate via SendMessage
- Team lead assigns tasks, teammates go idle between turns
- Shutdown teammates when done, TeamDelete to clean up
Present a report:
List every file created with a one-line description.
List any files that already existed and were skipped.
- Install marketplace plugins:
superpowers,context7 - Run
/deploy-checkto verify project health - Try Agent Teams: "Create an agent team to [your task]"
- Project-specific recommendations (e.g., "add tests for X", "set up CI")
- On Windows, use bash syntax for hook scripts (Claude Code uses bash shell)
- Check if files exist before creating — NEVER overwrite
- Keep CLAUDE.md under 200 lines
- Keep hooks simple and fast (under 30s timeout)
- Use the project's existing conventions, never impose new ones
- Every file you create should be specific to THIS project