custom-init

A command that examines a code project and writes its architecture, technologies, and main features to a CLAUDE.md instruction file.

In plain words
What is it for?
Use it when starting work on an unfamiliar project or creating project documentation for AI-assisted coding.
Why use it?
It gives Claude or another AI coding assistant a structured description of the project instead of requiring you to explain the codebase by hand.

Command for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/awattar/claude-code-best-practices/custom-init
Clone the repo
git clone --depth 1 https://github.com/awattar/claude-code-best-practices

Made for: Claude Code.

Per session 12 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,119 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00012 $0.02119
Opus 5 $0.00006 $0.01059
Sonnet 5 $0.00002 $0.00424
Haiku 4.5 $0.00001 $0.00212

Measured 3d ago against content hash 2eb70d376ab6, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

custom-init scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/commands/custom-init.md · 208 lines

How it starts

The opening of the file, as written. The whole thing — 208 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Claude Code User Command: Custom Init

This command helps you initialize a new, well-formatted CLAUDE.md file with codebase documentation.

Usage

To initialize a new CLAUDE.md file with codebase documentation, just type:

/custom-init

Relationship to native /init

Claude Code ships with a built-in /init command that also generates a CLAUDE.md. /custom-init covers the same goal through the explicit, deterministic phased workflow below, which produces a more structured result: staged analysis, per-feature detection, a versioned technology stack inventory, and consistent section ordering. Pick whichever fits the project — they are alternatives, not a hierarchy.

What This Command Does

Analyzes the project's architecture, technology stack, and key features through the phased workflow below, then writes the findings to CLAUDE.md so Claude (or any AI assistant) can work effectively in the codebase.

Agents Used

The main session orchestrates and dispatches each pass to the best-fit specialist agent through the Task tool, so each agent works in its own context window. Reach for general-purpose only as a fallback when no specialist matches a pass.

  • general-solution-architect — Phase 2 (architecture + technology stack).
  • general-backend-developer — Phase 3 backend passes (authentication, business domain, data access, communication).
  • general-devops — Phase 3 infrastructure pass and Phase 4 deployment pass.
  • general-qa — Phase 4 testing pass.
  • general-code-quality-debugger — Phase 4 troubleshooting pass.
  • general-technical-writer — Phase 4 documentation-discovery pass and Phase 5 assembly.

Phases 0 and 1 run inline in the main session. Phases 2, 3, and 4 can all be dispatched in the same message and run concurrently. Phase 5 is sequential — it consumes the outputs of Phases 2–4 and must wait for them to return.

Follow these steps:

Phase 0: Initialization

  1. Command Execution
    • Execute the command in the current directory.
    • Validate that the current directory is a project root.
    • Check for an existing CLAUDE.md file.
    • Set the analysis depth to a comprehensive scan.
  2. Environment Setup
    • Verify the current directory contains project files.
    • Check for a .git directory or other VCS metadata.
    • Confirm read access to project files.
  3. Tool Detection
    • Check which relevant CLI tools are available (git, docker, npm, dotnet, etc.).
    • Note language-specific tooling that can inform deeper analysis.
  4. Configuration Loading
    • Use smart defaults for all settings.
    • Respect ignore patterns from .gitignore.
    • Apply standard markdown output formatting.
  5. Pre-flight Checks

Read the full file on GitHub · 208 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 208 lines · 12 tokens per session scan A 2eb70d376ab6

Subscribe to this mod's changes

custom-init is a command published in the GitHub repository awattar/claude-code-best-practices (250 stars, last pushed 3mo ago), licensed MIT. It adds 12 tokens to every session and 2,119 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.