ai-rules-gen
v1.0.0
Published
CLI tool to scan a project and generate AI coding rule files (CLAUDE.md, .cursorrules, AGENTS.md)
Readme
claude-rules-gen
CLI that scans your project and generates AI coding rule files tailored to your tech stack:
- CLAUDE.md — for Claude Code
- .cursorrules — for Cursor
- AGENTS.md — for AI coding agents (Codex, Devin, etc.)
Installation
npm install -g claude-rules-genOr use directly with npx:
npx claude-rules-genUsage
# Scan current directory and generate all rule files
claude-rules-gen
# Scan a specific project
claude-rules-gen ./my-project
# Generate only CLAUDE.md
claude-rules-gen --format claude
# Generate only .cursorrules
claude-rules-gen --format cursor
# Output to a different directory
claude-rules-gen -o ./output
# Overwrite existing files
claude-rules-gen --forceOptions
| Option | Description | Default |
|--------|------------|---------|
| --output, -o | Output directory | current dir |
| --format, -f | Files to generate: all, claude, cursor, agents | all |
| --force | Overwrite existing files | false |
What It Detects
| Category | Detection | |----------|----------| | Language | TypeScript, JavaScript, Python, Go, Rust, Java, Ruby | | Framework | React, Next.js, Vue, Nuxt, Express, FastAPI, Django, Gin, Actix | | Package Manager | npm, yarn, pnpm, bun, pip, cargo, go modules | | Test Framework | Vitest, Jest, Pytest, Go test, Cargo test, Mocha | | Linting | ESLint, Biome, Ruff, Clippy, Prettier | | Project Type | Library, CLI, Web App, API, Monorepo |
Generated Content
Each file includes:
- Project-specific build, test, and lint commands
- Code style rules matching your linter configuration
- Framework-specific best practices
- File structure conventions
- Common patterns for your tech stack
Example Output
For a Next.js + TypeScript project:
# CLAUDE.md
## Build & Run
- `npm run dev` — Start development server
- `npm run build` — Production build
- `npm run lint` — ESLint check
## Code Style
- TypeScript strict mode
- Prefer functional components with hooks
- Use App Router conventions (app/ directory)
...Why?
AI coding assistants work much better when given project-specific context. Instead of manually writing rules files for every project, let claude-rules-gen detect your stack and generate them automatically.
Related
- AI Coding Rules Pack — Premium hand-crafted rule templates
- mcp-server-create — Scaffold MCP servers
License
MIT
