hooks-sync
Detects and resolves drift between Claude Code hooks (.claude/hooks/*.ps1 + .claude/settings.json) and GitHub Copilot hooks (.github/hooks/*.ps1 + .github/hooks/*.json). Ensures semantic parity across both hook surfaces. Invoked exclusively by the agent-manager agent.
- License 许可
- GPL-3.0
- 最近更新
- 2026-06-06
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- hooks-sync
- description
- Detects and resolves drift between Claude Code hooks (.claude/hooks/*.ps1 + .claude/settings.json) and GitHub Copilot hooks (.github/hooks/*.ps1 + .github/hooks/*.json). Ensures semantic parity across both hook surfaces. Invoked exclusively by the agent-manager agent.
03 SKILL.md 正文
Use this skill when hook definitions on Claude Code and GitHub Copilot have drifted apart, when a hook was added to one platform but not the other, or when a full hook inventory audit is needed. Parse the args to determine the operation mode, then execute the corresponding procedure.
Phase 0 — Context Load (silent)
- Read
.claude/CLAUDE.mdandAGENTS.mdto internalize project conventions and portability rules. - Invoke
Skill("manage-memory", args: "agent-manager")to load persistent memory (prior sync decisions, known hook names, settings.json structure). - Read
.claude/settings.jsonto understand currently registered Claude Code hooks. - Glob
.claude/hooks/*.ps1and.github/hooks/*.ps1and.github/hooks/*.jsonto build the current hook inventory.
Mode: audit
Args: audit
Inventory all hooks on both platforms and flag semantic drift.
- Read
.claude/settings.json— extract thehooksarray; for each entry record: event type, script path, matcher pattern (if any). - Glob
.claude/hooks/*.ps1— list all Claude hook script files. - Glob
.github/hooks/*.ps1— list all Copilot hook script files. - Glob
.github/hooks/*.json— list all Copilot hook metadata files. - Normalise hook names from filenames (strip
.ps1/.jsonextensions). - Build a cross-reference map keyed on hook name.
- Classify each entry:
- present-both — hook script and metadata exist on both platforms, and hook is registered in
settings.json - claude-only —
.claude/hooks/<name>.ps1is registered insettings.jsonbut no.github/hooks/<name>.ps1or.github/hooks/<name>.json - copilot-only —
.github/hooks/<name>.ps1+.github/hooks/<name>.jsonexist but no.claude/hooks/<name>.ps1registration - unregistered —
.claude/hooks/<name>.ps1exists but is not referenced insettings.json - drifted — both platforms have the hook but script content or metadata differs semantically
- present-both — hook script and metadata exist on both platforms, and hook is registered in
- Output a structured audit report:
## Hook Drift Report
| Hook | Claude script | settings.json | Copilot script | Copilot metadata | Status | Drift |
|------|---------------|--------------|----------------|-----------------|--------|-------|
| <name> | ✅ | ✅ | ✅ | ✅ | in sync | — |
| <name> | ✅ | ✅ | ❌ | ❌ | — | missing on Copilot |
| <name> | ✅ | ❌ | — | — | — | unregistered |
- Summarise counts: total hooks, fully in sync, drifted, orphans, unregistered.
Mode: sync
Args: sync <name>
Sync a named hook from Claude → Copilot (or vice versa when Copilot is ahead).
Claude → Copilot (default direction when Claude hook exists):
- Read
.claude/hooks/<name>.ps1; fail with a clear error if it does not exist. - Read
.claude/settings.json— find the hook entry matching<name>to extract event type and any matcher. - Write
.github/hooks/<name>.ps1with the same script content. - Write
.github/hooks/<name>.jsonwith the hook metadata:{ "name": "<name>", "event": "<event-type-from-settings>", "script": "<name>.ps1", "description": "<infer from script comments or hook name>" } - Confirm: "Hook
<name>synced to.github/hooks/."
Copilot → Claude (when only Copilot hook exists):
- Read
.github/hooks/<name>.ps1and.github/hooks/<name>.json. - Write
.claude/hooks/<name>.ps1with the same script content. - Read
.claude/settings.json; add the hook entry under the appropriate event type. - Write updated
.claude/settings.json. - Confirm: "Hook
<name>synced to.claude/hooks/and registered insettings.json."
Mode: sync-all
Args: sync-all
Sync all hooks detected in the Claude registry and Copilot hook directories.
- Read
.claude/settings.json— collect all registered hook names. - Glob
.github/hooks/*.json— collect all Copilot hook names. - Union the two sets.
- For each hook name, execute Mode: sync in sequence.
- Produce a summary: hooks synced, any errors encountered.
Mode: diff
Args: diff <name>
Show a structured diff for one hook name across platforms.
- Read
.claude/hooks/<name>.ps1; note if missing. - Read
.claude/settings.json— extract the registration entry for<name>; note if not registered. - Read
.github/hooks/<name>.ps1; note if missing. - Read
.github/hooks/<name>.json; note if missing. - Compare:
- Script content: identical / differs (show line-count diff if different)
- Event type:
settings.jsonevent vs<name>.jsoneventfield - Registration: registered in
settings.json/ not registered
- Output:
## Hook Diff: <name>
| Property | Claude | Copilot |
|----------|--------|---------|
| Script exists | ✅ / ❌ | ✅ / ❌ |
| Script identical | — | ✅ / ❌ |
| Event type | <val> | <val> |
| Registered | ✅ / ❌ | ✅ / ❌ |
- Conclude with: In sync / Drifted — run
sync <name>to resolve.
Validation Rules
- Every
.claude/hooks/<name>.ps1must have a matching entry in.claude/settings.json. - Every
.github/hooks/<name>.ps1must have a matching.github/hooks/<name>.json. - Hook names must be kebab-case and identical across both platforms.
- Never delete any hook file — use deprecation patterns when retiring.
- Never read or modify
.envfiles or sensitive configuration.
04 同仓库更多 Skills
write-tests
Test implementation skill for HypermediaEngine. Takes a confirmed test plan from design-test-cases and produces compilable, runnable xUnit tests following project conventions. Validates coverage quality through mutation testing. Invoked by the sqa-engineer agent after the test plan is approved.
write-documentation
Structured documentation writing workflow for HypermediaEngine. Writes or updates README.md files at the repo root and in each project directory (src/, tests/, samples/, etc.) based on current implementation, ADRs, and architecture decisions.
write-adr
Writes a numbered Architecture Decision Record (ADR) for a significant architectural choice in the HypermediaEngine project. Invoked by the software-architect agent whenever a consequential design decision is made or ratified. Saves the ADR to docs/architecture/decisions/.
tunit-playwright-ui-testing
Comprehensive guidance for writing coded end-to-end UI tests in C# using TUnit.Playwright. Tests inherit from PageTest — the base class manages all browser lifecycle. Covers NuGet setup, PageTest inheritance, Page Object Model, browser configuration, parallelism limiting, and CI integration. Based on the official TUnit docs at https://tunit.dev/docs/examples/playwright.
triage
Task classification, decomposition, dependency mapping, and routing skill. Invoked by the triage-agent to break any user request into discrete, independently-routable work items with assigned priorities and agent chains.
system-design
Expert system design skill. Use PROACTIVELY to design systems, review architectures, and assist software engineers in learning design principles and implementing them in the code with design patterns.