跳到正文
cccskills
免费在 GitHub 公开

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.

中文简介正在准备中。当前显示原文说明。

jaktestowac/awesome-copilot-for-testers星标 118(GitHub 118 + cccskills 0)
集成工具GitHub

实测评分 未实测

查看安装方法

包含的文件(4)

  • SKILL.md4.5 KB
  • resources/hook-example-pack.md2.8 KB
  • resources/hook-quality-checklist.md1.3 KB
  • resources/hook-template-pack.md2.3 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

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

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Defines, computes, and interprets test and quality metrics: pass rate, flake rate, suite duration, defect escape rate, time to detect, and coverage with its caveats. Use when building a QA dashboard, reporting suite health to stakeholders, comparing releases over time, or when a coverage percentage or a bug count is being treated as a measure of quality.

中文简介正在准备中。当前显示原文说明。

jaktestowac/awesome-copilot-for-testers1182026年8月27日 更新

Analyzes diffs, changed files, hotfixes, and release candidates to identify where regression risk spreads and what must be retested first. Use when scoping retest after a change, reviewing QA impact for a pull request, or building a minimal confidence suite for release validation.

中文简介正在准备中。当前显示原文说明。

jaktestowac/awesome-copilot-for-testers1182026年8月27日 更新

Writes and reviews API automation tests with Playwright Test, covering setup/teardown, assertions, data management, and hybrid API+UI flows. Use when creating backend API tests, contract checks, data-driven API coverage, API+UI hybrid workflows, or reviewing existing Playwright API suites.

中文简介正在准备中。当前显示原文说明。

jaktestowac/awesome-copilot-for-testers1182026年8月27日 更新

Measures the risk that code shipped without anyone understanding it: a teach-back attestation on high-risk changes, a risk band from changed-code complexity, diff size and whether a human explanation accompanied it, and optional AI-authorship provenance. Findings stay advisory by design. Use when an AI-assisted codebase grows faster than the team reads it, when reviews are rubber-stamped, when nobody can explain a module that ships weekly, or when leadership asks how much of the code the team can actually maintain.

中文简介正在准备中。当前显示原文说明。

jaktestowac/awesome-copilot-for-testers1182026年8月27日 更新

Produces an evidence-backed go/no-go recommendation: exit criteria status, open-defect risk profile, coverage against risk, environment parity, rollback readiness, and the residual risk stated plainly. Use when preparing a release sign-off, when someone asks whether a build is ready to ship, or when a decision to release is being made on impressions rather than evidence.

中文简介正在准备中。当前显示原文说明。

jaktestowac/awesome-copilot-for-testers1182026年8月27日 更新

Records human verification - code review, exploratory sessions, UAT, accessibility passes, UX and observability reviews - as dated, attributed attestations in a register, so human-centric practices stay in the quality contract without pretending to be automated checks. Use when a strategy requires verification no tool can prove, when sign-off evidence is scattered across chats and tickets, when a gap matrix needs to distinguish "attested" from "passed", or when an audit asks who verified what and when.

中文简介正在准备中。当前显示原文说明。

jaktestowac/awesome-copilot-for-testers1182026年8月27日 更新

查看 jaktestowac 的全部技能

报告此技能的问题