This article is based on the following article I wrote in Japanese, with some additional content.
https://dev.classmethod.jp/articles/rulesync/
I'm @dyoshikawa. A developer in Japan.
I created a tool called rulesync that allows you to manage rule files for various AI coding tools from a single group of markdown files, so I'd like to introduce it.
https://github.com/dyoshikawa/rulesync
By creating .rulesync/*.md
files, it generates files according to each tool's specifications.
Currently, it supports the following tools:
Tool Name | Generated Files |
---|---|
Claude Code |
CLAUDE.md .claude/memories/*.md
|
Gemini CLI |
GEMINI.md .gemini/memories/*.md
|
GitHub Copilot | .github/instructions/*.instructions.md |
Cursor | .cursor/rules/*.mdc |
Cline | .clinerules/*.md |
Roo Code | .roo/rules/*.md |
For Claude Code, since the location of files other than CLAUDE.md
is arbitrary (referenced with @{path}
), I decided to generate them in .claude/memories/*.md
based on my judgment (Gemini CLI was just released so I'm not very familiar with it, but I made it have a similar structure).
https://docs.anthropic.com/ja/docs/claude-code/memory
Motivation
Various AI coding tools have emerged, each defining their own rule file specifications (and Gemini CLI just joined them).
Managing these files individually is quite tedious. You have to write rules in different locations and formats for each tool: .github/instructions/*.instructions.md
, .cursor/rules/*.mdc
, CLAUDE.md
, GEMINI.md
, etc.
Also, it's difficult to stick to just one tool. The evolution of AI tools is fast, and the tool considered to have the highest performance changes every few months. Furthermore, different team members may prefer different tools. This creates the need to manually "synchronize" rule files between tools every time rule content is changed.
So I thought "wouldn't it be convenient if we could automatically generate rule files for each tool from a single rule file?" and developed rulesync.
The concept is as follows:
- By managing and generating rule files in bulk, you can freely choose AI coding tools.
- By managing and generating rule files in bulk, you can develop using different AI coding tools in hybrid combinations.
- Since the same rule content can be applied to all AI coding tools, you can maintain consistency in code quality and conventions regardless of which tool you use.
-
There is absolutely no lock-in to rulesync.
- You can abandon rulesync anytime. The generated rule files (
.github/instructions/
,.cursor/rules/
,.clinerules/
,CLAUDE.md
, etc.) will remain as they are, so you can just transition to manual management.
- You can abandon rulesync anytime. The generated rule files (
How to use rulesync
Getting Started
Since it's published as an npm package, you can start using it immediately with npx rulesync
if you have Node.js installed.
# Generate sample rule files
npx rulesync init
# Or import existing rules to create `.rulesync/*.md`
# (Example with Cursor Project Rules)
npx rulesync import --cursor
Bulk generation of rule files and adding rulesync files can be done with the following commands:
# Generate rule files for all supported tools
npx rulesync generate
# Generate rule files for specific tools only (example with Cursor and Claude Code)
npx rulesync --cursor --claudecode
# Add rulesync rule files
npx rulesync add new-rule.md
How to write .rulesync/*.md
I designed it to write Markdown files with Frontmatter, similar to Cursor Project Rules.
Here's an example from the rulesync repository's .rulesync/overview.md
:
---
root: true # Only one file can be designated as Root. Root files are always applied in principle (output as Cursor's `ruletype: always` or Claude Code's `CLAUDE.md`).
targets: ["*"] # Specify target tools for this file output as an array like `copilot`, `cursor`, `claudecode`. `*` targets all tools.
description: "rulesync project overview and architecture guide" # Description used by AI to determine whether to apply this rule.
globs: ["*"] # Specify file paths to apply rules using Glob. `*` targets all files. Example: `src/**/*.ts`
---
# rulesync Project Overview
rulesync is a unified AI configuration management CLI tool that supports multiple AI development tools (GitHub Copilot, Cursor, Cline, Claude Code, Roo Code).
## Core Architecture
...
Add generated files to gitignore
If you don't want to manage generated files with git, you can run the gitignore
command to add various generation destination paths to the .gitignore
file.
# Add generated files to .gitignore
npx rulesync gitignore
Import existing rule files to generate rulesync files
By running the import
command, you can do the reverse of the generate
command - convert existing rule files to .rulesync/*.md
and import them.
# Import existing Cursor Project Rules to create `.rulesync/*.md`
npx rulesync import --cursor
Implementation used Claude Code
I used Claude Code for implementing rulesync. I didn't write a single line of code myself.
The development process was simple - just repeating the cycle of "communicate specifications" → "manually test functionality" → "provide feedback". I had Claude Code write all the test code too, achieving over 90% coverage.
Small-scale CLI tools like rulesync seem to be easy for AI to implement. Since the execution environment is self-contained locally and there's no complex integration with external systems, it behaves as expected just by communicating the specifications.
On the other hand, when I tried having Claude Code create a Rails application and deploy it to Cloud Run on another occasion, this required quite a bit of intervention from a human developer (myself) to work properly1. I've seen articles from others who had similar experiences.
https://numb86-tech.hatenablog.com/entry/2025/05/29/220514
When it comes to work that involves coordinating multiple systems across networks, the complexity and difficulty of problem isolation seem to jump up significantly for AI. When errors occur, it might be difficult to determine whether it's a local problem, network problem, or cloud-side configuration problem.
Summary
I published a tool called rulesync for using multiple AI coding tools across different platforms.
Considering how quickly AI tool trends change, I think having a mechanism that allows flexible switching without being locked into specific tools will continue to be useful. I hope this can help those who are troubled by managing rule files.
If you're interested, please give it a try. PRs and Issues are also welcome.
-
The deployment itself was successful, but I couldn't get the health check to pass. ↩
Top comments (1)
Some comments may only be visible to logged-in visitors. Sign in to view all comments.