Skip to content

Add three-directory skill sync verification script #498

Closed

Description

@admarble

Problem

Every PR that touches skill files needs manual verification that changes are synced across .claude/skills/, templates/skills/, and skills/. This currently requires ~6 separate diff/grep commands during QA.

Origin: During QA for #484, the skills/testgen/SKILL.md file was found to be 575 lines while .claude/skills/testgen/SKILL.md was 713 lines — a pre-existing divergence that was only caught by adversarial manual review.

Desired Behavior

A single command checks all three directories for sync:

npx tsx scripts/dev/check-skill-sync.ts

Output:

✅ exec/SKILL.md — synced (3/3 match)
✅ qa/SKILL.md — synced (3/3 match)
✅ spec/SKILL.md — synced (3/3 match)
❌ testgen/SKILL.md — diverged (.claude/skills: 713 lines, skills/: 575 lines)
✅ _shared/references/subagent-types.md — synced (3/3 match)

Summary: 4/5 synced, 1 diverged

Acceptance Criteria

  • AC-1: scripts/dev/check-skill-sync.ts compares files across all three directories
  • AC-2: Reports which files match and which diverge, with line count diff
  • AC-3: Exits with code 1 if any divergence found (usable in CI)
  • AC-4: Handles missing files gracefully (file exists in one dir but not another)
  • AC-5: Can be run with --fix flag to copy from .claude/skills/ to the other two dirs

Design Notes

  • Source of truth: .claude/skills/ (active skills used by Claude Code)
  • templates/skills/ must match (copied by sequant init)
  • skills/ must match (distribution copy)
  • Compare file content, not just existence — use diff or hash comparison
  • Exclude .claude/skills/_shared/ vs skills/_shared/ if structure differs

Activity

  1. added
    enhancement
    cli
    on Apr 7, 2026
  2. admarble commented on Apr 12, 2026

    @admarble
    ContributorAuthor

    Spec Plan — #498: Three-directory skill sync verification script

    AC Checklist

    AC Description Verification Method
    AC-1 scripts/dev/check-skill-sync.ts compares files across all three directories Run script, verify output covers all skills Integration Test
    AC-2 Reports which files match/diverge with line count diff Run with known divergence, check output format Integration Test
    AC-3 Exits with code 1 if any divergence found (CI-usable) Run with divergent files, check exit code Integration Test
    AC-4 Handles missing files gracefully Remove a file from one dir, run script Integration Test
    AC-5 --fix flag copies from .claude/skills/ to other two dirs Run with divergence + --fix, verify files match after Integration Test

    Non-Goals

    • Detecting semantic differences (only content/file equality)
    • Auto-fixing during CI (CI only reports)
    • Handling nested directory structure differences beyond file-level comparison

    Implementation Plan

    1. Create scripts/dev/check-skill-sync.ts — TypeScript script following existing pattern (process.argv, no CLI framework)
    2. Directory scanning — Enumerate .claude/skills/*/ subdirs, find matching paths in templates/skills/ and skills/
    3. File comparison — Compare content via hash (crypto.createHash) for each matching file
    4. Reporting — Table output with sync status, line counts for diverged files
    5. Exit code — Exit 1 if any divergence, exit 0 if all synced
    6. --fix mode — Copy from .claude/skills/ to other two dirs using fs.copyFileSync
    7. Unit tests — Test comparison logic, missing file handling, fix mode

    Design Review

    1. Where? scripts/dev/check-skill-sync.ts — dev tooling layer, same as cleanup-worktree.sh
    2. Simplest approach? Read files, hash compare, report. No dependencies beyond Node built-ins (fs, crypto, path)
    3. Pattern? Follows scripts/prepare-marketplace.ts — direct process.argv, FS operations, exit codes
    4. Reviewer challenge? "Why not use diff?" — hash comparison is faster for equality check, and we need structured output for QA integration (Add QA skill check for three-directory skill sync #499)

    Recommended Workflow

    Phases: exec → qa
    Quality Loop: disabled
    Reasoning: Well-defined CLI script, 5 clear ACs, single file output

  3. added 2 commits that reference this issue on Apr 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    clienhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions