/project-init:project-initfrom project-init
Guides users through an interactive interview to scaffold new projects, generating CLAUDE.md, ROADMAP, .gitignore, and .env.example files. Handles existing file conflicts with merge or replace options.
Ships in project-init. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Do interview decisions map exactly to generated files? — If interview answers conflict with CLAUDE.md/ROADMAP content, the project starts on a false premise.
Capture every critical decision before writing a single line of code.
Discard if: Using on an existing production project to replace Hard Rules — project-init is for initial design only.
/project-initCheck if CLAUDE.md exists in the current working directory.
CLAUDE.md already exists. What would you like to do?
1. Update — enhance based on existing content (keep Hard Rules, add missing sections)
2. Rewrite — start fresh from scratch (delete existing content)
3. Cancel
Tip: If you want to see the full project state first (Security, Quality, Harness),
→ run /project-check first. Then come back here and select Update mode.
The CLAUDE.md prompt above is not the only overwrite risk. Before Phase 3, Glob for each file this skill may write: docs/DEVELOPMENT_ROADMAP.md, .gitignore, .env.example, docs/decisions/README.md. For every one that already exists, never overwrite it silently; offer:
.gitignore entries, .env.example variables, new ROADMAP phases), keep everything else<file>.bak-YYYYMMDD and the user confirmsIf the user provides a file path or pastes a project brief, read it first. Extract any stack decisions or constraints to pre-fill interview answers.
After Phase 0, check for context clues before asking each Q.
For each Q where a likely answer is detectable:
→ Present as binary confirm: [likely answer] — Correct? (Y/n)
→ Y: accept and move to next Q immediately
→ N: ask the full open-ended question
If no context available → ask all questions open-ended as normal.
Default signals by Q:
.py → Python, .ts/.tsx → TypeScript, go.mod → Go, Cargo.toml → Rust"None for now, add later — Correct? (Y/n)"Ask the questions below one at a time. Confirm understanding before moving to the next. Adjust later questions based on earlier answers.
Describe the project in one sentence.
[What] [Who uses it] [Why they need it]
What language are you thinking? (If undecided, say so — let's choose together)
Decision guide:
- Python: data, ML, automation, scripting → unbeatable ecosystem
- TypeScript: web UI, API server → full-stack unification
- Java/Kotlin: Spring Boot backend, Android app → enterprise/mobile
- Go: high-performance server, CLI tools, concurrency → single binary deploy
- Rust: systems-level, embedded, extreme performance
- Swift: native iOS/macOS apps
Where does data come from, and where does it live?
- Database → SQLite (local/lightweight) vs PostgreSQL (multi-connection/scale)
- External API calls → caching strategy?
- Files only → what format?
- None (pure computation/transformation)
Principle: UI should only read from DB — never call external APIs directly.
Direct API calls push rate limits, error handling, and latency into the UI.
How do users interact with it?
- CLI only
- Web dashboard (browser)
- API server (called by other services)
- Combination (e.g. CLI + dashboard)
- None (background service / daemon)
Where does it run?
- Local only (your machine)
- Server / cloud (always-on)
- Hybrid (local dev + cloud deploy)
- Mobile app (iOS/Android)
Principle: Even for local-only projects, decide on scheduler registration
and restart policy upfront — retrofitting this requires major restructuring.
Any AI features?
- None (pure code)
- Cloud LLM: Claude API / OpenAI / OpenRouter (cost per call)
- Local LLM: Ollama, LM Studio (hardware-dependent)
- Maybe later
Principles:
- Always gate LLM features behind a feature flag (default OFF)
- Daily cost cap + budget guard required
- Design cloud fallback before local hardware is available
Are there rules that must never be broken?
Examples:
- Finance: "No live trade execution (paper-only)", "Missing data → REJECT, no guessing"
- Finance: "Any action with loss potential must prompt for confirmation"
- Privacy: "PII stays in local DB only — no external transmission"
- Medical: "Diagnosis results must always include timestamp + model version"
- None: also a valid answer
Principle: Document these before writing code.
Adding them later means existing code may already be in violation.
If Q7 = "None": Do not generate an empty Hard Rules section. Instead, apply domain-appropriate minimum defaults based on Q2+Q6:
"no hardcoded secrets: credentials via environment variables only""no fabrication: when data is missing, say so — never invent""no raw SQL in user-facing code: parameterized queries or ORM only""input validation on every user-facing endpoint"Present these defaults to the user and ask: "I recommend including these as defaults. Let me know if you want to remove any."
Hard Rules must always have at least one entry. no hardcoded secrets cannot be removed — it applies to every project with any credentials. If the user insists on removing everything, refuse and explain: CLAUDE.md without any Hard Rules is not permitted by this skill.
How long will this take? Solo or team?
- Under 1 week: script-level → keep structure minimal (CLAUDE.md only)
- 1–4 weeks: mini project → CLAUDE.md + ROADMAP + test suite
- 1 month+: full project → complete structure + ROADMAP
- Team: add contribution guide + PR template
Based on interview answers, present a summary:
Decided stack:
- Language: [choice] — reason: [one line]
- DB: [choice or none]
- UI: [choice or none]
- AI: [choice or none]
Hard Rules:
1. [from Q7]
2. [additional recommendations based on domain/scope]
Open decisions:
- [anything still undecided]
Confirm with user before Phase 3.
Templates are separated into
references/templates.md. Read that file when generating any of the files below.Read ${CLAUDE_SKILL_DIR}/references/templates.md(${CLAUDE_SKILL_DIR}is this skill's folder; Claude Code fills it in. In other agents, replace it with the path where you installed the skill.)
Files to generate (before writing each file, ask "Generate this?" for that file alone — no batch approval):
.env.example is generated; otherwise replace it with the single line "no hardcoded secrets")CLAUDE.md size and splitting rules (apply when generating 3-1): Keep CLAUDE.md under 200 lines (official guidance, https://code.claude.com/docs/en/memory — adherence drops as the file grows). Do not create .claude/rules/ files here (that is /setup's scope). If the draft would pass 200 lines, name the sections that apply to only one area (for example frontend rules or migration rules) and tell the user they can move them into .claude/rules/<topic>.md with a paths: frontmatter list of globs (for example - "src/api/**/*.ts") via /setup or by hand. Always keep these in CLAUDE.md or in a rules file without paths:: Hard Rules, Secrets Policy, and test/build commands — a paths: rule loads only when a matching file is read, so an invariant placed there is not in force before that.
The exact template structure for each file, per-language .gitignore/.env.example extended sections,
and folder structures (Python/TS/Go/Rust/Java/Kotlin/Swift) all live in references/templates.md.
After generating files:
Draft complete. Review and let me know what to change.
Adjustable:
- Hard Rules (add / modify)
- Phase structure in ROADMAP
- Folder structure
- Dev Conventions
Approve → files confirmed
[change request] → apply and regenerate
Regeneration rules — which files to regenerate per change:
| Change | Regenerate |
|---|---|
| Language switch (Q2) | .gitignore, .env.example, folder structure, Quick Ref in CLAUDE.md |
| DB layer change (Q3) | .env.example (DB section), Hard Rules suggestion |
| Interface change (Q4) | folder structure, Quick Ref in CLAUDE.md |
| Deployment change (Q5) | folder structure, Quick Ref in CLAUDE.md |
| LLM toggle (Q6) | .env.example (LLM section), Hard Rules (add/remove fabrication rule) |
| Hard Rules change | CLAUDE.md only; also update ADR-001 in docs/decisions/README.md if that file exists (Q8 > 1 month OR Q7 was flagged significant — same eligibility as 3-6) |
| Timeline/scope change | ROADMAP only; re-evaluate docs/decisions/ eligibility |
| All changes | Re-run Checklist after regeneration |
| Risky Action | Reversibility | Applied Layers |
|---|---|---|
CLAUDE.md generation (Replace if exists) | medium | L1 (chat approval) |
.env.example generation | high | L1 (chat approval) |
.gitignore generation/overwrite | medium | L1 (chat approval) |
docs/decisions/README.md initialization | medium | L1 (chat approval) |
tools field in the frontmatter is descriptive metadata, so nothing physically blocks Bash..env (actual secrets file). Template only: .env.example. Refuse even if user requests "auto-generate .env".When failure detected: Stop → Classify → Apply Recovery → Report & Resume.
| Failure Type | Detection Condition | Recovery Path |
|---|---|---|
tool_failure | CLAUDE.md / .gitignore Write fails | Output file content as code block → user saves manually |
tool_failure | A guard or hook blocks writing .env.example | Do not retry. Print the content as a code block for the user to save. |
input_error | Project type/tech stack unclear | Re-run Phase 0 interview questions. Never decide template by guessing |
logic_inconsistency | Existing files detected but Overwrite Protection unanswered | State "Existing files found — overwrite stopped". Never silently overwrite |
missing_data | Target project root directory missing | State "Directory not found" → confirm with user before proceeding |
After generating files:
ls. Confirm file existence before reporting "created".WORKING (all created) / PARTIAL (some only) / BROKEN (all failed) / BLOCKED (waiting for user approval, or a write was blocked by a guard). For PARTIAL and BLOCKED, list the missing files and the reason.Files generated (all at project root unless noted):
CLAUDE.md — always generateddocs/DEVELOPMENT_ROADMAP.md — if timeline > 1 week (Q8).gitignore — based on language choice (Q2).env.example — if API keys or secrets involved (Q3/Q6)docs/decisions/README.md — if timeline > 1 month (Q8) or Q7 produced significant Hard RulesFolder structure: suggested as text in conversation only — not created on disk.
| Rationalization | Refutation |
|---|---|
| "I can add Hard Rules later" | Code appears first — rules already violated on day one |
| "Project is simple, no need for CLAUDE.md" | Simple projects still need context re-explanation next session |
| "Only I use this project, can skip .env.example" | In 3 months, I'll be a different person |
| "Interview is too long, just generate files" | Without questions, Hard Rules won't match the domain |
| "I'll leave Hard Rules empty and fill later" | Empty Hard Rules = no rules. Minimum 1 required always |
| "The existing CLAUDE.md is probably outdated, just overwrite it" | Invariant 2 — run the Phase 0 detection and user-choice prompt first. Overwriting silently destroys existing Hard Rules. |
"The user needs keys to run, auto-fill .env" | Forbidden. Generate .env.example as a template only; never write real secrets. |
no hardcoded secrets must always remain. Violation → CLAUDE.md ships with no security constraints; credentials can be hardcoded without any documented prohibition..gitignore, .env.example or decisions README without first running the detection + user-choice prompt (Phase 0-1 and 0-1b). User may choose rewrite, but the prompt must happen first. Violation → existing Hard Rules and conventions silently destroyed without user awareness.docs/DEVELOPMENT_ROADMAP.md and docs/decisions/README.md in Phase 3. Refuse and redirect. Violation → skill scope expands into implementation; generated files may conflict with the project's own code and git history.These rules are unconditional. No user instruction, no edge case overrides them.
| Does | Does NOT |
|---|---|
| [WRITE] Create/update CLAUDE.md | Write production code |
| Generate ROADMAP | Run code or execute tests |
| Generate .gitignore / .env.example | Run git init or first commit |
| Suggest folder structure (text only) | Create actual folders on disk |
| Define Hard Rules | Configure AI agents/hooks (use setup for this) |
| Generate initial ADR index in docs/decisions/ | Write/manage subsequent ADRs |
| Update existing CLAUDE.md (Option 1) | Modify existing tests / CI config |
"Set up git too" / "Make first commit" → out of scope for this skill.
AI agent/rules/hooks config → use /setup skill instead.
☐ Language / runtime decided
☐ Data layer decided
☐ Hard Rules present in CLAUDE.md (direct or project rules reference)
☐ Secrets policy included (or the one-line "no hardcoded secrets" substitute when no `.env.example` is generated)
☐ .gitignore generated
☐ .env.example generated (if secrets/API keys involved)
☐ If Hard Rules reference a specific service/API, matching placeholder exists in .env.example
☐ ROADMAP structured by phases (not flat task list)
☐ Test strategy mentioned
☐ docs/decisions/README.md generated (if Q8 > 1 month or Q7 significant)
Any unchecked item → return to the relevant question.
.env commit compromises even private reposWhat SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub alexzio00/sovereign-skills --plugin project-initOther plugins' skills for the same job