ide-rule
v1.2.0
Published
AI-native CLI generator for IDE rules. Instantly scaffold .cursorrules, .windsurfrules, and configurations for GitHub Copilot, Cursor, Windsurf, Trae, Lingma, and CodeBuddy. The ultimate standardization tool for AI-assisted coding workflows.
Maintainers
Readme
ide-rule
🎯 Why ide-rule?
As AI-powered coding assistants become mainstream, developers face a new challenge: each IDE has its own rule format. Cursor uses .mdc with YAML frontmatter, Windsurf prefers single .windsurfrules files, GitHub Copilot expects Markdown in .github/...
Managing these configurations manually is tedious, error-prone, and wastes valuable development time.
ide-rule solves this by providing:
- ✅ One Command, All IDEs — Generate properly formatted rule files for 7+ AI IDEs
- ✅ Consistent Rule Content — Same base rules, automatically adapted to each IDE's format
- ✅ Project Memory — Optional
project_memory.mdto persist context across sessions - ✅ Zero Configuration — Smart defaults with full customization when you need it
🖥️ Supported AI IDEs
| IDE | Rule Format | Output Path | Special Features |
|-----|-------------|-------------|------------------|
| Cursor | .mdc (Frontmatter) | .cursor/rules/ | Supports globs, alwaysApply, multi-file rules |
| Trae (ByteDance) | .md | .trae/rules/ | Standard Markdown format |
| Windsurf (Codeium) | .windsurfrules | Project root | Single-file merged rules |
| GitHub Copilot | .md | .github/ | Single copilot-instructions.md file |
| Lingma (Alibaba) | .md | .lingma/rules/ | HTML comment metadata support |
| CodeBuddy (Tencent) | .md | .codebuddy/rules/ | Standard Markdown format |
| VS Code (Generic) | .md | .vscode/rules/ | Standard Markdown format |
| Claude Code (Anthropic) | CLAUDE.md | Project root | Single-file project guidance |
| Gemini CLI (Google) | GEMINI.md | Project root | Single-file project guidance |
✨ Features
- 🎯 Multi-IDE Support — Automatically detects and generates the correct format for your IDE
- 📝 Unified Content Template — Base rule content stays consistent; only the format changes
- 🌍 Internationalization — Built-in support for
en-USandzh-CN, auto-detects system locale - 🔒 Safe File Operations — Never overwrites without
--force; creates.bakbackups automatically - 🧩 Extensible Architecture — Easily add custom IDEs, frameworks, and language templates
- ⚡ Interactive CLI — Beautiful prompts guide you through the setup process
- 📦 Zero Dependencies Runtime — Minimal footprint, fast installation
🚀 Quick Start
Installation
# Global installation (recommended)
npm install -g ide-rule
# Or run directly with npx (no install needed)
npx ide-ruleBasic Usage
# Start the interactive wizard
ide-rule
# Specify language explicitly
ide-rule --lang en-US
# Force overwrite existing files (creates .bak backup)
ide-rule --forceWhat Happens Next?
The CLI will guide you through:
- Select your AI IDE — Choose from Cursor, Windsurf, Copilot, and more
- Pick your tech stack — Frontend framework, backend framework, programming language
- Generate files — Rule files are created in the correct location with proper formatting
📂 Output Examples
Cursor (Multi-file with Frontmatter)
.cursor/rules/
├── base.mdc # Base rules with YAML Frontmatter
├── frontend-react.mdc # Framework-specific rules
└── backend-nest.mdc # Backend-specific rulesSample base.mdc structure:
---
description: Base coding rules for AI assistant
globs: ["**/*"]
alwaysApply: true
---
# Your coding standards here...Windsurf (Single Merged File)
.windsurfrules # All rules merged into a single fileGitHub Copilot (Single File)
.github/
└── copilot-instructions.mdClaude Code (Single File)
CLAUDE.md # Project rootGemini CLI (Single File)
GEMINI.md # Project root🛠️ Configuration Options
IDE Selection
| Option | IDE | Format |
|--------|-----|--------|
| cursor | Cursor IDE | .mdc with Frontmatter |
| trae | Trae (ByteDance) | .md |
| windsurf | Windsurf (Codeium) | .windsurfrules |
| copilot | GitHub Copilot | .md |
| lingma | Lingma (Alibaba) | .md |
| codebuddy | CodeBuddy (Tencent) | .md |
| vscode | VS Code Generic | .md |
| claudecode | Claude Code (Anthropic) | CLAUDE.md |
| gemini | Gemini CLI (Google) | GEMINI.md |
| custom | Custom IDE | Configurable |
Framework & Language Templates
Frontend Frameworks:
react|next|vue|nuxt|angular|svelte|custom|none
Backend Frameworks:
node-express|nest|koa|fastify|custom|none
Programming Languages:
javascript|typescript|go|python|java|c|c++|c#|php|ruby|custom
🏗️ Architecture
ide-rule/
├── bin/cli.js # CLI entry point
├── src/
│ ├── ide-adapters.js # IDE-specific configurations
│ ├── formatters.js # Content → IDE format transformers
│ ├── templates.js # Template loading & building
│ ├── scaffold.js # Core scaffolding logic
│ └── prompts.js # Interactive prompts
├── templates/
│ ├── base_rule_content.md # Pure content template
│ └── project_memory_example.md # Memory template
└── locales/
├── en-US.json # English translations
└── zh-CN.json # Chinese translationsDesign Principles:
- Content-Format Separation —
base_rule_content.mdstores pure content without formatting - Adapter Pattern — Each IDE has its own configuration (path, extension, formatting rules)
- Pluggable Formatters — Transform raw content into IDE-specific syntax
🔒 Backup Strategy
- Default behavior: Skips existing files and shows a warning
- With
--force: Creates timestamped.bakfiles before overwriting - Example:
base.mdc→base.mdc.bak.1702345678
🧪 Testing
The project maintains >90% test coverage using Jest.
# Run all tests
npm test
# Watch mode for development
npm run test:watch
# Generate coverage report
npm run test:coverage🤝 Contributing
Contributions are welcome! Here's how you can help:
- Add new IDE adapters — Support for more AI coding assistants
- Improve templates — Better default rules and prompts
- Add language translations — Expand i18n support
- Report bugs — Open issues for any problems you find
See CONTRIBUTING.md for detailed guidelines.
📄 License
ISC © 2024
🔗 Related Projects
- Cursor — AI-first code editor
- Windsurf — AI code editor by Codeium
- GitHub Copilot — AI pair programmer
- Claude Code — Anthropic's agentic coding tool
- Gemini CLI — Google's AI-powered CLI tool
