Claude
Skills
Sign in
Back

project-claude-init

Included with Lifetime
$97 forever

Bootstrap a project CLAUDE.md from the template in docs/templates/. Detects stack signals, asks 5 focused questions, writes a compliant file under the project root.

General

What this skill does


# project-claude-init

> Bootstrap a project `CLAUDE.md` from the template in `docs/templates/`.
> Detects stack signals, asks 5 focused questions, writes a compliant file
> under the project root.

**Triggers**: /project-claude-init, init project claude, bootstrap claude, create project CLAUDE.md, set up claude in this project

---

## Process

### Step 0 — Refuse to run in the wrong context

This skill is for projects OTHER than the `claude-config` repo. Refuse and stop
if any of these is true:

- CWD basename is `claude-config` or `agent-config`.
- CWD contains both `install.sh` and `skills/_shared/`.

Print: `This skill is for external projects. The claude-config repo edits its
own CLAUDE.md directly.` and stop.

### Step 1 — Check for existing `CLAUDE.md`

If `CLAUDE.md` already exists at CWD root, STOP and ask:

> A `CLAUDE.md` already exists. Choose one:
>   1. Audit the existing file with `/config-audit` (recommended).
>   2. Overwrite with a fresh template (destructive).
>   3. Cancel.

Wait for the answer. Only proceed to Step 2 if the user explicitly picks
overwrite.

### Step 2 — Locate the template

Read `~/.claude/docs/templates/project-claude-template.md`. If missing, fall
back to the repo path if the user has the `claude-config` repo cloned
locally (`~/agent-config/docs/templates/...` or `~/claude-config/docs/...`).

If neither path resolves, STOP and tell the user to run `install.sh` from
`claude-config` on this machine first.

### Step 3 — Detect stack signals

Scan the project root (one level deep) for stack indicators:

| File present | Stack hint |
|--------------|-----------|
| `package.json` | Node.js. Read `dependencies` to refine: next, react, vue, svelte, express, fastify, nest. |
| `pyproject.toml` / `requirements.txt` | Python. |
| `go.mod` | Go. |
| `Cargo.toml` | Rust. |
| `pom.xml` / `build.gradle` | Java/Kotlin. |
| `Gemfile` | Ruby. |
| `composer.json` | PHP. |
| `mix.exs` | Elixir. |

Also detect test/lint/build commands from `package.json` scripts or
equivalents.

Cache the detected stack signals — they prefill answers in Step 4 but do NOT
bypass user confirmation.

### Step 4 — Ask the 5 wizard questions

Ask one at a time. STOP after each.

**Q1 — Stack description**
```
One-line stack description (prefilled from detection — confirm or edit):

  Detected: <stack signals from Step 3>
```

**Q2 — Conventions**
```
What conventions does this project enforce that the global layer does not
cover? List 1-5 bullets, or "none" if the project uses standard conventions.
```

**Q3 — Commands**
```
Commands (one per line, leave blank to skip):

  Install:    <prefilled from package.json scripts if available>
  Dev:        <prefilled>
  Test:       <prefilled>
  Lint:       <prefilled>
  Type check: <prefilled>
  Build:      <prefilled>
```

**Q4 — Domain glossary**
```
Does this project have non-obvious domain terms that affect code reading
(e.g. "Wallet", "Reconciliation", "Tenant")? List 0-10 terms with one-line
definitions, or "none".
```

**Q5 — Overrides global**
```
Do you need to override any global rule for this project? If yes, name the
rule and the reason. If unsure, answer "none" — overrides should be rare and
deliberate.
```

### Step 5 — Render preview

Use the template skeleton. Fill placeholders with the answers. Drop any
section the user answered with "none" or blank. Show the rendered file inside
a fenced code block. Ask:

> Confirm to write `CLAUDE.md` at the project root? (y / edit / n)

`y` → write. `edit` → ask which section, loop back. `n` → abort.

### Step 6 — Write

Write `CLAUDE.md` at CWD root. Do NOT touch any other file.

### Step 7 — Post-write checklist

Print to the user:

```
Created: CLAUDE.md (<N> lines).

Recommended next steps:
  1. Review the file.
  2. Run /config-audit from this directory to check cross-layer duplication.
  3. Commit the file.

Reminders:
  - This file is the project layer. The global layer (from claude-config)
    still applies in every session.
  - Do not restate global rules here. If you need to deviate, use the
    "Overrides global" section.
```

### Step 8 — Save to engram

Call `mem_save`:
- title: `Initialized CLAUDE.md for <project name>`
- type: `config`
- topic_key: `project-init/<project-name>`
- content: structured **What/Why/Where/Learned** with the 5 wizard answers.

---

## Rules

- Never run in the `claude-config` / `agent-config` repo. That repo edits its
  own `CLAUDE.md` directly.
- Never overwrite an existing `CLAUDE.md` without explicit user confirmation.
- Never write outside CWD. This skill produces exactly one file:
  `<cwd>/CLAUDE.md`.
- Never restate global rules in the generated file. If the user offers global
  rules during the wizard (response format, verification, engram), refuse
  and point to the global layer.
- Stop after every question. Never bundle. Never default silently.
- Keep the generated file under 60 lines. Empty sections are dropped, not
  preserved.
- Do not commit. Do not run any audit automatically. Those decisions are the
  user's.

Related in General