New skill that creates or improves an apm hook, instruction or prompt. Its SKILL.md holds the shared procedure (dispatch on primitive, boundary gate, create-or-improve, factory-audit close); one self-contained reference per primitive carries its gate, checklist and template, drawn from the microsoft-apm research docs and ADR-0029. forge gains a route row sending a hook, instruction or prompt to primitive-author through author-routes.md, and no longer lists hooks as unroutable. factory-audit's description adds the primitive-author boundary now that the target resolves. Fixes #94 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KkT7RSDwDbmrM9T34b6sTi
3.6 KiB
3.6 KiB
name, description, allowed-tools, metadata
| name | description | allowed-tools | metadata | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| primitive-author | Use when the user wants an apm hook, instruction or prompt file created, or audit findings or feedback applied to an existing one. Not skills -> skill-author. Not agents -> agent-author. | Bash Read Write Edit |
|
Gotchas
apm compile --validateis not a gate. apm turns every instruction and prompt problem into a warning and exits 0, andapm installnever validates at all —/factory-auditis the only check that fails.- Never draft with the real suffix outside
.apm/<type>/. apm's local discovery globs**/*.instructions.mdacross the whole tree, so a draft or template named that way anywhere in the repo compiles intoAGENTS.md. The templates carry a trailing.templatefor this reason; drop it only on the final path. - Never hand-write
.claude/settings.json, even to test a hook. apm owns that file (ADR-0019), overwrites it outright when it is malformed, andapm audit --cifails on anything it would not have written.
Step 1 — Dispatch
| Target or intent | Primitive | Reference |
|---|---|---|
A hook — .apm/hooks/<name>.json, or "run X whenever Y happens" |
hook | references/hook.md |
An instruction — .apm/instructions/<name>.instructions.md, or a rule for files matching a pattern |
instruction | references/instruction.md |
A prompt — .apm/prompts/<name>.prompt.md, or a reusable message the user types to kick off work |
prompt | references/prompt.md |
| A skill or an agent | — | stop: route to skill-author or agent-author |
Read only the reference matching the resolved primitive — each is self-contained. If the target sits inside a git worktree, capture rtk git log --oneline -1 before touching the filesystem; Step 4 needs it.
Step 2 — Boundary gate
Run the reference's Gate section before writing anything. A failed gate stops this skill: name the owner it points to — skill-author for procedure, agentsmd-author for a repo-only rule, apm-workflow for reach or targets: — and hand over. Never bend the artifact to pass the gate.
Step 3 — Create or improve
| Condition | Action |
|---|---|
| No file at the target path | Create: copy the reference's template from assets/templates/, drop .template, fill every FILL IN, and apply the reference's checklist |
| File exists, at least one signal | Improve: read the whole file, then apply each signal against the reference's checklist |
| File exists, no signal | Stop and ask whether the user meant a new file or has feedback to apply |
Signals: grill output, /factory-audit findings, inline feedback, session context describing what went wrong. Group findings by root cause and fix the cause once.
Step 4 — Validate and close
- Run
/factory-auditon the file, inline in this context; resolve every FAIL before reporting done. - Run
rtk apm install --dry-runfrom the repo root and read what each target will receive. On a feature branch, discardapm.lock.yamlchurn afterwards (rtk git checkout -- apm.lock.yaml). - Bump the owning package's
apm.ymlversion:— minor for a new primitive, patch for a fix — unless this branch already bumped it for unreleased work. A primitive has no version of its own. - Commit verification. Inside a git worktree, once the audit is clean, run
rtk git addandrtk git commit, then re-runrtk git log --oneline -1and confirm the hash changed from Step 1's. Staged-but-uncommitted work is silently lost if the tree is cleaned up. Outside a worktree, report done on a clean audit and name that as the reason.