Guide

The Claude Code /init Command: Auto-Generate a CLAUDE.md

/init scans your codebase and writes a CLAUDE.md in 30 seconds. It's a great start — and a bad finish.

What /init does

Run /init inside a project and Claude Code reads through your repository — file structure, package manifests, build scripts, existing conventions — and generates a CLAUDE.md in the project root summarizing the project: the tech stack, how to build and test, the directory layout, and any obvious conventions it can infer.

The file lands at ./CLAUDE.md (project root) and is read at the start of every future conversation in that project. A blank page is the enemy; in thirty seconds you go from nothing to a structured draft that already knows your stack.

What the generated file gets right

The auto-generated CLAUDE.md is genuinely useful for the mechanical facts: build and test commands, the framework you're on, where things live. These are the parts Claude can read straight off your repo, and it gets them mostly right.

Where /init falls short

How to turn the /init draft into a file Claude follows

  1. Add a boundaries section (a short explicit "never do this without asking" list).
  2. Add voice and working style.
  3. Trim the bloat; if over ~2,000 tokens, compress it (see /guide/optimize-claude-md).
  4. Score it before you rely on it with the free CLAUDE.md Builder at /generator — it scores clarity, specificity, format, voice, boundaries, and length.

/init vs starting from a prompt

/init is repo-driven. If you're starting from your role rather than a repo (job search, consulting, research, writing), there's no code to scan — describe what you do in plain English and generate from that (see /guide/what-is-a-claude-md-file). CoworKit's Builder does both: paste an /init draft to optimize, or start from a description.

/init isn't working?

Almost always one of two things: you ran it outside a recognized project folder, or the resulting CLAUDE.md ended up somewhere Claude doesn't read. Confirm the file is named exactly CLAUDE.md and sits in the right location (see /guide/where-to-put-claude-md).

Bottom line

/init is the fastest way to get a CLAUDE.md, and you should use it. Just don't ship the raw output — add boundaries and voice, trim it under the token ceiling, and score it at /generator before you trust it.

Related guides

FAQ

What does the /init command do in Claude Code?

It scans your project and auto-generates a CLAUDE.md in the project root summarizing your stack, build/test commands, and directory structure. The file is read at the start of every future conversation in that project.

Does /init write a complete CLAUDE.md?

No. It captures mechanical facts well but omits working style, voice, and boundaries — the parts that most change behavior. Treat it as a starting skeleton you edit, not a finished file.

How do I generate a CLAUDE.md without a codebase?

/init needs a repo to scan. If you work from a role rather than code, describe what you do in plain English and generate from that — the free CoworKit Builder does exactly this, or you can write it yourself following how to write a CLAUDE.md.

Why isn't /init working?

Usually it was run outside a recognized project folder, or the file isn't where Claude reads it. Confirm it's named exactly CLAUDE.md and sits in the project root or ~/.claude/. See where to put CLAUDE.md for the full breakdown.

Get weekly Claude tips

Practical guides and prompt patterns — no fluff, unsubscribe any time.