create-hook

create-hook is a skill for Claude Code from microsoft/vscode. It costs 18 tokens per session (399 once invoked), scanned A, original, MIT.

A guide for creating a JSON hook that runs at specific points in an agent's lifecycle, such as before a tool is used or when a session starts. It can block actions, show warnings, add context, or run a script.

In plain words
What is it for?
Use it to enforce project policies, control tool use, add session context, or automate work when an agent session starts or ends.
Why use it?
It helps turn repeated safety rules and setup tasks into automatic checks, so you do not need to remind the agent every time.

Skill for Claude Code ✓ vendor

Written for Claude Code: disable-model-invocation in frontmatter.

Good fit Use it to enforce project policies, control tool use, add session context…

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/microsoft/vscode/create-hook
About the project

Visual Studio Code is a code editor that supports editing, navigating, understanding, debugging, and extending software projects. Developers use it for the edit-build-debug cycle, and the catalogue add-ons provide skills, instructions, and agents for working within the editor.

microsoft/vscode · 190,932 stars · on GitHub · code.visualstudio.com

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add microsoft/vscode --skill create-hook
Clone the repo
git clone --depth 1 https://github.com/microsoft/vscode

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for create-hook

README.md
[![agentmods](https://agentmods.dev/badge/skills/microsoft/vscode/create-hook.svg)](https://agentmods.dev/skills/microsoft/vscode/create-hook)
Your own site
<a href="https://agentmods.dev/skills/microsoft/vscode/create-hook"><img src="https://agentmods.dev/badge/skills/microsoft/vscode/create-hook.svg" alt="Measured on agentmods" height="20"></a>
Per session 18 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 399 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • Snyk pass 7 Sept 2026
Scanned here with the auditor’s own tool, on the date each one shows. They do not pin a commit, so an audit is not necessarily of the version listed here. How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00018 $0.00399
Opus 5 $0.00009 $0.00199
Sonnet 5 $0.00004 $0.00080
Haiku 4.5 $0.00002 $0.00040

Measured 3d ago against content hash 90ffcc7d0b6d, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

create-hook scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

extensions/copilot/assets/prompts/skills/create-hook/SKILL.md · 33 lines

What it actually says

Related skill: agent-customization. Load and follow hooks.md for template and principles.

Guide the user to create a hook in .github/hooks/.

Extract from Conversation

First, review the conversation history. If the user has been expressing concerns about agent behavior (e.g., "don't run this command", "always check before doing X", "inject this context"), generalize that into a hook. Extract:

  • Actions that should be blocked or gated
  • Context that should be injected at certain points
  • Automation needs at session start/end or tool use

Clarify if Needed

If no clear policy need emerges from the conversation, clarify:

  • What event should trigger this hook? (e.g. PreToolUse, SessionStart, Stop)
  • Should it block, warn, or inject context?
  • Does it need a companion script?

Path Conventions

  • Hook commands and companion scripts run with cwd defaulting to the workspace root (when a workspace folder is available); otherwise cwd falls back to the user home directory. Relative paths resolve from cwd. Absolute paths are fine when intentional — just be deliberate about which you use.
  • Do not use environment variables for pathing. The only exception is plugin-provided environment variables in hooks shipped as part of an agent plugin; never use environment variables for pathing outside of a plugin context.

Iterate

  1. Draft the hook JSON (and any scripts) and save them.
  2. Identify the most ambiguous or weak parts and ask about those.
  3. Once finalized, summarize what the hook enforces, suggest ways to test it, and propose related customizations to create next.

Remember to follow the agent-customization guidelines to create highly effective hooks.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 33 lines · 18 tokens per session scan A 90ffcc7d0b6d

Subscribe to this mod's changes

create-hook is a skill published in the GitHub repository microsoft/vscode (190,932 stars, last pushed yesterday), licensed MIT. It adds 18 tokens to every session and 399 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.