Skip to main content

/hook-code

writes a version-2 business hook

It does not load thinking.md. It does not become /hook-plan, /logic-plan, or /hook-critic.

Ground a hook-plan

/hook-code
<ground> @finance-invoices-record-invoice-payment-hook-plan.md </ground>

<ground> holds {collection}-{slug}-hook-plan.md. Critic PASS is the usual gate. A missing PASS is a WARNING, not a BLOCKER.

Ground a hook file

/hook-code
<ground> @record-invoice-payment.finance-invoices.hook.ts </ground>

<ground> holds a *.hook.ts path. A seen hook file is the write target.

Skill path

@.agents/skills/hook-code/SKILL.md
<ground> @finance-invoices-record-invoice-payment-hook-plan.md </ground>

If the slash name does not start the skill, put the skill file on line 1.

Examples

/hook-code
<ground> @finance-invoices-record-invoice-payment-hook-plan.md </ground>
Thought1s

Follow coder.md. Do not load thinking.md. Do not recopy coder.md.

The hook-plan is the contract. Do not invent identities. New scaffolds go through MCP create_hook.

Path-load /hook-code-style before write. Then tell the user to run /hook-critic.

Worked for 2m 6s

Wrote record-invoice-payment.finance-invoices.hook.ts.

One class. One execute(). ok + data. Pattern grammar order.

Run /hook-critic.

record-invoice-payment.finance-invoices.hook.ts

Implementer: `/hook-code` path-loads `.agents/rules/hook/coder.md`. Code is written.

Path: apps/api/src/app/hooks/finance-invoices/record-invoice-payment/record-invoice-payment.finance-invoices.hook.ts

The hook-plan file is the contract. The .ts file is the artifact. context.md is written with the hook.

Patch a seen hook

/hook-code
<ground> @record-invoice-payment.finance-invoices.hook.ts </ground>
Bound the list query. Name the stable payment key for idempotent: true.

Worked for 44s

Patched record-invoice-payment.finance-invoices.hook.ts.

Re-run /hook-critic.

Hold the hook file

The skill path-loads .agents/rules/hook/coder.md. It does not recopy that file.

Done is all of:

  • one version-2 *.hook.ts
  • context.md
  • a report (pattern, files, MCP evidence, replay and transaction, verification, residual risks)

New hooks use MCP create_hook. Do not scaffold by hand. Do not edit generated barrels or interface registries.

Do not edit framework-hooks/ or system-hooks/ without administrator approval.

UNKNOWN on a required identity, field, status, key, or relationship blocks the write.

If a *-hook-plan.md exists and /hook-plan-critic has not returned PASS, the skill warns and asks whether to proceed.

danger

If MCP tools are missing, stop. Fix Setup.

ProblemCauseAction
Tools missingMCP not registeredStop. Fix Setup.
UNKNOWN identityA name was guessedAsk. Do not write .ts.
Plan with no PASSCritic skippedWARNING. Confirm before you proceed.
Pattern grammar reorderexecute() order does not match the patternBLOCKER. Bind the selected pattern order.
Manual scaffoldcreate_hook skippedCall MCP create_hook. Then edit the scaffold.

Next steps

When the hook file exists, run /hook-critic.