Stop hand-writing AI coding rules. Detect your stack, generate them — for every tool.
One command scans your project, detects your frameworks, and writes a tailored rules file. Output a portable AGENTS.md (read by Cursor, Copilot, Codex & Claude Code) or Cursor's native .cursor/rules/*.mdc — from one source.
npx cursor-compose --agents # → AGENTS.md, works across every major AI editorEveryone is pasting the same recycled rules files between projects. They go stale, they don't match your actual stack, and every editor wants its own format.
cursor-compose reads your real dependencies (package.json, requirements.txt, pubspec.yaml) and composes a rules file from modular, stack-specific building blocks — and writes it as the portable AGENTS.md standard so the same source works in Cursor, Copilot, Codex and Claude Code. Zero config to start.
# In your project root:
npx cursor-compose # default → per-module .cursor/rules/*.mdc
npx cursor-compose --agents # → AGENTS.md (portable, cross-tool)
npx cursor-compose --all # → both .mdc and AGENTS.md, one passIt will:
- Scan your project for dependency files.
- Show the modules it detected and let you toggle optional ones.
- Write your chosen output(s).
No install, no config file required.
| Flag | Output |
|---|---|
| (default) | per-module .cursor/rules/*.mdc (current Cursor format) |
--agents |
AGENTS.md at repo root — portable across Cursor, Copilot, Codex, Claude Code |
--all |
both .mdc and AGENTS.md in one pass |
--legacy |
a single .cursorrules file |
--yes, -y |
non-interactive: use detected modules, no prompts (great for CI/scripts) |
-h, --help |
show help |
The generated content lives between managed markers:
<!-- cursor-compose:start -->
# AGENTS.md
...generated from your stack...
<!-- cursor-compose:end -->
## Your own notes (preserved on regenerate)Re-running --agents only replaces the managed block — anything you add outside it is kept.
| Auto-detected | From |
|---|---|
| Next.js + TypeScript | package.json |
| Supabase | package.json |
| Drizzle ORM | package.json |
| shadcn / Radix UI | package.json |
| FastAPI | requirements.txt |
| Flutter | pubspec.yaml |
Core conventions always load by default.
Toggle these on during the interactive prompt:
saas— multi-tenancy, billing, auth patternsecommerce— cart, checkout, payment flowsclaude-code—CLAUDE.md/ documentation conventionsagentic— agent & tool-calling patterns
- Node.js 18+
-
cursor-compose check— CI command that fails the build when your committed rules drift from your actual dependencies. - More stacks (Django, Rails, SvelteKit, Expo).
Want a stack supported? Open an issue or send a PR — adding a module is just a markdown file (see CONTRIBUTING.md).
src/
cli.js # interactive prompt + orchestration + flags
detect.js # reads dependency files → detected modules
compose.js # assembles selected modules; writes .mdc / .cursorrules / AGENTS.md
frontmatter.js # Cursor .mdc YAML frontmatter (not used for AGENTS.md)
modules/ # one .md per framework — the rule building blocks
patterns/ # reusable code-organization patterns
New modules are welcome and easy — drop a markdown file in modules/. See CONTRIBUTING.md.
MIT
