Agent skill

update-skills

Sync skills between projects - bidirectional copy with version detection and clean mode. TRIGGER when: user wants to sync skills ("update skills from X", "sync skills", "pull skills from framework", "push skills to project"), or wants complete directory replacement ("clean sync", "reset skills"). DO NOT TRIGGER when: user wants to update pillars/rules/workflow (use respective update-* skills), or just wants to read skill docs.

Stars 163
Forks 31

Install this agent skill to your Project

npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/update-skills-aifuun-u-safe

SKILL.md

Update Skills - Skills Synchronization

Sync skill files between projects bidirectionally with smart version detection and conflict handling.

Overview

This skill synchronizes skills (.claude/skills/) between projects:

What it does:

  1. Scans source and target projects for skills
  2. Compares skills to detect new/updated/conflicted versions
  3. Shows detailed diff preview with line counts
  4. Syncs skills with confirmation
  5. Supports selective skill filtering
  6. Creates backups before overwriting
  7. Reports what was synced

Why it's needed: Skills evolve across projects. Framework updates need to propagate, and project innovations should flow back. This skill automates bidirectional skill sync with version conflict detection and backup protection.

When to use:

  • Monthly framework upgrades
  • Promoting project skills to framework
  • Cross-project skill sharing
  • Initial project setup

Workflow

Step 1: Create Todo List

Initialize sync tracking using TaskCreate:

Task #1: Validate source and target paths
Task #2: Scan skills in both projects (blocked by #1)
Task #3: Compare and detect versions (blocked by #2)
Task #4: Show diff preview (blocked by #3)
Task #5: Execute sync with confirmation (blocked by #4)
Task #6: Report sync results (blocked by #5)

After creating tasks, proceed with sync execution.

Sync Modes

1. Pull Skills (--from)

Pull skills from source project to current project:

bash
/update-skills --from ~/dev/ai-dev
/update-skills --from ~/dev/ai-dev --dry-run
/update-skills --from ~/dev/ai-dev --skills adr,status,review

What happens:

  1. Scan source: <source>/.claude/skills/
  2. Scan current: .claude/skills/
  3. Compare modification times and sizes
  4. Detect: NEW, NEWER, OLDER, CONFLICT, SAME
  5. Show analysis table
  6. Confirm and copy updated skills

2. Push Skills (--to)

Push skills from current project to target project:

bash
/update-skills --to ~/projects/my-app
/update-skills --to ~/projects/my-app --dry-run
/update-skills --to ~/projects/my-app --skills create-issues,start-issue,finish-issue

What happens:

  1. Scan current project skills
  2. Scan target project skills
  3. Compare versions
  4. Show what will be pushed
  5. Confirm and copy to target

3. Dry Run Mode (--dry-run)

Preview changes without applying:

bash
/update-skills --from ~/dev/ai-dev --dry-run

Output:

  • Shows analysis table with versions
  • Reports what would be synced
  • No confirmation required
  • No actual changes made

4. Selective Sync (--skills)

Sync only specific skills:

bash
/update-skills --from ~/dev/ai-dev --skills adr,status
/update-skills --to ~/projects/my-app --skills custom-deploy,custom-test

Skill selection:

  • Comma-separated list
  • Only syncs specified skills
  • Ignores others

5. Smart Filter (--filter-config) - NEW

Apply intelligent filtering based on tech stack configuration:

bash
# Used by /update-framework meta-skill
/update-skills --from ~/dev/ai-dev --filter-config <target>/.claude/framework-config.json

What it does:

  1. Reads filter config from .claude/framework-config.json
  2. Applies exclude list for skills not relevant to tech stack
  3. Shows filter summary in analysis

Filter Configuration Format:

json
{
  "filterConfig": {
    "skills": {
      "include": ["*"],  // Usually sync all skills
      "exclude": []      // Rarely exclude skills
    }
  }
}

Filter Logic:

For each skill directory:
1. Check if skill name in exclude list
   โ†’ Skip if excluded
2. Apply normal NEW/NEWER/SAME logic

Example - Minimal Project:

Without filter: 16 skills synced With filter (exclude deployment skills): ~14 skills synced

๐Ÿ“‹ Smart Filter Active
โญ๏ธ  Excluding: deploy-prod (deployment skill)
โญ๏ธ  Excluding: hotfix (deployment skill)

Result: 14 skills synced (2 excluded)

Note:

  • Skills are usually synced completely (no filtering)
  • Filtering mainly used for specialized deployment skills
  • Typically called by /update-framework meta-skill

6. Clean Mode (--clean) - NEW in v2.3.0

IMPORTANT: Destructive operation with complete directory replacement.

Complete clean slate - delete entire target .claude/skills directory and replace with source:

bash
# Execute full replacement
/update-skills --from ~/dev/ai-dev --clean
/update-skills --to ~/projects/my-app --clean

What it does:

  1. Deletes target directory completely
  2. Copies all skills from source
  3. Reports results

Use Cases:

  • Version conflicts too complex to resolve manually
  • Target skills corrupted or inconsistent
  • Force align target to source state
  • Clean up residual skills after major version upgrade

Example Output:

๐Ÿ—‘๏ธ  Deleting .claude/skills (34 skills)
๐Ÿ“‹ Copying from ~/dev/ai-dev/.claude/skills (22 skills)

โœ… Clean sync complete: 22 skills synced

Mutual Exclusion Rules:

Parameter Combination Behavior Valid?
--from --clean Clean current, copy from source โœ… Valid
--to --clean Clean target, copy from current โœ… Valid
--clean --skills ERROR โŒ Mutually exclusive
--clean --filter-config ERROR โŒ Mutually exclusive

Error handling:

bash
$ /update-skills --from ~/dev/ai-dev --clean --skills adr,status

โŒ Error: --clean and --skills are mutually exclusive
   --clean performs full directory replacement

When NOT to use:

  • โŒ Normal version updates โ†’ Use standard sync (--from/--to)
  • โŒ Selective skill updates โ†’ Use --skills flag
  • โŒ Regular maintenance โ†’ Use smart filter (--filter-config)

When to use:

  • โœ… Severe version conflicts (manual resolution too complex)
  • โœ… Corrupted target skills directory
  • โœ… Force reset to framework state
  • โœ… Major version migration cleanup

Recovery: If you need to restore after clean sync, use git:

bash
# Restore deleted files
git restore .claude/skills/

# Or check changes
git status
git diff

Version Detection (v2.0.0+)

Method: Semantic version comparison from YAML frontmatter

Comparison algorithm:

python
def parse_yaml_version(file_path):
    """ไปŽ SKILL.md ็š„ YAML frontmatter ๆๅ– version ๅญ—ๆฎต

    Returns:
        str: ็‰ˆๆœฌๅท (ๅฆ‚ "1.1.0") ๆˆ– None
    """
    import re
    with open(file_path, 'r') as f:
        # ่ฏปๅ– YAML frontmatter (---...--- ไน‹้—ด)
        lines = []
        in_yaml = False
        for line in f:
            if line.strip() == '---':
                if not in_yaml:
                    in_yaml = True
                    continue
                else:
                    break  # ็ป“ๆŸ YAML ๅ—
            if in_yaml:
                lines.append(line)

        # ๆŸฅๆ‰พ version: "x.y.z"
        for line in lines:
            if line.startswith('version:'):
                # ๆๅ–ๅผ•ๅทๅ†…็š„็‰ˆๆœฌๅท
                match = re.search(r'version:\s*"([^"]+)"', line)
                if match:
                    return match.group(1)
    return None

def compare_semver(v1: str, v2: str) -> int:
    """่ฏญไน‰ๅŒ–็‰ˆๆœฌๆฏ”่พƒ

    Args:
        v1: ็‰ˆๆœฌๅท 1 (ๅฆ‚ "2.1.0")
        v2: ็‰ˆๆœฌๅท 2 (ๅฆ‚ "2.0.0")

    Returns:
        int: 1 if v1 > v2, -1 if v1 < v2, 0 if equal
    """
    parts1 = [int(x) for x in v1.split('.')]
    parts2 = [int(x) for x in v2.split('.')]

    for p1, p2 in zip(parts1, parts2):
        if p1 > p2:
            return 1
        elif p1 < p2:
            return -1

    return 0

def content_differs(source_path, target_path):
    """ๆฃ€ๆŸฅไธคไธชๆ–‡ไปถๅ†…ๅฎนๆ˜ฏๅฆไธๅŒ๏ผˆๅฟฝ็•ฅ็ฉบ็™ฝๅ’Œๆณจ้‡Š๏ผ‰

    Returns:
        bool: True if content differs
    """
    def normalize(path):
        # ่ฏปๅ–ๆ–‡ไปถ๏ผŒ็งป้™ค YAML frontmatter ๅ’Œ็ฉบ็™ฝ่กŒ
        with open(path, 'r') as f:
            lines = f.readlines()

        # ่ทณ่ฟ‡ YAML frontmatter
        in_yaml = False
        content_lines = []
        for line in lines:
            if line.strip() == '---':
                if not in_yaml:
                    in_yaml = True
                    continue
                else:
                    in_yaml = False
                    continue
            if not in_yaml and line.strip():
                content_lines.append(line.strip())

        return '\n'.join(content_lines)

    return normalize(source_path) != normalize(target_path)

def compare_skill_versions(source_skill, target_skill):
    """ๆฏ”่พƒไธคไธช skill ็š„็‰ˆๆœฌ

    Returns:
        str: "NEW", "NEWER", "OLDER", "SAME", "CONFLICT"
    """
    import os
    source_path = f"{source_skills_dir}/{source_skill}/SKILL.md"
    target_path = f"{target_skills_dir}/{target_skill}/SKILL.md"

    # 1. Target ไธๅญ˜ๅœจ โ†’ NEW
    if not os.path.exists(target_path):
        return "NEW"

    # 2. ่งฃๆž YAML version ๅญ—ๆฎต
    source_version = parse_yaml_version(source_path)
    target_version = parse_yaml_version(target_path)

    # 3. ๅ‘ๅŽๅ…ผๅฎน๏ผšไปปไธ€็ผบๅฐ‘ version โ†’ fallback to legacy
    if not source_version or not target_version:
        return compare_legacy(source_path, target_path)

    # 4. ่ฏญไน‰ๅŒ–็‰ˆๆœฌๆฏ”่พƒ
    cmp = compare_semver(source_version, target_version)

    if cmp > 0:
        return "NEWER"    # Source version higher
    elif cmp < 0:
        return "OLDER"    # Source version lower
    else:
        # 5. ็‰ˆๆœฌ็›ธๅŒ๏ผŒๆฃ€ๆŸฅๅ†…ๅฎน
        if content_differs(source_path, target_path):
            return "CONFLICT"  # Same version, different content
        else:
            return "SAME"

def compare_legacy(source_path, target_path):
    """Legacy ๆฏ”่พƒๆ–นๆณ•๏ผˆๆ—ถ้—ด + ่กŒๆ•ฐ๏ผ‰- ๅ‘ๅŽๅ…ผๅฎน"""
    import os
    # ๅŽŸๆœ‰็š„ stat -f %m ๅ’Œ wc -l ้€ป่พ‘
    source_time = os.path.getmtime(source_path)
    target_time = os.path.getmtime(target_path)

    if source_time > target_time:
        return "NEWER"
    elif source_time < target_time:
        return "OLDER"
    else:
        # ๆ—ถ้—ด็›ธๅŒ๏ผŒๆฏ”่พƒ่กŒๆ•ฐ
        source_lines = len(open(source_path).readlines())
        target_lines = len(open(target_path).readlines())

        if source_lines != target_lines:
            return "CONFLICT"
        else:
            return "SAME"

Process:

  1. Parse version: "x.y.z" from SKILL.md YAML frontmatter
  2. Compare using semantic versioning rules:
    • Major: Breaking changes (2.0.0 > 1.9.0)
    • Minor: New features (1.1.0 > 1.0.0)
    • Patch: Bug fixes (1.0.1 > 1.0.0)
  3. Detect conflicts: Same version, different content
  4. Fallback: If no version field, use legacy (time + size)

Status meanings:

  • NEW - Skill doesn't exist in target (safe to copy)
  • NEWER - Source version > target version (2.1.0 > 2.0.0, recommend update)
  • OLDER - Source version < target version (warn before overwrite)
  • SAME - Versions and content identical (skip)
  • CONFLICT - Same version but content differs (manual review needed)

Legacy fallback (for skills without version field):

  • Compare modification time (stat -f %m)
  • If time same, compare file size (wc -l)

Analysis Output

๐Ÿ“Š Analysis:
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Skill           โ”‚ Status โ”‚ Action                       โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ adr             โ”‚ NEWER  โ”‚ Update (v1.1.0 โ†’ v1.2.0)     โ”‚
โ”‚ create-issues   โ”‚ NEW    โ”‚ Add (v1.0.0)                 โ”‚
โ”‚ start-issue     โ”‚ NEWER  โ”‚ Update (v2.1.0 โ†’ v2.2.0)     โ”‚
โ”‚ finish-issue    โ”‚ NEW    โ”‚ Add (v1.0.0)                 โ”‚
โ”‚ status          โ”‚ SAME   โ”‚ Skip (both v1.0.0)           โ”‚
โ”‚ review          โ”‚ OLDER  โ”‚ Skip (v1.0.0 < v1.1.0)       โ”‚
โ”‚ work-issue      โ”‚ CONFLICTโ”‚ Manual review needed         โ”‚
โ”‚                 โ”‚        โ”‚ (both v3.0.0, content diff)  โ”‚
โ”‚ (15 others)     โ”‚ SAME   โ”‚ Skip                         โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Summary:
- New skills: 2 (create-issues, finish-issue)
- Updated skills: 2 (adr, start-issue)
- Unchanged: 15
- Skipped (older): 1 (review)
- Conflicts: 1 (work-issue - requires manual resolution)
- Total to sync: 4 skills

Conflict Handling

OLDER Source (Warning)

โš ๏ธ Warning: Source skill is OLDER than target

Skill: status
Source: 2026-03-01 (220 lines)
Target: 2026-03-04 (223 lines)

Options:
1. Skip (recommended) - Keep newer version
2. Overwrite - Replace with older version
3. Diff - Show differences

Choice (1/2/3):

CONFLICT Detection (Version Mismatch)

โŒ Conflict detected

Skill: work-issue
Source version: v3.0.0
Target version: v3.0.0
Content differs: Yes

โš ๏ธ Issue: Version numbers match but content differs

This usually means:
- Both sides modified same version
- Forgot to bump version after changes
- Divergent development

Recommended action:
1. Review changes: diff source/SKILL.md target/SKILL.md
2. Merge manually or choose one version
3. Update version number after merge (v3.0.1 or v3.1.0)

Options:
1. Skip - Keep current version (no sync)
2. Show diff - Compare line by line
3. Overwrite - Use source version (requires confirmation)
4. Manual merge - Open both files in editor

Choice (1/2/3/4):

Why conflicts occur:

  • Both source and target modified same version
  • Version number not bumped after content changes
  • Parallel development without coordination

Resolution steps:

  1. Review both versions (option 2: show diff)
  2. Choose merge strategy:
    • Manual merge: Combine both changes
    • Accept source: Use newer implementation
    • Accept target: Keep current version
  3. Bump version number (v3.0.0 โ†’ v3.0.1 or v3.1.0)
  4. Re-run sync to verify

Backup Strategy

Automatic backup before overwrite (incremental mode only):

bash
Before updating any skill:

โœ… Creating backup: .claude/skills/adr.backup-2026-03-06/
โœ… Backed up: adr/SKILL.md
โœ… Backed up: adr/LICENSE.txt

Now updating adr...
โœ… Updated: adr (408 โ†’ 443 lines)

Rollback available: .claude/skills/adr.backup-2026-03-06/

Backup cleanup:

  • Automatic after 7 days
  • Or manual: rm -rf .claude/skills/*.backup-*

Note on --clean mode:

  • --clean mode does NOT create backups
  • Relies on git version control for recovery
  • Use git restore .claude/skills/ to recover if needed

What Gets Synced

.claude/skills/
โ”œโ”€โ”€ README.md                 โœ… Synced (skills system guide)
โ”œโ”€โ”€ WORKFLOW_PATTERNS.md      โœ… Synced (workflow requirements)
โ”œโ”€โ”€ PYTHON_GUIDE.md           โœ… Synced (development guide)
โ”œโ”€โ”€ _shared/                  โœ… Synced (shared utilities)
โ”‚   โ”œโ”€โ”€ *.py
โ”‚   โ””โ”€โ”€ tests/
โ”œโ”€โ”€ skill-name/
โ”‚   โ”œโ”€โ”€ SKILL.md              โœ… Synced (entire directory)
โ”‚   โ”œโ”€โ”€ LICENSE.txt           โœ… Synced
โ”‚   โ”œโ”€โ”€ scripts/              โœ… Synced (if exists)
โ”‚   โ”œโ”€โ”€ references/           โœ… Synced (if exists)
โ”‚   โ””โ”€โ”€ assets/               โœ… Synced (if exists)
โ””โ”€โ”€ another-skill/
    โ””โ”€โ”€ ...                   โœ… Synced

.claude/
โ”œโ”€โ”€ settings.json             โŒ Not synced (project-specific)
โ”œโ”€โ”€ MEMORY.md                 โŒ Not synced (project-specific)
โ””โ”€โ”€ plans/                    โŒ Not synced (project-specific)

Note:

  • Entire skill directories are synced, not just SKILL.md
  • Root-level documentation (README, WORKFLOW_PATTERNS, PYTHON_GUIDE) is synced to preserve framework knowledge
  • Shared utilities and tests are synced for cross-skill compatibility

Usage Examples

Example 1: Framework Upgrade

User says:

"update skills from the framework"

What happens:

  1. Pull from ~/dev/ai-dev
  2. Scan both projects
  3. Show: 4 skills to update
  4. Confirm and sync
  5. Report: "Updated 4 skills"

Time: ~30 seconds

Example 2: Selective Update

User says:

"pull only the adr and status skills"

What happens:

  1. /update-skills --from ~/dev/ai-dev --skills adr,status
  2. Compare only those 2 skills
  3. Show: 1 updated (adr), 1 same (status)
  4. Sync adr only
  5. Report: "Updated adr skill"

Time: ~20 seconds

Example 3: Promote to Framework

User says:

"push my custom skills to the framework"

What happens:

  1. /update-skills --to ~/dev/ai-dev --skills custom-deploy,custom-test
  2. Compare custom skills
  3. Show: 2 NEW skills
  4. Confirm and push
  5. Report: "Pushed 2 skills to framework"

Time: ~25 seconds

Safety Features

Pre-flight checks:

  • โœ… Source/target paths exist
  • โœ… Source has .claude/skills/ directory
  • โœ… User confirmation before changes
  • โœ… Dry-run preview available

Version protection:

  • Warns when overwriting newer target
  • Detects conflicts (same time, different content)
  • Shows line count differences
  • Provides diff option

Backup protection:

  • Automatic backup before overwrite
  • Timestamped backup directories
  • Easy rollback

Error Handling

Invalid Source/Target

โŒ Error: Project not found

Path: ../nonexistent
Expected: ../nonexistent/.claude/skills/

Please check:
1. Path is correct
2. Project has .claude/skills/ directory
3. You have read permissions

No Skills to Update

โœ… All skills are up to date!

No new or updated skills found in source.
Current project has all latest versions.

Permission Issues

โŒ Error: Permission denied

Cannot write to: ../buffer/.claude/skills/

Please check:
1. You have write permissions
2. Directory is not read-only
3. No other process is locking the directory

Best Practices

  1. Always dry-run first: Test with --dry-run before applying changes
  2. Selective updates: Use --skills flag to update only specific skills
  3. Framework as source of truth: Projects pull from framework, framework pulls innovations from projects
  4. Document custom skills: Ensure complete YAML frontmatter, 200+ lines docs, examples, no hardcoded paths, LICENSE.txt

Integration

With other update- skills:*

bash
# Complete framework update
/update-pillars --from ~/dev/ai-dev   # 1. Pillars
/update-rules --from ~/dev/ai-dev     # 2. Rules
/update-workflow --from ~/dev/ai-dev  # 3. Workflow
/update-skills --from ~/dev/ai-dev    # 4. Skills

# Or use meta-skill
/update-framework --from ~/dev/ai-dev # All-in-one

Common workflow:

Framework upgrade โ†’ Pull Skills โ†’ Test locally โ†’ Commit
Skill development โ†’ Polish โ†’ Push to framework โ†’ Share

Task Management

After each sync step, update progress:

Paths validated โ†’ Update Task #1
Skills scanned โ†’ Update Task #2
Versions compared โ†’ Update Task #3
Diff shown โ†’ Update Task #4
Sync executed โ†’ Update Task #5
Results reported โ†’ Update Task #6

Provides real-time visibility of sync progress.

Final Verification

Before declaring sync complete, verify:

- [ ] All 6 sync tasks completed
- [ ] Source and target paths valid
- [ ] Skills compared successfully
- [ ] User confirmed changes
- [ ] Directories copied correctly
- [ ] Backups created (if overwritten)
- [ ] Sync summary displayed

Missing items indicate incomplete sync.

Workflow Skills Requirements

This is a workflow skill and must follow the standard pattern:

  1. TaskCreate at start - Create todo list for progress tracking
  2. TaskUpdate during execution - Mark tasks in_progress โ†’ completed
  3. Verification checklist - Final validation before completion

See: WORKFLOW_PATTERNS.md for complete implementation guide

Related Skills

  • /update-framework - Sync entire framework (calls this skill)
  • /update-pillars - Sync Pillars
  • /update-rules - Sync rules
  • /update-workflow - Sync workflow docs

Version: 2.4.0 Last Updated: 2026-03-14 Changelog:

  • v2.4.0 (2026-03-14): Simplify --clean mode documentation (Issue #256)
  • v2.3.0 (2026-03-13): Add --clean parameter for complete directory replacement (Issue #210)
  • v2.0.0 (2026-03-10): Upgrade to semantic version comparison (Issue #214)
  • v1.0.0 (Initial): Created update-skills skill (Issue #70)

Pattern: Tool-Reference (guides sync process) Compliance: ADR-001 Section 4 โœ…

Expand your agent's capabilities with these related and highly-rated skills.

Didn't find tool you were looking for?

Be as detailed as possible for better results