Generate Your CLAUDE.md in 30 Seconds (Interactive Script)
Source: Dev.to
What It Does
claude-md-generator.sh is a Bash script that asks eight questions about your project and creates a CLAUDE.md file containing:
- Project overview and tech stack
- Code‑style and testing commands
- Language‑specific rules (from seven 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 the eight questions interactively:
curl -sLO https://gist.githubusercontent.com/yurukusa/9e710dece35d673dd71e678dfa55eaa3/raw/claude-md-generator.sh
bash claude-md-generator.sh
Defaults mode
Generate a file with sensible defaults and no prompts:
bash claude-md-generator.sh --defaults
Custom output path
bash claude-md-generator.sh --defaults --output ./my-project/CLAUDE.md
What the Output Looks Like
Running the script with defaults produces a file with eight sections. Below is a trimmed example:
# 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
...
Each section is conditional—if you answer “no” to a safety feature, that section is omitted, giving you exactly what you need.
Why This Exists
Running Claude Code autonomously without a CLAUDE.md can lead to:
- Accidental
rm -rfon directories deemed “temporary” - Unapproved pushes to GitHub
- Linting rule violations and style drift
- Loss of context when a session restarts
A well‑crafted CLAUDE.md prevents all of these issues. This script captures the lessons learned from months of trial and error.
Get the Script
- Standalone Gist: claude-md-generator.sh
- Part of a larger toolkit: claude-code-ops-starter – includes four free safety hooks, the generator, and a
CLAUDE.mdtemplate
No dependencies beyond Bash, no network calls, MIT licensed. The script takes about 30 seconds, and the safety rules persist across every Claude Code session.