agentleFS
MoeenNehzatiMoeenNehzati/famulus/skills/hook-maker/SKILL.md

hook-maker

Skill4 starsChanged 4 months agoMITView on GitHub

Use when the user asks to create or change an assistant lifecycle hook that must support multiple hosts or runtimes. Do not use for ordinary Git hooks or single-host automation.

The file

We split this skill into the rules it gives an agent

10 rules. About 0 are common, 8 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈8

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use one hook module per purpose unless the host APIs are so different that separate modules are simpler.

    line 26
  2. Distinctive:

    Keep shared logic host-neutral.

    line 27
  3. Distinctive:

    Put host-specific branches in named adapter functions on the hook class.

    line 28
  4. Very specific:

    Put lifecycle binding metadata on the hook class itself.

    line 30
  5. Distinctive:

    Put an explicit host selector in every generated or development command.

    line 31
  6. Distinctive:

    Read stdin for lifecycle payload data, but not as the primary source of host identity when the installed config already knows the host.

    line 32
  7. Distinctive:

    Use environment variables only for host-provided paths or data roots, including the narrowly permitted shared-registration signal.

    line 33
  8. Distinctive:

    Add golden tests for each host binding and output shape, including minimal-env and env-noise cases.

    line 34
  9. Distinctive:

    When changing an existing hook, update all registration paths that install that hook for the supported hosts.

    line 36
  10. Very specific:

    Read references/cross-host-hook-scaffold.md before designing or editing a cross-host hook, then locate and inspect the live base …

    line 40

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md
<!-- BEGIN BLUEPRINT INTERFACES -->

Generated from blueprint.yaml. Do not edit this block by hand.

Used Interfaces: none

<!-- END BLUEPRINT INTERFACES -->

Core rule

Design hooks by separating:

  1. Purpose — the semantic action the hook performs.
  2. Binding — the host lifecycle event that invokes that purpose.
  3. Adapter — the host-specific stdin parsing, output schema, and exit behavior.

Unrelated ambient environment variables must never select output shape. Generated and development registrations must select the host explicitly. When hosts necessarily share one static plugin registration, its compatibility adapter may instead use one isolated host-owned registration signal, with an explicit fallback and golden tests for each host case.

Workflow

  1. Name the shared purpose first, before choosing event names. Examples: inject session context, summarize after stop, persist transcript metadata, block unsafe command.
  2. Map that purpose to each host lifecycle separately. Do not assume the same event exists or means the same thing across hosts.
  3. Use one hook module per purpose unless the host APIs are so different that separate modules are simpler.
  4. Keep shared logic host-neutral. Shared logic returns semantic data, not host-shaped JSON.
  5. Put host-specific branches in named adapter functions on the hook class.
  6. Inspect the repository's live cross-host base abstraction and reuse its standard parse/build/emit lifecycle when the hook fits it. Bypass it only when the hook contract materially differs.
  7. Put lifecycle binding metadata on the hook class itself. Shared fields like event and matcher may be overridden by per-host event and matcher fields.
  8. Put an explicit host selector in every generated or development command; the user should not type it manually. Apply the shared-static-registration exception from the core rule only when the host cannot provide distinct registrations.
  9. Read stdin for lifecycle payload data, but not as the primary source of host identity when the installed config already knows the host.
  10. Use environment variables only for host-provided paths or data roots, including the narrowly permitted shared-registration signal. Unrelated variables must not change output format.
  11. Add golden tests for each host binding and output shape, including minimal-env and env-noise cases; when the shared-registration exception applies, test each host signal and the documented fallback.
  12. Register each installable hook in the repository's canonical hook registry so installers can install every managed hook automatically.
  13. When changing an existing hook, update all registration paths that install that hook for the supported hosts.

Scaffold reference

Read references/cross-host-hook-scaffold.md before designing or editing a cross-host hook, then locate and inspect the live base abstraction, registry, installers, host contracts, and tests rather than assuming their paths or APIs.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.