Claude Code Starter
You are setting up Claude Code configuration for a project. Follow the flow below to analyze the project and generate all .claude/ configuration files.
Step 1: Detect Project Type
Check if this is a new project (empty or <3 source files) or an existing project.
For new projects, ask the user these questions:
- What are you building? (project description)
- Primary language? (TypeScript, JavaScript, Python, Go, Rust, Swift, Kotlin, Java, Ruby, C#, PHP, C++)
- Framework? (filtered by language — e.g. Next.js/React/Vue for TS/JS, FastAPI/Django/Flask for Python)
- Package manager? (filtered by language)
- Testing framework? (filtered by language, or "None")
- Linter/Formatter? (filtered by language, or "None")
- Project type? (Web App, API/Backend, CLI Tool, Library/Package, Mobile App, Desktop App, Monorepo, Other)
For existing projects, analyze the codebase:
- Read
package.json, pyproject.toml, Cargo.toml, go.mod, Gemfile, or equivalent
- Detect languages, frameworks, package manager, testing, linting, formatting, bundler
- Identify architecture patterns, directory structure, code conventions
Step 2: Create .claude/settings.json
Generate settings.json with permissions based on detected stack. Example:
{
"$schema": "https://json.schemastore.org/claude-code-settings.json",
"permissions": {
"allow": [
"Read(**)", "Edit(**)", "Write(.claude/**)", "Bash(git:*)",
"Bash(npm:*)", "Bash(node:*)"
]
}
}
Add language/framework-specific permissions (e.g. Bash(cargo:*) for Rust, Bash(pytest:*) for Python).
Step 3: Generate CLAUDE.md
Perform deep codebase analysis and generate .claude/CLAUDE.md following this structure:
Phase 1: Discovery
Read actual project files to discover:
- Project identity (name, version, description, purpose)
- Directory structure map (depth 3)
- Tech stack deep scan (languages, frameworks, database, auth, API layer, styling, build tools, CI/CD)
- Architecture pattern recognition (MVC, Clean, Hexagonal, etc.)
- Entry points and key files
- Code conventions (naming, imports, exports, function style, error handling)
- Development workflow (scripts, env vars, pre-commit hooks, testing setup)
- Domain knowledge (entities, workflows, integrations)
Phase 2: Write CLAUDE.md
Using ONLY discovered information, write .claude/CLAUDE.md with:
- Project name + one-line description
- Overview (purpose, audience, value proposition)
- Architecture (pattern, directory structure, data flow, key files)
- Tech stack table
- Development setup (prerequisites, getting started, env variables)
- Common commands
- Code conventions (naming patterns, patterns to follow, anti-patterns)
- Testing (commands, writing patterns)
- Domain knowledge (entities, workflows)
- Gotchas & important notes
- Rules
Phase 3: Quality Check
Verify every section contains project-specific content, not generic boilerplate. Skip sections without real content.
Step 4: Generate Skills
Write each skill file to .claude/skills/ with YAML frontmatter (name, description, globs).
Core Skills (ALWAYS generate all 8):
.claude/skills/pattern-discovery.md — Analyze codebase to discover and document patterns. Include project-specific search strategies based on the actual directory structure and file patterns found.
.claude/skills/systematic-debugging.md — 4-phase methodology: Reproduce, Locate, Diagnose, Fix. Tailor reproduction steps to the project's actual test runner and dev server commands.
.claude/skills/testing-methodology.md — AAA pattern (Arrange, Act, Assert). Use the project's actual testing framework syntax (e.g., describe/it for Jest/Vitest, def test_ for pytest). Include mocking patterns specific to the stack.
.claude/skills/iterative-development.md — TDD workflow loop: write failing test → implement → verify → refactor. Use the project's actual test command and lint command.
.claude/skills/commit-hygiene.md — Atomic commits, conventional commit format, size thresholds (±300 lines), when-to-commit triggers.
.claude/skills/code-deduplication.md — Check-before-write principle. Search existing code before writing new code. Include project-specific glob patterns for common file types.
.claude/skills/simplicity-rules.md — Function length limits (≤40 lines), file limits (≤300 lines), cyclomatic complexity constraints. Decomposition patterns.
.claude/skills/security.md — .gitignore entries for the stack, environment variable handling patterns, OWASP checklist items relevant to the detected framework.
Framework-Specific Skills (ONLY if detected):
Generate the appropriate skill based on detected frameworks:
| Framework |
Skill File |
Key Content |
| Next.js |
nextjs-patterns.md |
App Router, Server/Client Components, data fetching, middleware |
| React (no Next.js) |
react-components.md |
Hooks, component patterns, state management, performance |
| FastAPI |
fastapi-patterns.md |
Router organization, dependency injection, Pydantic models, async |
| NestJS |
nestjs-patterns.md |
Modules, controllers, services, decorators, pipes, guards |
| SwiftUI |
swiftui-patterns.md |
Property wrappers, MVVM, navigation, previews |
| UIKit |
uikit-patterns.md |
View controllers, Auto Layout, delegates, MVC |
| Vapor |
vapor-patterns.md |
Routes, middleware, Fluent ORM, async controllers |
| Jetpack Compose |
compose-patterns.md |
@Composable, remember, ViewModel, navigation |
| Android Views |
android-views-patterns.md |
Activities, Fragments, XML layouts, ViewBinding |
| Vue/Nuxt |
vue-patterns.md |
Composition API, composables, Pinia, routing |
| Django |
django-patterns.md |
Models, views, serializers, middleware, admin |
| Rails |
rails-patterns.md |
MVC, ActiveRecord, concerns, service objects |
| Spring |
spring-patterns.md |
Beans, controllers, services, repositories, AOP |
Tailor ALL skill content to the specific project's patterns, file structure, and conventions discovered during analysis.
Step 5: Generate Agents
Write 2 agent files to .claude/agents/:
.claude/agents/code-reviewer.md
---
name: code-reviewer
description: Reviews code for quality, security issues, and best practices
tools:
- Read
- Grep
- Glob
- "Bash(biome check .)" # Use actual lint command
disallowed_tools:
- Write
- Edit
model: sonnet
---
Body: Instructions for reviewing code quality, security, naming conventions, test coverage, and adherence to project patterns.
.claude/agents/test-writer.md
---
name: test-writer
description: Generates comprehensive tests for code
tools:
- Read
- Grep
- Glob
- Write
- Edit
- "Bash(bun test)" # Use actual test command
model: sonnet
---
Body: Instructions for writing tests using the project's actual testing framework, following existing test patterns.
Step 6: Generate Rules
Write rule files to .claude/rules/:
Always Generate:
.claude/rules/code-style.md — Formatting tool, comment style, error handling, git commit conventions.
Conditional (by language):
| Language |
File |
YAML paths |
Key Rules |
| TypeScript |
typescript.md |
["**/*.ts", "**/*.tsx"] |
Strict mode, type annotations, import style |
| Python |
python.md |
["**/*.py"] |
Type hints, docstrings, import ordering |
| Swift |
swift.md |
["**/*.swift"] |
Access control, optionals, protocol-oriented |
| Go |
go.md |
["**/*.go"] |
Error handling, interfaces, package naming |
| Rust |
rust.md |
["**/*.rs"] |
Ownership, error handling, trait patterns |
Each rule file needs YAML frontmatter with paths for file matching.
Step 7: Generate Commands
Write 5 command files to .claude/commands/:
.claude/commands/task.md
---
allowed-tools: ["Read", "Write", "Edit", "Glob"]
description: "Start or switch to a new task"
argument-hint: "<task description>"
---
Instructions to update .claude/state/task.md with new task, set status to "In Progress".
.claude/commands/status.md
---
allowed-tools: ["Read", "Glob", "Bash(git status)"]
description: "Show current task and session state"
---
Instructions to read task.md, show git status, summarize current state.
.claude/commands/done.md
---
allowed-tools: ["Read", "Write", "Edit", "Glob", "Bash(git:*)", "Bash(bun test)"]
description: "Mark current task complete"
---
Instructions to run tests, lint, verify, update task.md status to "Done".
.claude/commands/analyze.md
---
allowed-tools: ["Read", "Glob", "Grep"]
description: "Deep analysis of a specific area"
argument-hint: "<area or file path>"
---
Instructions to perform thorough analysis of specified area.
.claude/commands/code-review.md
---
allowed-tools: ["Read", "Glob", "Grep", "Bash(git diff)"]
description: "Review code changes for quality and security"
---
Instructions to review staged/unstaged changes.
Output Summary
After generating all files, output a brief summary:
- List of files created
- Any gaps found (missing config files, unclear patterns)
- Suggested next steps
Important Guidelines
- Be specific, not generic. Every file must contain project-specific content.
- Reference real files. Use
path/to/file.ts:lineNumber format.
- Use actual commands. Reference the project's real test/lint/build commands.
- Skip what doesn't apply. Don't generate framework skills for frameworks not in use.
- Respect existing files. If
.claude/ files exist, read and preserve manually-added content.
1---2name: claude-code-starter3description: Analyze a project's tech stack and generate comprehensive Claude Code configuration files (.claude/ directory with CLAUDE.md, skills, agents, rules, and commands). Use when setting up Claude Code for a new or existing repository.4---56# Claude Code Starter78You are setting up Claude Code configuration for a project. Follow the flow below to analyze the project and generate all `.claude/` configuration files.910## Step 1: Detect Project Type1112Check if this is a **new project** (empty or <3 source files) or an **existing project**.1314**For new projects**, ask the user these questions:151. What are you building? (project description)162. Primary language? (TypeScript, JavaScript, Python, Go, Rust, Swift, Kotlin, Java, Ruby, C#, PHP, C++)173. Framework? (filtered by language — e.g. Next.js/React/Vue for TS/JS, FastAPI/Django/Flask for Python)184. Package manager? (filtered by language)195. Testing framework? (filtered by language, or "None")206. Linter/Formatter? (filtered by language, or "None")217. Project type? (Web App, API/Backend, CLI Tool, Library/Package, Mobile App, Desktop App, Monorepo, Other)2223**For existing projects**, analyze the codebase:24- Read `package.json`, `pyproject.toml`, `Cargo.toml`, `go.mod`, `Gemfile`, or equivalent25- Detect languages, frameworks, package manager, testing, linting, formatting, bundler26- Identify architecture patterns, directory structure, code conventions2728## Step 2: Create `.claude/settings.json`2930Generate `settings.json` with permissions based on detected stack. Example:3132```json33{34 "$schema": "https://json.schemastore.org/claude-code-settings.json",35 "permissions": {36 "allow": [37 "Read(**)", "Edit(**)", "Write(.claude/**)", "Bash(git:*)",38 "Bash(npm:*)", "Bash(node:*)"39 ]40 }41}42```4344Add language/framework-specific permissions (e.g. `Bash(cargo:*)` for Rust, `Bash(pytest:*)` for Python).4546## Step 3: Generate CLAUDE.md4748Perform deep codebase analysis and generate `.claude/CLAUDE.md` following this structure:4950### Phase 1: Discovery5152Read actual project files to discover:53- Project identity (name, version, description, purpose)54- Directory structure map (depth 3)55- Tech stack deep scan (languages, frameworks, database, auth, API layer, styling, build tools, CI/CD)56- Architecture pattern recognition (MVC, Clean, Hexagonal, etc.)57- Entry points and key files58- Code conventions (naming, imports, exports, function style, error handling)59- Development workflow (scripts, env vars, pre-commit hooks, testing setup)60- Domain knowledge (entities, workflows, integrations)6162### Phase 2: Write CLAUDE.md6364Using ONLY discovered information, write `.claude/CLAUDE.md` with:65- Project name + one-line description66- Overview (purpose, audience, value proposition)67- Architecture (pattern, directory structure, data flow, key files)68- Tech stack table69- Development setup (prerequisites, getting started, env variables)70- Common commands71- Code conventions (naming patterns, patterns to follow, anti-patterns)72- Testing (commands, writing patterns)73- Domain knowledge (entities, workflows)74- Gotchas & important notes75- Rules7677### Phase 3: Quality Check7879Verify every section contains project-specific content, not generic boilerplate. Skip sections without real content.8081## Step 4: Generate Skills8283Write each skill file to `.claude/skills/` with YAML frontmatter (`name`, `description`, `globs`).8485### Core Skills (ALWAYS generate all 8):86871. **`.claude/skills/pattern-discovery.md`** — Analyze codebase to discover and document patterns. Include project-specific search strategies based on the actual directory structure and file patterns found.88892. **`.claude/skills/systematic-debugging.md`** — 4-phase methodology: Reproduce, Locate, Diagnose, Fix. Tailor reproduction steps to the project's actual test runner and dev server commands.90913. **`.claude/skills/testing-methodology.md`** — AAA pattern (Arrange, Act, Assert). Use the project's actual testing framework syntax (e.g., `describe`/`it` for Jest/Vitest, `def test_` for pytest). Include mocking patterns specific to the stack.92934. **`.claude/skills/iterative-development.md`** — TDD workflow loop: write failing test → implement → verify → refactor. Use the project's actual test command and lint command.94955. **`.claude/skills/commit-hygiene.md`** — Atomic commits, conventional commit format, size thresholds (±300 lines), when-to-commit triggers.96976. **`.claude/skills/code-deduplication.md`** — Check-before-write principle. Search existing code before writing new code. Include project-specific glob patterns for common file types.98997. **`.claude/skills/simplicity-rules.md`** — Function length limits (≤40 lines), file limits (≤300 lines), cyclomatic complexity constraints. Decomposition patterns.1001018. **`.claude/skills/security.md`** — .gitignore entries for the stack, environment variable handling patterns, OWASP checklist items relevant to the detected framework.102103### Framework-Specific Skills (ONLY if detected):104105Generate the appropriate skill based on detected frameworks:106107| Framework | Skill File | Key Content |108|-----------|-----------|-------------|109| Next.js | `nextjs-patterns.md` | App Router, Server/Client Components, data fetching, middleware |110| React (no Next.js) | `react-components.md` | Hooks, component patterns, state management, performance |111| FastAPI | `fastapi-patterns.md` | Router organization, dependency injection, Pydantic models, async |112| NestJS | `nestjs-patterns.md` | Modules, controllers, services, decorators, pipes, guards |113| SwiftUI | `swiftui-patterns.md` | Property wrappers, MVVM, navigation, previews |114| UIKit | `uikit-patterns.md` | View controllers, Auto Layout, delegates, MVC |115| Vapor | `vapor-patterns.md` | Routes, middleware, Fluent ORM, async controllers |116| Jetpack Compose | `compose-patterns.md` | @Composable, remember, ViewModel, navigation |117| Android Views | `android-views-patterns.md` | Activities, Fragments, XML layouts, ViewBinding |118| Vue/Nuxt | `vue-patterns.md` | Composition API, composables, Pinia, routing |119| Django | `django-patterns.md` | Models, views, serializers, middleware, admin |120| Rails | `rails-patterns.md` | MVC, ActiveRecord, concerns, service objects |121| Spring | `spring-patterns.md` | Beans, controllers, services, repositories, AOP |122123Tailor ALL skill content to the specific project's patterns, file structure, and conventions discovered during analysis.124125## Step 5: Generate Agents126127Write 2 agent files to `.claude/agents/`:128129### `.claude/agents/code-reviewer.md`130```yaml131---132name: code-reviewer133description: Reviews code for quality, security issues, and best practices134tools:135 - Read136 - Grep137 - Glob138 - "Bash(biome check .)" # Use actual lint command139disallowed_tools:140 - Write141 - Edit142model: sonnet143---144```145Body: Instructions for reviewing code quality, security, naming conventions, test coverage, and adherence to project patterns.146147### `.claude/agents/test-writer.md`148```yaml149---150name: test-writer151description: Generates comprehensive tests for code152tools:153 - Read154 - Grep155 - Glob156 - Write157 - Edit158 - "Bash(bun test)" # Use actual test command159model: sonnet160---161```162Body: Instructions for writing tests using the project's actual testing framework, following existing test patterns.163164## Step 6: Generate Rules165166Write rule files to `.claude/rules/`:167168### Always Generate:169- **`.claude/rules/code-style.md`** — Formatting tool, comment style, error handling, git commit conventions.170171### Conditional (by language):172| Language | File | YAML `paths` | Key Rules |173|----------|------|--------------|-----------|174| TypeScript | `typescript.md` | `["**/*.ts", "**/*.tsx"]` | Strict mode, type annotations, import style |175| Python | `python.md` | `["**/*.py"]` | Type hints, docstrings, import ordering |176| Swift | `swift.md` | `["**/*.swift"]` | Access control, optionals, protocol-oriented |177| Go | `go.md` | `["**/*.go"]` | Error handling, interfaces, package naming |178| Rust | `rust.md` | `["**/*.rs"]` | Ownership, error handling, trait patterns |179180Each rule file needs YAML frontmatter with `paths` for file matching.181182## Step 7: Generate Commands183184Write 5 command files to `.claude/commands/`:185186### `.claude/commands/task.md`187```yaml188---189allowed-tools: ["Read", "Write", "Edit", "Glob"]190description: "Start or switch to a new task"191argument-hint: "<task description>"192---193```194Instructions to update `.claude/state/task.md` with new task, set status to "In Progress".195196### `.claude/commands/status.md`197```yaml198---199allowed-tools: ["Read", "Glob", "Bash(git status)"]200description: "Show current task and session state"201---202```203Instructions to read task.md, show git status, summarize current state.204205### `.claude/commands/done.md`206```yaml207---208allowed-tools: ["Read", "Write", "Edit", "Glob", "Bash(git:*)", "Bash(bun test)"]209description: "Mark current task complete"210---211```212Instructions to run tests, lint, verify, update task.md status to "Done".213214### `.claude/commands/analyze.md`215```yaml216---217allowed-tools: ["Read", "Glob", "Grep"]218description: "Deep analysis of a specific area"219argument-hint: "<area or file path>"220---221```222Instructions to perform thorough analysis of specified area.223224### `.claude/commands/code-review.md`225```yaml226---227allowed-tools: ["Read", "Glob", "Grep", "Bash(git diff)"]228description: "Review code changes for quality and security"229---230```231Instructions to review staged/unstaged changes.232233## Output Summary234235After generating all files, output a brief summary:236- List of files created237- Any gaps found (missing config files, unclear patterns)238- Suggested next steps239240## Important Guidelines2412421. **Be specific, not generic.** Every file must contain project-specific content.2432. **Reference real files.** Use `path/to/file.ts:lineNumber` format.2443. **Use actual commands.** Reference the project's real test/lint/build commands.2454. **Skip what doesn't apply.** Don't generate framework skills for frameworks not in use.2465. **Respect existing files.** If `.claude/` files exist, read and preserve manually-added content.