Skip to content
Agentmart
Submit a tool

new-hook

Use when deciding whether a lifecycle or event hook is the right solution, or when creating or revising one for Antigravity, Codex, ChatGPT, Zed, OpenCode…

Skill by Starraider

IndexedCC-BY-4.0★ 2
Write a review

Chalk Labs

Need help deploying new-hook?

Chalk Labs sets up agents like this inside real teams: connected to your tools, tested on your data, with a human in the loop where it matters.

Book a call

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/starraider-new-hook

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Use when deciding whether a lifecycle or event hook is the right solution, or when creating or revising one for Antigravity, Codex, ChatGPT, Zed, OpenCode, Qoder, Orca, Cursor, GitHub Copilot / VS Code, Windsurf, Kiro, or Google Agents CLI. Select exactly one target and documented event model; recommend a Skill, plugin/app, permission policy, task, automation, or CI when a hook is unsupported or unsuitable.

Use cases: devops, productivity, agent-building

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md and code. Checked Oct 26, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/new-hook

What's inside

Skill name
new-hook
Description
Use when deciding whether a lifecycle or event hook is the right solution, or when creating or revising one for Antigravity, Codex, ChatGPT, Zed, OpenCode, Qoder, Orca, Cursor, GitHub Copilot / VS Code, Windsurf, Kiro, or Google Agents CLI. Select exactly one target and documented event model; recommend a Skill, plugin/app, permission policy, task, automation, or CI when a hook is unsupported or unsuitable.
License
CC-BY-4.0
Instructions
83 lines in SKILL.md · view on GitHub

Files (4)

  • README.md
  • SKILL.md
  • evals.json · evals/
  • target-hook-formats.md · references/

SKILL.md (first lines)

# New Hook

## Outcome

Create one narrow, deterministic, and testable hook for a selected product, or explicitly recommend the better-supported alternative. Produce only the configuration and source files required for that target, with installation, trust/reload, and smoke-test instructions.

## Workflow

1. Establish the event contract before choosing a mechanism.

   Require the target product, the event that must cause the action, the input to inspect, the intended effect, project or user scope, and whether the hook may block, rewrite, write, send network traffic, or invoke an external service. Ask one concise clarification question if the target or trigger is missing.

   Completion: the desired behavior can be expressed as “when **event X** happens, inspect **input Y**, then **allow/block/transform/observe action Z**.”

2. Decide whether a hook is appropriate.

   A hook is appropriate only when all of these are true:

   - The behavior is deterministic and event-driven, rather than a judgment the model should make.
   - The chosen client documents an event at the required point in time.
   - The required effect is supported (for example, a pre-action guard may block; a post-action formatter cannot undo a completed action).
   - The work can be fast, idempotent where repeated events are possible, and safe if invoked unexpectedly or concurrently.

   Prefer another mechanism when any condition fails:

   - **Skill or instruction:** reusable reasoning, authoring guidance, or a workflow that needs context and judgment; use [`new-skill`](../new-skill/README.md), [`new-agents-md`](../new-agents-md/README.md), or [`new-workflow`](../new-workflow/README.md) as appropriate.
   - **Permission policy:** a standing allow/ask/deny rule that does not need custom inspection.
   - **MCP server, app, or plugin:** a new capability or a maintained integration rather than an event reaction.
   - **Task, worktree setup, CI, or scheduler:** a build/deploy/check that is tied to a worktree, commit, time, or repository event instead of an agent lifecycle event; use [`new-workflow`](../new-workflow/README.md) for a target-native repeatable procedure.
   - **ChatGPT:** do not invent a local lifecycle hook. Use a Skill for repeatable behavior, a Plugin/App/MCP integration for tools, or an approved scheduled/Workspace Agent workflow when that is the actual need.
   - **Windsurf:** the agent (Cascade) does not expose a general lifecycle hook API. Use `.windsurfrules`, a `.windsurf/workflows/` file, or MCP for integration needs. A limited command hook (`PreToolUse`) exists only for blocking shell-level tool calls; confirm the target surface before implementing.

   Explain the recommendation before creating files when it is not a hook.

   Completion: the selected mechanism has a documented trigger and the smallest sufficient authority.

3. Select exactly one target branch and read its operative details in [target hook formats and research](references/target-hook-formats.md).

   - **Antigravity:** configure a JSON command hook in workspace `.agents/hooks.json`, global `~/.gemini/config/hooks.json`, or a plugin `hooks.json` only when a plugin is requested.
   - **Codex:** use `<repo>/.codex/hooks.json` or inline hook tables in `<repo>/.codex/config.toml`; keep the two representations separate in one config layer.
   - **ChatGPT:** report that a comparable local lifecycle hook is not documented and take the alternative branch from step 2.
   - **Zed:** create or revise a `tasks.json` task with `hooks: ["create_worktree"]`; do not claim Zed has general agent lifecycle hooks.
   - **OpenCode:** create a TypeScript/JavaScript plugin, register it in `opencode.json` or `opencode.jsonc`, and use the documented runtime hook API.
   - **Qoder:** add the target-specific JSON configuration to `.qoder/settings.json`, `.qoder/settings.local.json`, or `~/.qoder/settings.json`; create the referenced handler.
   - **Orca:** use an existing compatible Codex or Claude hook for agent lifecycle behavior, or configure a Repository worktree-setup hook for post-worktree setup. Do not fabricate an Orca event-hook file.
   - **Cursor:** create or revise `.cursor/hooks.json` (project) or `~/.cursor/hooks.json` (user); confirm events against the documented set before implementing.
   - **GitHub Copilot / VS Code:** create a `.json` file in `.github/hooks/` (project) or the user-level hooks directory; verify events against the VS Code Copilot hooks documentation.
   - **Windsurf:** use `~/.codeium/windsurf/hooks.json` (user) or `.windsurf/hooks.json` (workspace) only for shell-command blocking via `PreToolUse`; for any broader lifecycle need, take the alternative branch from step 2.
   - **Kiro:** create or revise a `.json` file under `.kiro/hooks/`; each file may contain multiple hook entries; use `command` or `agent` action types as appropriate.
   - **Google Agents CLI (ADK):** implement a `BasePlugin` subclass with `before_tool_callback` / `after_tool_callback` (and other documented callbacks); register it in the runner configuration. Do not fabricate a JSON hook file for the ADK.

   Completion: exactly one implementation model and one scope are selected; unsupported targets receive an alternative rather than pseudo-configuration.

4. Implement the smallest safe handler and registration.

   Read JSON from stdin only when the target sends it; parse only fields needed for the decision and validate their types. Make command paths explicit, quote path values, use a short timeout, write diagnostics to stderr, and emit only the target’s documented stdout shape. Prefer an exec-form command if the target supports it and shell parsing adds no value.

   Default to observation. For blocking hooks, block a precisely defined unsafe condition and return an actionable reason; never use a broad matcher or an unconditional deny as a substitute for permissions. For post-event work, make duplicate delivery harmless and do not claim it rolls back a completed tool call. Keep secret values out of config, source, logs, and hook output.

   Preserve unrelated settings and existing hooks. Never replace a whole shared settings file merely to add one hook.

   Completion: the handler, matcher, event, output contract, timeout, and scope each map to the stated event contract.

5. Verify loading, behavior, and the failure path.

   First validate syntax with the native parser or a language checker. Then follow the target’s reload/trust instructions in [target hook formats and research](references/target-hook-formats.md), trigger one representative event, and confirm the observable result. For a guard, test both an allowed input and a prohibited input; for a post-event hook, confirm it never claims to reverse the original action.

   Completion: the hook is loaded, its matcher fires only where expected, a normal request still succeeds, and the intended effect or block reason is observed.

## Safety

- A hook is executable code at a sensitive lifecycle boundary. Do not create or enable it without clear authority to edit the selected local configuration.
- Treat hooks as defense-in-depth, not a complete security boundary. Retain the client’s sandbox and permission controls.
- Do not place credentials in hook configuration, command strings, source, logs, or test fixtures. Use the target’s approved environment/secret mechanism and redact diagnostics.
- Never auto-run destructive commands, make external writes, or widen permissions merely because an event fires. Require an explicit condition and, where feasible, a user confirmation at the action boundary.
- Avoid network calls and long-running work in synchronous hooks. Use a background service, CI, task, scheduler, or plugin when latency, retries, durability, or observability matter.

## Resources

- If the event contract does not make the right mechanism clear, use [`improve-my-ai-harness`](../improve-my-ai-harness/README.md) before implementing an alternative.
- [Target hook formats, decision limits, validation, and primary-source links](references/target-hook-formats.md)

From Starraider/ai-skills-plugin, CC-BY-4.0.

More from Starraider/ai-skills-plugin

Signals

Stars
2
Forks
1
Open issues
29
Last commit (this folder)
Sep 24, 2026 (1 month ago)
Last release
Sep 26, 2026 (1 month ago)

From GitHub (fetched Oct 24, 2026).

Details

License
CC-BY-4.0
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from Starraider

Done for you

Rather not set it up yourself?

Chalk Labs scopes, builds and runs agents for your team: the task audit, the eval harness, the integrations and the weekly ops report. Fixed scope, priced before we start.

See how we build AI agents →Read the case studies

Chalk Labs is a two-founder AI and growth studio. We build AI agents, CRMs and MVPs for Web3 and AI companies, and have shipped 50+ product and token launches.

launches shipped
50+
launches shipped
media placements
500+
media placements
founders on every account
2
founders on every account

Press we've placed: Forbes · CoinDesk · Decrypt · Cointelegraph · The Block

Rahil Jain, Co-founder, Chalk Labs. Ex-Goldman Sachs engineer. You talk to the person who builds it.

Get new-hook running in your business

Tell us what you want to automate. A founder replies within one working day with a plan, not a pitch deck.

Goes to the Chalk Labs founders, not the newsletter. Privacy

Need help deploying new-hook?

CallGet help
Cite this page

new-hook skill. Agent Mart. https://agentmart.dev/skills/starraider-new-hook (last updated 2026-10-24)