Synchronize AI coding assistant rule files from a central repository to multiple projects using glob patterns
A CLI tool to synchronize AI coding assistant rule files between a central repository and multiple projects.
`sync-rules` helps you manage AI assistant rules across multiple projects by:
Use this skill when the user wants to:
Before using this skill, verify `sync-rules` is available:
```bash
npx sync-rules --help
```
If not available, inform the user they need Node.js v22.14.0+ and can install with:
```bash
npm install -g sync-rules
```
When the user wants to set up `sync-rules` for the first time:
```bash
sync-rules --init
```
Options:
After initialization, show the user where files were created:
```bash
sync-rules --paths
```
Help the user edit their `config.json`. The structure is:
```json
{
"rulesSource": "/path/to/central/rules/repository",
"global": ["global-rules/*.md"],
"projects": [
{
"path": "~/Developer/project-name",
"rules": ["backend/**/*.md", "python-style.md", "!backend/legacy/**"]
}
]
}
```
**Key fields:**
- `path`: Project root directory (supports `~` for home)
- `rules`: Array of POSIX glob patterns (supports negation with `!`)
Before syncing, always show the user what will change:
```bash
sync-rules --dry-run --verbose
```
For machine-readable output:
```bash
sync-rules --porcelain
```
The porcelain format outputs TSV with columns: `status`, `file_path`, `lines`
Once the user approves, run the sync:
```bash
sync-rules
```
Options:
After syncing, confirm the generated files:
1. Each project gets `AGENTS.md` (canonical rules file)
2. Each project gets `CLAUDE.md` (contains `@AGENTS.md` for Claude Code)
3. Global rules written to tool-specific locations if configured
Show the user how to chain with their AI tool:
```bash
sync-rules && claude --chat
```
Or create a shell function:
```bash
sr() { sync-rules && command "$@"; }
function sr; sync-rules; and command $argv; end
```
Then use: `sr claude --chat`
```bash
sync-rules --porcelain | tail -n +2 | cut -f2 | xargs -n1 dirname | sort -u | wc -l
```
```bash
sync-rules --porcelain | tail -n +2 | grep -v '^\w*\t.*/.claude/' | cut -f2
```
```bash
sync-rules --dry-run --verbose
```
**Config not found:**
**Rules not appearing:**
**Permission errors:**
1. User asks to set up rule syncing
2. Run `sync-rules --init`
3. Show user the config location with `sync-rules --paths`
4. Help them edit `config.json` with their projects and rule patterns
5. Preview changes with `sync-rules --dry-run --verbose`
6. Once approved, run `sync-rules`
7. Verify output files were created in each project
8. Show them how to integrate into their workflow
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/sync-rules/raw