Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 

Repository files navigation

Claude Code — Instant Project Setup

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.

How to use

Option 1 — Paste directly:

  1. Open your project in Claude Code
  2. Copy everything below the --- line
  3. Paste it as a message and hit Enter

Option 2 — Save as a global skill (recommended):

  1. Create ~/.claude/skills/setup/SKILL.md
  2. Paste the content below (including the frontmatter)
  3. Now type /setup in 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.

STEP 4: .claude/settings.local.json

Create and add to .gitignore:

{
  "env": {
    "EDITOR": "code"
  }
}

STEP 5: Hooks

Create .claude/hooks/ with these scripts:

format-on-save.sh (PostToolUse, matcher: "Edit|Write")

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.

protect-files.sh (PreToolUse, matcher: "Edit|Write")

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.

post-compact-reminder.sh (PostCompact)

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).

STEP 6: Skills

Create in .claude/skills/ based on project type:

Web projects (React, Next.js, Vue, Svelte, Angular):

  • component/SKILL.md — Component generator following project conventions (naming, styling, patterns)
  • page/SKILL.md — Page/route generator with proper metadata

API projects (Express, FastAPI, Django, Rails, Spring):

  • endpoint/SKILL.md — API endpoint generator with validation and error handling
  • migration/SKILL.md — Database migration generator

Python projects:

  • module/SKILL.md — Python module generator with proper structure

All projects:

  • 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.

STEP 7: Agents

Create in .claude/agents/:

code-reviewer.md (always create)

  • 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

test-runner.md (if test framework detected)

  • tools: Read, Write, Edit, Bash, Glob, Grep
  • model: sonnet
  • maxTurns: 15
  • Customize for the project's test framework and conventions

STEP 8: .mcp.json

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

STEP 9: .claude/rules/ (for larger projects)

If the project has 10+ source files, create topic-specific rules:

  • code-style.md — extracted from linter/formatter config
  • testing.md — testing conventions from existing tests

Use paths: frontmatter to scope rules to specific directories.

STEP 10: Enable Agent Teams

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.json

Subagents vs Agent Teams:

Subagents: 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

STEP 11: Summary

Present a report:

Created Files

List every file created with a one-line description.

Skipped Files

List any files that already existed and were skipped.

Recommended Next Steps

  1. Install marketplace plugins: superpowers, context7
  2. Run /deploy-check to verify project health
  3. Try Agent Teams: "Create an agent team to [your task]"
  4. Project-specific recommendations (e.g., "add tests for X", "set up CI")

IMPORTANT

  • 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

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors