hook-management
Create, modify, and delete Claude Code hooks and GitHub Copilot hook integrations safely using a discovery-first, non-destructive workflow.
- License 许可
- GPL-3.0
- 最近更新
- 2026-06-06
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- hook-management
- description
- Create, modify, and delete Claude Code hooks and GitHub Copilot hook integrations safely using a discovery-first, non-destructive workflow.
03 SKILL.md 正文
Hook Management
Use this skill when a user asks to create, update, migrate, or remove hook behavior for either Claude Code or GitHub Copilot in this repository.
This skill is implementation-agnostic but actionable. It always discovers actual hook files and references first, then applies minimal, reversible changes.
Inputs Expected
- Operation:
create|modify|delete - Platform target:
claude|copilot|both - Hook scope: repository-wide, agent-specific, skill-specific, or command-specific
- Hook name and intent: what the hook should do
- Trigger/event conditions: when it should run
- Safety constraints: destructive actions allowed or not, confirmation requirements
- Validation constraints: expected outputs, pass/fail signals, and rollback policy
If any required input is missing, ask only the minimum clarifying questions needed to proceed safely.
Phase 0 - Context Load (silent)
- Read
.claude/CLAUDE.mdandAGENTS.md. - Invoke
Skill("manage-memory", args: "agent-manager"). - Read repository governance files relevant to skill and command ownership.
- Discover current hook surfaces and references before proposing edits.
Phase 1 - Discovery And Classification
- Detect existing Claude hook assets:
.claude/hooks/**.claude/settings.json- Any hook script references from Claude command/agent files
- Detect existing Copilot hook assets (format may vary by repo):
.github/hooks/**- Any files that reference hook scripts, pre/post actions, or enforcement callbacks
- Build a hook inventory table:
- platform
- file path
- trigger/event
- linked script/config
- ownership and dependency notes
- Classify request into one mutation strategy:
- create new hook
- modify existing hook
- delete/deprecate hook
- migrate/duplicate behavior across platforms
Decision rule:
- If target hook is not discoverable and operation is
modifyordelete, pause and ask for disambiguation instead of guessing.
Phase 2 - Plan The Change
- Map requested behavior to one or both platforms.
- Choose smallest safe edit set:
- script/body changes
- config wiring changes
- command/prompt/instruction reference changes
- Identify impact radius:
- direct dependents
- potential execution side effects
- test/validation path
- For
delete, require an explicit safety plan:- backup path or reversible rename
- confirmation checkpoint before permanent removal
Branch logic:
-
scope = claude- Edit only Claude hook files and references.
-
scope = copilot- Edit only Copilot hook integration files and references.
-
scope = both- Keep semantic parity; document intentional differences.
-
operation = create- Add hook implementation + registration/wiring + docs note.
-
operation = modify- Patch in place with minimal diff; preserve unrelated behavior.
-
operation = delete- Prefer soft-delete first (disable/unwire + backup) unless hard delete is explicitly approved.
Phase 3 - Execute Create/Modify/Delete
A. Create
- Create or extend the hook implementation file in discovered platform convention paths.
- Register hook in the relevant platform config/reference files.
- Add brief inline comments only where logic is non-obvious.
- Ensure cross-platform naming consistency if
scope = both.
B. Modify
- Patch only required logic and references.
- Keep input/output contracts stable unless explicitly requested.
- Preserve existing guardrails (error handling, loop prevention, safety checks).
C. Delete
- Backup target hook content to a reversible location or branch-safe file before removal.
- Remove registration/wiring first, then implementation.
- Remove or update stale references.
- If permanent delete was not explicitly approved, leave a reversible deprecation marker.
Phase 4 - Safety And Validation
Validation checklist:
- [ ] Discovery evidence captured (what existed before changes)
- [ ] Correct platform scope honored (
claude,copilot, orboth) - [ ] No unrelated files modified
- [ ] Hook wiring references resolve to valid files
- [ ] Delete path is reversible unless explicit hard-delete approval exists
- [ ] Behavior parity documented when targeting both platforms
- [ ] Governance rules respected (agent-manager owns skill/command artifacts)
Completion criteria:
- Requested operation is fully implemented for the declared scope.
- Hook configuration and implementation are consistent.
- Risks and any assumptions are reported explicitly.
- User receives a concise delta summary and suggested next checks.
Ambiguity And Weak-Spot Detection
Before finalizing, surface the most important unresolved points:
- Copilot hook substrate ambiguity:
- Whether this repo treats prompts/instructions/agents as hook surfaces or uses separate script hooks.
- Delete semantics ambiguity:
- Whether deletion means disable, deprecate, or permanently remove files.
- Execution contract ambiguity:
- Expected input/output schema and fail-open vs fail-closed behavior for each platform.
When these are unresolved, return targeted clarification questions with one recommended default.
Example Invocations
Skill("hook-management", args: "create claude pre-stop hook to enforce dotnet test before finish")Skill("hook-management", args: "modify copilot hook to add repository quality-gate reminder")Skill("hook-management", args: "delete both hook named enforce-tests using soft-delete with backup")Skill("hook-management", args: "migrate claude hook behavior to copilot and keep event semantics aligned")
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.