A Node.js CLI tool that automatically generates configuration files for various AI development tools from unified AI rule files (.rulesync/*.md
). Also imports existing AI tool configurations into the unified format.
English | 日本語
rulesync supports both generation and import for the following AI development tools:
-
GitHub Copilot Custom Instructions (
.github/copilot-instructions.md
+.github/instructions/*.instructions.md
) -
Cursor Project Rules (
.cursor/rules/*.mdc
+.cursorrules
) -
Cline Rules (
.clinerules/*.md
+.cline/instructions.md
) -
Claude Code Memory (
./CLAUDE.md
+.claude/memories/*.md
) -
Roo Code Rules (
.roo/rules/*.md
+.roo/instructions.md
) -
Gemini CLI (
GEMINI.md
+.gemini/memories/*.md
)
npm install -g rulesync
# or
pnpm add -g rulesync
# or
yarn global add rulesync
-
Initialize your project:
npx rulesync init
-
Edit the generated rule files in
.rulesync/
directory to match your project needsOr add new rule files:
npx rulesync add my-custom-rules
-
Generate tool-specific configuration files:
npx rulesync generate
-
Optional: Add generated files to .gitignore:
npx rulesync gitignore
If you already have AI tool configurations, you can import them into rulesync format:
-
Import existing configurations:
# Import from specific tools (only one tool can be specified at a time) npx rulesync import --claudecode # From CLAUDE.md and .claude/memories/*.md npx rulesync import --cursor # From .cursorrules and .cursor/rules/*.mdc npx rulesync import --copilot # From .github/copilot-instructions.md npx rulesync import --cline # From .cline/instructions.md npx rulesync import --roo # From .roo/instructions.md npx rulesync import --geminicli # From GEMINI.md and .gemini/memories/*.md
-
Review and edit the imported rules in
.rulesync/
directory -
Generate unified configurations:
npx rulesync generate
That's it! Your AI coding assistants will now use the generated configuration files automatically.
Team members can freely choose their preferred AI coding tools. Whether it's GitHub Copilot, Cursor, Cline, or Claude Code, each developer can use the tool that maximizes their productivity.
AI development tools evolve rapidly with new tools emerging frequently. With rulesync, switching between tools doesn't require redefining your rules from scratch.
Enable hybrid development workflows combining multiple AI tools:
- GitHub Copilot for code completion
- Cursor for refactoring
- Claude Code for architecture design
- Cline for debugging assistance
- Gemini CLI for intelligent code analysis
Avoid vendor lock-in completely. If you decide to stop using rulesync, you can continue using the generated rule files (.github/instructions/
, .cursor/rules/
, .clinerules/
, CLAUDE.md
, GEMINI.md
, etc.) as-is.
Apply consistent rules across all AI tools, improving code quality and development experience for the entire team.
Instead of using Claude Code's built-in /init
command, we recommend creating a custom slash command specifically for rulesync.
Refer to the Claude Code slash commands documentation and add the following custom command:
.claude/commands/init-rulesync.md
Review this project's content and update .rulesync/*.md files as needed.
Steps:
1. Analyze project structure and codebase
2. Review existing .rulesync/ files
3. Consider project's tech stack, architecture, and coding conventions
4. Update .rulesync/*.md files if missing elements or improvements are found
5. Run rulesync generate if necessary
Project characteristics to consider:
- Technology stack
- Architecture patterns
- Coding conventions
- Security requirements
- Performance considerations
- Project-Specific Initialization: Optimized rule configuration for each project
- Automatic Rule Updates: Rules adapt to project changes automatically
- Team Standardization: All members use the same rule set
- Continuous Improvement: Rules evolve with project growth
npx rulesync init
This creates a .rulesync/
directory with sample rule files.
Define metadata in front matter for each Markdown file in the .rulesync/
directory. See the Example Files section below for detailed examples.
rulesync uses a two-level rule system:
-
root: true: Project-wide overview and policies
- Only one root file is allowed per project
- Contains high-level guidelines and project context
-
root: false: Specific implementation rules and detailed guidelines
- Multiple non-root files are allowed
- Contains specific coding rules, naming conventions, etc.
Each AI tool handles rule levels differently:
Tool | Root Rules | Non-Root Rules | Special Behavior |
---|---|---|---|
Claude Code | ./CLAUDE.md |
.claude/memories/*.md |
CLAUDE.md includes @filename references to detail files |
Cursor | cursorRuleType: always |
cursorRuleType: specificFiles (with globs)cursorRuleType: intelligently (with description)cursorRuleType: manual (default) |
Advanced rule type system based on content analysis |
GitHub Copilot | Standard format | Standard format | All rules use same format with frontmatter |
Cline | Standard format | Standard format | All rules use plain Markdown format |
Roo Code | Standard format | Standard format | All rules use plain Markdown format with description header |
Gemini CLI | GEMINI.md |
.gemini/memories/*.md |
GEMINI.md includes @filename references to memory files |
# Generate for all tools
npx rulesync generate
# Generate for specific tools
npx rulesync generate --copilot
npx rulesync generate --cursor
npx rulesync generate --cline
npx rulesync generate --claudecode
npx rulesync generate --roo
npx rulesync generate --geminicli
# Clean build (delete existing files first)
npx rulesync generate --delete
# Clean build for specific tools
npx rulesync generate --copilot --cursor --delete
# Verbose output
npx rulesync generate --verbose
npx rulesync generate --delete --verbose
# Generate in specific base directories (monorepo support)
npx rulesync generate --base-dir ./packages/frontend
npx rulesync generate --base-dir ./packages/frontend,./packages/backend
npx rulesync generate --base-dir ./apps/web,./apps/api,./packages/shared
-
--delete
: Remove all existing generated files before creating new ones -
--verbose
: Show detailed output during generation process -
--copilot
,--cursor
,--cline
,--claudecode
,--roo
,--geminicli
: Generate only for specified tools -
--base-dir <paths>
: Generate configuration files in specified base directories (comma-separated for multiple paths). Useful for monorepo setups where you want to generate tool-specific configurations in different project directories.
If you already have AI tool configurations in your project, you can import them to rulesync format:
# Import from existing AI tool configurations
npx rulesync import --claudecode # Import from CLAUDE.md and .claude/memories/*.md
npx rulesync import --cursor # Import from .cursorrules and .cursor/rules/*.md
npx rulesync import --copilot # Import from .github/copilot-instructions.md and .github/instructions/*.instructions.md
npx rulesync import --cline # Import from .cline/instructions.md
npx rulesync import --roo # Import from .roo/instructions.md
npx rulesync import --geminicli # Import from GEMINI.md and .gemini/memories/*.md
# Import each tool individually
npx rulesync import --claudecode
npx rulesync import --cursor
npx rulesync import --copilot
# Verbose output during import
npx rulesync import --claudecode --verbose
The import command will:
- Parse existing configuration files from each AI tool using custom parsers
- Convert them to rulesync format with appropriate frontmatter metadata
- Create new
.rulesync/*.md
files with imported content and proper rule categorization - Use tool-specific prefixes to avoid filename conflicts (e.g.,
claudecode-overview.md
,cursor-custom-rules.md
) - Generate unique filenames if conflicts occur
- Support complex formats like Cursor's MDC files with YAML frontmatter
- Handle multiple file imports (e.g., all files from
.claude/memories/
directory)
When importing from Cursor, the following four rule types are automatically identified:
-
always (
cursorRuleType: always
)- Condition:
alwaysApply: true
is set - Conversion: Imported as root rule (
root: false
), withglobs: ["**/*"]
set
- Condition:
-
manual (
cursorRuleType: manual
)- Condition: empty description + empty globs +
alwaysApply: false
- Conversion: Imported with empty globs patterns (manual application rule)
- Condition: empty description + empty globs +
-
specificFiles (
cursorRuleType: specificFiles
)- Condition: globs specified (regardless of description)
- Conversion: Specified globs patterns preserved as array, description set to empty string
-
intelligently (
cursorRuleType: intelligently
)- Condition: description specified + empty globs
- Conversion: Description preserved, empty globs patterns set
-
Non-empty description + non-empty globs: Processed as
specificFiles
(globs patterns take priority) -
No matching conditions: Processed as
manual
(default)
-
.cursorrules
(legacy format) -
.cursor/rules/*.mdc
(modern MDC format) -
.cursorignore
(ignore patterns) -
.cursor/mcp.json
(MCP server configuration)
# Initialize project with sample files
npx rulesync init
# Add a new rule file
npx rulesync add <filename>
npx rulesync add typescript-rules
npx rulesync add security.md # .md extension is automatically handled
# Validate rule files
npx rulesync validate
# Check current status
npx rulesync status
# Watch files and auto-generate
npx rulesync watch
# Add generated files to .gitignore
npx rulesync gitignore
.rulesync/
├── overview.md # Project overview (root: true, only one)
├── coding-rules.md # Coding rules (root: false)
├── naming-conventions.md # Naming conventions (root: false)
├── architecture.md # Architecture guidelines (root: false)
├── security.md # Security rules (root: false)
└── custom.md # Project-specific rules (root: false)
You can exclude specific rule files from being processed by creating a .rulesyncignore
file in your project root. This file uses gitignore-style patterns.
Example .rulesyncignore
:
# Ignore test rule files
**/*.test.md
# Ignore temporary files
tmp/**/*
# Ignore draft rules
draft-*.md
*-draft.md
When .rulesyncignore
exists, rulesync will:
- Skip matching files during rule processing
- Generate tool-specific ignore files:
-
.cursorignore
for Cursor -
.clineignore
for Cline -
.rooignore
for Roo Code -
.copilotignore
for GitHub Copilot (community tools) -
.aiexclude
for Gemini CLI - Update
.claude/settings.json
permissions.deny withRead()
rules for Claude Code
-
Each rule file must include frontmatter with the following fields:
---
root: true | false # Required: Rule level (true for overview, false for details)
targets: ["*"] # Required: Target tools (* = all, or specific tools)
description: "Brief description" # Required: Rule description
globs: "**/*.ts,**/*.js" # Required: File patterns (comma-separated or empty string)
cursorRuleType: "always" # Optional: Cursor-specific rule type (always, manual, specificFiles, intelligently)
---
Additional metadata field for Cursor tool:
-
always
: Rules applied to the entire project constantly -
manual
: Rules applied manually (default) -
specificFiles
: Rules automatically applied to specific file patterns -
intelligently
: Rules applied by AI judgment
Root file (.rulesync/overview.md
):
---
root: true
targets: ["*"]
description: "Project overview and development philosophy"
globs: "src/**/*.ts"
---
# Project Development Guidelines
This project follows TypeScript-first development with clean architecture principles.
Non-root file (.rulesync/coding-rules.md
):
---
root: false
targets: ["copilot", "cursor", "roo"]
description: "TypeScript coding standards"
globs: "**/*.ts,**/*.tsx"
---
# TypeScript Coding Rules
- Use strict TypeScript configuration
- Prefer interfaces over types for object shapes
- Use meaningful variable names
Tool | Output Path | Format | Rule Level Handling |
---|---|---|---|
GitHub Copilot | .github/instructions/*.instructions.md |
Front Matter + Markdown | Both levels use same format |
Cursor | .cursor/rules/*.mdc |
MDC (YAML header + Markdown) | Root: cursorRuleType: always Non-root: cursorRuleType: specificFiles (with globs)Non-root: cursorRuleType: intelligently (with description)Non-root: cursorRuleType: manual (default) |
Cline | .clinerules/*.md |
Plain Markdown | Both levels use same format |
Claude Code |
./CLAUDE.md (root).claude/memories/*.md (non-root) |
Plain Markdown | Root goes to CLAUDE.md Non-root go to separate memory files CLAUDE.md includes @filename references |
Roo Code | .roo/rules/*.md |
Plain Markdown | Both levels use same format with description header |
Gemini CLI |
GEMINI.md (root).gemini/memories/*.md (non-root) |
Plain Markdown | Root goes to GEMINI.md Non-root go to separate memory files GEMINI.md includes @filename references |
rulesync validates your rule files and provides helpful error messages:
npx rulesync validate
Common validation rules:
- Only one root file (root: true) is allowed per project
- All frontmatter fields are required and properly formatted
- File patterns (globs) use valid syntax
- Target tools are recognized values
rulesync can also manage MCP server configurations for supported AI tools. This allows you to configure language servers and other MCP-compatible services once and deploy them across multiple AI coding assistants.
-
Claude Code (
.mcp.json
) -
GitHub Copilot (
.vscode/mcp.json
) -
Cursor (
.cursor/mcp.json
) -
Cline (
.cline/mcp.json
) -
Gemini CLI (
.gemini/settings.json
) -
Roo Code (
.roo/mcp.json
)
Create a .rulesync/.mcp.json
file in your project:
{
"mcpServers": {
"github": {
"command": "docker",
"args": [
"run", "-i", "--rm",
"-e", "GITHUB_PERSONAL_ACCESS_TOKEN",
"ghcr.io/github/github-mcp-server"
],
"env": {},
"targets": ["*"]
}
}
}
-
mcpServers
: Object containing MCP server configurations-
command
: Executable command for stdio-based servers -
args
: Command arguments -
url
: URL for HTTP/SSE-based servers -
env
: Environment variables to pass to the server -
targets
: Array of tool names to deploy this server to- Use specific tool names:
["claude", "cursor", "copilot"]
- Use
["*"]
to deploy to all supported tools - If omitted, server is deployed to all tools by default
- Use specific tool names:
-
MCP configurations are generated alongside rule files:
# Generate both rules and MCP configurations
npx rulesync generate
# Generate only for specific tools
npx rulesync generate --claudecode --cursor
# Generate in specific directories (monorepo)
npx rulesync generate --base-dir ./packages/frontend
The MCP configurations will be generated in the appropriate locations for each tool, and the tools will automatically load them when started.
MIT License
Issues and Pull Requests are welcome!
For development setup and contribution guidelines, see CONTRIBUTING.md.