DEV Community

Yurukusa
Yurukusa

Posted on • Edited on

Generate Your CLAUDE.md in 30 Seconds (Interactive Script)

Every Claude Code session starts from zero. No memory of your project structure, your team's conventions, or which commands should never run unsupervised.

That's what CLAUDE.md is for — it's the file Claude Code reads at the start of every session. But writing one from scratch means figuring out what to include, what format to use, and what safety rules actually matter.

I made a script that does it for you.

What It Does

claude-md-generator.sh is a Bash script that asks 8 questions about your project and generates a CLAUDE.md file with:

  • Project overview and tech stack
  • Code style and testing commands
  • Language-specific rules (from 7 presets: Python, JavaScript/TypeScript, Go, Rust, Java, Shell, Other)
  • Optional safety modules:
    • Dangerous command protection (rm -rf, git reset --hard, etc.)
    • External action gates (require approval before git push, API calls)
    • Error tracking conventions

Try It

Interactive mode — answer 8 questions:

curl -sLO https://gist.githubusercontent.com/yurukusa/9e710dece35d673dd71e678dfa55eaa3/raw/claude-md-generator.sh
bash claude-md-generator.sh
Enter fullscreen mode Exit fullscreen mode

Defaults mode — generate with sensible defaults, no prompts:

bash claude-md-generator.sh --defaults
Enter fullscreen mode Exit fullscreen mode

Custom output path:

bash claude-md-generator.sh --defaults --output ./my-project/CLAUDE.md
Enter fullscreen mode Exit fullscreen mode

What the Output Looks Like

Running with defaults produces a file with 8 sections:

# CLAUDE.md — My Project

## Project Overview
...

## Tech Stack & Language Rules
- Language: Python
- Run `python -m py_compile` after editing .py files
...

## Dangerous Command Protection
NEVER run these commands without explicit user approval:
- `rm -rf`
- `git reset --hard`
...

## External Action Safety
Before any external action (git push, API calls, posting):
1. State what you're about to do
2. Wait for approval
...
Enter fullscreen mode Exit fullscreen mode

Each section is conditional — if you say "no" to dangerous command protection, that section is omitted. You get exactly what you need.

Why This Exists

I've been running Claude Code autonomously for months. The first thing I learned: without CLAUDE.md, the AI will:

  1. Run rm -rf on directories it thinks are "temporary"
  2. Push code to GitHub without asking
  3. Forget your linting rules and introduce style violations
  4. Lose context on what it was doing when the session restarts

A good CLAUDE.md prevents all of these. But writing one from scratch took me multiple iterations. This script captures what I learned.

Get the Script

No dependencies beyond Bash. No network calls. MIT licensed.


Running Claude Code without CLAUDE.md is like hiring someone without telling them the house rules. The script takes 30 seconds. The safety rules last every session.

For the complete autonomous operations setup, see the CC-Codex Ops Kit ($9.99) — 22 files, 15-minute setup.

Generated a CLAUDE.md? Scan your setup for security risks — free, 30 seconds, nothing installed. A good CLAUDE.md is step one. Knowing what else you're missing is step two.

Top comments (0)