Skip to content
Skills Library
AI & agents · Building & coding

creating-hooks

/creating-hooks

Creates GitHub Copilot hooks for VS Code using `hooks.json`, supporting scripts, and companion docs. Use when automating deterministic checks, pre/post tool policies, or reusable hook packs that need safe defaults, observability, and clear installation guidance.

Licence
MIT
Last repository change
26.08.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
4
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 26.08.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Creates GitHub Copilot hooks for VS Code using `hooks.json`, supporting scripts, and companion docs. Use when automating deterministic checks, pre/post tool policies, or reusable hook packs that need safe defaults, observability, and clear installation guidance.

Arguments

/creating-hooks Hook goal, lifecycle event, allowed or denied behaviors, and platform needs
Original author description

Creates GitHub Copilot hooks for VS Code using `hooks.json`, supporting scripts, and companion docs. Use when automating deterministic checks, pre/post tool policies, or reusable hook packs that need safe defaults, observability, and clear installation guidance.

How it works

  1. When to Use
  2. Outcome Standard
  3. Hook Design Rules
  4. Workflow
  5. Common Failure Modes
  6. Resource Map
  7. Definition of Done
Original SKILL.md headings · 114 lines, 659 words
SKILL.md preview
---
name: creating-hooks
description: "Creates GitHub Copilot hooks for VS Code using `hooks.json`, supporting scripts, and companion docs. Use when automating deterministic checks, pre/post tool policies, or reusable hook packs that need safe defaults, observability, and clear installation guidance."
argument-hint: "Hook goal, lifecycle event, allowed or denied behaviors, and platform needs"
user-invocable: true
---

# Creating Copilot Hooks

Use this skill when the right answer is not more advice, but deterministic behavior at a specific lifecycle point.
It helps design hooks that are safe, documented, and understandable.

## When to Use

Use this skill when the user asks for things like:

- "create a Copilot hook for this policy"
- "block dangerous commands before they run"
- "log or validate tool usage automatically"
- "add a reusable hook pack with docs and scripts"
- "turn this manual guardrail into a hook"

Typical scenarios:

- pre-tool checks for risky shell commands
- post-tool validation or formatting triggers
- audit or observability hooks for shared environments
- installing a documented hook bundle for reuse across workspaces

## Outcome Standard

A strong hook contribution usually includes:

- the right lifecycle event and the smallest useful behavior
- explicit safety defaults and clear denial or warning messages
- a documented `hooks.json` configuration
- cross-platform script guidance when Windows and Bash users both matter
- a README or pack that explains purpose, setup, and limitations

## Hook Design Rules

- **Start with observe or warn** - block only when the policy is stable and the failure message is clear.
- **Keep hooks fast** - long-running hooks become friction generators instead of safeguards.
- **Be explicit on denial** - if a hook blocks work, explain exactly why and what to do instead.
- **Separate policy from docs** - the script enforces behavior; the README explains it.
- **Prefer deterministic checks** - hooks should not depend on fuzzy interpretation when avoidable.

## Workflow

### Phase 0: Decide whether a hook is the right primitive

Use a hook when deterministic automation is needed at a lifecycle event.
If the need is guidance only, use instructions. If the need is a reusable workflow, use a skill. If the need is a user-started task, use a prompt.

### Phase 1: Choose the lifecycle event

Clarify or infer:

- what event should trigger the hook
- whether the behavior is observe, warn, mutate, or deny
- how quickly the hook must complete
- whether it needs cross-platform script support

### Phase 2: Design the safety model

Before scripting:

- define the exact condition being checked
- decide what the hook should output on allow, warn, or deny
- write the denial or warning message in user language, not policy jargon
- make sure the hook fails safely when inputs are missing or malformed

### Phase 3: Create the hook pack

Use the resources below as the default starting point:

- `./resources/hook-template-pack.md`
- `./resources/hook-example-pack.md`

A complete pack should usually include:

- `hooks.json`
- one or more supporting scripts
- a README with purpose, setup, and behavior notes

### Phase 4: Validate the operational fit

Check the result against `./resources/hook-quality-checklist.md`.

Pay special attention to:

- whether the hook is fast enough for the event it runs on
- whether the messages are actionable
- whether Windows and non-Windows paths are addressed when required
- whether the hook blocks only what it truly means to block

## Common Failure Modes

- using a hook when a normal instruction would have been enough
- blocking large classes of commands without a helpful reason
- writing scripts that are too slow for frequent lifecycle events
- shipping `hooks.json` without installation or behavior documentation
- creating platform-specific hooks with no fallback or adaptation guidance

## Resource Map

- `./resources/hook-template-pack.md` - template pack with README, config, and script scaffolds
- `./resources/hook-example-pack.md` - worked example of a safe, documented policy hook
- `./resources/hook-quality-checklist.md` - final review checklist before shipping

## Definition of Done

A task using this skill is complete when:

- the hook behavior matches a clear lifecycle need
- the configuration, scripts, and documentation agree with each other
- failure, allow, and deny messages are understandable
- the pack is install-ready or clearly adapted for the target environment
- the final result passes the quality checklist without obvious operational risk
Files in this package (4)
  • SKILL.md 4 KB
  • resources/hook-example-pack.md 3 KB
  • resources/hook-quality-checklist.md 1 KB
  • resources/hook-template-pack.md 2 KB

Versions

The database has no other skills named creating-hooks.

Identical content appears in 1 other GitHub folders. We show one copy with the highest score.

Database snapshot: 13.11.2026 · package version 8b0b91975d93 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100codex-hooks-builder
    Scaffold hook packs, validate hooks.json schema, verify hook script permissions, migrate hook configuration, and troubleshoot Codex hook execution errors. Use when creating, auditing, upgrading, or validating Codex hook packs, hooks.json files, hook scripts,…
  • 100copilot-guide
    Use when configuring GitHub Copilot CLI or cloud-agent hooks, policy hooks, plugins, or skills. Triggers on .github/hooks, ~/.copilot/hooks, policy.d, preToolUse, permissionRequest, agentStop, command/HTTP/prompt handlers, cloud sandbox differences, plugin.json, repository…
  • 100create-hook
    Create Cursor hooks. Use to create a hook, write hooks.json, add hook scripts, or automate behavior around agent events.
  • 100claude-code-hooks
    Claude Code hooks configuration patterns, event types, validation scripts, and decision control for automating workflows and integrating external tools. This skill should be used when creating hooks, validating tool usage, automating workflows, or integrating external tools with Claude Code.
  • 100github-integration
    Enable the GitHub CLI (`gh`) in Claude Code cloud sessions and GitHub Copilot coding agent environments. Use this skill when: (1) setting up a project so cloud AI agents can use `gh` for PRs, issues, and releases, (2) configuring setup scripts or SessionStart hooks for `gh`…
  • 100hook-authoring
    Creates and configures Claude Code hooks for lifecycle automation. Covers all 17 hook events, 4 hook types (command, prompt, agent, http), matchers, input/output formats, and exit codes. Follows official Anthropic best practices. USE WHEN: user mentions "hook", "hooks",…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.