Skip to content

Synchronize agent skill definitions between .claude and .codex directories

Notifications You must be signed in to change notification settings

viteinfinite/sync-skills

Repository files navigation

⚑ sync-skills

Synchronize AI agent skills across different platforms with a single command

License: MIT TypeScript Node Tests


✨ Why?

Managing the same AI agent skills across multiple platforms (Claude, Cursor Copilot, etc.) is painful. You end up duplicating files, keeping them in sync manually, and dealing with version conflicts.

sync-skills solves this by:

  • πŸ”„ Keep skills in sync across all your AI assistants automatically
  • πŸ“¦ Single source of truth in .agents-common/ directory
  • πŸš€ Auto-setup on first run - just run and go
  • βš™οΈ Reconfigure anytime with interactive prompts

Why not just use symlinks?

You might wonder: "Why not just symlink .claude/skills, .codex/skills, etc. to a common directory?"

While symlinks work for basic cases, sync-skills provides important advantages:

1. Assistant-specific frontmatter values

Different assistants may need different configurations for the same skill:

---
name: my-skill
description: A useful skill
# Assistant-specific model selection:
model: claude-sonnet-4-5 # ← Claude-specific. With sync-skills, this will not get copied to other assistants
---

With symlinks, all assistants would share the same frontmatter. sync-skills maintains separate SKILL.md files per platform while keeping the skill body in sync, allowing per-assistant customization.

2. Bring-your-own-assistant (BYOA) policies

Many companies have policies allowing developers to use their preferred AI assistants. With sync-skills:

  • Each developer can run with their own assistant set: sync-skills --reconfigure
  • Skills sync across all configured assistants automatically
  • No need to maintain separate skill sets or manually copy files
  • Works seamlessly whether you use Claude, Cursor, Windsurf, or all of them

3. Conflict resolution and safety

  • Hash-based conflict detection when dependent files change
  • Interactive prompts before creating new directories

πŸš€ Quick Start

# Install
npm install -g sync-skills

# Run in your project
sync-skills

Note: this repo includes prebuilt dist/ output so git installs work without running a build step. If you change source files locally, run npm run build to refresh dist/.

That's it! The tool will:

  1. Prompt you to select which AI assistants to configure (preselecting detected ones)
  2. Create a shared .agents-common/ directory
  3. Sync all your skills across platforms

πŸ€– Supported Assistants

sync-skills supports the following AI assistants out of the box:

Assistant Project Directory Home Directory Description
amp .agents/skills β€” Amp
claude .claude/skills β€” Claude Code
cline .cline/skills β€” Cline
codex .codex/skills β€” Codex
cursor .cursor/skills β€” Cursor
gemini .gemini/skills β€” Google Gemini
github .github/skills β€” GitHub Copilot
kilo .kilocode/skills β€” Kilo
opencode .opencode/skill .config/opencode/skill OpenCode
roo .roo/skills β€” Roo Code
windsurf .windsurf/skills .codeium/windsurf/skills Codeium Windsurf

Some assistants have separate project and home directory configurations. Use --home flag to sync home directories.

Adding Custom Assistants

You can easily add support for additional AI assistants by editing src/types.ts:

export const ASSISTANT_MAP: Record<string, string | AssistantPathConfig> = {
  // ... existing entries
  'your-assistant': '.your-folder/skills',  // ← Simple string

  // Or with separate project/home paths:
  'another-assistant': {
    project: '.project/skills',
    home: '.config/assistant/skills'
  },
};

Then rebuild and reinstall:

npm run build
npm install -g .

πŸ’‘ How It Works

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                           Your Project                           β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                                  β”‚
β”‚  .agents-common/          ←  One place for all your skills       β”‚
β”‚  β”œβ”€β”€ skill-a/SKILL.md                                            β”‚
β”‚  β”œβ”€β”€ skill-a/util.js      ←  Supporting files also synced!       β”‚
β”‚  β”œβ”€β”€ skill-a/docs/guide.md                                       β”‚
β”‚  └── skill-b/SKILL.md                                            β”‚
β”‚                                                                  β”‚
β”‚  .claude/skills/          ←  References to common skills         β”‚
β”‚  β”œβ”€β”€ skill-a/SKILL.md     β†’  @../../../.agents-common/skills/... |
β”‚  └── skill-b/SKILL.md     β†’  (dependent files removed)           β”‚
β”‚                                                                  β”‚
β”‚  .codex/skills/           ←  Same skills, same references        β”‚
β”‚  β”œβ”€β”€ skill-a/SKILL.md     β†’  @../../../.agents-common/skills/... β”‚
β”‚  └── skill-b/SKILL.md     β†’  (dependent files removed)           β”‚
β”‚                                                                  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

The magic: Edit once in .agents-common/, and all your AI assistants see the changes!

Dependent files (scripts, docs, configs) are automatically centralized in .agents-common/ with hash-based conflict resolution.


πŸ“– Usage

Basic Sync

sync-skills              # Sync all configured assistants

List Installed Skills

Get an overview of all skills installed across your configured assistant platforms:

sync-skills --list       # Grouped list of installed skills
# or
sync-skills -l

Example output:

before-pushing           [common, claude, codex] - Use when about to push commits to remote repository
my-custom-skill          [common, gemini] - A custom workflow for my project

Home Directory Mode

Keep your personal skill collection in ~/ and share across projects:

sync-skills --home       # Sync ~/.claude, ~/.codex, ~/.agents-common

Reconfigure

Change which assistants to sync:

sync-skills --reconfigure    # Interactive checkbox prompt

Strict Mode

sync-skills --fail-on-conflict    # Exit on conflicts without conflict resolution prompts

🎯 Common Workflows

Adding a New Skill

# 1. Create skill in common directory
mkdir -p .agents-common/skills/my-new-skill
echo "# My Skill" > .agents-common/skills/my-new-skill/SKILL.md

# 2. Run sync
npx github:viteinfinite/sync-skills

# 3. βœ… Done! All assistants now have access to this skill
#    πŸ”— .claude/skills/ and .codex/skills/ both reference the common files

Syncing Existing .claude Skills to .codex

# 1. Ensure you have existing skills in .claude/skills/
ls .claude/skills/

# 2. Run sync (auto-detects both .claude and .codex)
npx github:viteinfinite/sync-skills

# 3. βœ… Skills are now available in both assistants!
#    πŸ“ .agents-common/ contains the source of truth
#    πŸ”— .claude/skills/ and .codex/skills/ both reference the common files

What happens:

  • Existing .claude skills are moved to .agents-common/
  • Both .claude and .codex get reference files pointing to common skills
  • Future edits in .agents-common/ sync to both platforms automatically

Setting Up a New Project

cd my-new-project
sync-skills    # Auto-detects and sets up everything

πŸ› οΈ Configuration

Configuration is stored in .agents-common/config.json:

{
  "version": 1,
  "assistants": ["claude", "codex"]
}

Auto-created on first run - no manual setup needed!


πŸ“š What Gets Synced

Skills (SKILL.md)

  • βœ… Skill body
  • βœ… Frontmatter metadata (cf Agent Skill Specs):
    • name
    • description
    • allowed-tools
    • license
    • metadata
    • compatibility

Dependent Files

  • βœ… All non-SKILL.md files in skill folders are also synced:
    • Documentation (README.md, guide.md, docs/reference.md)
    • Utility scripts (scripts/util.js, helpers/*.ts)
    • Config files (config.json, schema.yaml)
    • Any other supporting files

How it works:

  1. Dependent files are centralized in .agents-common/skills/{skill}/
  2. Platform folders contain only SKILL.md (with @ references)
  3. Hash-based conflict resolution detects changes (main hash includes all files)

πŸ”§ Contributing & Debugging

πŸ’‘ See Supported Assistants above for how to add custom AI assistants.


πŸ§ͺ Testing

The project uses a comprehensive test suite with separate unit and integration tests:

# Run unit tests only
npm test

# Run integration tests only
npm run test:integration

# Run all tests
npm run test:all

# Clean up test fixtures
npm run test:clean

CI/CD Pipeline:

  • βœ… unit-tests - Fast configuration and parsing tests
  • βœ… integration-tests - Full workflow validation with real file operations
  • Both run in parallel for quick feedback

Contributions welcome!


Made with Claude Code

About

Synchronize agent skill definitions between .claude and .codex directories

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •