Compare commits
24
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
30fb33fc52 | ||
|
|
3407f787a3 | ||
|
|
ad0067e9ad | ||
|
|
09f4093c3b | ||
|
|
8381c9f395 | ||
|
|
e9df1ca0da | ||
|
|
6a3fd48fbd | ||
|
|
59e0f3a3b8 | ||
|
|
3b3b3028f8 | ||
|
|
f5a260e85c | ||
|
|
7707992a1d | ||
|
|
b4499fd024 | ||
|
|
a92320a189 | ||
|
|
68fa2abb62 | ||
|
|
d576695bb9 | ||
|
|
6328816584 | ||
|
|
c52e351954 | ||
|
|
529ed31cef | ||
|
|
17d67fbfa9 | ||
|
|
18fbdbc8e4 | ||
|
|
c2c56ff948 | ||
|
|
3ff0741857 | ||
|
|
8c583b5fd5 | ||
|
|
cacfa1b374 |
No files matched your search
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "holocron",
|
||||
"description": "AI development skills for Claude Code, and for GitHub Copilot through apm — factory, design, implement, review, and cross-cutting workflows.",
|
||||
"version": "0.5.1",
|
||||
"version": "0.6.1",
|
||||
"owner": {
|
||||
"name": "Defame1297",
|
||||
"email": "[email protected]",
|
||||
@@ -11,14 +11,14 @@
|
||||
{
|
||||
"name": "kyberforge",
|
||||
"description": "Skills and agents for creating, maintaining, and managing an apm plugin marketplace for Claude Code and GitHub Copilot.",
|
||||
"version": "2.0.1",
|
||||
"version": "2.2.1",
|
||||
"category": "Developer Tools",
|
||||
"source": "./plugins/kyberforge"
|
||||
},
|
||||
{
|
||||
"name": "bin",
|
||||
"description": "Skills for everyday AI-assisted development work that is not tied to a single tool, forge or language, and has not yet been split into a focused plugin.",
|
||||
"version": "1.1.9",
|
||||
"version": "2.0.0",
|
||||
"category": "Utilities",
|
||||
"source": "./plugins/bin"
|
||||
},
|
||||
@@ -50,6 +50,13 @@
|
||||
"category": "Productivity",
|
||||
"source": "./plugins/core"
|
||||
},
|
||||
{
|
||||
"name": "mattpocock",
|
||||
"description": "Matt Pocock's agent skills — planning, grilling, test-first development, triage and bug diagnosis — redistributed from upstream at a pinned release.",
|
||||
"version": "0.2.0",
|
||||
"category": "Productivity",
|
||||
"source": "./plugins/mattpocock"
|
||||
},
|
||||
{
|
||||
"name": "lint",
|
||||
"description": "Skills and agents for configuring and running linters.",
|
||||
|
||||
+17
-34
@@ -27,41 +27,24 @@ repos:
|
||||
stages: ['pre-commit']
|
||||
- id: pretty-format-json
|
||||
stages: ['pre-commit']
|
||||
args: [--autofix]
|
||||
# Every generated manifest lives at a KNOWN path, so every alternative is
|
||||
# root-anchored and spells that path out. This was five `(^|/)`
|
||||
# any-depth alternatives plus one `^` root-only one -- a mixture with no
|
||||
# rationale, under which a fixture or vendored tree containing
|
||||
# `.../.claude-plugin/marketplace.json` would have been silently excluded
|
||||
# from formatting while an equivalent
|
||||
# `.../.agents/plugins/marketplace.json` would not. Only the one root
|
||||
# marketplace manifest matches now; anything else is hand-authored and
|
||||
# gets formatted. The twelve per-plugin `plugin.json` alternatives were
|
||||
# dropped with the plugin manifests themselves when native
|
||||
# `claude plugin install` support was removed (ADR-0024) -- apm probes
|
||||
# `apm.yml` and never reached them. The `.agents/plugins/` and
|
||||
# `.github/plugin/` marketplace mirrors went the same way, and their
|
||||
# alternations went with them: `check-useless-excludes` fails on a
|
||||
# pattern that matches no file.
|
||||
args: [--autofix, --no-sort-keys]
|
||||
# `--no-sort-keys` is load-bearing. apm OWNS `.claude/settings.json` and its
|
||||
# `.claude/apm-hooks.json` sidecar (ADR-0018, ADR-0019), and
|
||||
# `apm audit --ci` replays the install and diffs the result byte-for-byte.
|
||||
# apm emits insertion order (`matcher` before `hooks`); the formatter's
|
||||
# default sorts keys, rewrites that into a form apm would never produce,
|
||||
# and the `apm-audit-ci` pre-push hook then reports drift on a file with
|
||||
# no git diff (#102, first hit at 2e395a4). Keeping insertion order means
|
||||
# those two files need no exclude. Dropping the flag is caught at pre-push
|
||||
# by `apm-audit-ci` as drift on `.claude/settings.json`.
|
||||
#
|
||||
# `.claude/settings.json` and its `.claude/apm-hooks.json` ownership
|
||||
# sidecar are the last two alternations, and they are the only ones
|
||||
# here for a reason other than "generated manifest":
|
||||
# apm OWNS that file (ADR-0018, ADR-0019), and
|
||||
# `apm audit --ci` replays the install into a scratch tree and diffs
|
||||
# the result byte-for-byte. `pretty-format-json` sorts object keys
|
||||
# unless `--no-sort-keys` is passed, while apm's hook integrator emits
|
||||
# insertion order (`matcher` before `hooks`, `type` before `command`).
|
||||
# Formatting the file therefore rewrites apm's output into a form apm
|
||||
# would never produce, and the `apm-audit-ci` pre-push hook reports it
|
||||
# as permanent drift on a file with no git diff -- exactly what
|
||||
# happened when the SessionStart hook first landed in 2e395a4.
|
||||
# Re-running `apm install` fixes the file; leaving it in scope here
|
||||
# would re-break it on the very commit that carries the fix. The
|
||||
# sidecar is committed so a fresh clone's install can claim the
|
||||
# settings entry instead of duplicating it (ADR-0019, 2026-09-16
|
||||
# correction), and it is apm output under the same byte-for-byte replay.
|
||||
exclude: '^(\.claude-plugin/marketplace\.json|\.claude/(settings|apm-hooks)\.json)$'
|
||||
# `.claude-plugin/marketplace.json` is the one remaining exclude. It
|
||||
# round-trips except for non-ASCII: it carries literal em dashes and the
|
||||
# formatter re-escapes them to `\u2014` (`--no-ensure-ascii` would fix that,
|
||||
# but it changes the output for every JSON file). Root-anchored because it
|
||||
# is one known path; `check-useless-excludes` fails on a pattern that
|
||||
# matches no file.
|
||||
exclude: '^\.claude-plugin/marketplace\.json$'
|
||||
- id: check-yaml
|
||||
stages: ['pre-commit']
|
||||
- id: trailing-whitespace
|
||||
|
||||
+11
-2
@@ -45,11 +45,20 @@ _Avoid_: agent hygiene
|
||||
### Distribution
|
||||
|
||||
**Skill**:
|
||||
A reusable slash command defined as a `SKILL.md` file following the
|
||||
A reusable capability defined as a `SKILL.md` file following the
|
||||
[Agent Skills open standard](https://agentskills.io), authored at
|
||||
`plugins/<plugin>/.apm/skills/<skill>/SKILL.md`.
|
||||
`plugins/<plugin>/.apm/skills/<skill>/SKILL.md`. It is loaded by description-matching, or typed by
|
||||
hand when declared a **Hand-invoked skill**. A single-file command that is not a `SKILL.md` is a
|
||||
**Prompt file**.
|
||||
_Avoid_: command, prompt, macro
|
||||
|
||||
**Prompt file**:
|
||||
An apm primitive authored as a single file at `.apm/prompts/<name>.prompt.md`. apm rewrites it per
|
||||
target: Copilot gets a verbatim copy, the Claude family gets a slash command, and Gemini gets a TOML
|
||||
command. It is not a **Skill**: it has no `SKILL.md`, no `references/` and no description-matching.
|
||||
_Avoid_: bare "prompt" (collides with an agent's system prompt and the `prompts` package type),
|
||||
"command" (the per-target deployed name), "skill"
|
||||
|
||||
**apm package**:
|
||||
The deployable unit apm builds and installs — one or more skills, agents, hooks, commands, and MCP
|
||||
servers under a single directory `plugins/<name>/`, consisting of that directory's `apm.yml` plus
|
||||
|
||||
+1
-1
@@ -128,7 +128,7 @@ Widening a description-opener rule to also catch mid-sentence text looked like a
|
||||
|
||||
## 2026-08-14 — A formatter in the commit path manufactures drift on a file with a clean git diff
|
||||
|
||||
`apm audit --ci` failed on `.claude/settings.json` with an empty `git diff` — `pretty-format-json --autofix` silently re-sorts JSON keys, and this generated file was missing from its exclude list, so every commit re-sorted apm's insertion-ordered output before apm compared against it. Separately, a defect introduced 3 hours earlier on the same branch was first mis-described as "pre-existing," an unverified claim about history. Fix: add tool-owned paths to every autofixing hook's exclude the moment ownership is declared, and verify "pre-existing" claims with `git log -S` or `git branch --contains` before writing them down.
|
||||
`apm audit --ci` failed on `.claude/settings.json` with an empty `git diff` — `pretty-format-json --autofix` silently re-sorts JSON keys, and this generated file was missing from its exclude list, so every commit re-sorted apm's insertion-ordered output before apm compared against it. Separately, a defect introduced 3 hours earlier on the same branch was first mis-described as "pre-existing," an unverified claim about history. Fix: add tool-owned paths to every autofixing hook's exclude the moment ownership is declared (for JSON, superseded by #102: `--no-sort-keys` makes the exclude unnecessary), and verify "pre-existing" claims with `git log -S` or `git branch --contains` before writing them down.
|
||||
|
||||
## 2026-08-16 — A rule reversed inside a retrofit leaves no trace unless someone writes it down (historical)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
name: holocron
|
||||
version: 0.5.1
|
||||
version: 0.6.1
|
||||
description: AI development skills for Claude Code, and for GitHub Copilot through apm — factory, design, implement, review, and cross-cutting workflows.
|
||||
license: MIT
|
||||
|
||||
@@ -61,7 +61,7 @@ dependencies:
|
||||
# an apm mechanic.
|
||||
executables:
|
||||
allow:
|
||||
kyberforge#2.0.1:
|
||||
kyberforge#2.2.1:
|
||||
hooks: true
|
||||
bin: true
|
||||
|
||||
@@ -71,7 +71,7 @@ marketplace:
|
||||
# top-level apm.yml description:/version: above are NOT inherited into the
|
||||
# compiled output despite being used elsewhere (e.g. by `apm audit`).
|
||||
description: AI development skills for Claude Code, and for GitHub Copilot through apm — factory, design, implement, review, and cross-cutting workflows.
|
||||
version: 0.5.1
|
||||
version: 0.6.1
|
||||
owner:
|
||||
name: Defame1297
|
||||
email: [email protected]
|
||||
@@ -117,6 +117,10 @@ marketplace:
|
||||
source: ./plugins/core
|
||||
category: Productivity
|
||||
|
||||
- name: mattpocock
|
||||
source: ./plugins/mattpocock
|
||||
category: Productivity
|
||||
|
||||
- name: lint
|
||||
source: ./plugins/lint
|
||||
category: Developer Tools
|
||||
@@ -0,0 +1,37 @@
|
||||
# A skill pulled from a third-party repo's subpath is a resolvable routing target
|
||||
|
||||
**Status: accepted (2026-11-11).** Extends ADR-0020's target resolution walk; builds on ADR-0026.
|
||||
|
||||
`plugins/mattpocock` redistributes Matt Pocock's skills as `owner/repo/<path>/<skill>#v1.3.2`
|
||||
dependencies and ships no skills of its own. Moving `tdd`, `triage`, `grill-with-docs` and
|
||||
`improve-codebase-architecture` out of `plugins/bin` into it left `diagnose`, `write-docs` and
|
||||
`forge` routing to names that exist nowhere under `plugins/*/.apm/skills`. The corpus-wide backstop in
|
||||
`tests/test-adr0020-targets.sh` ("no skill in the corpus routes to a target that does not resolve")
|
||||
failed with exactly those four, and its message says not to relax it.
|
||||
|
||||
The resolver could not see them for two reasons that compound. Rule 1 of the walk reads skills that
|
||||
are *files under* `plugins/*/`, and these are not. Rule 3 reads a package's declared dependencies
|
||||
from `apm_modules/`, which a plugin package never has (ADR-0026: a plugin package is not an install
|
||||
root). Reading the root manifest instead was already ruled out by the walk, and installing in CI would
|
||||
make the verdict depend on the machine, which is the defect ADR-0020 exists to remove.
|
||||
|
||||
**Decision.** `_collect_package()` in `lib-boundary-resolver.sh` also adds the last path segment of
|
||||
every *string* dependency in the package's `apm.yml` that has at least `owner/repo/<subpath>` after an
|
||||
optional host prefix. It is applied wherever `_collect_package()` already runs, so every plugin in the
|
||||
monorepo contributes the skills it pulls. No network, no `apm_modules/`, same verdict on a fresh
|
||||
clone.
|
||||
|
||||
What it deliberately does not count: a whole-repo dependency such as `code.onedev.io/onedev/tod`
|
||||
(three segments with the host, so it names no skill), SSH and `host:` forms, and dict entries, which
|
||||
are packages and already resolve through the `path:` branch. The name is a convention, not a check:
|
||||
it assumes apm deploys the skill under the subpath's last segment, which it does today (verified on
|
||||
apm 0.28.0 for `wayfinder`), and a rename upstream is caught by the pin, not by this gate.
|
||||
|
||||
**Rejected: rewording the four clauses out of route notation.** Cheap, but it turns real routing
|
||||
checks into SUGGESTIONs for exactly the skills most likely to be renamed upstream.
|
||||
|
||||
**Consequence worth knowing.** Resolving a target is not the same as being able to call it. Upstream
|
||||
marks `grill-me`, `grill-with-docs`, `triage` and `improve-codebase-architecture` hand-invoked, so a
|
||||
`Call` step in another skill (`forge` Step 1) is blocked by the host. `forge`'s existing "grill inline
|
||||
if it does not resolve" fallback now always runs. The gate does not model this; ADR-0020's
|
||||
hand-invoked exemption covers the routing *rules*, not callability.
|
||||
+19
-16
@@ -283,7 +283,9 @@ monorepo root further up.
|
||||
The universe is then:
|
||||
|
||||
1. every skill and agent under `<root>/plugins/*/` — sibling plugins resolve, which is what a
|
||||
monorepo means;
|
||||
monorepo means — plus the skills each plugin's `apm.yml` pulls from a subpath of a third-party
|
||||
repo (`owner/repo/<path>/<skill>#ref` gives `<skill>`; a whole-repo dependency gives nothing;
|
||||
ADR-0029);
|
||||
2. the checked file's own apm package;
|
||||
3. the packages that package declares in **its own** `apm.yml` `dependencies.apm`.
|
||||
|
||||
@@ -1279,24 +1281,25 @@ point only). Machine-specific settings go in the gitignored `.claude/settings.lo
|
||||
does not deploy and the replay does not compare; shared enforcement belongs in
|
||||
`.pre-commit-config.yaml`.
|
||||
|
||||
### Why it is excluded from `pretty-format-json`
|
||||
|
||||
It is in the **second and last alternation** in that hook's `exclude:` pattern, and that alternation
|
||||
is the only one there for a reason other than "generated manifest". Mind which number you are
|
||||
quoting: the pattern is `^(\.claude-plugin/marketplace\.json|\.claude/(settings|apm-hooks)\.json)$`
|
||||
— **two top-level alternations, expanding to three real tracked files**:
|
||||
`.claude-plugin/marketplace.json`, this one, and its committed `.claude/apm-hooks.json` sidecar,
|
||||
which is apm output under the same byte-for-byte replay and is excluded for the same reason.
|
||||
### Why `pretty-format-json` runs with `--no-sort-keys`
|
||||
|
||||
`pretty-format-json --autofix` sorts object keys unless `--no-sort-keys` is passed, while apm's hook
|
||||
integrator emits insertion order (`matcher` before `hooks`, `type` before `command`). Leaving the
|
||||
file in that hook's scope therefore rewrites apm's output into a form apm would never produce on the
|
||||
way into **every** commit, and `apm-audit-ci` then reports permanent drift on a file with an empty
|
||||
`git diff` — exactly what happened when the `SessionStart` hook first landed in `2e395a4`. Re-running
|
||||
`apm install` fixes the file; leaving it in scope would re-break it on the very commit carrying the
|
||||
fix.
|
||||
integrator emits insertion order (`matcher` before `hooks`, `type` before `command`). In scope with
|
||||
the default, the formatter rewrites apm's output into a form apm would never produce on the way into
|
||||
**every** commit, and `apm-audit-ci` then reports permanent drift on a file with an empty `git diff`
|
||||
— exactly what happened when the `SessionStart` hook first landed in `2e395a4` (#102).
|
||||
|
||||
**Load-bearing. Do not tidy it out of that list** (see `LESSONS.md`, 2026-08-14).
|
||||
The hook now passes `--no-sort-keys`, so this file and its committed `.claude/apm-hooks.json` sidecar
|
||||
(apm output under the same byte-for-byte replay) need **no exclude**: the formatter's default 2-space
|
||||
indent already matches apm's, and with insertion order kept they round-trip untouched. No dedicated
|
||||
test pins this: dropping `--no-sort-keys` surfaces at pre-push as `apm-audit-ci` drift on
|
||||
`.claude/settings.json`, which is the same gate that caught the original failure.
|
||||
|
||||
**Load-bearing. Do not remove `--no-sort-keys`.** `.claude-plugin/marketplace.json` is the one path
|
||||
still in that hook's `exclude:`: it carries literal em dashes that the formatter re-escapes to
|
||||
`\u2014`, which `--no-ensure-ascii` would stop but for every JSON file. This closes the JSON case
|
||||
only; a new tool-owned file in the scope of another autofixer is still caught only by `apm-audit-ci`
|
||||
drift after the fact, not by a derived gate.
|
||||
|
||||
## Pushing without a network
|
||||
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
---
|
||||
name: grill-me
|
||||
description: >
|
||||
Use when the user says "grill me" or wants a plan or design stress-tested by
|
||||
relentless interview — one question at a time, down each branch of the
|
||||
decision tree. Not a plan to challenge against `CONTEXT.md` and ADRs ->
|
||||
`grill-with-docs`.
|
||||
metadata:
|
||||
version: "1.0.1"
|
||||
---
|
||||
|
||||
Interview me relentlessly about every aspect of this plan until we reach a shared understanding. Walk down each branch of the design tree, resolving dependencies between decisions one-by-one. For each question, provide your recommended answer.
|
||||
|
||||
Ask the questions one at a time.
|
||||
|
||||
If a question can be answered by exploring the codebase, explore the codebase instead.
|
||||
@@ -1,93 +0,0 @@
|
||||
---
|
||||
name: grill-with-docs
|
||||
description: >
|
||||
Use when a plan should be stress-tested against the project's domain model —
|
||||
the interview challenges terms against `CONTEXT.md` and writes decisions into
|
||||
it and into ADRs as they land. Not a plain interview -> `grill-me`.
|
||||
metadata:
|
||||
version: "1.0.1"
|
||||
---
|
||||
|
||||
<what-to-do>
|
||||
|
||||
Interview me relentlessly about every aspect of this plan until we reach a shared understanding. Walk down each branch of the design tree, resolving dependencies between decisions one-by-one. For each question, provide your recommended answer.
|
||||
|
||||
Ask the questions one at a time, waiting for feedback on each question before continuing.
|
||||
|
||||
If a question can be answered by exploring the codebase, explore the codebase instead.
|
||||
|
||||
</what-to-do>
|
||||
|
||||
<supporting-info>
|
||||
|
||||
## Domain awareness
|
||||
|
||||
During codebase exploration, also look for existing documentation:
|
||||
|
||||
### File structure
|
||||
|
||||
Most repos have a single context:
|
||||
|
||||
```
|
||||
/
|
||||
├── CONTEXT.md
|
||||
├── docs/
|
||||
│ └── adr/
|
||||
│ ├── 0001-event-sourced-orders.md
|
||||
│ └── 0002-postgres-for-write-model.md
|
||||
└── src/
|
||||
```
|
||||
|
||||
If a `CONTEXT-MAP.md` exists at the root, the repo has multiple contexts. The map points to where each one lives:
|
||||
|
||||
```
|
||||
/
|
||||
├── CONTEXT-MAP.md
|
||||
├── docs/
|
||||
│ └── adr/ ← system-wide decisions
|
||||
├── src/
|
||||
│ ├── ordering/
|
||||
│ │ ├── CONTEXT.md
|
||||
│ │ └── docs/adr/ ← context-specific decisions
|
||||
│ └── billing/
|
||||
│ ├── CONTEXT.md
|
||||
│ └── docs/adr/
|
||||
```
|
||||
|
||||
Create files lazily — only when you have something to write. If no `CONTEXT.md` exists, create one when the first term is resolved. If no `docs/adr/` exists, create it when the first ADR is needed.
|
||||
|
||||
## During the session
|
||||
|
||||
### Challenge against the glossary
|
||||
|
||||
When the user uses a term that conflicts with the existing language in `CONTEXT.md`, call it out immediately. "Your glossary defines 'cancellation' as X, but you seem to mean Y — which is it?"
|
||||
|
||||
### Sharpen fuzzy language
|
||||
|
||||
When the user uses vague or overloaded terms, propose a precise canonical term. "You're saying 'account' — do you mean the Customer or the User? Those are different things."
|
||||
|
||||
### Discuss concrete scenarios
|
||||
|
||||
When domain relationships are being discussed, stress-test them with specific scenarios. Invent scenarios that probe edge cases and force the user to be precise about the boundaries between concepts.
|
||||
|
||||
### Cross-reference with code
|
||||
|
||||
When the user states how something works, check whether the code agrees. If you find a contradiction, surface it: "Your code cancels entire Orders, but you just said partial cancellation is possible — which is right?"
|
||||
|
||||
### Update CONTEXT.md inline
|
||||
|
||||
When a term is resolved, update `CONTEXT.md` right there. Don't batch these up — capture them as they happen. Use the format in [context-format.md](references/context-format.md).
|
||||
|
||||
Don't couple `CONTEXT.md` to implementation details. Only include terms that are meaningful to domain experts.
|
||||
|
||||
### Offer ADRs sparingly
|
||||
|
||||
Only offer to create an ADR when all three are true:
|
||||
|
||||
1. **Hard to reverse** — the cost of changing your mind later is meaningful
|
||||
2. **Surprising without context** — a future reader will wonder "why did they do it this way?"
|
||||
3. **The result of a real trade-off** — there were genuine alternatives and you picked one for specific reasons
|
||||
|
||||
If any of the three is missing, skip the ADR. Use the format in [adr-format.md](references/adr-format.md).
|
||||
|
||||
</supporting-info>
|
||||
@@ -1,47 +0,0 @@
|
||||
# ADR Format
|
||||
|
||||
ADRs live in `docs/adr/` and use sequential numbering: `0001-slug.md`, `0002-slug.md`, etc.
|
||||
|
||||
Create the `docs/adr/` directory lazily — only when the first ADR is needed.
|
||||
|
||||
## Template
|
||||
|
||||
```md
|
||||
# {Short title of the decision}
|
||||
|
||||
{1-3 sentences: what's the context, what did we decide, and why.}
|
||||
```
|
||||
|
||||
That's it. An ADR can be a single paragraph. The value is in recording *that* a decision was made and *why* — not in filling out sections.
|
||||
|
||||
## Optional sections
|
||||
|
||||
Only include these when they add genuine value. Most ADRs won't need them.
|
||||
|
||||
- **Status** frontmatter (`proposed | accepted | deprecated | superseded by ADR-NNNN`) — useful when decisions are revisited
|
||||
- **Considered Options** — only when the rejected alternatives are worth remembering
|
||||
- **Consequences** — only when non-obvious downstream effects need to be called out
|
||||
|
||||
## Numbering
|
||||
|
||||
Scan `docs/adr/` for the highest existing number and increment by one.
|
||||
|
||||
## When to offer an ADR
|
||||
|
||||
All three of these must be true:
|
||||
|
||||
1. **Hard to reverse** — the cost of changing your mind later is meaningful
|
||||
2. **Surprising without context** — a future reader will look at the code and wonder "why on earth did they do it this way?"
|
||||
3. **The result of a real trade-off** — there were genuine alternatives and you picked one for specific reasons
|
||||
|
||||
If a decision is easy to reverse, skip it — you'll just reverse it. If it's not surprising, nobody will wonder why. If there was no real alternative, there's nothing to record beyond "we did the obvious thing."
|
||||
|
||||
### What qualifies
|
||||
|
||||
- **Architectural shape.** "We're using a monorepo." "The write model is event-sourced, the read model is projected into Postgres."
|
||||
- **Integration patterns between contexts.** "Ordering and Billing communicate via domain events, not synchronous HTTP."
|
||||
- **Technology choices that carry lock-in.** Database, message bus, auth provider, deployment target. Not every library — just the ones that would take a quarter to swap out.
|
||||
- **Boundary and scope decisions.** "Customer data is owned by the Customer context; other contexts reference it by ID only." The explicit no-s are as valuable as the yes-s.
|
||||
- **Deliberate deviations from the obvious path.** "We're using manual SQL instead of an ORM because X." Anything where a reasonable reader would assume the opposite. These stop the next engineer from "fixing" something that was deliberate.
|
||||
- **Constraints not visible in the code.** "We can't use AWS because of compliance requirements." "Response times must be under 200ms because of the partner API contract."
|
||||
- **Rejected alternatives when the rejection is non-obvious.** If you considered GraphQL and picked REST for subtle reasons, record it — otherwise someone will suggest GraphQL again in six months.
|
||||
@@ -1,77 +0,0 @@
|
||||
# CONTEXT.md Format
|
||||
|
||||
## Structure
|
||||
|
||||
```md
|
||||
# {Context Name}
|
||||
|
||||
{One or two sentence description of what this context is and why it exists.}
|
||||
|
||||
## Language
|
||||
|
||||
**Order**:
|
||||
{A concise description of the term}
|
||||
_Avoid_: Purchase, transaction
|
||||
|
||||
**Invoice**:
|
||||
A request for payment sent to a customer after delivery.
|
||||
_Avoid_: Bill, payment request
|
||||
|
||||
**Customer**:
|
||||
A person or organization that places orders.
|
||||
_Avoid_: Client, buyer, account
|
||||
|
||||
## Relationships
|
||||
|
||||
- An **Order** produces one or more **Invoices**
|
||||
- An **Invoice** belongs to exactly one **Customer**
|
||||
|
||||
## Example dialogue
|
||||
|
||||
> **Dev:** "When a **Customer** places an **Order**, do we create the **Invoice** immediately?"
|
||||
> **Domain expert:** "No — an **Invoice** is only generated once a **Fulfillment** is confirmed."
|
||||
|
||||
## Flagged ambiguities
|
||||
|
||||
- "account" was used to mean both **Customer** and **User** — resolved: these are distinct concepts.
|
||||
```
|
||||
|
||||
## Rules
|
||||
|
||||
- **Be opinionated.** When multiple words exist for the same concept, pick the best one and list the others as aliases to avoid.
|
||||
- **Flag conflicts explicitly.** If a term is used ambiguously, call it out in "Flagged ambiguities" with a clear resolution.
|
||||
- **Keep definitions tight.** One sentence max. Define what it IS, not what it does.
|
||||
- **Show relationships.** Use bold term names and express cardinality where obvious.
|
||||
- **Only include terms specific to this project's context.** General programming concepts (timeouts, error types, utility patterns) don't belong even if the project uses them extensively. Before adding a term, ask: is this a concept unique to this context, or a general programming concept? Only the former belongs.
|
||||
- **Group terms under subheadings** when natural clusters emerge. If all terms belong to a single cohesive area, a flat list is fine.
|
||||
- **Write an example dialogue.** A conversation between a dev and a domain expert that demonstrates how the terms interact naturally and clarifies boundaries between related concepts.
|
||||
|
||||
## Single vs multi-context repos
|
||||
|
||||
**Single context (most repos):** One `CONTEXT.md` at the repo root.
|
||||
|
||||
**Multiple contexts:** A `CONTEXT-MAP.md` at the repo root lists the contexts, where they live, and how they relate to each other:
|
||||
|
||||
```md
|
||||
# Context Map
|
||||
|
||||
## Contexts
|
||||
|
||||
- [Ordering](./src/ordering/CONTEXT.md) — receives and tracks customer orders
|
||||
- [Billing](./src/billing/CONTEXT.md) — generates invoices and processes payments
|
||||
- [Fulfillment](./src/fulfillment/CONTEXT.md) — manages warehouse picking and shipping
|
||||
|
||||
## Relationships
|
||||
|
||||
- **Ordering → Fulfillment**: Ordering emits `OrderPlaced` events; Fulfillment consumes them to start picking
|
||||
- **Fulfillment → Billing**: Fulfillment emits `ShipmentDispatched` events; Billing consumes them to generate invoices
|
||||
- **Ordering ↔ Billing**: Shared types for `CustomerId` and `Money`
|
||||
```
|
||||
|
||||
The skill infers which structure applies:
|
||||
|
||||
- If `CONTEXT-MAP.md` exists, read it to find contexts
|
||||
- If only a root `CONTEXT.md` exists, single context
|
||||
- If neither exists, create a root `CONTEXT.md` lazily when the first term is resolved
|
||||
|
||||
When multiple contexts exist, infer which one the current topic relates to. If unclear, ask.
|
||||
@@ -1,80 +0,0 @@
|
||||
---
|
||||
name: improve-codebase-architecture
|
||||
description: >
|
||||
Use when the user wants to improve architecture, find refactoring
|
||||
opportunities, consolidate tightly-coupled modules, or make a codebase more
|
||||
testable and AI-navigable — deepening opportunities that turn shallow modules
|
||||
into deep ones, informed by `CONTEXT.md` and `docs/adr/`. Not debugging a
|
||||
failure -> `diagnose`.
|
||||
metadata:
|
||||
version: "1.0.1"
|
||||
---
|
||||
|
||||
# Improve Codebase Architecture
|
||||
|
||||
Surface architectural friction and propose **deepening opportunities** — refactors that turn shallow modules into deep ones. The aim is testability and AI-navigability.
|
||||
|
||||
## Glossary
|
||||
|
||||
Use these terms exactly in every suggestion. Consistent language is the point — don't drift into "component," "service," "API," or "boundary."
|
||||
|
||||
- **Module** — anything with an interface and an implementation (function, class, package, slice).
|
||||
- **Interface** — everything a caller must know to use the module: types, invariants, error modes, ordering, config. Not just the type signature.
|
||||
- **Implementation** — the code inside.
|
||||
- **Depth** — leverage at the interface: a lot of behaviour behind a small interface. **Deep** = high leverage. **Shallow** = interface nearly as complex as the implementation.
|
||||
- **Seam** — where an interface lives; a place behaviour can be altered without editing in place. (Use this, not "boundary.")
|
||||
- **Adapter** — a concrete thing satisfying an interface at a seam.
|
||||
- **Leverage** — what callers get from depth.
|
||||
- **Locality** — what maintainers get from depth: change, bugs, knowledge concentrated in one place.
|
||||
|
||||
Key principles:
|
||||
|
||||
- **Deletion test**: imagine deleting the module. If complexity vanishes, it was a pass-through. If complexity reappears across N callers, it was earning its keep.
|
||||
- **The interface is the test surface.**
|
||||
- **One adapter = hypothetical seam. Two adapters = real seam.**
|
||||
|
||||
If a term or principle above is ambiguous in the case in front of you, or you need the definitions and the principles the two lists leave out, read `references/language.md`.
|
||||
|
||||
This skill is _informed_ by the project's domain model. The domain language gives names to good seams; ADRs record decisions the skill should not re-litigate.
|
||||
|
||||
## Process
|
||||
|
||||
### 1. Explore
|
||||
|
||||
Read the domain glossary and any ADRs in the area first.
|
||||
|
||||
Then use the Agent tool with `subagent_type=Explore` to walk the codebase. Don't follow rigid heuristics — explore organically and note where you experience friction:
|
||||
|
||||
- Where does understanding one concept require bouncing between many small modules?
|
||||
- Where are modules **shallow** — interface nearly as complex as the implementation?
|
||||
- Where have pure functions been extracted just for testability, but the real bugs hide in how they're called (no **locality**)?
|
||||
- Where do tightly-coupled modules leak across their seams?
|
||||
- Which parts of the codebase are untested, or hard to test through their current interface?
|
||||
|
||||
Apply the **deletion test** to anything you suspect is shallow: would deleting it concentrate complexity, or just move it? A "yes, concentrates" is the signal you want.
|
||||
|
||||
### 2. Present candidates
|
||||
|
||||
Present a numbered list of deepening opportunities. For each candidate:
|
||||
|
||||
- **Files** — which files/modules are involved
|
||||
- **Problem** — why the current architecture is causing friction
|
||||
- **Solution** — plain English description of what would change
|
||||
- **Benefits** — explained in terms of locality and leverage, and also in how tests would improve
|
||||
|
||||
**Use CONTEXT.md vocabulary for the domain, and the architecture glossary above for the architecture.** If `CONTEXT.md` defines "Order," talk about "the Order intake module" — not "the FooBarHandler," and not "the Order service."
|
||||
|
||||
**ADR conflicts**: if a candidate contradicts an existing ADR, only surface it when the friction is real enough to warrant revisiting the ADR. Mark it clearly (e.g. _"contradicts ADR-0007 — but worth reopening because…"_). Don't list every theoretical refactor an ADR forbids.
|
||||
|
||||
Do NOT propose interfaces yet. Ask the user: "Which of these would you like to explore?"
|
||||
|
||||
### 3. Grilling loop
|
||||
|
||||
Once the user picks a candidate, drop into a grilling conversation. Walk the design tree with them — constraints, dependencies, the shape of the deepened module, what sits behind the seam, what tests survive.
|
||||
|
||||
Side effects happen inline as decisions crystallize:
|
||||
|
||||
- **Naming a deepened module after a concept not in `CONTEXT.md`?** Add the term to `CONTEXT.md` — same discipline as `grill-with-docs`, in the format `grill-with-docs`'s `references/context-format.md` defines. Create the file lazily if it doesn't exist.
|
||||
- **Sharpening a fuzzy term during the conversation?** Update `CONTEXT.md` right there.
|
||||
- **User rejects the candidate with a load-bearing reason?** Offer an ADR, framed as: _"Want me to record this as an ADR so future architecture reviews don't re-suggest it?"_ Only offer when the reason would actually be needed by a future explorer to avoid re-suggesting the same thing — skip ephemeral reasons ("not worth it right now") and self-evident ones. See `grill-with-docs`'s `references/adr-format.md`.
|
||||
- **Want to explore alternative interfaces for the deepened module?** Read `references/interface-design.md`.
|
||||
@@ -1,37 +0,0 @@
|
||||
# Deepening
|
||||
|
||||
How to deepen a cluster of shallow modules safely, given its dependencies. Assumes the vocabulary in [language.md](language.md) — **module**, **interface**, **seam**, **adapter**.
|
||||
|
||||
## Dependency categories
|
||||
|
||||
When assessing a candidate for deepening, classify its dependencies. The category determines how the deepened module is tested across its seam.
|
||||
|
||||
### 1. In-process
|
||||
|
||||
Pure computation, in-memory state, no I/O. Always deepenable — merge the modules and test through the new interface directly. No adapter needed.
|
||||
|
||||
### 2. Local-substitutable
|
||||
|
||||
Dependencies that have local test stand-ins (PGLite for Postgres, in-memory filesystem). Deepenable if the stand-in exists. The deepened module is tested with the stand-in running in the test suite. The seam is internal; no port at the module's external interface.
|
||||
|
||||
### 3. Remote but owned (Ports & Adapters)
|
||||
|
||||
Your own services across a network boundary (microservices, internal APIs). Define a **port** (interface) at the seam. The deep module owns the logic; the transport is injected as an **adapter**. Tests use an in-memory adapter. Production uses an HTTP/gRPC/queue adapter.
|
||||
|
||||
Recommendation shape: *"Define a port at the seam, implement an HTTP adapter for production and an in-memory adapter for testing, so the logic sits in one deep module even though it's deployed across a network."*
|
||||
|
||||
### 4. True external (Mock)
|
||||
|
||||
Third-party services (Stripe, Twilio, etc.) you don't control. The deepened module takes the external dependency as an injected port; tests provide a mock adapter.
|
||||
|
||||
## Seam discipline
|
||||
|
||||
- **One adapter means a hypothetical seam. Two adapters means a real one.** Don't introduce a port unless at least two adapters are justified (typically production + test). A single-adapter seam is just indirection.
|
||||
- **Internal seams vs external seams.** A deep module can have internal seams (private to its implementation, used by its own tests) as well as the external seam at its interface. Don't expose internal seams through the interface just because tests use them.
|
||||
|
||||
## Testing strategy: replace, don't layer
|
||||
|
||||
- Old unit tests on shallow modules become waste once tests at the deepened module's interface exist — delete them.
|
||||
- Write new tests at the deepened module's interface. The **interface is the test surface**.
|
||||
- Tests assert on observable outcomes through the interface, not internal state.
|
||||
- Tests should survive internal refactors — they describe behaviour, not implementation. If a test has to change when the implementation changes, it's testing past the interface.
|
||||
@@ -1,44 +0,0 @@
|
||||
# Interface Design
|
||||
|
||||
When the user wants to explore alternative interfaces for a chosen deepening candidate, use this parallel sub-agent pattern. Based on "Design It Twice" (Ousterhout) — your first idea is unlikely to be the best.
|
||||
|
||||
Uses the vocabulary in [language.md](language.md) — **module**, **interface**, **seam**, **adapter**, **leverage**.
|
||||
|
||||
## Process
|
||||
|
||||
### 1. Frame the problem space
|
||||
|
||||
Before spawning sub-agents, write a user-facing explanation of the problem space for the chosen candidate:
|
||||
|
||||
- The constraints any new interface would need to satisfy
|
||||
- The dependencies it would rely on, and which category they fall into (see [deepening.md](deepening.md))
|
||||
- A rough illustrative code sketch to ground the constraints — not a proposal, just a way to make the constraints concrete
|
||||
|
||||
Show this to the user, then immediately proceed to Step 2. The user reads and thinks while the sub-agents work in parallel.
|
||||
|
||||
### 2. Spawn sub-agents
|
||||
|
||||
Spawn 3+ sub-agents in parallel using the Agent tool. Each must produce a **radically different** interface for the deepened module.
|
||||
|
||||
Prompt each sub-agent with a separate technical brief (file paths, coupling details, dependency category from [deepening.md](deepening.md), what sits behind the seam). The brief is independent of the user-facing problem-space explanation in Step 1. Give each agent a different design constraint:
|
||||
|
||||
- Agent 1: "Minimize the interface — aim for 1–3 entry points max. Maximise leverage per entry point."
|
||||
- Agent 2: "Maximise flexibility — support many use cases and extension."
|
||||
- Agent 3: "Optimise for the most common caller — make the default case trivial."
|
||||
- Agent 4 (if applicable): "Design around ports & adapters for cross-seam dependencies."
|
||||
|
||||
Include both [language.md](language.md) vocabulary and CONTEXT.md vocabulary in the brief so each sub-agent names things consistently with the architecture language and the project's domain language.
|
||||
|
||||
Each sub-agent outputs:
|
||||
|
||||
1. Interface (types, methods, params — plus invariants, ordering, error modes)
|
||||
2. Usage example showing how callers use it
|
||||
3. What the implementation hides behind the seam
|
||||
4. Dependency strategy and adapters (see [deepening.md](deepening.md))
|
||||
5. Trade-offs — where leverage is high, where it's thin
|
||||
|
||||
### 3. Present and compare
|
||||
|
||||
Present designs sequentially so the user can absorb each one, then compare them in prose. Contrast by **depth** (leverage at the interface), **locality** (where change concentrates), and **seam placement**.
|
||||
|
||||
After comparing, give your own recommendation: which design you think is strongest and why. If elements from different designs would combine well, propose a hybrid. Be opinionated — the user wants a strong read, not a menu.
|
||||
@@ -1,53 +0,0 @@
|
||||
# Language
|
||||
|
||||
Shared vocabulary for every suggestion this skill makes. Use these terms exactly — don't substitute "component," "service," "API," or "boundary." Consistent language is the whole point.
|
||||
|
||||
## Terms
|
||||
|
||||
**Module**
|
||||
Anything with an interface and an implementation. Deliberately scale-agnostic — applies equally to a function, class, package, or tier-spanning slice.
|
||||
_Avoid_: unit, component, service.
|
||||
|
||||
**Interface**
|
||||
Everything a caller must know to use the module correctly. Includes the type signature, but also invariants, ordering constraints, error modes, required configuration, and performance characteristics.
|
||||
_Avoid_: API, signature (too narrow — those refer only to the type-level surface).
|
||||
|
||||
**Implementation**
|
||||
What's inside a module — its body of code. Distinct from **Adapter**: a thing can be a small adapter with a large implementation (a Postgres repo) or a large adapter with a small implementation (an in-memory fake). Reach for "adapter" when the seam is the topic; "implementation" otherwise.
|
||||
|
||||
**Depth**
|
||||
Leverage at the interface — the amount of behaviour a caller (or test) can exercise per unit of interface they have to learn. A module is **deep** when a large amount of behaviour sits behind a small interface. A module is **shallow** when the interface is nearly as complex as the implementation.
|
||||
|
||||
**Seam** _(from Michael Feathers)_
|
||||
A place where you can alter behaviour without editing in that place. The *location* at which a module's interface lives. Choosing where to put the seam is its own design decision, distinct from what goes behind it.
|
||||
_Avoid_: boundary (overloaded with DDD's bounded context).
|
||||
|
||||
**Adapter**
|
||||
A concrete thing that satisfies an interface at a seam. Describes *role* (what slot it fills), not substance (what's inside).
|
||||
|
||||
**Leverage**
|
||||
What callers get from depth. More capability per unit of interface they have to learn. One implementation pays back across N call sites and M tests.
|
||||
|
||||
**Locality**
|
||||
What maintainers get from depth. Change, bugs, knowledge, and verification concentrate at one place rather than spreading across callers. Fix once, fixed everywhere.
|
||||
|
||||
## Principles
|
||||
|
||||
- **Depth is a property of the interface, not the implementation.** A deep module can be internally composed of small, mockable, swappable parts — they just aren't part of the interface. A module can have **internal seams** (private to its implementation, used by its own tests) as well as the **external seam** at its interface.
|
||||
- **The deletion test.** Imagine deleting the module. If complexity vanishes, the module wasn't hiding anything (it was a pass-through). If complexity reappears across N callers, the module was earning its keep.
|
||||
- **The interface is the test surface.** Callers and tests cross the same seam. If you want to test *past* the interface, the module is probably the wrong shape.
|
||||
- **One adapter means a hypothetical seam. Two adapters means a real one.** Don't introduce a seam unless something actually varies across it.
|
||||
|
||||
## Relationships
|
||||
|
||||
- A **Module** has exactly one **Interface** (the surface it presents to callers and tests).
|
||||
- **Depth** is a property of a **Module**, measured against its **Interface**.
|
||||
- A **Seam** is where a **Module**'s **Interface** lives.
|
||||
- An **Adapter** sits at a **Seam** and satisfies the **Interface**.
|
||||
- **Depth** produces **Leverage** for callers and **Locality** for maintainers.
|
||||
|
||||
## Rejected framings
|
||||
|
||||
- **Depth as ratio of implementation-lines to interface-lines** (Ousterhout): rewards padding the implementation. We use depth-as-leverage instead.
|
||||
- **"Interface" as the TypeScript `interface` keyword or a class's public methods**: too narrow — interface here includes every fact a caller must know.
|
||||
- **"Boundary"**: overloaded with DDD's bounded context. Say **seam** or **interface**.
|
||||
@@ -1,38 +0,0 @@
|
||||
---
|
||||
name: prototype
|
||||
description: >
|
||||
Use when the user wants a throwaway prototype to answer a design question about
|
||||
a data model, state machine or business logic, or to mock up a UI in several
|
||||
variations. Not production code -> `tdd`. Not talking a design through ->
|
||||
`grill-me`.
|
||||
metadata:
|
||||
version: "1.0.1"
|
||||
---
|
||||
|
||||
# Prototype
|
||||
|
||||
A prototype is **throwaway code that answers a question**. The question decides the shape.
|
||||
|
||||
## Pick a branch
|
||||
|
||||
| Question being answered | Build | Reference |
|
||||
|---|---|---|
|
||||
| "Does this logic / state model feel right?" | A tiny interactive terminal app that pushes the state machine through cases that are hard to reason about on paper | `references/logic.md` |
|
||||
| "What should this look like?" | Several radically different UI variations on one route, switchable via a URL search param and a floating bottom bar | `references/ui.md` |
|
||||
|
||||
Resolve the row from the user's prompt, the surrounding code, or by asking if the user is around, then read only that reference — each is self-contained.
|
||||
|
||||
The two branches produce fundamentally different artifacts — getting this wrong wastes the whole prototype. If the question is genuinely ambiguous and the user isn't reachable, default to whichever branch better matches the surrounding code (a backend module → logic; a page or component → UI) and state the assumption at the top of the prototype.
|
||||
|
||||
## Rules that apply to both
|
||||
|
||||
1. **Throwaway from day one, and clearly marked as such.** Locate the prototype code close to where it will actually be used (next to the module or page it's prototyping for) so context is obvious — but name it so a casual reader can see it's a prototype, not production. For throwaway UI routes, obey whatever routing convention the project already uses; don't invent a new top-level structure.
|
||||
2. **One command to run.** Whatever the project's existing task runner supports — `pnpm <name>`, `python <path>`, `bun <path>`, etc. The user must be able to start it without thinking.
|
||||
3. **No persistence by default.** State lives in memory. Persistence is the thing the prototype is *checking*, not something it should depend on. If the question explicitly involves a database, hit a scratch DB or a local file with a clear "PROTOTYPE — wipe me" name.
|
||||
4. **Skip the polish.** No tests, no error handling beyond what makes the prototype *runnable*, no abstractions. The point is to learn something fast and then delete it.
|
||||
5. **Surface the state.** After every action (logic) or on every variant switch (UI), print or render the full relevant state so the user can see what changed.
|
||||
6. **Delete or absorb when done.** When the prototype has answered its question, either delete it or fold the validated decision into the real code — don't leave it rotting in the repo.
|
||||
|
||||
## When done
|
||||
|
||||
The *answer* is the only thing worth keeping from a prototype. Capture it somewhere durable (commit message, ADR, issue, or a `NOTES.md` next to the prototype) along with the question it was answering. If the user is around, that capture is a quick conversation; if not, leave the placeholder so they (or you, on the next pass) can fill in the verdict before deleting the prototype.
|
||||
@@ -1,79 +0,0 @@
|
||||
# Logic Prototype
|
||||
|
||||
A tiny interactive terminal app that lets the user drive a state model by hand. Use this when the question is about **business logic, state transitions, or data shape** — the kind of thing that looks reasonable on paper but only feels wrong once you push it through real cases.
|
||||
|
||||
## When this is the right shape
|
||||
|
||||
- "I'm not sure if this state machine handles the edge case where X then Y."
|
||||
- "Does this data model actually let me represent the case where..."
|
||||
- "I want to feel out what the API should look like before writing it."
|
||||
- Anything where the user wants to **press buttons and watch state change**.
|
||||
|
||||
If the question is "what should this look like" — wrong branch. Read `references/ui.md`.
|
||||
|
||||
## Process
|
||||
|
||||
### 1. State the question
|
||||
|
||||
Before writing code, write down what state model and what question you're prototyping. One paragraph, in the prototype's README or a comment at the top of the file. A logic prototype that answers the wrong question is pure waste — make the question explicit so it can be checked later, whether the user is watching now or returning to it AFK.
|
||||
|
||||
### 2. Pick the language
|
||||
|
||||
Use whatever the host project uses. If the project has no obvious runtime (e.g. a docs repo), ask.
|
||||
|
||||
Match the project's existing conventions for tooling — don't add a new package manager or runtime just for the prototype.
|
||||
|
||||
### 3. Isolate the logic in a portable module
|
||||
|
||||
Put the actual logic — the bit that's answering the question — behind a small, pure interface that could be lifted out and dropped into the real codebase later. The TUI around it is throwaway; the logic module shouldn't be.
|
||||
|
||||
The right shape depends on the question:
|
||||
|
||||
- **A pure reducer** — `(state, action) => state`. Good when actions are discrete events and state is a single value.
|
||||
- **A state machine** — explicit states and transitions. Good when "which actions are even legal right now" is part of the question.
|
||||
- **A small set of pure functions** over a plain data type. Good when there's no implicit current state — just transformations.
|
||||
- **A class or module with a clear method surface** when the logic genuinely owns ongoing internal state.
|
||||
|
||||
Pick whichever shape best fits the question being asked, *not* whichever is easiest to wire to a TUI. Keep it pure: no I/O, no terminal code, no `console.log` for control flow. The TUI imports it and calls into it; nothing flows the other direction.
|
||||
|
||||
This is what makes the prototype useful past its own lifetime. When the question's been answered, the validated reducer / machine / function set can be lifted into the real module — the TUI shell gets deleted.
|
||||
|
||||
### 4. Build the smallest TUI that exposes the state
|
||||
|
||||
Build it as a **lightweight TUI** — on every tick, clear the screen (`console.clear()` / `print("\033[2J\033[H")` / equivalent) and re-render the whole frame. The user should always see one stable view, not an ever-growing scrollback.
|
||||
|
||||
Each frame has two parts, in this order:
|
||||
|
||||
1. **Current state**, pretty-printed and diff-friendly (one field per line, or formatted JSON). Use **bold** for field names or section headers and **dim** for less important context (timestamps, IDs, derived values). Native ANSI escape codes are fine — `\x1b[1m` bold, `\x1b[2m` dim, `\x1b[0m` reset. No need to pull in a styling library unless one is already in the project.
|
||||
2. **Keyboard shortcuts**, listed at the bottom: `[a] add user [d] delete user [t] tick clock [q] quit`. Bold the key, dim the description, or vice-versa — whatever reads cleanly.
|
||||
|
||||
Behaviour:
|
||||
|
||||
1. **Initialise state** — a single in-memory object/struct. Render the first frame on start.
|
||||
2. **Read one keystroke (or one line)** at a time, dispatch to a handler that mutates state.
|
||||
3. **Re-render** the full frame after every action — don't append, replace.
|
||||
4. **Loop until quit.**
|
||||
|
||||
The whole frame should fit on one screen.
|
||||
|
||||
### 5. Make it runnable in one command
|
||||
|
||||
Add a script to the project's existing task runner (`package.json` scripts, `Makefile`, `justfile`, `pyproject.toml`). The user should run `pnpm run <prototype-name>` or equivalent — never need to remember a path.
|
||||
|
||||
If the host project has no task runner, just put the command at the top of the prototype's README.
|
||||
|
||||
### 6. Hand it over
|
||||
|
||||
Give the user the run command. They'll drive it themselves; the interesting moments are when they say "wait, that shouldn't be possible" or "huh, I assumed X would be different" — those are the bugs in the _idea_, which is the whole point. If they want new actions added, add them. Prototypes evolve.
|
||||
|
||||
### 7. Capture the answer
|
||||
|
||||
When the prototype has done its job, the answer to the question is the only thing worth keeping. If the user is around, ask what it taught them. If not, leave a `NOTES.md` next to the prototype so the answer can be filled in (or filled in by you, if you've watched the session) before the prototype gets deleted.
|
||||
|
||||
## Anti-patterns
|
||||
|
||||
- **Don't add tests.** A prototype that needs tests is no longer a prototype.
|
||||
- **Don't wire it to the real database.** Use an in-memory store unless the question is specifically about persistence.
|
||||
- **Don't generalise.** No "what if we wanted to support X later." The prototype answers one question.
|
||||
- **Don't blur the logic and the TUI together.** If the reducer / state machine references `console.log`, prompts, or terminal escape codes, it's no longer portable. Keep the TUI as a thin shell over a pure module.
|
||||
- **Don't ship the TUI shell into production.** The shell is optimised for being driven by hand from a terminal. The logic module behind it is the bit worth keeping.
|
||||
@@ -1,112 +0,0 @@
|
||||
# UI Prototype
|
||||
|
||||
Generate **several radically different UI variations** on a single route, switchable from a floating bottom bar. The user flips between variants in the browser, picks one (or steals bits from each), then throws the rest away.
|
||||
|
||||
If the question is about logic/state rather than what something looks like — wrong branch. Read `references/logic.md`.
|
||||
|
||||
## When this is the right shape
|
||||
|
||||
- "What should this page look like?"
|
||||
- "I want to see a few options for this dashboard before committing."
|
||||
- "Try a different layout for the settings screen."
|
||||
- Any time the user would otherwise spend a day picking between three vague mockups in their head.
|
||||
|
||||
## Two sub-shapes — strongly prefer sub-shape A
|
||||
|
||||
A UI prototype is much easier to judge when it's **butting up against the rest of the app** — real header, real sidebar, real data, real density. A throwaway route on its own is a vacuum: every variant looks fine in isolation. Default to sub-shape A whenever there's a plausible existing page to host the variants. Only reach for sub-shape B if the prototype genuinely has no nearby home.
|
||||
|
||||
### Sub-shape A — adjustment to an existing page (preferred)
|
||||
|
||||
The route already exists. Variants are rendered **on the same route**, gated by a `?variant=` URL search param. The existing data fetching, params, and auth all stay — only the rendering swaps. This is the default; pick it unless there's a specific reason not to.
|
||||
|
||||
If the prototype is for something that doesn't yet have a page but *would naturally live inside one* (a new section of the dashboard, a new card on the settings screen, a new step in an existing flow) — that's still sub-shape A. Mount the variants inside the host page.
|
||||
|
||||
### Sub-shape B — a new page (last resort)
|
||||
|
||||
Only use this when the thing being prototyped genuinely has no existing page to live inside — e.g. an entirely new top-level surface, or a flow that can't be embedded anywhere sensible.
|
||||
|
||||
Create a **throwaway route** following whatever routing convention the project already uses — don't invent a new top-level structure. Name it so it's obviously a prototype (e.g. include the word `prototype` in the path or filename). Same `?variant=` pattern.
|
||||
|
||||
Before committing to sub-shape B, sanity-check: is there really no existing page this could be embedded in? An empty route hides design problems that a populated one would expose.
|
||||
|
||||
In both sub-shapes the floating bottom bar is identical.
|
||||
|
||||
## Process
|
||||
|
||||
### 1. State the question and pick N
|
||||
|
||||
Default to **3 variants**. More than 5 stops being radically different and starts being noise — cap there.
|
||||
|
||||
Write down the plan in one line, in the prototype's location or a top-of-file comment:
|
||||
|
||||
> "Three variants of the settings page, switchable via `?variant=`, on the existing `/settings` route."
|
||||
|
||||
This works whether the user is here to push back or not.
|
||||
|
||||
### 2. Generate radically different variants
|
||||
|
||||
Draft each variant. Hold each one to:
|
||||
|
||||
- The page's purpose and the data it has access to.
|
||||
- The project's component library / styling system (TailwindCSS, shadcn, MUI, plain CSS, whatever).
|
||||
- A clear exported component name, e.g. `VariantA`, `VariantB`, `VariantC`.
|
||||
|
||||
Variants must be **structurally different** — different layout, different information hierarchy, different primary affordance, not just different colours. Three slightly-tweaked card grids isn't a UI prototype, it's wallpaper. If two drafts come out too similar, redo one with explicit "do not use a card grid" guidance.
|
||||
|
||||
### 3. Wire them together
|
||||
|
||||
Create a single switcher component on the route:
|
||||
|
||||
```tsx
|
||||
// pseudo-code — adapt to the project's framework
|
||||
const variant = searchParams.get('variant') ?? 'A';
|
||||
return (
|
||||
<>
|
||||
{variant === 'A' && <VariantA {...data} />}
|
||||
{variant === 'B' && <VariantB {...data} />}
|
||||
{variant === 'C' && <VariantC {...data} />}
|
||||
<PrototypeSwitcher variants={['A','B','C']} current={variant} />
|
||||
</>
|
||||
);
|
||||
```
|
||||
|
||||
For sub-shape A (existing page): keep all the existing data fetching above the switcher; only the rendered subtree changes per variant.
|
||||
|
||||
For sub-shape B (new page): the throwaway route under `/prototype/<name>` mounts the same switcher.
|
||||
|
||||
### 4. Build the floating switcher
|
||||
|
||||
A small fixed-position bar at the bottom-centre of the screen with three pieces:
|
||||
|
||||
- **Left arrow** — cycles to the previous variant (wraps around).
|
||||
- **Variant label** — shows the current variant key and, if the variant exports a name, that name too. e.g. `B — Sidebar layout`.
|
||||
- **Right arrow** — cycles forward (wraps around).
|
||||
|
||||
Behaviour:
|
||||
|
||||
- Clicking an arrow updates the URL search param (use the framework's router — `router.replace` on Next, `navigate` on React Router, etc) so the variant is shareable and reload-stable.
|
||||
- Keyboard: `←` and `→` arrow keys also cycle. Don't intercept arrow keys when an `<input>`, `<textarea>`, or `[contenteditable]` is focused.
|
||||
- Visually distinct from the page (e.g. high-contrast pill, subtle shadow) so it's obviously not part of the design being evaluated.
|
||||
- Hidden in production builds — gate on `process.env.NODE_ENV !== 'production'` or an equivalent check, so a stray prototype merge can't ship the bar to users.
|
||||
|
||||
Put the switcher in a single shared component so both sub-shapes can reuse it. Locate it wherever shared UI lives in the project.
|
||||
|
||||
### 5. Hand it over
|
||||
|
||||
Surface the URL (and the `?variant=` keys). The user will flip through whenever they get to it. The interesting feedback is usually **"I want the header from B with the sidebar from C"** — that's the actual design they want.
|
||||
|
||||
### 6. Capture the answer and clean up
|
||||
|
||||
Once a variant has won, write down which one and why (commit message, ADR, issue, or a `NOTES.md` next to the prototype if running AFK and the user hasn't responded yet). Then:
|
||||
|
||||
- **Sub-shape A** — delete the losing variants and the switcher; fold the winner into the existing page.
|
||||
- **Sub-shape B** — promote the winning variant to a real route, delete the throwaway route and the switcher.
|
||||
|
||||
Don't leave variant components or the switcher lying around. They rot fast and confuse the next reader.
|
||||
|
||||
## Anti-patterns
|
||||
|
||||
- **Variants that differ only in colour or copy.** That's a tweak, not a prototype. Real variants disagree about structure.
|
||||
- **Sharing too much code between variants.** A shared `<Header>` is fine; a shared `<Layout>` defeats the point. Each variant should be free to throw out the layout.
|
||||
- **Wiring variants to real mutations.** Read-only prototypes are fine. If a variant needs to mutate, point it at a stub — the question is "what should this look like", not "does the backend work".
|
||||
- **Promoting the prototype directly to production.** The variant code was written under prototype constraints (no tests, minimal error handling). Rewrite it properly when you fold it in.
|
||||
@@ -1,114 +0,0 @@
|
||||
---
|
||||
name: tdd
|
||||
description: >
|
||||
Use when the user wants a feature built or a bug fixed test-first, in a strict
|
||||
red-green-refactor loop, one behaviour at a time. Not diagnosing an existing
|
||||
bug -> `diagnose`. Not throwaway exploratory code -> `prototype`.
|
||||
metadata:
|
||||
version: "1.0.1"
|
||||
---
|
||||
|
||||
# Test-Driven Development
|
||||
|
||||
## Philosophy
|
||||
|
||||
**Core principle**: Tests should verify behavior through public interfaces, not implementation details. Code can change entirely; tests shouldn't.
|
||||
|
||||
**Good tests** are integration-style: they exercise real code paths through public APIs. They describe _what_ the system does, not _how_ it does it. A good test reads like a specification - "user can checkout with valid cart" tells you exactly what capability exists. These tests survive refactors because they don't care about internal structure.
|
||||
|
||||
**Bad tests** are coupled to implementation. They mock internal collaborators, test private methods, or verify through external means (like querying a database directly instead of using the interface). The warning sign: your test breaks when you refactor, but behavior hasn't changed. If you rename an internal function and tests fail, those tests were testing implementation, not behavior.
|
||||
|
||||
If you need worked examples of the difference — a behaviour-level test beside the implementation-coupled version of the same check — read `references/tests.md`. If a test needs a collaborator faked, read `references/mocking.md` before reaching for a mock.
|
||||
|
||||
## Anti-Pattern: Horizontal Slices
|
||||
|
||||
**DO NOT write all tests first, then all implementation.** This is "horizontal slicing" - treating RED as "write all tests" and GREEN as "write all code."
|
||||
|
||||
This produces **crap tests**:
|
||||
|
||||
- Tests written in bulk test _imagined_ behavior, not _actual_ behavior
|
||||
- You end up testing the _shape_ of things (data structures, function signatures) rather than user-facing behavior
|
||||
- Tests become insensitive to real changes - they pass when behavior breaks, fail when behavior is fine
|
||||
- You outrun your headlights, committing to test structure before understanding the implementation
|
||||
|
||||
**Correct approach**: Vertical slices via tracer bullets. One test → one implementation → repeat. Each test responds to what you learned from the previous cycle. Because you just wrote the code, you know exactly what behavior matters and how to verify it.
|
||||
|
||||
```
|
||||
WRONG (horizontal):
|
||||
RED: test1, test2, test3, test4, test5
|
||||
GREEN: impl1, impl2, impl3, impl4, impl5
|
||||
|
||||
RIGHT (vertical):
|
||||
RED→GREEN: test1→impl1
|
||||
RED→GREEN: test2→impl2
|
||||
RED→GREEN: test3→impl3
|
||||
...
|
||||
```
|
||||
|
||||
## Workflow
|
||||
|
||||
### 1. Planning
|
||||
|
||||
When exploring the codebase, use the domain glossary so test names and interface vocabulary match the project's language, and respect ADRs in the area.
|
||||
|
||||
Before writing any code:
|
||||
|
||||
- [ ] Confirm with user what interface changes are needed
|
||||
- [ ] Confirm with user which behaviors to test (prioritize)
|
||||
- [ ] Identify opportunities for [deep modules](references/deep-modules.md) (small interface, deep implementation)
|
||||
- [ ] Design interfaces for [testability](references/interface-design.md)
|
||||
- [ ] List the behaviors to test (not implementation steps)
|
||||
- [ ] Get user approval on the plan
|
||||
|
||||
Ask: "What should the public interface look like? Which behaviors are most important to test?"
|
||||
|
||||
**You can't test everything.** Confirm with the user exactly which behaviors matter most. Focus testing effort on critical paths and complex logic, not every possible edge case.
|
||||
|
||||
### 2. Tracer Bullet
|
||||
|
||||
Write ONE test that confirms ONE thing about the system:
|
||||
|
||||
```
|
||||
RED: Write test for first behavior → test fails
|
||||
GREEN: Write minimal code to pass → test passes
|
||||
```
|
||||
|
||||
This is your tracer bullet - proves the path works end-to-end.
|
||||
|
||||
### 3. Incremental Loop
|
||||
|
||||
For each remaining behavior:
|
||||
|
||||
```
|
||||
RED: Write next test → fails
|
||||
GREEN: Minimal code to pass → passes
|
||||
```
|
||||
|
||||
Rules:
|
||||
|
||||
- One test at a time
|
||||
- Only enough code to pass current test
|
||||
- Don't anticipate future tests
|
||||
- Keep tests focused on observable behavior
|
||||
|
||||
### 4. Refactor
|
||||
|
||||
After all tests pass, look for [refactor candidates](references/refactoring.md):
|
||||
|
||||
- [ ] Extract duplication
|
||||
- [ ] Deepen modules (move complexity behind simple interfaces)
|
||||
- [ ] Apply SOLID principles where natural
|
||||
- [ ] Consider what new code reveals about existing code
|
||||
- [ ] Run tests after each refactor step
|
||||
|
||||
**Never refactor while RED.** Get to GREEN first.
|
||||
|
||||
## Checklist Per Cycle
|
||||
|
||||
```
|
||||
[ ] Test describes behavior, not implementation
|
||||
[ ] Test uses public interface only
|
||||
[ ] Test would survive internal refactor
|
||||
[ ] Code is minimal for this test
|
||||
[ ] No speculative features added
|
||||
```
|
||||
@@ -1,33 +0,0 @@
|
||||
# Deep Modules
|
||||
|
||||
From "A Philosophy of Software Design":
|
||||
|
||||
**Deep module** = small interface + lots of implementation
|
||||
|
||||
```
|
||||
┌─────────────────────┐
|
||||
│ Small Interface │ ← Few methods, simple params
|
||||
├─────────────────────┤
|
||||
│ │
|
||||
│ │
|
||||
│ Deep Implementation│ ← Complex logic hidden
|
||||
│ │
|
||||
│ │
|
||||
└─────────────────────┘
|
||||
```
|
||||
|
||||
**Shallow module** = large interface + little implementation (avoid)
|
||||
|
||||
```
|
||||
┌─────────────────────────────────┐
|
||||
│ Large Interface │ ← Many methods, complex params
|
||||
├─────────────────────────────────┤
|
||||
│ Thin Implementation │ ← Just passes through
|
||||
└─────────────────────────────────┘
|
||||
```
|
||||
|
||||
When designing interfaces, ask:
|
||||
|
||||
- Can I reduce the number of methods?
|
||||
- Can I simplify the parameters?
|
||||
- Can I hide more complexity inside?
|
||||
@@ -1,31 +0,0 @@
|
||||
# Interface Design for Testability
|
||||
|
||||
Good interfaces make testing natural:
|
||||
|
||||
1. **Accept dependencies, don't create them**
|
||||
|
||||
```typescript
|
||||
// Testable
|
||||
function processOrder(order, paymentGateway) {}
|
||||
|
||||
// Hard to test
|
||||
function processOrder(order) {
|
||||
const gateway = new StripeGateway();
|
||||
}
|
||||
```
|
||||
|
||||
2. **Return results, don't produce side effects**
|
||||
|
||||
```typescript
|
||||
// Testable
|
||||
function calculateDiscount(cart): Discount {}
|
||||
|
||||
// Hard to test
|
||||
function applyDiscount(cart): void {
|
||||
cart.total -= discount;
|
||||
}
|
||||
```
|
||||
|
||||
3. **Small surface area**
|
||||
- Fewer methods = fewer tests needed
|
||||
- Fewer params = simpler test setup
|
||||
@@ -1,59 +0,0 @@
|
||||
# When to Mock
|
||||
|
||||
Mock at **system boundaries** only:
|
||||
|
||||
- External APIs (payment, email, etc.)
|
||||
- Databases (sometimes - prefer test DB)
|
||||
- Time/randomness
|
||||
- File system (sometimes)
|
||||
|
||||
Don't mock:
|
||||
|
||||
- Your own classes/modules
|
||||
- Internal collaborators
|
||||
- Anything you control
|
||||
|
||||
## Designing for Mockability
|
||||
|
||||
At system boundaries, design interfaces that are easy to mock:
|
||||
|
||||
**1. Use dependency injection**
|
||||
|
||||
Pass external dependencies in rather than creating them internally:
|
||||
|
||||
```typescript
|
||||
// Easy to mock
|
||||
function processPayment(order, paymentClient) {
|
||||
return paymentClient.charge(order.total);
|
||||
}
|
||||
|
||||
// Hard to mock
|
||||
function processPayment(order) {
|
||||
const client = new StripeClient(process.env.STRIPE_KEY);
|
||||
return client.charge(order.total);
|
||||
}
|
||||
```
|
||||
|
||||
**2. Prefer SDK-style interfaces over generic fetchers**
|
||||
|
||||
Create specific functions for each external operation instead of one generic function with conditional logic:
|
||||
|
||||
```typescript
|
||||
// GOOD: Each function is independently mockable
|
||||
const api = {
|
||||
getUser: (id) => fetch(`/users/${id}`),
|
||||
getOrders: (userId) => fetch(`/users/${userId}/orders`),
|
||||
createOrder: (data) => fetch('/orders', { method: 'POST', body: data }),
|
||||
};
|
||||
|
||||
// BAD: Mocking requires conditional logic inside the mock
|
||||
const api = {
|
||||
fetch: (endpoint, options) => fetch(endpoint, options),
|
||||
};
|
||||
```
|
||||
|
||||
The SDK approach means:
|
||||
- Each mock returns one specific shape
|
||||
- No conditional logic in test setup
|
||||
- Easier to see which endpoints a test exercises
|
||||
- Type safety per endpoint
|
||||
@@ -1,10 +0,0 @@
|
||||
# Refactor Candidates
|
||||
|
||||
After TDD cycle, look for:
|
||||
|
||||
- **Duplication** → Extract function/class
|
||||
- **Long methods** → Break into private helpers (keep tests on public interface)
|
||||
- **Shallow modules** → Combine or deepen
|
||||
- **Feature envy** → Move logic to where data lives
|
||||
- **Primitive obsession** → Introduce value objects
|
||||
- **Existing code** the new code reveals as problematic
|
||||
@@ -1,61 +0,0 @@
|
||||
# Good and Bad Tests
|
||||
|
||||
## Good Tests
|
||||
|
||||
**Integration-style**: Test through real interfaces, not mocks of internal parts.
|
||||
|
||||
```typescript
|
||||
// GOOD: Tests observable behavior
|
||||
test("user can checkout with valid cart", async () => {
|
||||
const cart = createCart();
|
||||
cart.add(product);
|
||||
const result = await checkout(cart, paymentMethod);
|
||||
expect(result.status).toBe("confirmed");
|
||||
});
|
||||
```
|
||||
|
||||
Characteristics:
|
||||
|
||||
- Tests behavior users/callers care about
|
||||
- Uses public API only
|
||||
- Survives internal refactors
|
||||
- Describes WHAT, not HOW
|
||||
- One logical assertion per test
|
||||
|
||||
## Bad Tests
|
||||
|
||||
**Implementation-detail tests**: Coupled to internal structure.
|
||||
|
||||
```typescript
|
||||
// BAD: Tests implementation details
|
||||
test("checkout calls paymentService.process", async () => {
|
||||
const mockPayment = jest.mock(paymentService);
|
||||
await checkout(cart, payment);
|
||||
expect(mockPayment.process).toHaveBeenCalledWith(cart.total);
|
||||
});
|
||||
```
|
||||
|
||||
Red flags:
|
||||
|
||||
- Mocking internal collaborators
|
||||
- Testing private methods
|
||||
- Asserting on call counts/order
|
||||
- Test breaks when refactoring without behavior change
|
||||
- Test name describes HOW not WHAT
|
||||
- Verifying through external means instead of interface
|
||||
|
||||
```typescript
|
||||
// BAD: Bypasses interface to verify
|
||||
test("createUser saves to database", async () => {
|
||||
await createUser({ name: "Alice" });
|
||||
const row = await db.query("SELECT * FROM users WHERE name = ?", ["Alice"]);
|
||||
expect(row).toBeDefined();
|
||||
});
|
||||
|
||||
// GOOD: Verifies through interface
|
||||
test("createUser makes user retrievable", async () => {
|
||||
const user = await createUser({ name: "Alice" });
|
||||
const retrieved = await getUser(user.id);
|
||||
expect(retrieved.name).toBe("Alice");
|
||||
});
|
||||
```
|
||||
@@ -1,108 +0,0 @@
|
||||
---
|
||||
name: triage
|
||||
description: >
|
||||
Use when the user wants an issue created, triaged, or moved through the
|
||||
tracker's triage states, or an issue prepared for an AFK agent. Not debugging
|
||||
the bug itself -> `diagnose`. Not fleshing out a design -> `grill-with-docs`.
|
||||
metadata:
|
||||
version: "1.0.1"
|
||||
---
|
||||
|
||||
# Triage
|
||||
|
||||
Move issues on the project issue tracker through a small state machine of triage roles.
|
||||
|
||||
Every comment or issue posted to the issue tracker during triage **must** start with this disclaimer:
|
||||
|
||||
```
|
||||
> *This was generated by AI during triage.*
|
||||
```
|
||||
|
||||
## Reference docs
|
||||
|
||||
- [agent-brief.md](references/agent-brief.md) — how to write durable agent briefs
|
||||
- [out-of-scope.md](references/out-of-scope.md) — how the `.out-of-scope/` knowledge base works
|
||||
|
||||
## Roles
|
||||
|
||||
Two **category** roles:
|
||||
|
||||
- `bug` — something is broken
|
||||
- `enhancement` — new feature or improvement
|
||||
|
||||
Five **state** roles:
|
||||
|
||||
- `needs-triage` — maintainer needs to evaluate
|
||||
- `needs-info` — waiting on reporter for more information
|
||||
- `ready-for-agent` — fully specified, ready for an AFK agent
|
||||
- `ready-for-human` — needs human implementation
|
||||
- `wontfix` — will not be actioned
|
||||
|
||||
Every triaged issue should carry exactly one category role and one state role. If state roles conflict, flag it and ask the maintainer before doing anything else.
|
||||
|
||||
These are canonical role names — the actual label strings used in the issue tracker may differ. Resolve each canonical name against the tracker's live label set before applying it, using whichever tracker skill this install provides. If a name has no counterpart there, report the gap and ask the maintainer for the mapping — never substitute a guess.
|
||||
|
||||
State transitions: an unlabeled issue normally goes to `needs-triage` first; from there it moves to `needs-info`, `ready-for-agent`, `ready-for-human`, or `wontfix`. `needs-info` returns to `needs-triage` once the reporter replies. The maintainer can override at any time — flag transitions that look unusual and ask before proceeding.
|
||||
|
||||
## Invocation
|
||||
|
||||
The maintainer invokes `/triage` and describes what they want in natural language. Interpret the request and act. Examples:
|
||||
|
||||
- "Show me anything that needs my attention"
|
||||
- "Let's look at #42"
|
||||
- "Move #42 to ready-for-agent"
|
||||
- "What's ready for agents to pick up?"
|
||||
|
||||
## Show what needs attention
|
||||
|
||||
Query the issue tracker and present three buckets, oldest first:
|
||||
|
||||
1. **Unlabeled** — never triaged.
|
||||
2. **`needs-triage`** — evaluation in progress.
|
||||
3. **`needs-info` with reporter activity since the last triage notes** — needs re-evaluation.
|
||||
|
||||
Show counts and a one-line summary per issue. Let the maintainer pick.
|
||||
|
||||
## Triage a specific issue
|
||||
|
||||
1. **Gather context.** Read the full issue (body, comments, labels, reporter, dates). Parse any prior triage notes so you don't re-ask resolved questions. Explore the codebase using the domain glossary, respecting ADRs in the area. Read `.out-of-scope/*.md` and surface any prior rejection that resembles this issue.
|
||||
|
||||
2. **Recommend.** Tell the maintainer your category and state recommendation with reasoning, plus a brief codebase summary relevant to the issue. Wait for direction.
|
||||
|
||||
3. **Reproduce (bugs only).** Before any grilling, attempt reproduction: read the reporter's steps, trace the relevant code, run tests or commands. Report what happened — successful repro with code path, failed repro, or insufficient detail (a strong `needs-info` signal). A confirmed repro makes a much stronger agent brief.
|
||||
|
||||
4. **Grill (if needed).** If the issue needs fleshing out, run a `/grill-with-docs` session.
|
||||
|
||||
5. **Apply the outcome:**
|
||||
- `ready-for-agent` — post an agent brief comment ([agent-brief.md](references/agent-brief.md)).
|
||||
- `ready-for-human` — same structure as an agent brief, but note why it can't be delegated (judgment calls, external access, design decisions, manual testing).
|
||||
- `needs-info` — post triage notes (template below).
|
||||
- `wontfix` (bug) — polite explanation, then close.
|
||||
- `wontfix` (enhancement) — write to `.out-of-scope/`, link to it from a comment, then close ([out-of-scope.md](references/out-of-scope.md)).
|
||||
- `needs-triage` — apply the role. Optional comment if there's partial progress.
|
||||
|
||||
## Quick state override
|
||||
|
||||
If the maintainer says "move #42 to ready-for-agent", trust them and apply the role directly. Confirm what you're about to do (role changes, comment, close), then act. Skip grilling. If moving to `ready-for-agent` without a grilling session, ask whether they want to write an agent brief.
|
||||
|
||||
## Needs-info template
|
||||
|
||||
```markdown
|
||||
## Triage Notes
|
||||
|
||||
**What we've established so far:**
|
||||
|
||||
- point 1
|
||||
- point 2
|
||||
|
||||
**What we still need from you (@reporter):**
|
||||
|
||||
- question 1
|
||||
- question 2
|
||||
```
|
||||
|
||||
Capture everything resolved during grilling under "established so far" so the work isn't lost. Questions must be specific and actionable, not "please provide more info".
|
||||
|
||||
## Resuming a previous session
|
||||
|
||||
If prior triage notes exist on the issue, read them, check whether the reporter has answered any outstanding questions, and present an updated picture before continuing. Don't re-ask resolved questions.
|
||||
@@ -1,168 +0,0 @@
|
||||
# Writing Agent Briefs
|
||||
|
||||
An agent brief is a structured comment posted on an issue in the issue tracker when it moves to `ready-for-agent`. It is the authoritative specification that an AFK agent will work from. The original issue body and discussion are context — the agent brief is the contract.
|
||||
|
||||
## Principles
|
||||
|
||||
### Durability over precision
|
||||
|
||||
The issue may sit in `ready-for-agent` for days or weeks. The codebase will change in the meantime. Write the brief so it stays useful even as files are renamed, moved, or refactored.
|
||||
|
||||
- **Do** describe interfaces, types, and behavioral contracts
|
||||
- **Do** name specific types, function signatures, or config shapes that the agent should look for or modify
|
||||
- **Don't** reference file paths — they go stale
|
||||
- **Don't** reference line numbers
|
||||
- **Don't** assume the current implementation structure will remain the same
|
||||
|
||||
### Behavioral, not procedural
|
||||
|
||||
Describe **what** the system should do, not **how** to implement it. The agent will explore the codebase fresh and make its own implementation decisions.
|
||||
|
||||
- **Good:** "The `SkillConfig` type should accept an optional `schedule` field of type `CronExpression`"
|
||||
- **Bad:** "Open src/types/skill.ts and add a schedule field on line 42"
|
||||
- **Good:** "When a user runs `/triage` with no arguments, they should see a summary of issues needing attention"
|
||||
- **Bad:** "Add a switch statement in the main handler function"
|
||||
|
||||
### Complete acceptance criteria
|
||||
|
||||
The agent needs to know when it's done. Every agent brief must have concrete, testable acceptance criteria. Each criterion should be independently verifiable.
|
||||
|
||||
- **Good:** "Querying the issue tracker for the `needs-triage` label returns issues that have been through initial classification"
|
||||
- **Bad:** "Triage should work correctly"
|
||||
|
||||
### Explicit scope boundaries
|
||||
|
||||
State what is out of scope. This prevents the agent from gold-plating or making assumptions about adjacent features.
|
||||
|
||||
## Template
|
||||
|
||||
```markdown
|
||||
## Agent Brief
|
||||
|
||||
**Category:** bug / enhancement
|
||||
**Summary:** one-line description of what needs to happen
|
||||
|
||||
**Current behavior:**
|
||||
Describe what happens now. For bugs, this is the broken behavior.
|
||||
For enhancements, this is the status quo the feature builds on.
|
||||
|
||||
**Desired behavior:**
|
||||
Describe what should happen after the agent's work is complete.
|
||||
Be specific about edge cases and error conditions.
|
||||
|
||||
**Key interfaces:**
|
||||
- `TypeName` — what needs to change and why
|
||||
- `functionName()` return type — what it currently returns vs what it should return
|
||||
- Config shape — any new configuration options needed
|
||||
|
||||
**Acceptance criteria:**
|
||||
- [ ] Specific, testable criterion 1
|
||||
- [ ] Specific, testable criterion 2
|
||||
- [ ] Specific, testable criterion 3
|
||||
|
||||
**Out of scope:**
|
||||
- Thing that should NOT be changed or addressed in this issue
|
||||
- Adjacent feature that might seem related but is separate
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
### Good agent brief (bug)
|
||||
|
||||
```markdown
|
||||
## Agent Brief
|
||||
|
||||
**Category:** bug
|
||||
**Summary:** Skill description truncation drops mid-word, producing broken output
|
||||
|
||||
**Current behavior:**
|
||||
When a skill description exceeds 1024 characters, it is truncated at exactly
|
||||
1024 characters regardless of word boundaries. This produces descriptions
|
||||
that end mid-word (e.g. "Use when the user wants to confi").
|
||||
|
||||
**Desired behavior:**
|
||||
Truncation should break at the last word boundary before 1024 characters
|
||||
and append "..." to indicate truncation.
|
||||
|
||||
**Key interfaces:**
|
||||
- The `SkillMetadata` type's `description` field — no type change needed,
|
||||
but the validation/processing logic that populates it needs to respect
|
||||
word boundaries
|
||||
- Any function that reads SKILL.md frontmatter and extracts the description
|
||||
|
||||
**Acceptance criteria:**
|
||||
- [ ] Descriptions under 1024 chars are unchanged
|
||||
- [ ] Descriptions over 1024 chars are truncated at the last word boundary
|
||||
before 1024 chars
|
||||
- [ ] Truncated descriptions end with "..."
|
||||
- [ ] The total length including "..." does not exceed 1024 chars
|
||||
|
||||
**Out of scope:**
|
||||
- Changing the 1024 char limit itself
|
||||
- Multi-line description support
|
||||
```
|
||||
|
||||
### Good agent brief (enhancement)
|
||||
|
||||
```markdown
|
||||
## Agent Brief
|
||||
|
||||
**Category:** enhancement
|
||||
**Summary:** Add `.out-of-scope/` directory support for tracking rejected feature requests
|
||||
|
||||
**Current behavior:**
|
||||
When a feature request is rejected, the issue is closed with a `wontfix` label
|
||||
and a comment. There is no persistent record of the decision or reasoning.
|
||||
Future similar requests require the maintainer to recall or search for the
|
||||
prior discussion.
|
||||
|
||||
**Desired behavior:**
|
||||
Rejected feature requests should be documented in `.out-of-scope/<concept>.md`
|
||||
files that capture the decision, reasoning, and links to all issues that
|
||||
requested the feature. When triaging new issues, these files should be
|
||||
checked for matches.
|
||||
|
||||
**Key interfaces:**
|
||||
- Markdown file format in `.out-of-scope/` — each file should have a
|
||||
`# Concept Name` heading, a `**Decision:**` line, a `**Reason:**` line,
|
||||
and a `**Prior requests:**` list with issue links
|
||||
- The triage workflow should read all `.out-of-scope/*.md` files early
|
||||
and match incoming issues against them by concept similarity
|
||||
|
||||
**Acceptance criteria:**
|
||||
- [ ] Closing a feature as wontfix creates/updates a file in `.out-of-scope/`
|
||||
- [ ] The file includes the decision, reasoning, and link to the closed issue
|
||||
- [ ] If a matching `.out-of-scope/` file already exists, the new issue is
|
||||
appended to its "Prior requests" list rather than creating a duplicate
|
||||
- [ ] During triage, existing `.out-of-scope/` files are checked and surfaced
|
||||
when a new issue matches a prior rejection
|
||||
|
||||
**Out of scope:**
|
||||
- Automated matching (human confirms the match)
|
||||
- Reopening previously rejected features
|
||||
- Bug reports (only enhancement rejections go to `.out-of-scope/`)
|
||||
```
|
||||
|
||||
### Bad agent brief
|
||||
|
||||
```markdown
|
||||
## Agent Brief
|
||||
|
||||
**Summary:** Fix the triage bug
|
||||
|
||||
**What to do:**
|
||||
The triage thing is broken. Look at the main file and fix it.
|
||||
The function around line 150 has the issue.
|
||||
|
||||
**Files to change:**
|
||||
- src/triage/handler.ts (line 150)
|
||||
- src/types.ts (line 42)
|
||||
```
|
||||
|
||||
This is bad because:
|
||||
- No category
|
||||
- Vague description ("the triage thing is broken")
|
||||
- References file paths and line numbers that will go stale
|
||||
- No acceptance criteria
|
||||
- No scope boundaries
|
||||
- No description of current vs desired behavior
|
||||
@@ -1,101 +0,0 @@
|
||||
# Out-of-Scope Knowledge Base
|
||||
|
||||
The `.out-of-scope/` directory in a repo stores persistent records of rejected feature requests. It serves two purposes:
|
||||
|
||||
1. **Institutional memory** — why a feature was rejected, so the reasoning isn't lost when the issue is closed
|
||||
2. **Deduplication** — when a new issue comes in that matches a prior rejection, the skill can surface the previous decision instead of re-litigating it
|
||||
|
||||
## Directory structure
|
||||
|
||||
```
|
||||
.out-of-scope/
|
||||
├── dark-mode.md
|
||||
├── plugin-system.md
|
||||
└── graphql-api.md
|
||||
```
|
||||
|
||||
One file per **concept**, not per issue. Multiple issues requesting the same thing are grouped under one file.
|
||||
|
||||
## File format
|
||||
|
||||
The file should be written in a relaxed, readable style — more like a short design document than a database entry. Use paragraphs, code samples, and examples to make the reasoning clear and useful to someone encountering it for the first time.
|
||||
|
||||
```markdown
|
||||
# Dark Mode
|
||||
|
||||
This project does not support dark mode or user-facing theming.
|
||||
|
||||
## Why this is out of scope
|
||||
|
||||
The rendering pipeline assumes a single color palette defined in
|
||||
`ThemeConfig`. Supporting multiple themes would require:
|
||||
|
||||
- A theme context provider wrapping the entire component tree
|
||||
- Per-component theme-aware style resolution
|
||||
- A persistence layer for user theme preferences
|
||||
|
||||
This is a significant architectural change that doesn't align with the
|
||||
project's focus on content authoring. Theming is a concern for downstream
|
||||
consumers who embed or redistribute the output.
|
||||
|
||||
```ts
|
||||
// The current ThemeConfig interface is not designed for runtime switching:
|
||||
interface ThemeConfig {
|
||||
colors: ColorPalette; // single palette, resolved at build time
|
||||
fonts: FontStack;
|
||||
}
|
||||
```
|
||||
|
||||
## Prior requests
|
||||
|
||||
- #42 — "Add dark mode support"
|
||||
- #87 — "Night theme for accessibility"
|
||||
- #134 — "Dark theme option"
|
||||
```
|
||||
|
||||
### Naming the file
|
||||
|
||||
Use a short, descriptive kebab-case name for the concept: `dark-mode.md`, `plugin-system.md`, `graphql-api.md`. The name should be recognizable enough that someone browsing the directory understands what was rejected without opening the file.
|
||||
|
||||
### Writing the reason
|
||||
|
||||
The reason should be substantive — not "we don't want this" but why. Good reasons reference:
|
||||
|
||||
- Project scope or philosophy ("This project focuses on X; theming is a downstream concern")
|
||||
- Technical constraints ("Supporting this would require Y, which conflicts with our Z architecture")
|
||||
- Strategic decisions ("We chose to use A instead of B because...")
|
||||
|
||||
The reason should be durable. Avoid referencing temporary circumstances ("we're too busy right now") — those aren't real rejections, they're deferrals.
|
||||
|
||||
## When to check `.out-of-scope/`
|
||||
|
||||
During triage (Step 1: Gather context), read all files in `.out-of-scope/`. When evaluating a new issue:
|
||||
|
||||
- Check if the request matches an existing out-of-scope concept
|
||||
- Matching is by concept similarity, not keyword — "night theme" matches `dark-mode.md`
|
||||
- If there's a match, surface it to the maintainer: "This is similar to `.out-of-scope/dark-mode.md` — we rejected this before because [reason]. Do you still feel the same way?"
|
||||
|
||||
The maintainer may:
|
||||
|
||||
- **Confirm** — the new issue gets added to the existing file's "Prior requests" list, then closed
|
||||
- **Reconsider** — the out-of-scope file gets deleted or updated, and the issue proceeds through normal triage
|
||||
- **Disagree** — the issues are related but distinct, proceed with normal triage
|
||||
|
||||
## When to write to `.out-of-scope/`
|
||||
|
||||
Only when an **enhancement** (not a bug) is rejected as `wontfix`. The flow:
|
||||
|
||||
1. Maintainer decides a feature request is out of scope
|
||||
2. Check if a matching `.out-of-scope/` file already exists
|
||||
3. If yes: append the new issue to the "Prior requests" list
|
||||
4. If no: create a new file with the concept name, decision, reason, and first prior request
|
||||
5. Post a comment on the issue explaining the decision and mentioning the `.out-of-scope/` file
|
||||
6. Close the issue with the `wontfix` label
|
||||
|
||||
## Updating or removing out-of-scope files
|
||||
|
||||
If the maintainer changes their mind about a previously rejected concept:
|
||||
|
||||
- Delete the `.out-of-scope/` file
|
||||
- The skill does not need to reopen old issues — they're historical records
|
||||
- The new issue that triggered the reconsideration proceeds through normal triage
|
||||
+1
-3
@@ -1,5 +1,5 @@
|
||||
name: bin
|
||||
version: 1.1.9
|
||||
version: 2.0.0
|
||||
description: Skills for everyday AI-assisted development work that is not tied to a single tool, forge or language, and has not yet been split into a focused plugin.
|
||||
author:
|
||||
name: Defame1297
|
||||
@@ -11,8 +11,6 @@ repository: https://git.rkdr.net/Defame1297/holocron/src/branch/main/plugins/bin
|
||||
keywords:
|
||||
- utility
|
||||
- diagnostics
|
||||
- prototyping
|
||||
- tdd
|
||||
- research
|
||||
|
||||
# Constrains what .apm/ may contain: instructions, skill, hybrid, or prompts
|
||||
|
||||
@@ -6,7 +6,7 @@ description: >
|
||||
Not read-only review -> `factory-audit`. Not skills -> `skill-author`.
|
||||
allowed-tools: Bash Read Write Edit
|
||||
metadata:
|
||||
version: "1.0.3"
|
||||
version: "1.0.4"
|
||||
category: factory
|
||||
source_keys:
|
||||
- context7-websites-code-claude
|
||||
@@ -31,7 +31,7 @@ metadata:
|
||||
|
||||
Signals: grill output, `factory-audit` findings, inline feedback, session context describing what went wrong. With none, ask: "No improvement signals found. Did you mean to create a new agent, or do you have feedback to apply?"
|
||||
|
||||
Read only the reference for the resolved flow. Capture `rtk git log --oneline -1` before touching the filesystem; Step 4 needs it.
|
||||
Read only the reference for the resolved flow.
|
||||
|
||||
## Step 2 — Scope
|
||||
|
||||
@@ -61,5 +61,3 @@ At every scope, five tools reach no subagent whatever `tools` says — `AskUserQ
|
||||
Invoke `factory-audit` on each file written and resolve every FAIL before reporting done. It checks the field allowlist, name-to-stem match, leftover placeholders and template comments, the description budget and the Copilot body limit — do not hand-check those.
|
||||
|
||||
At plugin/APM scope bump the resolved package's `apm.yml` `version` — **minor** on create, **patch** on improve — because consumers compare it to detect updates. Project and user scope have no manifest.
|
||||
|
||||
**Commit verification.** Once the audit is clean, run `rtk git add` and `rtk git commit` — do not stop at staging. Re-run `rtk git log --oneline -1` and confirm the hash changed from Step 1's. A non-empty `git diff --stat` is not proof: staged-but-uncommitted work is part of no commit and is lost if the tree is cleaned up. Report done only once the hash has changed.
|
||||
@@ -7,8 +7,8 @@ source_keys:
|
||||
|
||||
# Creating a new agent
|
||||
|
||||
Return to `SKILL.md` Step 4 once Step 3 below is done — validation, the version bump and commit
|
||||
verification are shared with the improve flow and are not repeated here.
|
||||
Return to `SKILL.md` Step 4 once Step 3 below is done — validation and the version bump
|
||||
are shared with the improve flow and are not repeated here.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@ source_keys:
|
||||
|
||||
# Improving an existing agent
|
||||
|
||||
Return to `SKILL.md` Step 4 once Step 4 below is done — validation, the version bump and commit
|
||||
verification are shared with the create flow and are not repeated here.
|
||||
Return to `SKILL.md` Step 4 once Step 4 below is done — validation and the version bump
|
||||
are shared with the create flow and are not repeated here.
|
||||
|
||||
## Step 1 — Verify inputs
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ description: >
|
||||
the dependencies it declares, or an apm marketplace — even when the user does
|
||||
not say "apm". Not the apm binary or an agent runtime -> `apm-install`.
|
||||
metadata:
|
||||
version: "1.0.1"
|
||||
version: "1.0.3"
|
||||
category: apm
|
||||
source_keys:
|
||||
- context7-microsoft-apm
|
||||
|
||||
@@ -12,7 +12,7 @@ apm compile --clean # zero-write sanity check; use for skill/agent-o
|
||||
apm compile --clean --dry-run # pure preview, no writes
|
||||
```
|
||||
|
||||
Compiles `.apm/instructions/` + `.apm/agents/*.agent.md` primitives into consumer-side context files (AGENTS.md/CLAUDE.md CONTEXT files) for the deployment target, per the `compilation:` block in `apm.yml`. This is the consumer/deployment side — it is NOT the producer of `plugin.json`/`marketplace.json`; that's `apm pack`'s job (below). Run `apm compile` after any change to `.apm/instructions/`/`.apm/agents/` content or to `compilation:`/`targets:` in `apm.yml`.
|
||||
Compiles `.apm/instructions/` + `.apm/agents/*.agent.md` primitives into consumer-side context files (AGENTS.md/CLAUDE.md CONTEXT files) for the deployment target, per the `compilation:` block in `apm.yml`. This is the consumer/deployment side — it is NOT the producer of `plugin.json`/`marketplace.json`; that's `apm pack`'s job (below). Run `apm compile` after any change to `.apm/instructions/`/`.apm/agents/` content or to `compilation:`/`targets:` in `apm.yml`. To author an instructions file, use `instructions-author` — it covers which fields each target drops. `apm compile` never reads `.apm/prompts/`; to author a prompt file, use `prompt-author` — verification there is a throwaway `apm install`.
|
||||
|
||||
## Pack
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ description: >
|
||||
fixes -> agent-author.
|
||||
allowed-tools: Bash Read
|
||||
metadata:
|
||||
version: "1.0.5"
|
||||
version: "1.0.6"
|
||||
category: factory
|
||||
source_keys:
|
||||
- agentskills-home
|
||||
|
||||
@@ -114,8 +114,47 @@ def _is_fs_root(path):
|
||||
return os.path.dirname(path) == path
|
||||
|
||||
|
||||
def _virtual_skill_names(pkg_dir):
|
||||
"""Skill names a package's manifest pulls from a SUBDIRECTORY of a git repo.
|
||||
|
||||
An apm dependency written `owner/repo/<path>/<skill>[#ref]` installs one
|
||||
skill out of someone else's repo (plugins/mattpocock does this for Matt
|
||||
Pocock's skills). Nothing of it exists under the monorepo, and the package
|
||||
directory has no apm_modules/ (ADR-0026), so without this the name dangles
|
||||
for every skill that routes to it. The skill's name is the last path
|
||||
segment; apm deploys it under that name. Needs no network and no install,
|
||||
which is what keeps the verdict the same on a fresh clone.
|
||||
|
||||
Only the string form counts. A whole-repo dependency (`host/owner/repo`,
|
||||
e.g. TOD) names no skill, and a dict entry is a package, not a skill: the
|
||||
`path:` branch of _declared_dependency_dirs already resolves those.
|
||||
"""
|
||||
manifest = os.path.join(pkg_dir, 'apm.yml')
|
||||
if not os.path.isfile(manifest):
|
||||
return set()
|
||||
try:
|
||||
data = yaml.safe_load(read_text(manifest)) or {}
|
||||
except Exception:
|
||||
return set()
|
||||
deps = data.get('dependencies') if isinstance(data, dict) else None
|
||||
deps = deps.get('apm') if isinstance(deps, dict) else None
|
||||
if not isinstance(deps, list):
|
||||
return set()
|
||||
found = set()
|
||||
for entry in deps:
|
||||
if not isinstance(entry, str) or ':' in entry or entry.startswith('git@'):
|
||||
continue
|
||||
segments = [seg for seg in re.split(r'[#@]', entry)[0].strip().strip('/').split('/') if seg]
|
||||
if segments and '.' in segments[0]:
|
||||
segments = segments[1:] # a host prefix is not part of owner/repo/path
|
||||
if len(segments) >= 3:
|
||||
found.add(segments[-1].lower())
|
||||
return found
|
||||
|
||||
|
||||
def _collect_package(pkg_dir, names):
|
||||
"""Add every skill/agent name a package directory exposes, any layout."""
|
||||
names.update(_virtual_skill_names(pkg_dir))
|
||||
# glob.escape() the DIRECTORY only. A checkout path containing `[`, `]`,
|
||||
# `*` or `?` — a worktree named `feature[2]`, say — otherwise turns the
|
||||
# whole pattern into a character class that matches nothing, and the
|
||||
|
||||
@@ -1,33 +1,29 @@
|
||||
---
|
||||
name: forge
|
||||
description: >
|
||||
Use when the user wants to build or improve something but has not yet named
|
||||
the artifact type — skill, agent, plugin, or marketplace entry; "not sure if
|
||||
this should be a skill or a plugin", "I have an idea but don't know where it
|
||||
belongs". Routes to the matching author skill. Do not use when the type is
|
||||
already named — invoke `skill-author`, `agent-author` or `apm-workflow`
|
||||
directly.
|
||||
Use when the user wants to build or improve something without naming the
|
||||
artifact type ("not sure if this should be a skill or a plugin"). Not a named
|
||||
skill -> `skill-author`. Not a named agent -> `agent-author`. Not a named
|
||||
plugin -> `apm-workflow`.
|
||||
metadata:
|
||||
version: "1.0.1"
|
||||
version: "1.0.4"
|
||||
category: factory
|
||||
source_keys:
|
||||
- claude-code-subagents-docs
|
||||
- context7-websites-code-claude
|
||||
- agentskills-spec
|
||||
---
|
||||
|
||||
## Gotchas
|
||||
|
||||
- forge is an optional guided entry point, not a gate — `skill-author`, `agent-author`, `factory-audit` and `apm-workflow` all stay directly invokable, and forge never intercepts a direct call to one.
|
||||
- Claude Code's skill-level `context: fork` frontmatter field and the `/fork` subagent command are opposites despite the shared word: `context: fork` isolates (fresh context, no parent access), while `/fork` inherits the full conversation. The route reference each classification loads spends that distinction: `references/author-routes.md` chooses between the two, `references/apm-routes.md` rules the fork out.
|
||||
- forge is an optional guided entry point, not a gate — `skill-author`, `agent-author`, `instructions-author`, `prompt-author`, `factory-audit` and `apm-workflow` all stay directly invokable, and forge never intercepts a direct call to one.
|
||||
|
||||
## Step 1 — Grill the intent
|
||||
|
||||
Call `grill-with-docs` unless a grill session has already run and is available in the context.
|
||||
|
||||
`grill-with-docs` ships in a sibling plugin that kyberforge does not declare as an apm dependency, so it resolves in the authoring monorepo but can be absent where kyberforge is installed alone. If it does not resolve, grill inline yourself rather than skipping the step: what problem the artifact solves, who invokes it and how, what it must refuse, and which existing skill or plugin already owns part of the job. Say which path you took.
|
||||
`grill-with-docs` ships in a sibling plugin kyberforge does not declare as an apm dependency, so it can be absent where kyberforge is installed alone. If it does not resolve, grill inline yourself rather than skipping the step: what problem the artifact solves, who invokes it and how, what it must refuse, and which existing skill or plugin already owns part of the job. Say which path you took.
|
||||
|
||||
Grilling regularly overturns the artifact type assumed at the start, or splits one idea into several artifacts, so it runs before classification rather than confirming it. Run it inline in the current conversation — grilling is interactive and a subagent cannot hold the back-and-forth.
|
||||
Grilling often overturns the assumed artifact type or splits one idea into several, so it runs before classification. Run it inline: a subagent cannot hold the back-and-forth.
|
||||
|
||||
## Step 2 — Classify and dispatch
|
||||
|
||||
@@ -37,12 +33,14 @@ Match the grilled intent against exactly one row — or more than one, if the in
|
||||
|---|---|---|---|
|
||||
| A reusable capability the agent loads inline in the main conversation, triggered by description-matching, free to bundle its own `references/`, `scripts/` or `assets/` | Skill | `skill-author` | `references/author-routes.md` |
|
||||
| A recurring task needs its own reusable definition — dedicated system prompt, tools and description, invokable by name across sessions | Agent / subagent | `agent-author` | `references/author-routes.md` |
|
||||
| Always-on or path-scoped agent guidance in `.apm/instructions/*.instructions.md` | Instructions file | `instructions-author` | `references/author-routes.md` |
|
||||
| A single-file slash command in `.apm/prompts/*.prompt.md`, typed by hand with arguments and fanned out to each target's commands surface | Prompt file | `prompt-author` | `references/author-routes.md` |
|
||||
| A new distributable unit — no existing plugin is the right home for the skill, agent, hook or MCP server being built, or the bundle needs its own manifest, versioning and install lifecycle | Plugin | `apm-workflow` (`apm plugin init`) | `references/apm-routes.md` |
|
||||
| The plugin already exists and only its marketplace-facing metadata changes — a first listing, or a version/description update, never the plugin's contents | Marketplace entry | `apm-workflow` (`apm marketplace package add`) | `references/apm-routes.md` |
|
||||
|
||||
The table classifies what to build, not how to run it: a one-off task that merely needs an isolated or context-inheriting run is not an artifact and has no row here. If the intent stays genuinely ambiguous between rows after grilling, ask the user rather than guessing.
|
||||
|
||||
A real artifact that matches no row — a hook, an MCP server, an AGENTS.md, a research doc — has no route here. Say so, hand the user the skill that does own it, and never bend it into a row to make the table fit.
|
||||
An artifact that matches no row — a hook, an MCP server, an AGENTS.md, a research doc — has no route here. Say so, hand the user the skill that owns it, and never bend it into a row.
|
||||
|
||||
When the intent spans several rows, chain the routes in dependency order — an artifact that must exist on disk before another skill can target it goes first, so `apm-workflow` scaffolds the plugin directory before `skill-author` scaffolds a skill inside it.
|
||||
|
||||
@@ -51,4 +49,4 @@ When the intent spans several rows, chain the routes in dependency order — an
|
||||
## Step 3 — Closing gates, common to every route
|
||||
|
||||
- **Resolve before closing.** A route is finished only when its verification reports nothing unresolved. An actionable finding reopens the route; it is never reported onward as a caveat.
|
||||
- **Bump the package version.** A skill route always lands here: `skill-author` moves only a skill's own `metadata.version`, which is not the package `apm.yml`'s number — so read `references/version-bump.md` after one. `agent-author` and the apm routes bump the package themselves at plugin scope; after those, read it only when their output does not say they did.
|
||||
- **Bump the package version.** A skill route always lands here: `skill-author` moves only a skill's own `metadata.version`, which is not the package `apm.yml`'s number — so read `references/version-bump.md` after one. `agent-author`, `instructions-author`, `prompt-author` and the apm routes bump the package themselves at plugin scope; after those, read it only when their output does not say they did.
|
||||
@@ -1,14 +1,52 @@
|
||||
---
|
||||
source_keys:
|
||||
- claude-code-subagents-docs
|
||||
- context7-websites-code-claude
|
||||
- claude-code-memory-docs
|
||||
- apm-docs-author-prompts
|
||||
- apm-cli-0-28-0-prompt-experiments
|
||||
- claude-code-slash-commands
|
||||
---
|
||||
|
||||
# Routing a skill or agent to its author skill
|
||||
# Routing a skill, agent, instructions file or prompt file to its author skill
|
||||
|
||||
Reached from `SKILL.md` Step 2 when the classified artifact is a skill or an agent/subagent
|
||||
definition. Route a skill to `skill-author` and an agent to `agent-author`. The two branches
|
||||
differ on the author skill only — both verify the result with `factory-audit`, which detects the
|
||||
artifact type itself — and everything below applies to both.
|
||||
Reached from `SKILL.md` Step 2 when the classified artifact is a skill, an agent/subagent
|
||||
definition, an instructions file or a prompt file. Route a skill to `skill-author`, an agent to
|
||||
`agent-author`, an instructions file to `instructions-author` and a prompt file to `prompt-author`.
|
||||
The branches differ on the author skill only, and everything below applies to all four — except
|
||||
that `factory-audit` has no instructions or prompt flow yet, so those are verified by their author
|
||||
skill's own throwaway-package check and the clean-context rerun below is skipped for them.
|
||||
|
||||
## Rule, procedure or enforcement?
|
||||
|
||||
Before routing guidance to `instructions-author`, check what the content is. Claude reads an
|
||||
instruction as context, not as enforced configuration, so only a rule belongs there.
|
||||
|
||||
| The content is | Route |
|
||||
|---|---|
|
||||
| A rule for part of the codebase, or a short every-session rule | Instructions file (`instructions-author`) |
|
||||
| A rule for every session in every tool, kept as prose | `AGENTS.md` (`agentsmd-author`); no row here. Claude Code reads it only when no `CLAUDE.md` exists, so otherwise `CLAUDE.md` must import it |
|
||||
| A multi-step procedure or one task's guidance | Skill (`skill-author`) |
|
||||
| Something that must run at a fixed point or be blocked | A hook or a `permissions.deny` setting; no row here, so hand the user the owner and do not bend it into a rule |
|
||||
|
||||
## Prompt file or hand-invoked skill?
|
||||
|
||||
Before routing a "slash command I type" request, check which artifact it is. Claude Code merged
|
||||
custom commands into skills and its docs steer new work toward skills, so a prompt file earns its
|
||||
place only where its single-file, multi-target shape is the point.
|
||||
|
||||
| The content is | Route |
|
||||
|---|---|
|
||||
| A single-file command that should also reach Copilot, Cursor, Gemini or OpenCode | Prompt file (`prompt-author`) |
|
||||
| A command that needs `references/` or `scripts/`, or that other skills or the model must be able to call | Skill (`skill-author`), declared hand-invoked |
|
||||
| A Claude-only command with no such need | Skill (`skill-author`), because the vendor steers new commands there |
|
||||
|
||||
## Gotcha: `context: fork` is not `/fork`
|
||||
|
||||
Claude Code's skill-level `context: fork` frontmatter field and the `/fork` subagent command are
|
||||
opposites despite the shared word: `context: fork` isolates (fresh context, no parent access),
|
||||
while `/fork` inherits the full conversation. The fork-versus-inline choice below is about `/fork`.
|
||||
`references/apm-routes.md` rules the fork out entirely.
|
||||
|
||||
## Choose fork or inline
|
||||
|
||||
@@ -25,7 +63,7 @@ Fall back to an **inline invocation** — same conversation, no subagent — whe
|
||||
|
||||
## Two-tier verification
|
||||
|
||||
Both author skills already close out with their own inline audit, in the same context as the
|
||||
The skill and agent author skills already close out with their own inline audit, in the same context as the
|
||||
authoring work: `skill-author` and `agent-author` each invoke `factory-audit` on what they wrote.
|
||||
That is tier one, and forge does not change it.
|
||||
|
||||
|
||||
@@ -12,8 +12,40 @@
|
||||
|
||||
- **URL:** context7:/websites/code_claude
|
||||
- **Research doc:** plugins/kyberforge/docs/research/docs/claude-code-plugins/sources.md
|
||||
- **Description:** Official Claude Code documentation site indexed by Context7 — confirms the `context: fork` skill-level frontmatter field means isolated/fresh execution, the opposite of what the `/fork` subagent command does (inherits conversation). Informs the Gotchas entry in `SKILL.md` warning against conflating the two; nothing else in this skill draws on it, and no `references/` file mentions the `context: fork` field.
|
||||
- **Contributing files:** SKILL.md
|
||||
- **Description:** Official Claude Code documentation site indexed by Context7 — confirms the `context: fork` skill-level frontmatter field means isolated/fresh execution, the opposite of what the `/fork` subagent command does (inherits conversation). Informs the `context: fork` gotcha in `references/author-routes.md` warning against conflating the two; nothing else in this skill draws on it.
|
||||
- **Contributing files:** references/author-routes.md
|
||||
- **Status:** `extracted`
|
||||
|
||||
## claude-code-memory-docs
|
||||
|
||||
- **URL:** https://code.claude.com/docs/en/memory
|
||||
- **Research doc:** plugins/kyberforge/docs/research/docs/microsoft-apm/sources.md (digest: plugins/kyberforge/docs/research/docs/microsoft-apm/instructions-target-mapping.md)
|
||||
- **Description:** Claude Code memory documentation. Grounds the "Rule, procedure or enforcement?" table in `references/author-routes.md`: instructions are context rather than enforced configuration, multi-step procedures belong in skills, and enforcement belongs in hooks or `permissions.deny`.
|
||||
- **Contributing files:** references/author-routes.md
|
||||
- **Status:** `extracted`
|
||||
|
||||
## apm-docs-author-prompts
|
||||
|
||||
- **URL:** https://microsoft.github.io/apm/producer/author-primitives/prompts/
|
||||
- **Research doc:** plugins/kyberforge/docs/research/docs/microsoft-apm/sources.md (digest: plugins/kyberforge/docs/research/docs/microsoft-apm/prompt-primitive-schema.md)
|
||||
- **Description:** Official "Author a prompt" page. Grounds the "Prompt file or hand-invoked skill?" table in `references/author-routes.md`: a prompt file is a single file that apm deploys to each target's commands surface.
|
||||
- **Contributing files:** references/author-routes.md
|
||||
- **Status:** `extracted`
|
||||
|
||||
## apm-cli-0-28-0-prompt-experiments
|
||||
|
||||
- **URL:** https://pypi.org/project/apm-cli/0.28.0/
|
||||
- **Research doc:** plugins/kyberforge/docs/research/docs/microsoft-apm/sources.md (digest: plugins/kyberforge/docs/research/docs/microsoft-apm/prompt-target-mapping.md)
|
||||
- **Description:** The installed apm-cli 0.28.0 exercised in throwaway packages. Grounds the same table: which targets receive a prompt file.
|
||||
- **Contributing files:** references/author-routes.md
|
||||
- **Status:** `extracted`
|
||||
|
||||
## claude-code-slash-commands
|
||||
|
||||
- **URL:** https://code.claude.com/docs/en/slash-commands
|
||||
- **Research doc:** plugins/kyberforge/docs/research/docs/prompt-standards/sources.md (digest: plugins/kyberforge/docs/research/docs/prompt-standards/claude-code-commands.md)
|
||||
- **Description:** Claude Code custom-commands documentation. Grounds the third row of the "Prompt file or hand-invoked skill?" table in `references/author-routes.md`: custom commands are merged into skills, still work, and the docs recommend skills for new work.
|
||||
- **Contributing files:** references/author-routes.md
|
||||
- **Status:** `extracted`
|
||||
|
||||
## claude-code-plugins-docs
|
||||
|
||||
@@ -7,9 +7,9 @@ source_keys:
|
||||
|
||||
Reached from `SKILL.md` Step 3 after a route has finished. A skill route always lands here:
|
||||
`skill-author` moves only a skill's own `metadata.version`, which is not the package manifest's
|
||||
number, so the package version is still behind when it reports done. `agent-author` bumps the
|
||||
resolved package's `apm.yml` itself at plugin/APM scope, and `apm-workflow`'s configure flow
|
||||
carries the same policy — read those routes' output before acting here, because a second bump for
|
||||
number, so the package version is still behind when it reports done. `agent-author`,
|
||||
`instructions-author` and `prompt-author` bump the resolved package's `apm.yml` themselves
|
||||
(`agent-author` at plugin/APM scope), and `apm-workflow`'s configure flow carries the same policy — read those routes' output before acting here, because a second bump for
|
||||
one change is wrong.
|
||||
|
||||
## Find the owning package
|
||||
@@ -31,7 +31,7 @@ brief:
|
||||
> "The package at `<package-path>` gained a new `<artifact-type>` (`<artifact-name>`). Bump the
|
||||
> `version` field in that package's `apm.yml`. Determine whether to bump minor (0.1.0) or patch
|
||||
> (0.0.1) based on whether this is a new capability (minor) or a fix/refactor (patch). Do not
|
||||
> release or tag — just update `apm.yml` and commit."
|
||||
> release or tag — just update `apm.yml`."
|
||||
|
||||
Clean context rather than a fork is the point: the bump decision is made independently, without
|
||||
anchoring on the authoring conversation that just argued for the artifact's significance.
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
---
|
||||
name: instructions-author
|
||||
description: >
|
||||
Use when creating or revising an apm instructions file
|
||||
(`.apm/instructions/*.instructions.md`). Not read-only review ->
|
||||
`factory-audit`. Not skills -> `skill-author`. Not agents -> `agent-author`.
|
||||
Not AGENTS.md -> `agentsmd-author`.
|
||||
compatibility: Requires the apm CLI; behaviour verified against apm 0.28.0.
|
||||
allowed-tools: Bash Read Write Edit
|
||||
metadata:
|
||||
version: "0.1.0"
|
||||
category: factory
|
||||
source_keys:
|
||||
- apm-docs-site
|
||||
- apm-cli-0-28-0-experiments
|
||||
- claude-code-memory-docs
|
||||
---
|
||||
|
||||
## Gotchas
|
||||
|
||||
- Claude Code drops `description`; only Copilot, grok-build and Cursor keep it. Write a body that explains itself.
|
||||
- Quote every `applyTo`. An unquoted `**/*.py` fails to parse, compile skips the file, and `apm install` still deploys it with no `paths:`, so it loads in every session. Install prints the parse warning once and exits 0.
|
||||
|
||||
## Step 1 — Dispatch
|
||||
|
||||
| Condition | Flow | Reference |
|
||||
|---|---|---|
|
||||
| No file at the target path | Create | `references/create.md` |
|
||||
| A file exists, at least one improvement signal present | Improve | `references/improve.md` |
|
||||
| A file exists, no signals | Stop and ask | — |
|
||||
|
||||
Signals: grill output, audit findings, inline feedback, a session describing a rule that loaded when it should not or failed to load. With none, ask whether the user meant to create a new file or has feedback to apply.
|
||||
|
||||
Read only the reference for the resolved flow.
|
||||
|
||||
## Step 2 — Contract
|
||||
|
||||
Gates on every file, whichever flow wrote it:
|
||||
|
||||
- **One topic per file.** Two topics are two files.
|
||||
- **Scope.** Omit `applyTo` only for a rule that must load in every session, and tell the user it then costs context at every launch.
|
||||
- **Source.** Flat in `.apm/instructions/`, named `<stem>.instructions.md`. Anything nested or misnamed is ignored or never installed.
|
||||
- **Stem.** It becomes the deployed filename, and install overwrites a hand-authored rule of the same name on most targets without a prompt. Check for a collision before choosing it.
|
||||
- **Body.** Concrete, checkable bullets, paths in backticks, nothing assuming another file is loaded, under 200 lines. If unsure the content is a rule rather than a procedure or something to enforce, read `references/content.md`.
|
||||
|
||||
If a field, glob or location is in question, read `references/schema.md`. If the question is which target keeps which field, or what compile does, read `references/target-mapping.md`.
|
||||
|
||||
## Step 3 — Validate and close
|
||||
|
||||
- [ ] Verify with a real compile and a throwaway deploy: read `references/verify.md`. Resolve every warning and confirm a scoped rule deploys with `paths:`.
|
||||
- [ ] Bump the owning package's `apm.yml` `version` — **minor** on create, **patch** on improve — because consumers compare it to detect updates.
|
||||
|
||||
`factory-audit` has no instructions checks yet, so nothing else gates the file; report only what the verification showed.
|
||||
@@ -0,0 +1,5 @@
|
||||
# assets/
|
||||
|
||||
## templates/
|
||||
|
||||
- **`instructions.md`** — minimal valid `.apm/instructions/<name>.instructions.md`, copied by `scripts/new-instructions.sh`. Carries a `description`, a quoted `applyTo` and a one-topic body, each marked `FILL IN:`. The bullets model a checkable rule; what belongs in the body is in `references/content.md`, field semantics in `references/schema.md`.
|
||||
@@ -0,0 +1,12 @@
|
||||
---
|
||||
# Delete these comments once filled in; Copilot receives this file verbatim.
|
||||
description: "FILL IN: one line on what this rule covers. Only Copilot, grok-build and Cursor keep it."
|
||||
applyTo: "FILL IN: quoted glob, e.g. **/*.py"
|
||||
# applyTo is always quoted: an unquoted ** is a YAML alias error and the rule
|
||||
# deploys unscoped. Several globs: "**/*.css,**/*.scss". Delete the line only
|
||||
# for a rule that must load in every session.
|
||||
---
|
||||
# FILL IN: one topic per file
|
||||
|
||||
- FILL IN: a concrete rule an agent can check, e.g. "Use 2-space indentation", not "Format code properly".
|
||||
- FILL IN: a convention that differs from the tool's default, or a pitfall with the reason for it.
|
||||
@@ -0,0 +1,34 @@
|
||||
---
|
||||
source_keys:
|
||||
- claude-code-memory-docs
|
||||
---
|
||||
|
||||
# What belongs in an instructions file
|
||||
|
||||
Reached from `SKILL.md` Step 2. Claude reads instructions as context, not as enforced configuration, so a rule only helps if it is specific, short and not contradicted elsewhere.
|
||||
|
||||
## Write rules an agent can check
|
||||
|
||||
| Weak | Checkable |
|
||||
|---|---|
|
||||
| Format code properly | Use 2-space indentation |
|
||||
| Test your changes | Run `npm test` before committing |
|
||||
| Keep files organized | API handlers live in `src/api/handlers/` |
|
||||
|
||||
Group related bullets under a short heading. Give the reason when a rule looks arbitrary; a rule with a stated reason survives the edge case.
|
||||
|
||||
## Keep
|
||||
|
||||
- Conventions that differ from the tool's default.
|
||||
- Pitfalls the agent would walk into, with the reason.
|
||||
- Build, test and lint commands; where things live when a path cannot be guessed.
|
||||
|
||||
## Cut
|
||||
|
||||
- What the agent can read from the code: directory listings, dependency lists, architecture overviews.
|
||||
- Anything stated in another file that loads alongside this one. Two copies drift, and contradictory rules are followed arbitrarily.
|
||||
- Generalities ("write clean code").
|
||||
|
||||
## Not a rule?
|
||||
|
||||
A multi-step procedure belongs in a skill, and something that must be enforced belongs in a hook or a `permissions.deny` setting. If the content is one of those, say so to the user and stop; do not bend it into a rule.
|
||||
@@ -0,0 +1,39 @@
|
||||
---
|
||||
source_keys:
|
||||
- apm-docs-site
|
||||
- apm-cli-0-28-0-experiments
|
||||
---
|
||||
|
||||
# Creating a new instructions file
|
||||
|
||||
Return to `SKILL.md` Step 3 once Step 3 below is done.
|
||||
|
||||
## Before touching the filesystem
|
||||
|
||||
Confirm, and ask the user for anything missing:
|
||||
|
||||
- [ ] The one topic the file covers. Two topics are two files.
|
||||
- [ ] Which files it governs, as a glob, or that it must load in every session.
|
||||
- [ ] A kebab-case stem. It becomes the deployed filename.
|
||||
|
||||
## Step 1 — Check the stem
|
||||
|
||||
Install overwrites a hand-authored file at `.claude/rules/<stem>.md`, `.cursor/rules/<stem>.mdc`, `.windsurf/rules/<stem>.md`, `.kiro/steering/<stem>.md` and `.agents/rules/<stem>.md` without a prompt. List those paths in the consuming project and choose another stem on any hit.
|
||||
|
||||
## Step 2 — Scaffold
|
||||
|
||||
```bash
|
||||
bash scripts/new-instructions.sh <name> <path-inside-the-package>
|
||||
```
|
||||
|
||||
The script walks up for a `type:`-bearing `apm.yml`. With none it exits 1 and names `/apm-workflow configure`; run that first, then retry. It never overwrites an existing file.
|
||||
|
||||
## Step 3 — Fill in
|
||||
|
||||
Replace every `FILL IN:` and delete the template's comments.
|
||||
|
||||
- `applyTo`: quoted. Omit it only for a rule that must load in every session, and say so to the user; it costs context at every launch.
|
||||
- `description`: one line. Write the body as if it were absent, because Claude Code never sees it.
|
||||
- Body: concrete bullets, one topic, paths in backticks, nothing that assumes another file is loaded. Read `references/content.md` if unsure the content belongs in an instructions file.
|
||||
|
||||
For glob syntax or a field question, read `references/schema.md`.
|
||||
@@ -0,0 +1,31 @@
|
||||
---
|
||||
source_keys:
|
||||
- apm-docs-site
|
||||
- apm-cli-0-28-0-experiments
|
||||
---
|
||||
|
||||
# Improving an existing instructions file
|
||||
|
||||
Return to `SKILL.md` Step 3 once the edits are made.
|
||||
|
||||
## Step 1 — Read the file and the signals
|
||||
|
||||
Read the file whole. Signals are grill output, audit findings, inline feedback, or a session describing a rule that loaded when it should not, or failed to load. Apply what the signals name and nothing else.
|
||||
|
||||
## Step 2 — Diagnose by symptom
|
||||
|
||||
| Symptom | Cause | Fix |
|
||||
|---|---|---|
|
||||
| A scoped rule loads in every Claude session | `applyTo` is unquoted or malformed, so install deployed no `paths:` | Quote it, then confirm with `references/verify.md` |
|
||||
| Compile warns "Failed to parse" | Broken frontmatter YAML | Repair the YAML; do not delete the field |
|
||||
| The rule is in `CLAUDE.md` but not `.claude/rules/` | The file is nested under `.apm/instructions/` | Move it up to the flat directory |
|
||||
| The rule appears nowhere | The name lacks `.instructions.md` | Rename it |
|
||||
| Claude ignores guidance written in `description` | Claude Code drops `description` | Move the substance into the body |
|
||||
| A hand-written rule vanished after install | The stem collided with a deployed name | Restore it from version control and rename the source stem |
|
||||
| The same rule reaches the agent twice | Cursor, Windsurf, Kiro and Grok get both a native file and an `AGENTS.md` copy | State it to the user; it is apm behaviour, not a defect in the file |
|
||||
|
||||
Cases not in the table: read `references/target-mapping.md`.
|
||||
|
||||
## Step 3 — Split or trim
|
||||
|
||||
A file covering two topics, or longer than 200 lines, becomes several files. Do the split only when a signal names it.
|
||||
@@ -0,0 +1,50 @@
|
||||
---
|
||||
source_keys:
|
||||
- apm-docs-site
|
||||
- apm-github-repo
|
||||
- apm-cli-0-28-0-experiments
|
||||
- claude-code-memory-docs
|
||||
---
|
||||
|
||||
# The instructions source file
|
||||
|
||||
Verified against apm 0.28.0. Reached from `SKILL.md` Step 2 when a frontmatter field, a glob or the file's location is in question.
|
||||
|
||||
## Location and name
|
||||
|
||||
`.apm/instructions/<name>.instructions.md`, flat. The double extension is the discovery key and the stem is the primitive's name; there is no `name` field.
|
||||
|
||||
- A plain `.md` in that directory is ignored by both `apm compile` and `apm install`.
|
||||
- A file in a subdirectory is folded into compiled root files by compile but never deployed by install, so it reaches `CLAUDE.md` and `AGENTS.md` and no native rules directory.
|
||||
- The stem becomes the deployed filename: `<stem>.md`, `<stem>.mdc`, or `<stem>.instructions.md`, by target.
|
||||
|
||||
## Frontmatter
|
||||
|
||||
Only `description` and `applyTo` carry meaning. `author` and `version` are parsed and emitted only by the verbatim-copy targets (Copilot, grok-build).
|
||||
|
||||
- `description`: one line. The apm docs call it required; the binary only warns. Copilot, grok-build and Cursor keep it; Claude Code, Windsurf, Kiro, Antigravity and every compiled root file drop it. Cursor auto-generates one from the first body sentence when it is missing.
|
||||
- `applyTo`: a glob scoping the rule. The apm docs list it as both required and optional; the binary treats it as optional, with a warning. Empty or absent means an unconditional rule.
|
||||
|
||||
### `applyTo` grammar
|
||||
|
||||
- One glob: `"**/*.py"`.
|
||||
- Several globs in one string, comma-separated: `"**/*.css,**/*.scss"`. Whitespace around segments is trimmed.
|
||||
- A YAML sequence is joined into the same comma form.
|
||||
- Brace alternation is never split: `"**/*.{css,scss},**/*.py"` is two patterns.
|
||||
- A literal comma in a pattern is `\,`; a literal backslash is `\\`.
|
||||
- Always quote the value. An unquoted `**/*.py` is a YAML alias error; see `SKILL.md` Gotchas for what apm then does.
|
||||
|
||||
## Body
|
||||
|
||||
Plain markdown. Official guidance: bullets over prose, one topic per file (`python-style` and `python-testing` are two files), paths in backticks, no greetings or meta-commentary, no assumption that other files are loaded. apm sets no size limit. The downstream tools do: Claude Code recommends under 200 lines per file and Cursor under 500.
|
||||
|
||||
## Validation
|
||||
|
||||
`Instruction.validate()` yields three findings, all demoted to warnings: missing `description`, missing `applyTo` ("will apply globally") and empty content. A broken relative link in the body is a fourth, also non-fatal.
|
||||
|
||||
- A real `apm compile` prints them. `apm compile --validate` prints none of them and exits 0 even for a file with all three problems; it exits 1 only when the package has no instructions at all.
|
||||
- `apm install` prints none.
|
||||
- `apm audit --ci` checks lockfile, deployed-file presence, content hash and hidden Unicode, not instruction content.
|
||||
- A file whose frontmatter does not parse is skipped by compile ("Failed to parse") but still deployed by install.
|
||||
|
||||
No standalone instructions validator exists, so enforcement is this skill's checks and `references/verify.md`.
|
||||
@@ -0,0 +1,59 @@
|
||||
---
|
||||
source_keys:
|
||||
- apm-docs-site
|
||||
- apm-github-repo
|
||||
- apm-cli-0-28-0-experiments
|
||||
- claude-code-memory-docs
|
||||
- github-copilot-custom-instructions-docs
|
||||
- cursor-rules-docs
|
||||
---
|
||||
|
||||
# Sources
|
||||
|
||||
## apm-docs-site
|
||||
|
||||
- **URL:** https://microsoft.github.io/apm/
|
||||
- **Research doc:** plugins/kyberforge/docs/research/docs/microsoft-apm/sources.md (digest: plugins/kyberforge/docs/research/docs/microsoft-apm/instructions-primitive-schema.md)
|
||||
- **Description:** Official apm documentation, the instructions-and-agents authoring page plus targets and compile pages: frontmatter requirements, per-target deploy paths, compile behaviour and flags.
|
||||
- **Contributing files:** SKILL.md, references/schema.md, references/target-mapping.md, references/create.md, references/improve.md
|
||||
- **Status:** `extracted`
|
||||
|
||||
## apm-github-repo
|
||||
|
||||
- **URL:** https://github.com/microsoft/apm
|
||||
- **Research doc:** plugins/kyberforge/docs/research/docs/microsoft-apm/sources.md (digest: plugins/kyberforge/docs/research/docs/microsoft-apm/instructions-primitive-schema.md)
|
||||
- **Description:** apm's own Python source read for the Instruction model, discovery globs and per-target integrators.
|
||||
- **Contributing files:** references/schema.md
|
||||
- **Status:** `extracted`
|
||||
|
||||
## apm-cli-0-28-0-experiments
|
||||
|
||||
- **URL:** https://pypi.org/project/apm-cli/0.28.0/
|
||||
- **Research doc:** plugins/kyberforge/docs/research/docs/microsoft-apm/sources.md (digest: plugins/kyberforge/docs/research/docs/microsoft-apm/instructions-gotchas.md)
|
||||
- **Description:** The installed apm-cli 0.28.0 package plus throwaway install, compile and audit experiments confirming validation severity, unquoted-glob handling, discovery asymmetry, dedup and overwrite behaviour.
|
||||
- **Contributing files:** SKILL.md, references/schema.md, references/target-mapping.md, references/verify.md, references/create.md, references/improve.md
|
||||
- **Status:** `extracted`
|
||||
|
||||
## claude-code-memory-docs
|
||||
|
||||
- **URL:** https://code.claude.com/docs/en/memory
|
||||
- **Research doc:** plugins/kyberforge/docs/research/docs/microsoft-apm/sources.md (digest: plugins/kyberforge/docs/research/docs/microsoft-apm/instructions-target-mapping.md)
|
||||
- **Description:** Claude Code memory documentation: `.claude/rules/` loading, the `paths` field as the only field read, invalid YAML ignored, size and specificity guidance, instructions versus skills and hooks.
|
||||
- **Contributing files:** SKILL.md, references/schema.md, references/target-mapping.md, references/content.md
|
||||
- **Status:** `extracted`
|
||||
|
||||
## github-copilot-custom-instructions-docs
|
||||
|
||||
- **URL:** https://docs.github.com/en/copilot/how-tos/configure-custom-instructions/add-repository-instructions
|
||||
- **Research doc:** plugins/kyberforge/docs/research/docs/microsoft-apm/sources.md (digest: plugins/kyberforge/docs/research/docs/microsoft-apm/instructions-target-mapping.md)
|
||||
- **Description:** GitHub Copilot repository custom instructions: `.github/instructions/*.instructions.md`, `applyTo` and `excludeAgent`, the separate repo-wide file.
|
||||
- **Contributing files:** references/target-mapping.md
|
||||
- **Status:** `extracted`
|
||||
|
||||
## cursor-rules-docs
|
||||
|
||||
- **URL:** https://cursor.com/docs/context/rules
|
||||
- **Research doc:** plugins/kyberforge/docs/research/docs/microsoft-apm/sources.md (digest: plugins/kyberforge/docs/research/docs/microsoft-apm/instructions-target-mapping.md)
|
||||
- **Description:** Cursor project rules: the `.mdc` requirement, `description`, `globs` and `alwaysApply`, rule types, size guidance.
|
||||
- **Contributing files:** references/target-mapping.md
|
||||
- **Status:** `extracted`
|
||||
@@ -0,0 +1,63 @@
|
||||
---
|
||||
source_keys:
|
||||
- apm-cli-0-28-0-experiments
|
||||
- apm-docs-site
|
||||
- claude-code-memory-docs
|
||||
- github-copilot-custom-instructions-docs
|
||||
- cursor-rules-docs
|
||||
---
|
||||
|
||||
# What each target receives
|
||||
|
||||
Verified against apm 0.28.0 and throwaway installs. Reached from `SKILL.md` Step 2 when the question is which target keeps which field. Source-file syntax is in `references/schema.md`.
|
||||
|
||||
## Two output paths
|
||||
|
||||
`apm install` writes one native file per instruction into each target's rules directory. `apm compile` writes root context files that concatenate instruction bodies, grouped by `applyTo`. Treat install as the primary path for Claude Code and Copilot, and compile as the path for targets with no native instructions directory.
|
||||
|
||||
## Install: deployed path and transform
|
||||
|
||||
| Target | Deployed path | Transform |
|
||||
|---|---|---|
|
||||
| copilot | `.github/instructions/<n>.instructions.md` | Verbatim copy |
|
||||
| claude | `.claude/rules/<n>.md` | `applyTo` becomes a `paths:` list; `description` dropped; no frontmatter at all without `applyTo` |
|
||||
| cursor | `.cursor/rules/<n>.mdc` | `applyTo` becomes `globs`; `description` kept; no `alwaysApply` written |
|
||||
| windsurf | `.windsurf/rules/<n>.md` | `trigger: glob` plus `globs`, or `trigger: always_on`; `description` dropped |
|
||||
| kiro | `.kiro/steering/<n>.md` | `inclusion: fileMatch` plus `fileMatchPattern`, or `inclusion: always`; `description` dropped |
|
||||
| antigravity | `.agents/rules/<n>.md` | `trigger: glob` plus `globs`, or no frontmatter; `description` dropped |
|
||||
| grok-build | `.grok/rules/<n>.instructions.md` | Verbatim copy |
|
||||
| codex, gemini, opencode and the rest | none | Reach instructions only through compile |
|
||||
|
||||
Cursor, Windsurf and Antigravity do not deploy at user scope; Kiro and the rest do.
|
||||
|
||||
## Field survival
|
||||
|
||||
| Field | Claude | Copilot, grok-build | Cursor | Windsurf, Kiro, Antigravity | Compiled root file |
|
||||
|---|---|---|---|---|---|
|
||||
| `applyTo` | as `paths` | verbatim | as `globs` | as each target's glob key | grouping only |
|
||||
| `description` | dropped | kept | kept | dropped | dropped |
|
||||
| `author`, `version` | dropped | kept only because the file is a verbatim copy | dropped | dropped | dropped |
|
||||
|
||||
For Claude Code the body's first line or heading is the only descriptive text that survives, so the body must explain itself.
|
||||
|
||||
## Ownership and overwrite
|
||||
|
||||
- Claude, Cursor, Windsurf, Kiro and Antigravity treat each deployed file as apm-owned: install replaces a hand-authored file at the same path without a prompt. Copilot and grok-build skip an unmanaged file ("local files exist, not managed by APM") until `apm install --force`.
|
||||
- Removing or renaming a source makes the next install delete the file it deployed for Claude, Copilot, Cursor, Windsurf and Kiro. Antigravity and grok-build leave the old file behind in 0.28.0, so delete it by hand.
|
||||
|
||||
## Compile
|
||||
|
||||
- `--target claude` writes `CLAUDE.md`; Gemini writes `GEMINI.md` and `AGENTS.md`; every other target writes `AGENTS.md`.
|
||||
- Compile skips instructions already deployed natively, for Claude, Copilot and Antigravity only, and the skip is all-or-nothing: if any instruction has a same-stem file in `.claude/rules/`, compile omits every instruction from `CLAUDE.md`, including a new one never deployed. With rules populated, `--target claude` exits 0, prints "produced no output files" and writes nothing. `--force-instructions` (alias `--no-dedup`) overrides.
|
||||
- Cursor, Windsurf, Kiro and Grok have no dedup: compile writes `AGENTS.md` that repeats rules the tool already loads natively. Codex, Gemini and OpenCode get no native file, so the compiled root file is their only copy.
|
||||
- A package with no instruction primitives (skills only) makes plain `apm compile` exit 1 with "No instruction files found"; `apm compile --clean` exits 0.
|
||||
|
||||
## Native format facts
|
||||
|
||||
- Claude Code reads `.claude/rules/**/*.md` recursively. `paths` is the only field it reads, as a list or a comma-separated string; other fields are ignored. A rule without `paths` loads at every launch. Frontmatter that fails to parse is ignored and the rule loads without `paths`.
|
||||
- Copilot path-specific files need `applyTo` as a quoted comma-joined string; `excludeAgent` is the only other documented key. Repository-wide instructions are the separate `.github/copilot-instructions.md`.
|
||||
- Cursor ignores a plain `.md` in `.cursor/rules`. A rule with only a `description` is "Apply Intelligently", not always-on.
|
||||
|
||||
## Unverified
|
||||
|
||||
Cursor's handling of a YAML-list `globs`, Copilot's handling of unknown frontmatter keys, and runtime behaviour on Windsurf, Kiro and Antigravity. Say so rather than asserting any of them.
|
||||
@@ -0,0 +1,32 @@
|
||||
---
|
||||
source_keys:
|
||||
- apm-cli-0-28-0-experiments
|
||||
---
|
||||
|
||||
# Verifying a file in a throwaway package
|
||||
|
||||
Reached from `SKILL.md` Step 3. Run step 2 outside the repo: `apm install` writes `apm_modules/`, `apm.lock.yaml` and a rules directory, and install overwrites hand-authored rule files without warning.
|
||||
|
||||
1. From the package root, a real compile. `--validate` hides the missing-`description`, missing-`applyTo` and empty-body warnings and exits 0 whenever the package has an instruction, so it verifies nothing:
|
||||
|
||||
```bash
|
||||
apm compile --dry-run --target claude
|
||||
```
|
||||
|
||||
Resolve every warning it prints: missing `description`, missing `applyTo`, empty content, broken link, "Failed to parse".
|
||||
|
||||
2. For a scoped rule, deploy it where nothing else can be overwritten:
|
||||
|
||||
```bash
|
||||
d=$(mktemp -d)
|
||||
printf 'name: scratch\nversion: 0.1.0\ntype: instructions\ntargets:\n - claude\n' > "$d/apm.yml"
|
||||
mkdir -p "$d/.apm/instructions"
|
||||
cp <package-root>/.apm/instructions/<name>.instructions.md "$d/.apm/instructions/"
|
||||
(cd "$d" && apm install && cat .claude/rules/<name>.md)
|
||||
```
|
||||
|
||||
3. The deployed file must open with `paths:` listing the intended globs. No frontmatter block at all means `applyTo` was missing or did not parse: the rule would load in every session.
|
||||
|
||||
4. Once rules sit in `.claude/rules/`, `apm compile --target claude` writes no `CLAUDE.md` and still exits 0, so an exit-code check proves nothing. To inspect the compiled root file, pass `--force-instructions`.
|
||||
|
||||
Delete the directory afterwards. Report only what was observed; Cursor's list-form `globs` and the Windsurf, Kiro and Antigravity runtimes stay unverified.
|
||||
@@ -0,0 +1,3 @@
|
||||
# scripts/
|
||||
|
||||
- **`new-instructions.sh <name> <root>`** — scaffolds `<package-root>/.apm/instructions/<name>.instructions.md` from `assets/templates/instructions.md`. Walks up from `<root>` for the nearest `type:`-bearing `apm.yml`; exits 1 with a pointer to `/apm-workflow configure` when there is none. Never overwrites an existing file. Run `--help` for the full contract.
|
||||
+116
@@ -0,0 +1,116 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
SKILL_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
TEMPLATE="$SKILL_DIR/../assets/templates/instructions.md"
|
||||
|
||||
usage() {
|
||||
cat <<USAGE
|
||||
Usage: new-instructions.sh <name> <root>
|
||||
|
||||
Scaffold an apm instructions file from the bundled template.
|
||||
|
||||
Arguments:
|
||||
name Kebab-case stem. Becomes <name>.instructions.md and, after install,
|
||||
the deployed rule's filename.
|
||||
root Existing path at or below the target package. The script walks up for
|
||||
the nearest apm.yml with a top-level type: field (instructions, skill,
|
||||
hybrid or prompts); an apm.yml without type: is a marketplace-only
|
||||
manifest and is skipped. Creates
|
||||
<package-root>/.apm/instructions/<name>.instructions.md
|
||||
|
||||
Exit codes:
|
||||
0 File created, or already existed (no-op)
|
||||
1 Invalid arguments, missing root, no package found, or template not found
|
||||
USAGE
|
||||
}
|
||||
|
||||
if [[ "${1:-}" == "--help" || "${1:-}" == "-h" ]]; then
|
||||
usage
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [[ $# -lt 2 ]]; then
|
||||
echo "Error: name and root are required." >&2
|
||||
echo "" >&2
|
||||
usage >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
NAME="$1"
|
||||
ROOT="${2/#\~/$HOME}"
|
||||
|
||||
if [[ ! $NAME =~ ^[a-z0-9]+(-[a-z0-9]+)*$ ]]; then
|
||||
echo "Error: name must use lowercase letters, numbers, and hyphens only." >&2
|
||||
echo " No leading, trailing, or consecutive hyphens." >&2
|
||||
echo " Received: '$NAME'" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -f "$TEMPLATE" ]]; then
|
||||
echo "Error: template not found at '$TEMPLATE'." >&2
|
||||
echo " Run this script from its original location inside the instructions-author skill." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -d "$ROOT" ]]; then
|
||||
echo "Error: root directory '$ROOT' does not exist." >&2
|
||||
exit 1
|
||||
fi
|
||||
ROOT="$(cd "$ROOT" && pwd)"
|
||||
|
||||
# Same marker as agent-author's new-agent.sh: a top-level type: naming one of
|
||||
# the four package types, with matching quotes if quoted.
|
||||
is_apm_package_manifest() {
|
||||
local apm_yml="$1" line
|
||||
while IFS= read -r line || [[ -n "$line" ]]; do
|
||||
if [[ "$line" =~ ^type:[[:space:]]*(instructions|skill|hybrid|prompts)([[:space:]]|$) ]]; then
|
||||
return 0
|
||||
fi
|
||||
if [[ "$line" =~ ^type:[[:space:]]*([\"\'])(instructions|skill|hybrid|prompts)([\"\'])([[:space:]]|$) ]] \
|
||||
&& [[ "${BASH_REMATCH[1]}" == "${BASH_REMATCH[3]}" ]]; then
|
||||
return 0
|
||||
fi
|
||||
done < "$apm_yml"
|
||||
return 1
|
||||
}
|
||||
|
||||
PACKAGE_ROOT=""
|
||||
current="$ROOT"
|
||||
while true; do
|
||||
if [[ -f "$current/apm.yml" ]] && is_apm_package_manifest "$current/apm.yml"; then
|
||||
PACKAGE_ROOT="$current"
|
||||
break
|
||||
fi
|
||||
if [[ -e "$current/.git" ]]; then
|
||||
break
|
||||
fi
|
||||
parent="$(dirname "$current")"
|
||||
[[ "$parent" == "$current" ]] && break
|
||||
current="$parent"
|
||||
done
|
||||
|
||||
if [[ -z "$PACKAGE_ROOT" ]]; then
|
||||
echo "Error: no apm package found at or above '$ROOT'." >&2
|
||||
echo " Instructions only deploy from a package's .apm/instructions/. Run" >&2
|
||||
echo " /apm-workflow configure (apm plugin init) there first, then retry." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
DEST_DIR="$PACKAGE_ROOT/.apm/instructions"
|
||||
DEST="$DEST_DIR/$NAME.instructions.md"
|
||||
|
||||
if [[ -f "$DEST" ]]; then
|
||||
echo "Skipping '$DEST' — already exists." >&2
|
||||
exit 0
|
||||
fi
|
||||
|
||||
mkdir -p "$DEST_DIR"
|
||||
cp "$TEMPLATE" "$DEST"
|
||||
echo "Created: $DEST" >&2
|
||||
echo "" >&2
|
||||
echo "Next steps:" >&2
|
||||
echo " 1. Fill in $DEST — replace every FILL IN: placeholder and delete the comments." >&2
|
||||
echo " 2. Check '$NAME' does not collide with a hand-authored rule: install overwrites" >&2
|
||||
echo " <target>/rules/$NAME.* on most targets without warning." >&2
|
||||
echo " 3. Verify with a real compile, not --validate: apm compile --dry-run --target <target>" >&2
|
||||
@@ -0,0 +1,15 @@
|
||||
# tests/
|
||||
|
||||
- **`new-instructions.bats`** — covers `scripts/new-instructions.sh` (name validation, package walk-up, no-package refusal, no-op on an existing file, template placeholders) and the apm behaviour the skill's gotchas rest on, run against throwaway packages: a filled scaffold compiles into `CLAUDE.md` and installs into `.claude/rules/` with `description` dropped, compile writes nothing once rules are installed, an unquoted `applyTo` installs unscoped, and `--validate` hides the warnings a real compile prints.
|
||||
|
||||
## Dependencies
|
||||
|
||||
The test file loads `bats-support` and `bats-assert` from the repo root's `tests/test_helper/`, and runs on the repo's bats submodule at `tests/bats/`. The first `bash tests/run-bats.sh` initialises the submodules.
|
||||
|
||||
The apm tests need the `apm` CLI on `PATH` and skip when it is absent. They assert apm 0.28.0 behaviour, so a failure after an apm upgrade is a finding about the skill's gotchas, not a flaky test.
|
||||
|
||||
From the repo root:
|
||||
|
||||
```bash
|
||||
tests/bats/bin/bats plugins/kyberforge/.apm/skills/instructions-author/tests/new-instructions.bats
|
||||
```
|
||||
@@ -0,0 +1,263 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
setup() {
|
||||
REPO_ROOT="$(cd "$BATS_TEST_DIRNAME/../../../../../../" && pwd)"
|
||||
load "$REPO_ROOT/tests/test_helper/bats-support/load"
|
||||
load "$REPO_ROOT/tests/test_helper/bats-assert/load"
|
||||
|
||||
SCRIPT="$(cd "$BATS_TEST_DIRNAME/../scripts" && pwd)/new-instructions.sh"
|
||||
ROOT="$(mktemp -d)"
|
||||
}
|
||||
|
||||
teardown() {
|
||||
rm -rf "$ROOT"
|
||||
}
|
||||
|
||||
make_package() {
|
||||
printf 'name: my-package\nversion: 0.1.0\ntype: instructions\ntargets:\n - claude\n' > "$ROOT/apm.yml"
|
||||
}
|
||||
|
||||
# Replace every placeholder and drop the template's comments, leaving a valid file.
|
||||
fill() {
|
||||
sed -i -E \
|
||||
-e '/^#/{/^# FILL IN/!d}' \
|
||||
-e 's/^description: .?FILL IN.*/description: Python style rules/' \
|
||||
-e 's/^applyTo: .*/applyTo: "**\/*.py"/' \
|
||||
-e 's/^# FILL IN.*/# Python style/' \
|
||||
-e 's/^- FILL IN.*/- Use type hints./' \
|
||||
"$1"
|
||||
}
|
||||
|
||||
need_apm() {
|
||||
command -v apm >/dev/null 2>&1 || skip "apm CLI not installed"
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Help and arguments
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
@test "--help exits 0" {
|
||||
run bash "$SCRIPT" --help
|
||||
assert_success
|
||||
assert_output --partial "Usage:"
|
||||
}
|
||||
|
||||
@test "missing arguments exits 1" {
|
||||
run bash "$SCRIPT"
|
||||
assert_failure
|
||||
assert_output --partial "name and root are required"
|
||||
}
|
||||
|
||||
@test "nonexistent root exits 1" {
|
||||
run bash "$SCRIPT" my-rule "$ROOT/missing"
|
||||
assert_failure
|
||||
assert_output --partial "does not exist"
|
||||
}
|
||||
|
||||
@test "rejects names that are not kebab-case" {
|
||||
make_package
|
||||
for bad in My-Rule my_rule -leading trailing- double--hyphen; do
|
||||
run bash "$SCRIPT" "$bad" "$ROOT"
|
||||
assert_failure
|
||||
assert_output --partial "lowercase letters"
|
||||
done
|
||||
assert [ ! -d "$ROOT/.apm" ]
|
||||
}
|
||||
|
||||
@test "rejects a name containing a newline" {
|
||||
make_package
|
||||
run bash "$SCRIPT" $'my-rule\nextra' "$ROOT"
|
||||
assert_failure
|
||||
assert_output --partial "lowercase letters"
|
||||
assert [ ! -d "$ROOT/.apm" ]
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Package resolution
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
@test "creates <name>.instructions.md under .apm/instructions/" {
|
||||
make_package
|
||||
run bash "$SCRIPT" my-rule "$ROOT"
|
||||
assert_success
|
||||
assert [ -f "$ROOT/.apm/instructions/my-rule.instructions.md" ]
|
||||
}
|
||||
|
||||
@test "walks up from a subdirectory to the package root" {
|
||||
make_package
|
||||
mkdir -p "$ROOT/deep/er"
|
||||
run bash "$SCRIPT" my-rule "$ROOT/deep/er"
|
||||
assert_success
|
||||
assert [ -f "$ROOT/.apm/instructions/my-rule.instructions.md" ]
|
||||
assert [ ! -d "$ROOT/deep/er/.apm" ]
|
||||
}
|
||||
|
||||
@test "skips a type-less apm.yml and keeps walking up" {
|
||||
make_package
|
||||
mkdir -p "$ROOT/marketplace"
|
||||
printf 'name: catalog\nmarketplace:\n packages: []\n' > "$ROOT/marketplace/apm.yml"
|
||||
run bash "$SCRIPT" my-rule "$ROOT/marketplace"
|
||||
assert_success
|
||||
assert [ -f "$ROOT/.apm/instructions/my-rule.instructions.md" ]
|
||||
assert [ ! -d "$ROOT/marketplace/.apm" ]
|
||||
}
|
||||
|
||||
@test "accepts a quoted type value" {
|
||||
printf 'name: p\ntype: "hybrid"\n' > "$ROOT/apm.yml"
|
||||
run bash "$SCRIPT" my-rule "$ROOT"
|
||||
assert_success
|
||||
assert [ -f "$ROOT/.apm/instructions/my-rule.instructions.md" ]
|
||||
}
|
||||
|
||||
@test "no package: exits 1, points at apm-workflow configure, writes nothing" {
|
||||
mkdir -p "$ROOT/.git"
|
||||
run bash "$SCRIPT" my-rule "$ROOT"
|
||||
assert_failure
|
||||
assert_output --partial "apm-workflow configure"
|
||||
assert [ ! -d "$ROOT/.apm" ]
|
||||
}
|
||||
|
||||
@test "does not walk above a .git boundary" {
|
||||
make_package
|
||||
mkdir -p "$ROOT/repo/.git"
|
||||
run bash "$SCRIPT" my-rule "$ROOT/repo"
|
||||
assert_failure
|
||||
assert [ ! -d "$ROOT/.apm" ]
|
||||
}
|
||||
|
||||
@test "a mismatched-quote type value is not a package marker" {
|
||||
mkdir -p "$ROOT/.git"
|
||||
printf 'name: p\ntype: "hybrid'"'"'\n' > "$ROOT/apm.yml"
|
||||
run bash "$SCRIPT" my-rule "$ROOT"
|
||||
assert_failure
|
||||
assert [ ! -d "$ROOT/.apm" ]
|
||||
}
|
||||
|
||||
@test "a type value that only starts with a package type is not a package marker" {
|
||||
mkdir -p "$ROOT/.git"
|
||||
printf 'name: p\ntype: prompts-only\n' > "$ROOT/apm.yml"
|
||||
run bash "$SCRIPT" my-rule "$ROOT"
|
||||
assert_failure
|
||||
assert [ ! -d "$ROOT/.apm" ]
|
||||
}
|
||||
|
||||
@test "expands a leading ~ in the root to HOME" {
|
||||
make_package
|
||||
run env HOME="$ROOT" bash "$SCRIPT" my-rule '~'
|
||||
assert_success
|
||||
assert [ -f "$ROOT/.apm/instructions/my-rule.instructions.md" ]
|
||||
}
|
||||
|
||||
@test "no-op when the file already exists" {
|
||||
make_package
|
||||
mkdir -p "$ROOT/.apm/instructions"
|
||||
echo "existing" > "$ROOT/.apm/instructions/my-rule.instructions.md"
|
||||
run bash "$SCRIPT" my-rule "$ROOT"
|
||||
assert_success
|
||||
run cat "$ROOT/.apm/instructions/my-rule.instructions.md"
|
||||
assert_output "existing"
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Template contents
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
@test "scaffold carries FILL IN placeholders and a quoted applyTo" {
|
||||
make_package
|
||||
bash "$SCRIPT" my-rule "$ROOT"
|
||||
file="$ROOT/.apm/instructions/my-rule.instructions.md"
|
||||
run grep -c 'FILL IN' "$file"
|
||||
assert_success
|
||||
run grep -E '^applyTo: "' "$file"
|
||||
assert_success
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# apm behaviour the skill's gotchas rest on (verified against apm 0.28.0)
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
@test "filled scaffold compiles for the Claude target into CLAUDE.md without the description" {
|
||||
need_apm
|
||||
make_package
|
||||
bash "$SCRIPT" my-rule "$ROOT"
|
||||
fill "$ROOT/.apm/instructions/my-rule.instructions.md"
|
||||
cd "$ROOT"
|
||||
run apm compile --target claude
|
||||
assert_success
|
||||
assert [ -f "$ROOT/CLAUDE.md" ]
|
||||
run grep -F 'Use type hints.' "$ROOT/CLAUDE.md"
|
||||
assert_success
|
||||
run grep -F 'Python style rules' "$ROOT/CLAUDE.md"
|
||||
assert_failure
|
||||
}
|
||||
|
||||
@test "install deploys .claude/rules with paths: and drops the description" {
|
||||
need_apm
|
||||
make_package
|
||||
bash "$SCRIPT" my-rule "$ROOT"
|
||||
fill "$ROOT/.apm/instructions/my-rule.instructions.md"
|
||||
cd "$ROOT"
|
||||
run apm install
|
||||
assert_success
|
||||
rule="$ROOT/.claude/rules/my-rule.md"
|
||||
assert [ -f "$rule" ]
|
||||
run grep -F 'paths:' "$rule"
|
||||
assert_success
|
||||
run grep -F '**/*.py' "$rule"
|
||||
assert_success
|
||||
run grep -F 'Python style rules' "$rule"
|
||||
assert_failure
|
||||
}
|
||||
|
||||
@test "once rules are installed, compile --target claude writes no CLAUDE.md and exits 0" {
|
||||
need_apm
|
||||
make_package
|
||||
bash "$SCRIPT" my-rule "$ROOT"
|
||||
fill "$ROOT/.apm/instructions/my-rule.instructions.md"
|
||||
cd "$ROOT"
|
||||
apm install
|
||||
run apm compile --target claude
|
||||
assert_success
|
||||
assert [ ! -f "$ROOT/CLAUDE.md" ]
|
||||
}
|
||||
|
||||
@test "an unquoted applyTo still installs, as a rule with no paths:" {
|
||||
need_apm
|
||||
make_package
|
||||
mkdir -p "$ROOT/.apm/instructions"
|
||||
printf -- '---\ndescription: x\napplyTo: **/*.py\n---\n# T\n\n- a\n' > "$ROOT/.apm/instructions/bad.instructions.md"
|
||||
cd "$ROOT"
|
||||
run apm install
|
||||
assert_success
|
||||
assert [ -f "$ROOT/.claude/rules/bad.md" ]
|
||||
run grep -F 'paths:' "$ROOT/.claude/rules/bad.md"
|
||||
assert_failure
|
||||
}
|
||||
|
||||
@test "compile --validate exits 0 and hides the warnings a real compile prints" {
|
||||
need_apm
|
||||
make_package
|
||||
mkdir -p "$ROOT/.apm/instructions"
|
||||
printf -- '---\napplyTo: "**/*.py"\n---\n' > "$ROOT/.apm/instructions/bare.instructions.md"
|
||||
cd "$ROOT"
|
||||
run apm compile --validate
|
||||
assert_success
|
||||
refute_output --partial "Missing 'description'"
|
||||
run apm compile --dry-run --target claude
|
||||
assert_success
|
||||
assert_output --partial "Missing 'description'"
|
||||
assert_output --partial "Empty content"
|
||||
}
|
||||
|
||||
@test "the raw scaffold is valid YAML and compiles with no parse warnings" {
|
||||
need_apm
|
||||
make_package
|
||||
run bash "$SCRIPT" my-rule "$ROOT"
|
||||
assert_success
|
||||
cd "$ROOT"
|
||||
run apm compile --dry-run --target claude
|
||||
assert_success
|
||||
assert_output --partial "dry-run"
|
||||
refute_output --partial "Failed to parse"
|
||||
refute_output --partial "Warning"
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
---
|
||||
name: prompt-author
|
||||
description: >
|
||||
Use when creating or revising an apm prompt file
|
||||
(`.apm/prompts/*.prompt.md`). Not read-only review -> `factory-audit`.
|
||||
Not skills -> `skill-author`. Not agents -> `agent-author`. Not
|
||||
instructions -> `instructions-author`.
|
||||
compatibility: Requires the apm CLI; behaviour verified against apm 0.28.0.
|
||||
allowed-tools: Bash Read Write Edit
|
||||
metadata:
|
||||
version: "0.1.0"
|
||||
category: factory
|
||||
source_keys:
|
||||
- apm-docs-author-prompts
|
||||
- apm-docs-llms-full
|
||||
- apm-docs-producer-ramp
|
||||
- apm-github-repo
|
||||
- apm-cli-0-28-0-prompt-experiments
|
||||
---
|
||||
|
||||
## Gotchas
|
||||
|
||||
- `apm compile` never reads prompt files, and `--validate` ignores them even when malformed. A prompt file is verified only by a throwaway `apm install`.
|
||||
- Unsupported frontmatter keys are dropped, loudly on the Claude family and silently on Gemini, which keeps only `description`. Codex, Kiro and Antigravity deploy nothing and print nothing.
|
||||
- `input:` descriptions are discarded: only the names survive, as `arguments:`. Duplicate names are not caught.
|
||||
|
||||
## Step 1 — Dispatch
|
||||
|
||||
| Condition | Flow | Reference |
|
||||
|---|---|---|
|
||||
| No file at the target path | Create | `references/create.md` |
|
||||
| A file exists, at least one improvement signal present | Improve | `references/improve.md` |
|
||||
| A file exists, no signals | Stop and ask | — |
|
||||
|
||||
Signals: grill output, audit findings, inline feedback, a session describing a command that is missing, argument-less or lost a field after install. With none, ask whether this is a new file or feedback to apply.
|
||||
|
||||
Read only the reference for the resolved flow.
|
||||
|
||||
## Step 2 — Contract
|
||||
|
||||
Gates on every file, whichever flow wrote it:
|
||||
|
||||
- **Source.** A single file named `<stem>.prompt.md` in `.apm/prompts/`, flat. Anything nested, uppercase or named plain `.md` is silently ignored.
|
||||
- **Stem.** Kebab-case. It becomes the deployed command name, and apm skips a hand-written file of the same name unless `--force` is passed. Check for a collision before choosing it.
|
||||
- **Frontmatter.** `description`, plus `input`, `allowed-tools`, `model` or `argument-hint` only when needed. No other keys: they are dropped, and `source_keys` would warn on every install.
|
||||
- **Arguments.** Declare `input:` names and use `${input:name}` in the body, or use a literal `$ARGUMENTS`, never both.
|
||||
- **Body.** Written as an instruction to the model, self-contained, and clear about what it produces. If unsure the content is a prompt file rather than a skill, a rule or something to enforce, read `references/content.md`.
|
||||
|
||||
If a field, name or location is in question, read `references/schema.md`. If the question is which target keeps which field, read `references/target-mapping.md`.
|
||||
|
||||
## Step 3 — Validate and close
|
||||
|
||||
- [ ] Verify with a throwaway `apm install` and read the deployed file: `references/verify.md`. Resolve every warning.
|
||||
- [ ] Bump the owning package's `apm.yml` `version` — **minor** on create, **patch** on improve — because consumers compare it to detect updates.
|
||||
|
||||
`factory-audit` has no prompt checks yet, so nothing else gates the file; report only what the verification showed.
|
||||
@@ -0,0 +1,5 @@
|
||||
# assets/
|
||||
|
||||
## templates/
|
||||
|
||||
- **`prompt.md`** — minimal valid `.apm/prompts/<name>.prompt.md`, copied by `scripts/new-prompt.sh`. Carries a `description`, one `input:` name and a body that uses it, marked `FILL IN:`, with the optional `allowed-tools`, `model` and `argument-hint` commented out. Field semantics are in `references/schema.md`, what each target keeps in `references/target-mapping.md`.
|
||||
@@ -0,0 +1,17 @@
|
||||
---
|
||||
# Delete these comments once filled in; Copilot receives this file verbatim.
|
||||
description: "FILL IN: one line on what this command does, shown in the command picker."
|
||||
input:
|
||||
- target
|
||||
# FILL IN: rename or remove. input takes names only, matching
|
||||
# [A-Za-z][A-Za-z0-9_-]{0,63}, no duplicates; a description beside a name is
|
||||
# discarded. It becomes `arguments:` on Claude. Do not also write a literal
|
||||
# $ARGUMENTS in the body: both would be deployed.
|
||||
# Optional, uncomment only if needed. The Claude family keeps them, Gemini drops them:
|
||||
# allowed-tools: Bash(git status:*) Read
|
||||
# model: FILL IN
|
||||
# argument-hint: "<target>" # synthesised from input: when omitted
|
||||
---
|
||||
FILL IN: an instruction to the model, written so it works with nothing else loaded.
|
||||
|
||||
Work on ${input:target}.
|
||||
@@ -0,0 +1,29 @@
|
||||
---
|
||||
source_keys:
|
||||
- apm-docs-author-prompts
|
||||
- apm-docs-producer-ramp
|
||||
---
|
||||
|
||||
# What belongs in a prompt file
|
||||
|
||||
Reached from `SKILL.md` Step 2. A prompt file is a single instruction a user fires by name, with arguments. It has no `references/`, no `scripts/` and no way to be loaded by description.
|
||||
|
||||
## Write
|
||||
|
||||
- An instruction to the model, in the imperative, that works with nothing else loaded.
|
||||
- What the output should be and where it goes, so the result is checkable.
|
||||
- Arguments as `${input:name}`, each declared in `input:`.
|
||||
|
||||
## Cut
|
||||
|
||||
- Background the model can read from the repository.
|
||||
- A second job. Two jobs are two files.
|
||||
- Descriptions of an argument beside its name in `input:`; they are discarded. Put the meaning in the body next to the placeholder.
|
||||
|
||||
## Not a prompt file?
|
||||
|
||||
Stop and tell the user when the content is any of these, and do not bend it into a prompt file:
|
||||
|
||||
- A multi-step procedure that needs `references/` or `scripts/`, or that other skills or the model must be able to call: a skill. Which kind is forge's call.
|
||||
- A rule that should apply without being typed: an instructions file.
|
||||
- Something that must run at a fixed point or be blocked: a hook or a `permissions.deny` setting.
|
||||
@@ -0,0 +1,39 @@
|
||||
---
|
||||
source_keys:
|
||||
- apm-docs-author-prompts
|
||||
- apm-cli-0-28-0-prompt-experiments
|
||||
---
|
||||
|
||||
# Creating a new prompt file
|
||||
|
||||
Return to `SKILL.md` Step 3 once the file is filled in (Step 3 below).
|
||||
|
||||
## Before touching the filesystem
|
||||
|
||||
Confirm, and ask the user for anything missing:
|
||||
|
||||
- [ ] What the prompt file does, in one sentence. Two jobs are two files.
|
||||
- [ ] Which arguments it takes, by name, or that it takes none.
|
||||
- [ ] A kebab-case stem. It becomes the command name.
|
||||
|
||||
## Step 1 — Check the stem
|
||||
|
||||
apm skips a hand-written file at a deployed path ("not managed by APM") and installs everything else. `--force` overwrites it. For each target in `targets:`, list its path from `references/target-mapping.md` in the consuming project and choose another stem on any hit.
|
||||
|
||||
## Step 2 — Scaffold
|
||||
|
||||
```bash
|
||||
bash scripts/new-prompt.sh <name> <path-inside-the-package>
|
||||
```
|
||||
|
||||
The script walks up for a `type:`-bearing `apm.yml`. With none it exits 1 and names `/apm-workflow configure`; run that first, then retry. It creates `.apm/prompts/` when absent and never overwrites an existing file.
|
||||
|
||||
## Step 3 — Fill in
|
||||
|
||||
Replace every `FILL IN:` and delete the template's comments.
|
||||
|
||||
- `description`: one line. Every target keeps it.
|
||||
- `input:`: argument names only, matching `[A-Za-z][A-Za-z0-9_-]{0,63}`, no duplicates. Remove the block for a command with no arguments, and drop `${input:...}` from the body.
|
||||
- Body: an instruction to the model that works with nothing else loaded. Read `references/content.md` if unsure the content belongs in a prompt file.
|
||||
|
||||
For a field or placeholder question, read `references/schema.md`.
|
||||
@@ -0,0 +1,35 @@
|
||||
---
|
||||
source_keys:
|
||||
- apm-docs-author-prompts
|
||||
- apm-cli-0-28-0-prompt-experiments
|
||||
---
|
||||
|
||||
# Improving an existing prompt file
|
||||
|
||||
Return to `SKILL.md` Step 3 once the edits are made.
|
||||
|
||||
## Step 1 — Read the file and the signals
|
||||
|
||||
Read the file whole. Apply the signals that triggered this flow (`SKILL.md` Step 1) and nothing else.
|
||||
|
||||
## Step 2 — Diagnose by symptom
|
||||
|
||||
| Symptom | Cause | Fix |
|
||||
|---|---|---|
|
||||
| The command does not exist after install | The file is nested, uppercase (`.PROMPT.md`) or a bare `.md`, so discovery ignored it | Move it flat into `.apm/prompts/` and name it `<stem>.prompt.md` |
|
||||
| The command is missing and install warned "malformed or over-budget YAML frontmatter" | Broken frontmatter, so Claude and Gemini skipped the file | Repair the YAML |
|
||||
| Install warned "frontmatter keys not supported … dropped" | The file carries keys the Claude family does not keep | Remove them, or accept that only Copilot keeps them |
|
||||
| An argument is missing from `arguments:` | The name failed `[A-Za-z][A-Za-z0-9_-]{0,63}` and install warned `input: rejected` | Rename it |
|
||||
| An argument appears twice | Duplicate names are not caught | Remove the duplicate |
|
||||
| `arguments:` lists `name` and `description` | An `input:` item had `name:` and `description:` keys, and each key became an argument | Use plain names, or one `{name: description}` pair per item |
|
||||
| The body shows `$ARGUMENTS` or `$0` next to named arguments | `input:` and a literal placeholder were both written | Use one style |
|
||||
| The Gemini command ignores `model` or `allowed-tools` | Gemini keeps only `description` and the body, silently | State it to the user; it is apm behaviour |
|
||||
| Nothing deployed for Codex, Kiro or Antigravity | Those targets have no prompt surface | State it to the user |
|
||||
| A hand-written command was not replaced | apm skips unmanaged files | Rename the stem, or use `apm install --force` knowingly |
|
||||
| Install failed with exit 1 and a security error | Tag characters or a bidi override in the file; the Claude-family command is withheld even with `--force`, while the Copilot copy and Gemini TOML may still be written | Remove the hidden characters |
|
||||
|
||||
Cases not in the table: read `references/target-mapping.md`.
|
||||
|
||||
## Step 3 — Split
|
||||
|
||||
A prompt file doing two jobs becomes two files. Do the split only when a signal names it.
|
||||
@@ -0,0 +1,44 @@
|
||||
---
|
||||
source_keys:
|
||||
- apm-docs-author-prompts
|
||||
- apm-github-repo
|
||||
- apm-cli-0-28-0-prompt-experiments
|
||||
---
|
||||
|
||||
# The prompt source file
|
||||
|
||||
Verified against apm 0.28.0. Reached from `SKILL.md` Step 2 when a field, a placeholder or the file's location is in question.
|
||||
|
||||
## Location and name
|
||||
|
||||
`.apm/prompts/<name>.prompt.md`, flat. A root-level `<name>.prompt.md` is also discovered, but `.apm/prompts/` is canonical.
|
||||
|
||||
- Discovery is non-recursive and case-sensitive. A file in a subdirectory, `X.PROMPT.md` or a bare `x.md` is ignored with exit 0.
|
||||
- The stem is the prompt file's name and, once deployed, the command name. There is no `name` field. Odd names (uppercase, underscores, dots, spaces) deploy unvalidated, so use kebab-case.
|
||||
- `apm init` creates only `apm.yml`; create `.apm/prompts/` yourself.
|
||||
- The manifest `type:` is validated (`instructions`, `skill`, `hybrid`, `prompts`) but never constrains what deploys.
|
||||
- Do not give a root file and a `.apm/prompts/` file the same stem. The root one wins and the other is skipped with a misleading "not managed by APM".
|
||||
|
||||
## Frontmatter
|
||||
|
||||
No closed schema; apm passes or drops keys per target.
|
||||
|
||||
| Key | Purpose |
|
||||
|---|---|
|
||||
| `description` | Shown in pickers; kept everywhere |
|
||||
| `input` | Argument names, a list of strings. Becomes `arguments:` on the Claude family. A list item `{name: description}` is accepted, but the description is discarded. An item with several keys, such as `name:` plus `description:`, makes each key an argument, so do not write one |
|
||||
| `allowed-tools` (alias `allowedTools`) | Tool allowlist. Copilot ignores it |
|
||||
| `model` | Model override |
|
||||
| `argument-hint` (alias `argumentHint`) | Hint text; synthesised as `<a> <b>` from `input` when omitted |
|
||||
|
||||
Input names must match `[A-Za-z][A-Za-z0-9_-]{0,63}`. An invalid name is dropped with a warning and the install still succeeds; duplicates are neither removed nor warned about.
|
||||
|
||||
The Copilot App workflow keys `interval`, `schedule_hour` and `schedule_day` mark a prompt file as a scheduled workflow that the command integrator skips. Do not use them in a plain prompt file. The VS Code keys `agent`, `tools` and `name` survive on Copilot only.
|
||||
|
||||
## Body placeholders
|
||||
|
||||
On the Claude family `${input:x}` and `${{input:x}}` become `$x`, including for undeclared names; `${input:x:placeholder}` is left alone. A literal `$ARGUMENTS` or `$0` passes through unchanged, so mixing it with `input:` yields both with no diagnostic.
|
||||
|
||||
## Validation
|
||||
|
||||
There is no prompt validator. `apm compile` never reads prompts and `--validate` ignores them, even malformed ones. Malformed YAML makes Claude and Gemini skip the file with a warning, while Copilot copies it verbatim silently. The only check is `references/verify.md`.
|
||||
@@ -0,0 +1,50 @@
|
||||
---
|
||||
source_keys:
|
||||
- apm-docs-author-prompts
|
||||
- apm-docs-llms-full
|
||||
- apm-docs-producer-ramp
|
||||
- apm-github-repo
|
||||
- apm-cli-0-28-0-prompt-experiments
|
||||
---
|
||||
|
||||
# Sources
|
||||
|
||||
## apm-docs-author-prompts
|
||||
|
||||
- **URL:** https://microsoft.github.io/apm/producer/author-primitives/prompts/
|
||||
- **Research doc:** plugins/kyberforge/docs/research/docs/microsoft-apm/sources.md (digest: plugins/kyberforge/docs/research/docs/microsoft-apm/prompt-primitive-schema.md)
|
||||
- **Description:** Official "Author a prompt" page: file layout, the preserved frontmatter keys, per-target output paths and the pitfalls list.
|
||||
- **Contributing files:** SKILL.md, references/create.md, references/improve.md, references/schema.md, references/target-mapping.md, references/content.md
|
||||
- **Status:** `extracted`
|
||||
|
||||
## apm-docs-llms-full
|
||||
|
||||
- **URL:** https://microsoft.github.io/apm/llms-full.txt
|
||||
- **Research doc:** plugins/kyberforge/docs/research/docs/microsoft-apm/sources.md (digest: plugins/kyberforge/docs/research/docs/microsoft-apm/prompt-target-mapping.md)
|
||||
- **Description:** The complete apm documentation dump, read for the target matrix, manifest `type` field, install ownership and stale-cleanup rules.
|
||||
- **Contributing files:** SKILL.md, references/target-mapping.md
|
||||
- **Status:** `extracted`
|
||||
|
||||
## apm-docs-producer-ramp
|
||||
|
||||
- **URL:** https://microsoft.github.io/apm/_llms-txt/producer-ramp.txt
|
||||
- **Research doc:** plugins/kyberforge/docs/research/docs/microsoft-apm/sources.md (digest: plugins/kyberforge/docs/research/docs/microsoft-apm/prompt-gotchas.md)
|
||||
- **Description:** Producer-ramp bundle covering prompt authoring, dual-surface naming and the verify loop.
|
||||
- **Contributing files:** SKILL.md, references/content.md
|
||||
- **Status:** `extracted`
|
||||
|
||||
## apm-github-repo
|
||||
|
||||
- **URL:** https://github.com/microsoft/apm
|
||||
- **Research doc:** plugins/kyberforge/docs/research/docs/microsoft-apm/sources.md (digest: plugins/kyberforge/docs/research/docs/microsoft-apm/prompt-primitive-schema.md)
|
||||
- **Description:** apm's own Python source read for the prompt and command integrators, discovery globs and the preserved-key set.
|
||||
- **Contributing files:** SKILL.md, references/schema.md
|
||||
- **Status:** `extracted`
|
||||
|
||||
## apm-cli-0-28-0-prompt-experiments
|
||||
|
||||
- **URL:** https://pypi.org/project/apm-cli/0.28.0/
|
||||
- **Research doc:** plugins/kyberforge/docs/research/docs/microsoft-apm/sources.md (digest: plugins/kyberforge/docs/research/docs/microsoft-apm/prompt-gotchas.md)
|
||||
- **Description:** The installed apm-cli 0.28.0 exercised in throwaway packages: discovery, manifest type, compile on prompts-only packages, per-target output and warnings, input-name and YAML edge cases, collisions, cleanup, hidden-Unicode scanning and packing.
|
||||
- **Contributing files:** SKILL.md, references/create.md, references/improve.md, references/schema.md, references/target-mapping.md, references/verify.md
|
||||
- **Status:** `extracted`
|
||||
@@ -0,0 +1,62 @@
|
||||
---
|
||||
source_keys:
|
||||
- apm-docs-author-prompts
|
||||
- apm-docs-llms-full
|
||||
- apm-cli-0-28-0-prompt-experiments
|
||||
---
|
||||
|
||||
# What each target receives
|
||||
|
||||
Verified against apm 0.28.0 in throwaway installs; runtime behaviour in the receiving tools was not tested. Reached from `SKILL.md` Step 2. Source syntax is in `references/schema.md`.
|
||||
|
||||
## Install is the only path
|
||||
|
||||
`apm compile` never touches prompts. `apm install` routes each one to a target's commands surface.
|
||||
|
||||
| Target | Deployed path | Transform |
|
||||
|---|---|---|
|
||||
| copilot | `.github/prompts/<n>.prompt.md` | Byte copy |
|
||||
| claude | `.claude/commands/<n>.md` | Reconstructed slash command |
|
||||
| cursor, opencode, grok-build | `.cursor/commands/`, `.opencode/commands/`, `.grok/commands/` `<n>.md` | Same transform as claude |
|
||||
| windsurf | `.windsurf/workflows/<n>.md` | Same transform |
|
||||
| gemini | `.gemini/commands/<n>.toml` | `description` and `prompt` only, silently |
|
||||
| codex, kiro, antigravity, agent-skills | none | Exit 0, no warning |
|
||||
|
||||
At user scope (`apm install -g`) claude, gemini and cursor deploy to their home commands directories and Copilot to `~/.copilot/prompts/`. The experimental targets (hermes, openclaw, copilot-cowork, grok-cloud, copilot-app) need a flag and are untested.
|
||||
|
||||
## Field survival
|
||||
|
||||
| Key | Copilot | Claude family | Gemini |
|
||||
|---|---|---|---|
|
||||
| `description` | kept | kept | kept |
|
||||
| `input` | as written | becomes `arguments:`, names only | dropped silently |
|
||||
| `allowed-tools` | kept (ignored by Copilot) | kept | dropped silently |
|
||||
| `model` | kept | kept | dropped silently |
|
||||
| `argument-hint` | kept | kept or synthesised | dropped silently |
|
||||
| any other key | kept | dropped, with a warning naming the keys | dropped silently |
|
||||
|
||||
The Claude command file holds only `allowed-tools`, `argument-hint`, `arguments`, `description` and `model`, sorted, with no trailing newline.
|
||||
|
||||
## Body placeholders by target
|
||||
|
||||
| Source | Claude family | Gemini | Copilot |
|
||||
|---|---|---|---|
|
||||
| `${input:x}`, `${{input:x}}` | `$x` | unchanged | unchanged |
|
||||
| `$ARGUMENTS` | unchanged | `{{args}}` | unchanged |
|
||||
| `$0`, `$1` | unchanged | unchanged, and an "Arguments: {{args}}" line is prepended | unchanged |
|
||||
|
||||
Claude Code natively supports `$ARGUMENTS`, zero-based `$N` and named `$name` from `arguments:`.
|
||||
|
||||
## Ownership and cleanup
|
||||
|
||||
- A hand-written file at a deployed path is skipped ("not managed by APM", exit 0); `--force` overwrites. Editing a deployed file and reinstalling silently overwrites it.
|
||||
- Removing a prompt file from the package and reinstalling deletes the deployed files. A hand-edited one is kept with a "delete manually" message.
|
||||
- Zero-width characters, BOM and NBSP warn and the file deploys to every target. Tag characters and bidi overrides are critical: install exits 1 and the Claude-family command is withheld, but the Copilot byte copy and Gemini TOML may still be written. `--force` makes the exit code 0 and changes nothing else.
|
||||
|
||||
## Packing
|
||||
|
||||
`apm pack --format plugin` copies `.apm/prompts/x.prompt.md` to `commands/x.md` unchanged and skips root-level prompts. Installing that bundle copies files verbatim, so `input:` survives untransformed and Copilot receives `.github/commands/`.
|
||||
|
||||
## Unverified
|
||||
|
||||
Claude Code, Cursor and Gemini runtime handling of the emitted files, the experimental targets, and `apm run` / `apm preview`. Say so rather than asserting any of them.
|
||||
@@ -0,0 +1,26 @@
|
||||
---
|
||||
source_keys:
|
||||
- apm-cli-0-28-0-prompt-experiments
|
||||
---
|
||||
|
||||
# Verifying a file in a throwaway package
|
||||
|
||||
Reached from `SKILL.md` Step 3. `apm compile` and `apm compile --validate` never read prompts, so they verify nothing. Install is the only check. Run it outside the repo: `apm install` writes `apm_modules/`, `apm.lock.yaml` and a commands directory.
|
||||
|
||||
1. Deploy the prompt where nothing else can be overwritten:
|
||||
|
||||
```bash
|
||||
d=$(mktemp -d)
|
||||
printf 'name: scratch\nversion: 0.1.0\ntype: prompts\ntargets:\n - claude\n' > "$d/apm.yml"
|
||||
mkdir -p "$d/.apm/prompts" "$d/.claude"
|
||||
cp <package-root>/.apm/prompts/<name>.prompt.md "$d/.apm/prompts/"
|
||||
(cd "$d" && apm install && cat .claude/commands/<name>.md)
|
||||
```
|
||||
|
||||
2. Read every warning install prints. A line starting "frontmatter keys not supported … dropped" lists keys that did not survive; "input: rejected" names an invalid argument; "Skipped command … malformed" means the file did not parse and no command exists.
|
||||
|
||||
3. The deployed file must contain `description` and, if `input:` was written, an `arguments:` list matching it. Body placeholders should read `$name`, not `${input:name}`. A missing file means the install skipped it.
|
||||
|
||||
4. For another target, add it to `targets:` and `cat` its deployed path from `references/target-mapping.md`. Gemini prints no warning for what it drops, so read its `.toml`.
|
||||
|
||||
Delete the directory afterwards. Report only what was observed; runtime behaviour in the receiving tool stays unverified.
|
||||
@@ -0,0 +1,3 @@
|
||||
# scripts/
|
||||
|
||||
- **`new-prompt.sh <name> <root>`** — scaffolds `<package-root>/.apm/prompts/<name>.prompt.md` from `assets/templates/prompt.md`, creating `.apm/prompts/` because `apm init` does not. Walks up from `<root>` for the nearest `type:`-bearing `apm.yml`; exits 1 with a pointer to `/apm-workflow configure` when there is none. Never overwrites an existing file. Run `--help` for the full contract.
|
||||
@@ -0,0 +1,116 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
SKILL_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
TEMPLATE="$SKILL_DIR/../assets/templates/prompt.md"
|
||||
|
||||
usage() {
|
||||
cat <<USAGE
|
||||
Usage: new-prompt.sh <name> <root>
|
||||
|
||||
Scaffold an apm prompt file from the bundled template.
|
||||
|
||||
Arguments:
|
||||
name Kebab-case stem. Becomes <name>.prompt.md and, after install, the
|
||||
command name (/<name> on the Claude family).
|
||||
root Existing path at or below the target package. The script walks up for
|
||||
the nearest apm.yml with a top-level type: field (instructions, skill,
|
||||
hybrid or prompts); an apm.yml without type: is a marketplace-only
|
||||
manifest and is skipped. Creates
|
||||
<package-root>/.apm/prompts/<name>.prompt.md
|
||||
|
||||
Exit codes:
|
||||
0 File created, or already existed (no-op)
|
||||
1 Invalid arguments, missing root, no package found, or template not found
|
||||
USAGE
|
||||
}
|
||||
|
||||
if [[ "${1:-}" == "--help" || "${1:-}" == "-h" ]]; then
|
||||
usage
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [[ $# -lt 2 ]]; then
|
||||
echo "Error: name and root are required." >&2
|
||||
echo "" >&2
|
||||
usage >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
NAME="$1"
|
||||
ROOT="${2/#\~/$HOME}"
|
||||
|
||||
if [[ ! $NAME =~ ^[a-z0-9]+(-[a-z0-9]+)*$ ]]; then
|
||||
echo "Error: name must use lowercase letters, numbers, and hyphens only." >&2
|
||||
echo " No leading, trailing, or consecutive hyphens." >&2
|
||||
echo " Received: '$NAME'" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -f "$TEMPLATE" ]]; then
|
||||
echo "Error: template not found at '$TEMPLATE'." >&2
|
||||
echo " Run this script from its original location inside the prompt-author skill." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -d "$ROOT" ]]; then
|
||||
echo "Error: root directory '$ROOT' does not exist." >&2
|
||||
exit 1
|
||||
fi
|
||||
ROOT="$(cd "$ROOT" && pwd)"
|
||||
|
||||
# Same marker as agent-author's new-agent.sh: a top-level type: naming one of
|
||||
# the four package types, with matching quotes if quoted.
|
||||
is_apm_package_manifest() {
|
||||
local apm_yml="$1" line
|
||||
while IFS= read -r line || [[ -n "$line" ]]; do
|
||||
if [[ "$line" =~ ^type:[[:space:]]*(instructions|skill|hybrid|prompts)([[:space:]]|$) ]]; then
|
||||
return 0
|
||||
fi
|
||||
if [[ "$line" =~ ^type:[[:space:]]*([\"\'])(instructions|skill|hybrid|prompts)([\"\'])([[:space:]]|$) ]] \
|
||||
&& [[ "${BASH_REMATCH[1]}" == "${BASH_REMATCH[3]}" ]]; then
|
||||
return 0
|
||||
fi
|
||||
done < "$apm_yml"
|
||||
return 1
|
||||
}
|
||||
|
||||
PACKAGE_ROOT=""
|
||||
current="$ROOT"
|
||||
while true; do
|
||||
if [[ -f "$current/apm.yml" ]] && is_apm_package_manifest "$current/apm.yml"; then
|
||||
PACKAGE_ROOT="$current"
|
||||
break
|
||||
fi
|
||||
if [[ -e "$current/.git" ]]; then
|
||||
break
|
||||
fi
|
||||
parent="$(dirname "$current")"
|
||||
[[ "$parent" == "$current" ]] && break
|
||||
current="$parent"
|
||||
done
|
||||
|
||||
if [[ -z "$PACKAGE_ROOT" ]]; then
|
||||
echo "Error: no apm package found at or above '$ROOT'." >&2
|
||||
echo " Prompt files only deploy from a package's .apm/prompts/. Run" >&2
|
||||
echo " /apm-workflow configure (apm plugin init) there first, then retry." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
DEST_DIR="$PACKAGE_ROOT/.apm/prompts"
|
||||
DEST="$DEST_DIR/$NAME.prompt.md"
|
||||
|
||||
if [[ -f "$DEST" ]]; then
|
||||
echo "Skipping '$DEST' — already exists." >&2
|
||||
exit 0
|
||||
fi
|
||||
|
||||
mkdir -p "$DEST_DIR"
|
||||
cp "$TEMPLATE" "$DEST"
|
||||
echo "Created: $DEST" >&2
|
||||
echo "" >&2
|
||||
echo "Next steps:" >&2
|
||||
echo " 1. Fill in $DEST — replace every FILL IN: placeholder and delete the comments." >&2
|
||||
echo " 2. Check '$NAME' does not collide with a hand-written <target>/commands/$NAME.md:" >&2
|
||||
echo " apm skips it with 'not managed by APM' unless install --force is passed." >&2
|
||||
echo " 3. Verify with a throwaway apm install, not apm compile: compile never reads prompts." >&2
|
||||
@@ -0,0 +1,13 @@
|
||||
# tests/
|
||||
|
||||
- **`new-prompt.bats`** — covers `scripts/new-prompt.sh`: name validation, package walk-up, no-package refusal, creating `.apm/prompts/`, no-op on an existing file and template placeholders. It does not assert apm's behaviour; the skill's gotchas are checked by hand with `references/verify.md`.
|
||||
|
||||
## Dependencies
|
||||
|
||||
The test file loads `bats-support` and `bats-assert` from the repo root's `tests/test_helper/`, and runs on the repo's bats submodule at `tests/bats/`. The first `bash tests/run-bats.sh` initialises the submodules.
|
||||
|
||||
From the repo root:
|
||||
|
||||
```bash
|
||||
tests/bats/bin/bats plugins/kyberforge/.apm/skills/prompt-author/tests/new-prompt.bats
|
||||
```
|
||||
@@ -0,0 +1,178 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
setup() {
|
||||
REPO_ROOT="$(cd "$BATS_TEST_DIRNAME/../../../../../../" && pwd)"
|
||||
load "$REPO_ROOT/tests/test_helper/bats-support/load"
|
||||
load "$REPO_ROOT/tests/test_helper/bats-assert/load"
|
||||
|
||||
SCRIPT="$(cd "$BATS_TEST_DIRNAME/../scripts" && pwd)/new-prompt.sh"
|
||||
ROOT="$(mktemp -d)"
|
||||
}
|
||||
|
||||
teardown() {
|
||||
rm -rf "$ROOT"
|
||||
}
|
||||
|
||||
make_package() {
|
||||
printf 'name: my-package\nversion: 0.1.0\ntype: prompts\ntargets:\n - claude\n' > "$ROOT/apm.yml"
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Help and arguments
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
@test "--help exits 0" {
|
||||
run bash "$SCRIPT" --help
|
||||
assert_success
|
||||
assert_output --partial "Usage:"
|
||||
}
|
||||
|
||||
@test "missing arguments exits 1" {
|
||||
run bash "$SCRIPT"
|
||||
assert_failure
|
||||
assert_output --partial "name and root are required"
|
||||
}
|
||||
|
||||
@test "nonexistent root exits 1" {
|
||||
run bash "$SCRIPT" my-prompt "$ROOT/missing"
|
||||
assert_failure
|
||||
assert_output --partial "does not exist"
|
||||
}
|
||||
|
||||
@test "rejects names that are not kebab-case" {
|
||||
make_package
|
||||
for bad in My-Rule my_rule -leading trailing- double--hyphen; do
|
||||
run bash "$SCRIPT" "$bad" "$ROOT"
|
||||
assert_failure
|
||||
assert_output --partial "lowercase letters"
|
||||
done
|
||||
assert [ ! -d "$ROOT/.apm" ]
|
||||
}
|
||||
|
||||
@test "rejects a name containing a newline" {
|
||||
make_package
|
||||
run bash "$SCRIPT" $'my-prompt\nextra' "$ROOT"
|
||||
assert_failure
|
||||
assert_output --partial "lowercase letters"
|
||||
assert [ ! -d "$ROOT/.apm" ]
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Package resolution
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
@test "creates <name>.prompt.md under .apm/prompts/, which apm init does not create" {
|
||||
make_package
|
||||
assert [ ! -d "$ROOT/.apm" ]
|
||||
run bash "$SCRIPT" my-prompt "$ROOT"
|
||||
assert_success
|
||||
assert [ -f "$ROOT/.apm/prompts/my-prompt.prompt.md" ]
|
||||
}
|
||||
|
||||
@test "walks up from a subdirectory to the package root" {
|
||||
make_package
|
||||
mkdir -p "$ROOT/deep/er"
|
||||
run bash "$SCRIPT" my-prompt "$ROOT/deep/er"
|
||||
assert_success
|
||||
assert [ -f "$ROOT/.apm/prompts/my-prompt.prompt.md" ]
|
||||
assert [ ! -d "$ROOT/deep/er/.apm" ]
|
||||
}
|
||||
|
||||
@test "skips a type-less apm.yml and keeps walking up" {
|
||||
make_package
|
||||
mkdir -p "$ROOT/marketplace"
|
||||
printf 'name: catalog\nmarketplace:\n packages: []\n' > "$ROOT/marketplace/apm.yml"
|
||||
run bash "$SCRIPT" my-prompt "$ROOT/marketplace"
|
||||
assert_success
|
||||
assert [ -f "$ROOT/.apm/prompts/my-prompt.prompt.md" ]
|
||||
assert [ ! -d "$ROOT/marketplace/.apm" ]
|
||||
}
|
||||
|
||||
@test "accepts a quoted type value" {
|
||||
printf 'name: p\ntype: "hybrid"\n' > "$ROOT/apm.yml"
|
||||
run bash "$SCRIPT" my-prompt "$ROOT"
|
||||
assert_success
|
||||
assert [ -f "$ROOT/.apm/prompts/my-prompt.prompt.md" ]
|
||||
}
|
||||
|
||||
@test "no package: exits 1, points at apm-workflow configure, writes nothing" {
|
||||
mkdir -p "$ROOT/.git"
|
||||
run bash "$SCRIPT" my-prompt "$ROOT"
|
||||
assert_failure
|
||||
assert_output --partial "apm-workflow configure"
|
||||
assert [ ! -d "$ROOT/.apm" ]
|
||||
}
|
||||
|
||||
@test "does not walk above a .git boundary" {
|
||||
make_package
|
||||
mkdir -p "$ROOT/repo/.git"
|
||||
run bash "$SCRIPT" my-prompt "$ROOT/repo"
|
||||
assert_failure
|
||||
assert [ ! -d "$ROOT/.apm" ]
|
||||
}
|
||||
|
||||
@test "a mismatched-quote type value is not a package marker" {
|
||||
mkdir -p "$ROOT/.git"
|
||||
printf 'name: p\ntype: "hybrid'"'"'\n' > "$ROOT/apm.yml"
|
||||
run bash "$SCRIPT" my-prompt "$ROOT"
|
||||
assert_failure
|
||||
assert [ ! -d "$ROOT/.apm" ]
|
||||
}
|
||||
|
||||
@test "a type value that only starts with a package type is not a package marker" {
|
||||
mkdir -p "$ROOT/.git"
|
||||
printf 'name: p\ntype: prompts-only\n' > "$ROOT/apm.yml"
|
||||
run bash "$SCRIPT" my-prompt "$ROOT"
|
||||
assert_failure
|
||||
assert [ ! -d "$ROOT/.apm" ]
|
||||
}
|
||||
|
||||
@test "expands a leading ~ in the root to HOME" {
|
||||
make_package
|
||||
run env HOME="$ROOT" bash "$SCRIPT" my-prompt '~'
|
||||
assert_success
|
||||
assert [ -f "$ROOT/.apm/prompts/my-prompt.prompt.md" ]
|
||||
}
|
||||
|
||||
@test "no-op when the file already exists" {
|
||||
make_package
|
||||
mkdir -p "$ROOT/.apm/prompts"
|
||||
echo "existing" > "$ROOT/.apm/prompts/my-prompt.prompt.md"
|
||||
run bash "$SCRIPT" my-prompt "$ROOT"
|
||||
assert_success
|
||||
run cat "$ROOT/.apm/prompts/my-prompt.prompt.md"
|
||||
assert_output "existing"
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Template contents
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
@test "scaffold carries FILL IN placeholders and one input name" {
|
||||
make_package
|
||||
bash "$SCRIPT" my-prompt "$ROOT"
|
||||
file="$ROOT/.apm/prompts/my-prompt.prompt.md"
|
||||
run grep -c 'FILL IN' "$file"
|
||||
assert_success
|
||||
run grep -E '^input:' "$file"
|
||||
assert_success
|
||||
run grep -c '^ - ' "$file"
|
||||
assert_output "1"
|
||||
run grep -F '${input:target}' "$file"
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "scaffold has no source_keys and no Copilot App workflow keys" {
|
||||
make_package
|
||||
bash "$SCRIPT" my-prompt "$ROOT"
|
||||
file="$ROOT/.apm/prompts/my-prompt.prompt.md"
|
||||
run grep -E '^(source_keys|interval|schedule_hour|schedule_day):' "$file"
|
||||
assert_failure
|
||||
}
|
||||
|
||||
@test "scaffold frontmatter is closed" {
|
||||
make_package
|
||||
bash "$SCRIPT" my-prompt "$ROOT"
|
||||
run grep -c '^---$' "$ROOT/.apm/prompts/my-prompt.prompt.md"
|
||||
assert_output "2"
|
||||
}
|
||||
@@ -6,7 +6,7 @@ description: >
|
||||
Not read-only review -> `factory-audit`. Not agent files -> `agent-author`.
|
||||
allowed-tools: Bash Read Write Edit
|
||||
metadata:
|
||||
version: "1.0.5"
|
||||
version: "1.0.6"
|
||||
category: factory
|
||||
source_keys:
|
||||
- agentskills-home
|
||||
@@ -34,7 +34,7 @@ metadata:
|
||||
|
||||
Signals: grill output, `/factory-audit` findings, inline feedback, eval results, session context describing what went wrong. With none, ask whether the user meant to create a new skill or has feedback to apply.
|
||||
|
||||
Read only the reference matching the resolved flow — 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.
|
||||
Read only the reference matching the resolved flow — each is self-contained.
|
||||
|
||||
## Step 2 — Invocation axis
|
||||
|
||||
@@ -58,5 +58,3 @@ Gates `/factory-audit` enforces in both flows:
|
||||
Run `/factory-audit` on the resolved skill directory; resolve every FAIL before reporting done. It checks name-to-directory match, placeholders, both size budgets, boundary-target resolution and script hygiene — do not hand-check those. Hand-check the one thing it misses: an empty body reports `PASS SKILL.md body word count 0 (ADR-0020 target: 600)`, so confirm at least one non-empty section exists.
|
||||
|
||||
Bump `metadata.version`: the **minor** version on create (new skills start at `0.1.0`) and the **patch** version on improve.
|
||||
|
||||
**Commit verification.** Inside a git worktree: once the audit is clean, run `rtk git add` and `rtk git commit` — do not stop at staging. Re-run `rtk git log --oneline -1` and confirm the hash changed from Step 1's. A non-empty `git diff --stat` is not proof: staged-but-uncommitted work is part of no commit and is silently lost if the tree is cleaned up. Report done only once the hash has changed. Outside a worktree (a skill under `~/.claude/skills/`, say) nothing is committable — report done on a clean audit, naming that as the reason.
|
||||
@@ -9,8 +9,8 @@ source_keys:
|
||||
|
||||
# Creating a new skill
|
||||
|
||||
Return to `SKILL.md` Step 4 once Step 6 below is done — validation, versioning and commit
|
||||
verification are shared with the improve flow and are not repeated here.
|
||||
Return to `SKILL.md` Step 4 once Step 6 below is done — validation and versioning
|
||||
are shared with the improve flow and are not repeated here.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@ source_keys:
|
||||
|
||||
# Improving an existing skill
|
||||
|
||||
Return to `SKILL.md` Step 4 once Step 4 below is done — validation, versioning and commit
|
||||
verification are shared with the create flow and are not repeated here.
|
||||
Return to `SKILL.md` Step 4 once Step 4 below is done — validation and versioning
|
||||
are shared with the create flow and are not repeated here.
|
||||
|
||||
## Step 1 — Verify inputs
|
||||
|
||||
|
||||
@@ -39,9 +39,11 @@ Authoring source lives in `.apm/`; it is the only content source and the only th
|
||||
|
||||
| Skill | Description |
|
||||
|---|---|
|
||||
| `forge` | Grill an unclassified "I want to add something" request, decide whether it's a skill, agent, plugin, or marketplace entry, then route to the matching author skill |
|
||||
| `forge` | Grill an unclassified "I want to add something" request, decide whether it's a skill, agent, instructions file, prompt file, plugin, or marketplace entry, then route to the matching author skill |
|
||||
| `skill-author` | Create or improve a skill from scratch, audit findings, or inline feedback |
|
||||
| `agent-author` | Author an agent definition file |
|
||||
| `instructions-author` | Create or improve an apm instructions file (`.apm/instructions/*.instructions.md`): path-scoped or always-on rules, verified with a real compile and a throwaway deploy |
|
||||
| `prompt-author` | Create or improve an apm prompt file (`.apm/prompts/*.prompt.md`): a single-file command with arguments, verified with a throwaway `apm install` because `apm compile` never reads prompts |
|
||||
| `factory-audit` | Audit a skill directory or an agent definition — structure, provider safety, description and body quality, and provenance; produces a findings report. Auto-detects which of the two it was handed (ADR-0025) |
|
||||
| `apm-install` | Install or upgrade the apm CLI and set up the agent runtimes it drives (Copilot CLI, Codex, Gemini, generic llm) |
|
||||
| `apm-workflow` | Author apm.yml, scaffold an apm package/marketplace, install dependencies, and compile/pack/publish/audit apm content |
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
name: kyberforge
|
||||
version: 2.0.1
|
||||
version: 2.2.1
|
||||
description: Skills and agents for creating, maintaining, and managing an apm plugin marketplace for Claude Code and GitHub Copilot.
|
||||
author:
|
||||
name: Defame1297
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
---
|
||||
topic: instructions-gotchas
|
||||
source_keys:
|
||||
- apm-cli-0-28-0-experiments
|
||||
- apm-docs-site
|
||||
- claude-code-memory-docs
|
||||
- cursor-rules-docs
|
||||
- github-copilot-custom-instructions-docs
|
||||
---
|
||||
|
||||
Surprising behaviours and source contradictions for the instructions primitive. "Verified" means observed with the installed apm 0.28.0 in a throwaway directory outside the repo. Everything else is stated as sourced or inferred.
|
||||
|
||||
## Verified failure modes
|
||||
|
||||
### Unquoted glob silently widens scope
|
||||
|
||||
`applyTo: **/*.py` (unquoted) is a YAML alias error. Verified outcome:
|
||||
|
||||
- `apm compile` and `apm compile --validate` print "Failed to parse" and skip the file, exit 0; the validated-primitive count is one lower.
|
||||
- `apm install` still deploys the file, to `.claude/rules/<name>.md` with no `paths:` frontmatter. A rule meant for Python files becomes an unconditional rule loaded in every session. Nothing errors.
|
||||
- Any frontmatter that is broken YAML (for example `description: [broken`) behaves the same way.
|
||||
- Claude Code itself behaves consistently: invalid frontmatter is ignored and the rule loads without `paths`.
|
||||
|
||||
Rule for the skill: always quote `applyTo`, and after scaffolding check that the deployed file has the expected `paths:`; a missing frontmatter block is the symptom.
|
||||
|
||||
### Validation never fails
|
||||
|
||||
Missing `description`, missing `applyTo` and an empty body are warnings only. `apm compile --validate` prints "All primitives validated successfully" and exits 0 even for those, and shows none of the warnings. Only a real `apm compile` prints them. `apm install` and `apm audit --ci` print nothing about instruction content. The official docs call `description` and `applyTo` required; the binary does not enforce either. Any enforcement has to live in this repo's own checks.
|
||||
|
||||
### Nested files: compile sees them, install does not
|
||||
|
||||
`.apm/instructions/sub/x.instructions.md` is folded into compiled root files but never deployed natively. A plain `x.md` (no `.instructions` infix) is ignored by both.
|
||||
|
||||
### Compile writes nothing when native rules exist (Claude, Copilot, Antigravity)
|
||||
|
||||
`apm compile --target claude` after an install exits 0, prints "produced no output files" and creates no `CLAUDE.md`. Use `--force-instructions` or compile in a project with no native rules. A test that only checks the exit code passes without testing anything.
|
||||
|
||||
### Compile duplicates content for the other targets
|
||||
|
||||
For cursor, windsurf, kiro, codex (and grok, opencode by source) compile still writes `AGENTS.md` even though native rules exist, so the same instruction reaches the agent twice.
|
||||
|
||||
### Install overwrites hand-authored rule files
|
||||
|
||||
For claude, cursor, windsurf, kiro and antigravity, an existing file at the deployed path is replaced without warning. Copilot skips it and asks for `--force`.
|
||||
|
||||
### Empty-source compile
|
||||
|
||||
In a package with no instruction primitives, plain `apm compile --target claude` prints "No instruction files found in .apm/ directory" and exits 1; `apm compile --clean` exits 0. This matches the apm-workflow compile reference. Exit 0 with no output is a different case: instructions exist but are already deployed natively (above).
|
||||
|
||||
## Cursor-specific
|
||||
|
||||
- Install emits `globs` plus `description` and never `alwaysApply`. Per the Cursor docs a rule with only a `description` is "Apply Intelligently", so an unscoped apm instruction does not become always-on in Cursor (inferred from docs plus verified output; Cursor runtime not tested).
|
||||
- Multiple globs are emitted as a YAML list (Kiro likewise). The Cursor docs show only a comma-separated string. Unverified whether Cursor honours the list form.
|
||||
|
||||
## Claude-specific
|
||||
|
||||
- `description` is dropped, so it can never appear in a `.claude/rules/` file; do not rely on it for Claude Code. Source: the apm source transform and verified deployed output. The apm docs do not state this.
|
||||
- A rule with no `applyTo` becomes a file with no frontmatter and loads at every launch, which costs context. Claude Code guidance is to keep each file short (under 200 lines).
|
||||
- The documented Claude `paths` budget is 1,000 brace-expanded patterns and 4 MiB.
|
||||
|
||||
## Contradictions between sources
|
||||
|
||||
| Point | Official apm docs | Installed 0.28.0 behaviour |
|
||||
|---|---|---|
|
||||
| `description` | Required | Warning only |
|
||||
| `applyTo` | Listed as required and also as optional | Optional, warning only |
|
||||
| Instruction with no `applyTo` | Folded into compiled root files instead of a per-file rule | Still deployed per-file on every rule-directory target (Claude: no frontmatter; Cursor: description only; Windsurf: `always_on`; Kiro: `always`) and also compiled |
|
||||
| Grok deployed name | `.grok/rules/<name>.md` | `.grok/rules/<name>.instructions.md` |
|
||||
| Compile scope | Docs say compile "only handles instructions" | Consistent for content, but compile also emits GEMINI.md and honours the agents_md mode |
|
||||
| Cursor and Windsurf at user scope | Two fetches of the docs disagreed | Source excludes both at user scope; the source was preferred |
|
||||
|
||||
An earlier version of this topic's schema file described missing `description` and empty content as errors and `skip_instructions` as a config flag; both were wrong for 0.28.0 (warnings; internal variable).
|
||||
|
||||
## Unverified
|
||||
|
||||
- Whether Cursor accepts a YAML list for `globs`.
|
||||
- Whether Copilot ignores unknown frontmatter keys such as `description`; its docs list only `applyTo` and `excludeAgent`.
|
||||
- Runtime behaviour of Windsurf, Kiro and Antigravity on the emitted frontmatter; no downstream docs were fetched.
|
||||
- Windsurf user-scope global rules.
|
||||
- The Context7 step was unavailable (invalid API key), so the registry carries no fresh Context7 pull. Doc pages were summarised by a smaller model before reaching this file and can be lossy.
|
||||
- Apm versions other than 0.28.0 were not tested.
|
||||
|
||||
## What belongs in an instruction body
|
||||
|
||||
From the Claude Code memory docs (`claude-code-memory-docs`): instructions reach Claude as context, not enforced configuration, so adherence rises with specificity and falls with length and contradiction.
|
||||
|
||||
- Write rules concrete enough to verify: "Use 2-space indentation", "Run `npm test` before committing", "API handlers live in `src/api/handlers/`", not "Format code properly" or "Keep files organized".
|
||||
- Keep to facts Claude should hold every session: build commands, conventions, layout, "always do X" rules. The `/doctor` trim check cuts what Claude can derive from the codebase (directory layouts, dependency lists, architecture overviews) and keeps pitfalls, rationale and conventions that differ from tool defaults.
|
||||
- A multi-step procedure, or guidance that matters for one task, belongs in a skill. Guidance that matters for one part of the codebase belongs in a path-scoped rule.
|
||||
- Something that must happen at a fixed point (before every commit) or must be blocked is a hook or a `permissions.deny` entry, never an instruction: "Settings rules are enforced by the client regardless of what Claude decides to do. CLAUDE.md instructions shape Claude's behavior but are not a hard enforcement layer."
|
||||
- Two instructions that contradict each other make Claude pick one arbitrarily, across user and project files and across rules.
|
||||
- Under 200 lines per file; one topic per file.
|
||||
+50
-42
@@ -3,64 +3,72 @@ topic: instructions-primitive-schema
|
||||
source_keys:
|
||||
- context7-microsoft-apm
|
||||
- apm-github-repo
|
||||
- apm-docs-site
|
||||
- apm-cli-0-28-0-experiments
|
||||
---
|
||||
|
||||
## File location, naming, and frontmatter
|
||||
Scope of this file: what an instructions source file is, where it lives, what its frontmatter means, how `applyTo` is parsed, and what validation exists. Per-target output is in `instructions-target-mapping.md`; behaviours that surprised us and where sources disagree are in `instructions-gotchas.md`. Everything here was re-checked against apm 0.28.0 (the installed binary) in this revision.
|
||||
|
||||
`.apm/instructions/*.instructions.md`. Confirmed as the genuine required extension (not assumed) via APM's own discovery glob in `apm_cli/primitives/discovery.py`: `**/.apm/instructions/*.instructions.md` (and the `.github/instructions/` mirror, plus a bare `**/*.instructions.md` fallback).
|
||||
## File location, naming, and discovery
|
||||
|
||||
Unlike prompts and hooks, instructions **do** have a small, concretely modeled dataclass — `apm_cli.primitives.models.Instruction` — because instructions feed APM's own compile pipeline (they get folded into root context files), not just pass-through deployment:
|
||||
Source files live at `.apm/instructions/<name>.instructions.md`. The `.instructions.md` double extension is the real discovery key: the parser strips `.instructions.md` to get the primitive name, and a plain `.md` file in `.apm/instructions/` is ignored by both compile and install (verified by experiment).
|
||||
|
||||
```python
|
||||
@dataclass
|
||||
class Instruction:
|
||||
name: str
|
||||
file_path: Path
|
||||
description: str
|
||||
apply_to: str # from frontmatter key "applyTo"; empty means global/unconditional
|
||||
content: str
|
||||
author: str | None = None
|
||||
version: str | None = None
|
||||
source: str | None = None
|
||||
```
|
||||
Discovery is not identical in compile and install:
|
||||
|
||||
Frontmatter fields: `description` (required by convention — its absence is a validation error) and `applyTo` (a glob or comma-separated glob list, or a YAML sequence — APM normalizes all three input shapes into one canonical comma-separated form internally via `normalize_apply_to`/`parse_apply_to`). No `applyTo` means the rule is treated as **unconditional** — folded into root context files as always-on guidance rather than scoped to specific paths.
|
||||
- `apm install` (the per-target deploy step) looks only in `.apm/instructions/` of the package, non-recursively. An instruction placed in a subdirectory such as `.apm/instructions/sub/x.instructions.md` is not deployed to any target (verified by experiment).
|
||||
- `apm compile` (the root-context fold-in) discovers with a wider glob set: `.apm/instructions/`, a `.github/instructions/` mirror, and a bare `**/*.instructions.md` fallback. The same nested file that install ignores is picked up by compile (verified by experiment). An author who nests files therefore gets them in `CLAUDE.md`/`AGENTS.md` but not in `.claude/rules/` or any other native rules directory.
|
||||
- Dependency packages are scanned the same way: `instructions/*.instructions.md` under the dependency's `.apm/` (and `.github/` as a fallback).
|
||||
- Primitive name collisions across local and dependency sources are tracked as conflicts; local wins.
|
||||
|
||||
`Instruction.validate()` produces these built-in errors/warnings:
|
||||
- Missing `description` → error: `"Missing 'description' in frontmatter"`.
|
||||
- Missing `applyTo` → warning-level: `"No 'applyTo' pattern specified -- instruction will apply globally"` (not fatal — it's accepted, just broad).
|
||||
- Empty body → error: `"Empty content"`.
|
||||
The deployed filename derives from the source stem: `<stem>.instructions.md` becomes `<stem>.md`, `<stem>.mdc`, or stays `<stem>.instructions.md`, depending on target.
|
||||
|
||||
## Compile-time mapping: two entirely different mechanisms per target
|
||||
## Frontmatter fields
|
||||
|
||||
This is the biggest divergence from the agent/skill/prompt primitives, and the one most likely to surprise: **Claude Code does not get a verbatim copy of the `.instructions.md` file at all.**
|
||||
The parser reads exactly these keys from the frontmatter into the `Instruction` model: `description`, `applyTo`, plus optional `author` and `version`. Nothing else is modelled. There is no `name` field; the name always comes from the filename.
|
||||
|
||||
**Copilot CLI — verbatim, native primitive.** `PrimitiveMapping("instructions", ".instructions.md", "github_instructions")` on the `copilot` target has no `output_compare` flag, so `InstructionIntegrator` copies content through unchanged, preserving the original `applyTo:` frontmatter byte-for-byte (per the integrator's own docstring: "Copilot: `.github/instructions/` (verbatim, preserving applyTo:)"). This is deployed by `apm install`, not `apm compile`.
|
||||
- `description`: one-line summary. The official authoring page lists it as required. In the binary it is only a warning when missing (see Validation). It is consumed by Cursor (kept in the `.mdc`, and auto-generated from the first body sentence when missing) and by Copilot (verbatim file). It is discarded for Claude Code, Windsurf, Kiro, Antigravity, and in all compiled root files.
|
||||
- `applyTo`: a glob that scopes the rule. See the grammar below. The official authoring page labels it required for instructions, yet states elsewhere that omitting it is supported and yields an unconditional rule. The binary treats it as optional with a warning.
|
||||
- `author`, `version`: parsed into the model but never emitted to any target.
|
||||
|
||||
At **Copilot user scope only** (`~/.copilot/`), individual files are not deployed — Copilot CLI at user scope reads a single `copilot-instructions.md`, so APM concatenates all instructions into that one file instead (`user_primitive_overrides: {"instructions": PrimitiveMapping("", ".md", "copilot_user_instructions")}`). Project-scope behavior (per-file, `.github/instructions/`) is unaffected.
|
||||
Body is plain markdown. An empty body is a validation warning. The official guidance for body style is: bullets over prose, one topic per file (split `python-style` from `python-testing`), cite paths in backticks, no greetings or meta-commentary, and do not assume other context is loaded. No numeric size limit is documented by apm; the downstream tools give their own (Claude Code recommends under 200 lines per instruction file; Cursor recommends under 500 lines per rule; Copilot says repository-wide instructions should be no longer than two pages).
|
||||
|
||||
**Claude Code — real reconstruction into `.claude/rules/`, with field-dropping.** `PrimitiveMapping("rules", ".md", "claude_rules", output_compare=True)` marks this as one of APM's four "rule formats" (`RULE_FORMATS = {cursor_rules, claude_rules, windsurf_rules, kiro_steering}`) that transform their source rather than copy it. `InstructionIntegrator._convert_to_claude_rules()`:
|
||||
## applyTo grammar
|
||||
|
||||
- Parses the source frontmatter and pulls only `applyTo` — **`description` is dropped entirely**, not carried into the output in any form.
|
||||
- Converts `applyTo` into a `paths:` YAML list (one `parse_apply_to()`-split glob per line), e.g. `applyTo: "**/*.py"` → `paths:\n - "**/*.py"`.
|
||||
- If there was no `applyTo` (unconditional instruction), the output has **no frontmatter at all** — just the raw body, matching Claude's convention that files without `paths:` in `.claude/rules/` apply unconditionally.
|
||||
- Filename is renamed: `<x>.instructions.md` → `<x>.md` (the primitive's `extension` field, `.md`, replaces the source suffix — this is the general rule for every `output_compare=True` "rule format").
|
||||
`applyTo` is normalised to one comma-separated string and then split by `parse_apply_to`:
|
||||
|
||||
This is architecturally the same category of lossy, real transformation the prior agent-primitive research found for Codex/Kiro agents — except here it's the default behavior for Claude specifically (not an opt-out edge case), and it applies even though Claude and Copilot are both first-class, actively-supported targets.
|
||||
- A single glob: `"**/*.py"`.
|
||||
- A comma-separated list in one string: `"**/*.css,**/*.scss"`. Whitespace around segments is trimmed and empty segments are dropped, so `"**/*.py, **/*.go"` is fine.
|
||||
- A YAML sequence: every non-null entry is kept and joined into the same comma form; an entry that itself contains a top-level comma is escaped so it stays one pattern.
|
||||
- Brace alternation `{a,b}` is never split: `"**/*.{css,scss},**/*.py"` yields two patterns.
|
||||
- A literal top-level comma in a pattern is written `\,`; a literal backslash is `\\`.
|
||||
- Always quote glob values in YAML. An unquoted value starting with `*` (for example `applyTo: **/*.py`) is a YAML alias token and fails to parse. What apm then does is the most dangerous failure mode in this primitive; see `instructions-gotchas.md`.
|
||||
|
||||
## Compile-time file placement
|
||||
When `applyTo` is empty or absent the instruction is unconditional ("global"). Distributed compile places it in the root `AGENTS.md`/`CLAUDE.md`; native deploy produces an always-on rule in the target's own syntax.
|
||||
|
||||
| Target | Output path | Transform |
|
||||
|---|---|---|
|
||||
| Copilot CLI (project scope) | `.github/instructions/<name>.instructions.md` | Verbatim byte copy, `applyTo:` preserved as-is |
|
||||
| Copilot CLI (user scope, `~/.copilot/`) | `~/.copilot/copilot-instructions.md` | Concatenated — all instructions merged into one file, because Copilot CLI at user scope reads only that single file |
|
||||
| Claude Code | `.claude/rules/<name>.md` | Reconstructed: `applyTo` → `paths:` YAML list; `description` dropped; no frontmatter at all if unconditional |
|
||||
Scoped patterns in distributed compile may match files under dot-directories apm knows about (`.agents`, `.apm`, `.claude`, `.codex`, `.cursor`, `.gemini`, `.github`, `.kiro`, `.opencode`, `.windsurf`); other hidden directories are excluded from matching.
|
||||
|
||||
Additionally, **`apm compile`** (distinct from `apm install`) can also fold instruction content directly into root context files — `AGENTS.md` (single-file or per-directory "distributed" mode) and the Claude-specific parallel format `CLAUDE.md`/per-directory `CLAUDE.md` — grouped by directory using `applyTo` pattern analysis (`context_optimizer.optimize_instruction_placement`). To avoid duplicating content between the native `.claude/rules/`+`.github/instructions/` deployment (from `apm install`) and this root-context fold-in (from `apm compile`), a `skip_instructions` config flag (and `compilation.placement.min_instructions_per_file` in `apm.yml`) actively suppresses the redundant copy in AGENTS.md/CLAUDE.md once native per-target files exist — `apm compile --target claude --force-instructions` overrides this dedup when an author explicitly wants both.
|
||||
## Validation
|
||||
|
||||
## Validation constraints and gotchas
|
||||
`Instruction.validate()` returns up to three findings:
|
||||
|
||||
- **The `description` field is real for Copilot but silently discarded for Claude.** An author who relies on `description` to explain *why* a rule exists (common practice, since Copilot's `.instructions.md` UI can surface it) gets that context deleted on every Claude compile — there's no config to keep it as a comment or otherwise.
|
||||
- **No content-level validation for the `paths:` conversion** — if `applyTo` contains a pattern `parse_apply_to` can't split sensibly, the resulting `paths:` list is whatever falls out; no dedicated schema check catches a malformed glob before deploy.
|
||||
- **Directory-distribution logic for AGENTS.md/CLAUDE.md is heuristic, not declarative** — `context_optimizer.optimize_instruction_placement` picks placement directories from `applyTo` patterns algorithmically; `compilation.placement.min_instructions_per_file` in `apm.yml` (default effectively 1) is the only tuning knob, and setting it above 1 causes under-populated directories to have their instructions bubbled up to the parent directory rather than dropped.
|
||||
- **Same "no dedicated primitive validation function" gap noted for agents** — `Instruction.validate()` in `primitives/models.py` is the only validation, and it is invoked as part of the generic primitive-discovery/compile pipeline, not as a standalone `apm audit` check comparable to what exists for `apm.yml` itself.
|
||||
- Missing `description`: "Missing 'description' in frontmatter".
|
||||
- Missing `applyTo`: "No 'applyTo' pattern specified -- instruction will apply globally".
|
||||
- Empty body: "Empty content".
|
||||
|
||||
All three are demoted to warnings by the compiler, so none of them fails any command. Verified by experiment: a file with no `description` and an empty body compiles with exit 0 and three warnings, and `apm install` deploys it (to `.claude/rules/` it produces a file holding only the `paths:` frontmatter). `apm compile --validate` calls the same code but discards warnings: it prints "All primitives validated successfully!" and exits 0 even for the bad file, so it is not a usable lint gate for instruction content. The warnings appear only on a real `apm compile` run, and `apm install` prints none of them.
|
||||
|
||||
Markdown links in the body are also checked at compile time; a broken relative link is a warning with the same non-fatal behaviour.
|
||||
|
||||
Files whose frontmatter does not parse as YAML are skipped by compile with a "Failed to parse" message (and `--validate` then counts one fewer primitive), but are still deployed by install. This asymmetry is covered in the gotchas file.
|
||||
|
||||
There is no standalone instructions validator and `apm audit` does not check instruction content; `apm audit --ci` checks lockfile consistency, deployed-file presence, content hash drift, and hidden Unicode only (verified by experiment on a clean install).
|
||||
|
||||
## Instructions versus AGENTS.md and CLAUDE.md
|
||||
|
||||
An instruction is an input primitive; `AGENTS.md`, `CLAUDE.md`, and `GEMINI.md` are outputs that `apm compile` generates from instructions (and, in this repo, hand-authored root files are a separate concern owned by the AGENTS.md skills). Generated root files carry a "Generated by APM CLI" header and a build id, and must not be hand-edited. Hand-authored files are never deleted by `apm compile --clean`.
|
||||
|
||||
Claude Code's own side of the story: it reads `.claude/rules/*.md` natively; `paths` is the only frontmatter field it reads and any other field is ignored without error; a rule without `paths` loads unconditionally at launch; if the frontmatter YAML does not parse, the frontmatter is ignored and the rule loads as if it had no `paths`. Claude Code reads `AGENTS.md` only when no `CLAUDE.md` exists on the path (unless configured otherwise), which is one reason apm emits `CLAUDE.md` for the claude target instead of relying on `AGENTS.md`.
|
||||
|
||||
## Package type
|
||||
|
||||
`apm.yml` `type: instructions` is a routing hint documented as "compiles to AGENTS.md only". It validates nothing about what is in `.apm/`; see the apm-workflow configure reference for the confirmed behaviour. An install with `targets:` set deploys instructions regardless of the declared type.
|
||||
@@ -0,0 +1,83 @@
|
||||
---
|
||||
topic: instructions-target-mapping
|
||||
source_keys:
|
||||
- apm-cli-0-28-0-experiments
|
||||
- apm-docs-site
|
||||
- claude-code-memory-docs
|
||||
- github-copilot-custom-instructions-docs
|
||||
- cursor-rules-docs
|
||||
---
|
||||
|
||||
What each target receives from an instruction file, at install time (native per-file deploy) and at compile time (folded into a root context file). Verified against apm 0.28.0 source and throwaway installs unless marked otherwise. Field syntax of the source file is in `instructions-primitive-schema.md`.
|
||||
|
||||
## Two separate output paths
|
||||
|
||||
`apm install` writes native files, one per instruction, into each target's own rules directory. `apm compile` writes root context files (`CLAUDE.md`, `AGENTS.md`, `GEMINI.md`) that concatenate instruction bodies. The two overlap, which is why compile has a dedup rule (below). A skill author should treat install as the primary path for Claude Code and Copilot, and compile as the path for targets that have no native instructions directory.
|
||||
|
||||
## Install-time mapping
|
||||
|
||||
| Target | Deployed path | Transform |
|
||||
|---|---|---|
|
||||
| copilot | `.github/instructions/<n>.instructions.md` | Verbatim copy, frontmatter untouched |
|
||||
| copilot, user scope | `~/.copilot/copilot-instructions.md` | All bodies concatenated into one file, frontmatter stripped, provenance markers added |
|
||||
| claude | `.claude/rules/<n>.md` | `applyTo` becomes a `paths:` list; `description` dropped; no frontmatter at all when there is no `applyTo` |
|
||||
| cursor | `.cursor/rules/<n>.mdc` | `applyTo` becomes `globs:` (scalar for one pattern, list for several); `description` kept, auto-generated from the first body sentence when missing; no `alwaysApply` is written; not deployed at user scope |
|
||||
| windsurf | `.windsurf/rules/<n>.md` | `trigger: glob` plus `globs:`, or `trigger: always_on` when unscoped; `description` dropped; not deployed at user scope |
|
||||
| kiro | `.kiro/steering/<n>.md` | `inclusion: fileMatch` plus `fileMatchPattern`, or `inclusion: always` when unscoped; `description` dropped |
|
||||
| antigravity | `.agents/rules/<n>.md` | `trigger: glob` plus `globs`, or no frontmatter when unscoped; not deployed at user scope |
|
||||
| grok-build | `.grok/rules/<n>.instructions.md` | Verbatim copy; keeps the `.instructions.md` name |
|
||||
| codex, gemini, opencode, agent-skills, openclaw, hermes, grok-cloud, copilot-cowork, copilot-app | none | No instructions mapping; these targets receive instructions only through compile |
|
||||
|
||||
Rename rule: the source suffix `.instructions.md` is replaced by the target's extension (`.md`, `.mdc`) except for Copilot and Grok, which keep the full suffix.
|
||||
|
||||
### Ownership and overwrite
|
||||
|
||||
The rule-directory targets (cursor, claude, windsurf, kiro, antigravity) are treated as APM-owned per file: install overwrites an existing hand-authored file with the same deployed name without a prompt (verified: a hand-written `.claude/rules/u.md` was replaced). Copilot behaves differently: an existing unmanaged file is skipped with the message "local files exist, not managed by APM" and needs `apm install --force` to overwrite. A name collision with a hand-authored rule in `.claude/rules/` is therefore silent data loss, so authors should not reuse stems of existing hand-written rules.
|
||||
|
||||
Removing or renaming a source instruction makes the next install delete the previously deployed file ("Cleaned N stale files"), and `apm audit --ci` passes after a clean install.
|
||||
|
||||
Install with explicit `targets:` in `apm.yml` creates the target directories (`.claude/`, `.github/`) if they do not exist.
|
||||
|
||||
## Per-target field survival
|
||||
|
||||
| Field | Claude | Copilot | Cursor | Windsurf | Kiro | Antigravity | Compiled root file |
|
||||
|---|---|---|---|---|---|---|---|
|
||||
| `applyTo` | as `paths` | kept verbatim | as `globs` | as `globs` | as `fileMatchPattern` | as `globs` | used for grouping only |
|
||||
| `description` | dropped | kept (verbatim file) | kept | dropped | dropped | dropped | dropped |
|
||||
| `author`, `version` | dropped | kept only because the file is verbatim | dropped | dropped | dropped | dropped | dropped |
|
||||
|
||||
Consequence for authors: a `description` is useful only for Copilot and Cursor. For Claude Code the first line or heading of the body is the only descriptive text that survives, so the body must be self-explanatory.
|
||||
|
||||
## Native format facts from the downstream tools
|
||||
|
||||
Claude Code: `.claude/rules/*.md` is found recursively. `paths` is the only field read; it accepts a YAML list or a comma-separated string. Other fields are ignored with no error. Rules without `paths` load unconditionally at launch; path-scoped rules load when matching files are read. Invalid frontmatter YAML is ignored and the rule loads without `paths`. Brace expansion in `paths` is capped at 1,000 patterns and 4 MiB.
|
||||
|
||||
Copilot: path-specific files live at `.github/instructions/**/NAME.instructions.md`. `applyTo` is required and is a quoted, comma-joined string. An optional `excludeAgent` takes `"code-review"` or `"cloud-agent"`. The docs do not mention a `description` key. Repository-wide instructions use the separate `.github/copilot-instructions.md`, which has no frontmatter. Path-specific files apply on GitHub.com only to the cloud agent and code review; IDE use differs.
|
||||
|
||||
Cursor: project rules must have the `.mdc` extension; a plain `.md` in `.cursor/rules` is ignored. Fields are `description`, `globs` (documented as a comma-separated string) and `alwaysApply` (boolean). A rule with only a `description` is "Apply Intelligently" (the agent decides), not always-on. The documented limit is 500 lines per rule.
|
||||
|
||||
Windsurf, Kiro, Antigravity: the apm source emits their trigger keys, but no downstream documentation was fetched for them, so runtime behaviour is unverified.
|
||||
|
||||
## Compile-time behaviour
|
||||
|
||||
Output file by target:
|
||||
|
||||
- `--target claude` writes `CLAUDE.md`.
|
||||
- Gemini writes `GEMINI.md` (which imports `AGENTS.md`) and `AGENTS.md`.
|
||||
- Every other target writes `AGENTS.md`.
|
||||
|
||||
Instructions are grouped by `applyTo`: a "Global Instructions" section for unscoped ones and one "Files matching `<pattern>`" section per distinct pattern. Descriptions are omitted. In distributed strategy, scoped instructions are placed in nested directory files near the matching files, subject to `placement.min_instructions_per_file` (default 1); `single-file` strategy puts everything in one root file.
|
||||
|
||||
### Dedup against native files
|
||||
|
||||
Compile skips instructions already deployed natively, but only for three targets: Claude (`.claude/rules/`), Copilot (`.github/instructions/`) and Antigravity (`.agents/rules/`). With populated native rules, `apm compile --target claude` prints a dedup message and "produced no output files" and exits 0 without writing `CLAUDE.md`. `--force-instructions` (alias `--no-dedup`) overrides it and writes the file. Cursor, Windsurf, Kiro, Grok, Codex and OpenCode have no dedup, so compile writes `AGENTS.md` that duplicates the native rules already loaded by the tool (verified for cursor, windsurf, kiro, codex).
|
||||
|
||||
Test implication: a compile-based test for the Claude target must run in a project with no populated `.claude/rules/`, or pass `--force-instructions`; otherwise it produces no file and silently asserts nothing.
|
||||
|
||||
### apm.yml compilation block
|
||||
|
||||
Keys: `target`, `strategy` (`distributed` or `single-file`), `single_file`, `output`, `chatmode`, `resolve_links`, `source_attribution`, `exclude`, `placement.min_instructions_per_file`, and `agents_md.mode` (`full` or `managed_section`; the latter writes only between markers and leaves the rest of the file alone).
|
||||
|
||||
### Relevant compile flags
|
||||
|
||||
`--validate` (parse only; see schema file for why it is a weak check), `--dry-run`, `--clean` (removes orphaned generated files, never hand-authored ones), `--target`, `--all`, `--root`, `-g`, `--local-only`, `--single-agents`, `--no-links`, `--with-constitution`, `--force-instructions`. Documented exit codes: 0 success, 1 error, 2 conflicting flags. A compile with no instruction primitives at all exits 0 in 0.28.0.
|
||||
@@ -0,0 +1,74 @@
|
||||
---
|
||||
topic: prompt-gotchas
|
||||
source_keys:
|
||||
- apm-docs-author-prompts
|
||||
- apm-docs-llms-full
|
||||
- apm-docs-producer-ramp
|
||||
- apm-docs-cli-run
|
||||
- apm-docs-cli-compile
|
||||
- apm-cli-0-28-0-prompt-experiments
|
||||
---
|
||||
|
||||
## What this covers
|
||||
|
||||
Constraints that surprise a prompt author. Items are marked **observed** when they were reproduced on the installed apm 0.28.0 in a throwaway project with local-path packages, and **doc** when they come only from the published docs. Where an observation disagrees with a doc statement, the observation wins and the disagreement is noted. Claude Code, Cursor and Gemini runtime behaviour on the emitted files was not tested.
|
||||
|
||||
## Discovery
|
||||
|
||||
- **Observed:** a root-level `<pkg>/foo.prompt.md` is discovered and deployed alongside `.apm/prompts/`. The `.apm/prompts/` directory is canonical; root-level discovery works but is a backward-compatibility path.
|
||||
- **Observed:** discovery is non-recursive and case-sensitive. `.apm/prompts/sub/x.prompt.md`, `X.PROMPT.md` and a bare `x.md` are silently ignored with exit 0.
|
||||
- **Observed:** `apm init` writes only `apm.yml`. It creates no `.apm/` and no `.apm/prompts/`, so the scaffold must create the directory.
|
||||
- **Observed:** a project's own `.apm/prompts` is deployed by a bare `apm install` in that project, with no dependency needed. Such local prompts are recorded in the lockfile only under `deployments:`, while dependency prompts also appear in `deployed_files` with hashes.
|
||||
- **Observed:** odd filenames (uppercase, underscores, dots, spaces, a leading dash or dot) deploy as-is with no validation. Whether Claude Code accepts such command names was not tested, so authors should stay with kebab-case.
|
||||
|
||||
## Manifest `type:`
|
||||
|
||||
**Observed:** `instructions`, `skill`, `prompts` and `hybrid` all deploy prompts identically. Any other value (`agents`, `bogus`) fails the install with exit 1 and the message "Invalid package type ... Valid types are: 'instructions', 'skill', 'hybrid', 'prompts'", and apm.yml is restored. So the value is validated but never constrains deployment, which matches the spec's "advisory" wording and contradicts the manifest reference that says it constrains contents.
|
||||
|
||||
## Compile versus install
|
||||
|
||||
- **Observed:** `apm compile` never reads prompts. Prompts reach commands directories only through `apm install`.
|
||||
- **Observed:** on a prompts-only package, plain `apm compile`, `--validate` and `--target claude` exit 1 with "No instruction files found in .apm/ directory" while no `.claude/` exists. Once install has created `.claude/`, the same commands exit 0 with "CLAUDE.md not generated" and no output, and `--validate` reports "Validated 0 primitives". `--dry-run` exits 0 either way and writes nothing. The exit code tracks whether `.claude/` exists, not anything about the prompts.
|
||||
- **Observed:** with one valid instruction present, `apm compile --validate` exits 0 and counts only instructions, even when prompts have malformed YAML, invalid input names or unknown keys. It cannot lint prompts, and the docs' suggestion to use it as a verify step does not cover them.
|
||||
- **Consequence:** verifying a prompt means a throwaway `apm install` and inspecting the deployed files, not `apm compile`. Any acceptance criterion phrased as "passes `apm compile` for the Claude target" proves nothing about prompts unless it also asserts the installed output.
|
||||
|
||||
## Silent or quiet loss
|
||||
|
||||
- **Observed:** on the Claude family (claude, cursor, opencode, windsurf, grok-build) unsupported keys are dropped with exit 0 and a warning of the form "frontmatter keys not supported for claude commands and were dropped: agent, author, mcp, mode, parameters, tools. Supported keys: allowed-tools, argument-hint, description, input, model". Unknown keys such as `inputs` are dropped the same way. Copilot keeps everything.
|
||||
- **Observed, disagrees with the docs:** Gemini drops everything except `description` with **no** diagnostic.
|
||||
- **Observed:** codex, kiro, antigravity and agent-skills deploy nothing, exit 0, with no warning.
|
||||
- **Observed:** a single-key `{name: description}` list item loses its description and only the name survives, as `arguments:`. A multi-key item such as `name:` plus `description:` turns every key into an argument (`arguments: [name, description]`). Found by a clean-context review of `prompt-author`.
|
||||
- **Observed:** invalid input names (`bad name!`, `9lead`) are rejected with a warning and the install succeeds. Duplicate names are neither removed nor warned about, giving `arguments: [dup, dup]`.
|
||||
- **Observed:** declaring `input:` and also writing a literal `$ARGUMENTS` or `$0` in the body gives both `arguments:` and the literal text, with no conflict diagnostic.
|
||||
|
||||
## Frontmatter and body edge cases
|
||||
|
||||
- **Observed:** malformed YAML makes Claude and Gemini skip the file with a "Skipped command ... malformed or over-budget YAML frontmatter" warning and exit 0, so the command is simply missing. Copilot copies the broken file verbatim with no warning.
|
||||
- **Observed:** a prompt with no frontmatter becomes an empty `{}` frontmatter block on Claude. An empty body deploys frontmatter only on Claude and `prompt = ""` on Gemini. Neither warns.
|
||||
- **Observed:** `${input:x}` and `${{input:x}}` become `$x` on the Claude family, including for undeclared names. The placeholder form `${input:x:placeholder}` is left untouched. Gemini does not rewrite `${input:...}` at all, and a `$<digit>` anywhere in a Gemini body prepends an "Arguments: {{args}}" line.
|
||||
|
||||
## Identity, collisions and ownership
|
||||
|
||||
- **Observed:** a pre-existing hand-written `.claude/commands/<name>.md`, `.github/prompts/<name>.prompt.md`, cursor or gemini file is skipped with "files skipped -- local files exist, not managed by APM", exit 0, other prompts still deploy, and `--force` overwrites. This is uniform across the four targets tested, unlike instructions, which overwrote silently on some.
|
||||
- **Observed:** editing the source and reinstalling redeploys. Hand-editing a deployed file and reinstalling silently overwrites it.
|
||||
- **Observed:** removing a prompt from the package and reinstalling cleans the stale deployed files on every target tested. A deployed file that was hand-edited first is kept with a "delete manually" message.
|
||||
- **Observed, disagrees with the docs:** the same base name in the root and in `.apm/prompts/` does not fail. The root copy is processed first and wins; the second is skipped with the misleading "not managed by APM" message, and `--force` lets `.apm/prompts/` win. There is no transform failure and no duplicate diagnostic.
|
||||
|
||||
## Security scanning
|
||||
|
||||
- **Observed:** zero-width space, BOM and NBSP in a prompt are warnings and the file deploys. Tag characters and bidi overrides are critical: the install exits 1 and apm.yml is restored; the Claude-family command is withheld, but the Copilot and Gemini outputs may still be written.
|
||||
- **Observed, disagrees with the docs:** `--force` makes the exit code 0 and prints "Deployed with --force despite critical hidden characters", yet the Claude-family command is still not deployed. Re-tested later: even without `--force`, a plain install that exits 1 on a tag character still wrote the Copilot byte copy and the Gemini TOML; only the Claude file was withheld.
|
||||
- **Observed:** `apm audit` scans deployed command files, exits 2 on the zero-width warning, and a hand-appended critical character produces a critical finding plus drift. `apm audit --ci` reports `hash-drift`.
|
||||
|
||||
## Packing
|
||||
|
||||
- **Observed:** `apm pack --format plugin` maps `.apm/prompts/x.prompt.md` to `commands/x.md`, byte-identical to the source with no transform. Root-level prompts are not packed. Installing that bundle copies files verbatim: Claude gets an untransformed file that still has `input:`, and Copilot gets `.github/commands/` rather than `.github/prompts/`.
|
||||
- **Observed:** pack refuses a manifest with a local-path dependency, and with neither dependencies, marketplace nor target it exits 1 with "Nothing to pack".
|
||||
|
||||
## apm run specifics (doc only)
|
||||
|
||||
Parameters are interpolated into any `.prompt.md` the script references and are not exported as shell variables. A typo in a script name can fall through to discovery and then a virtual-package install attempt. The docs do not say what happens when a placeholder has no `--param`. `apm run` is marked experimental, and the spec describes `{key}` placeholders where the CLI docs use `${input:name}`. `apm run` and `apm preview` were not exercised.
|
||||
|
||||
## Not tested
|
||||
|
||||
The experimental targets (hermes, openclaw, copilot-cowork, grok-cloud, copilot-app), because enabling them writes global config. Claude Code, Cursor and Gemini runtime handling of the emitted files.
|
||||
@@ -3,8 +3,12 @@ topic: prompt-primitive-schema
|
||||
source_keys:
|
||||
- context7-microsoft-apm
|
||||
- apm-github-repo
|
||||
- apm-docs-author-prompts
|
||||
- apm-docs-llms-full
|
||||
---
|
||||
|
||||
Per-target output, key survival and the doc inconsistencies are in `prompt-target-mapping.md` and `prompt-gotchas.md`. The published "Author a prompt" page lists five preserved keys: `description`, `input`, `allowed-tools`, `model`, `argument-hint`. Where the section below says four keys are preserved, read that as four plus `input`, which is consumed into `arguments:` on Claude. Both the page and the installed 0.28.0 source agree on this set.
|
||||
|
||||
## File location, naming, and frontmatter
|
||||
|
||||
`.apm/prompts/*.prompt.md` (also discovered at the package root). Filename minus the `.prompt.md` suffix becomes the prompt's identity — used verbatim as the Copilot filename and, after transformation, as the Claude command name. No required-extension ambiguity: it is genuinely `.prompt.md`, confirmed both in docs and in APM's own `PromptIntegrator.find_prompt_files` (`*.prompt.md`) and `CommandIntegrator.find_prompt_files` (same glob).
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
---
|
||||
topic: prompt-target-mapping
|
||||
source_keys:
|
||||
- apm-docs-author-prompts
|
||||
- apm-docs-llms-full
|
||||
- apm-docs-producer-ramp
|
||||
- apm-github-repo
|
||||
- apm-cli-0-28-0-prompt-experiments
|
||||
---
|
||||
|
||||
## Scope and confidence
|
||||
|
||||
This file maps one `.apm/prompts/<name>.prompt.md` source to what each apm target receives. The paths and transforms below were **observed** on apm 0.28.0 using local-path packages in a throwaway project, and cross-checked against the published docs and the installer source. Where docs and observation disagree, the observation is used and `prompt-gotchas.md` records the disagreement. Runtime behaviour in the receiving tools was not tested.
|
||||
|
||||
## Output per target
|
||||
|
||||
| Target | Output path | Form |
|
||||
|---|---|---|
|
||||
| copilot (also vscode, intellij) | `.github/prompts/<name>.prompt.md` | Byte-identical copy |
|
||||
| claude | `.claude/commands/<name>.md` | Reconstructed slash command |
|
||||
| cursor | `.cursor/commands/<name>.md` | Identical transform to claude; output is byte-identical |
|
||||
| opencode | `.opencode/commands/<name>.md` | Identical transform |
|
||||
| grok-build | `.grok/commands/<name>.md` | Identical transform |
|
||||
| windsurf | `.windsurf/workflows/<name>.md` | Identical transform, workflow directory |
|
||||
| gemini | `.gemini/commands/<name>.toml` | TOML with `description` and `prompt` only |
|
||||
| codex, kiro, antigravity, agent-skills | none | Exit 0, no warning |
|
||||
| hermes, openclaw, copilot-cowork, grok-cloud, copilot-app | none by default | Print that an experimental flag is required; untested |
|
||||
|
||||
At user scope (`apm install -g`) claude, gemini and cursor deploy to their home-directory commands folders and Copilot deploys to the Copilot user prompts directory. This resolves the earlier doc conflict about Copilot user scope.
|
||||
|
||||
## Slot terminology
|
||||
|
||||
The docs call the source primitive "prompts" and the per-target surface "commands". Claude has no `prompts` slot in its target profile, so prompts reach it only through `apm install`, which routes them into the commands slot; `apm compile` never touches them. There is no `.apm/commands/` source directory. A package built with `apm pack --format plugin` maps the prompts directory to `commands/` and renames `x.prompt.md` to `x.md` without transforming the contents.
|
||||
|
||||
## Claude-family output
|
||||
|
||||
For a source with `description`, `input` (`simple`, `named: The named one`, `other`), `allowed-tools`, `model`, `argument-hint` and extra keys, the Claude command file contains only `allowed-tools`, `argument-hint`, `arguments`, `description` and `model`, keys sorted alphabetically, with no trailing newline. `input` is consumed into `arguments:` as names only (a single-key `{name: description}` item loses its description; a multi-key item turns every key into an argument), and `argument-hint` is synthesised as `<a> <b>` when absent or kept when given. `argumentHint` and `allowedTools` are accepted as aliases. The five keys visible in the output are therefore `description`, `allowed-tools`, `model`, `argument-hint` and `arguments`, while the five keys an author may write and expect to survive are `description`, `input`, `allowed-tools`, `model` and `argument-hint`.
|
||||
|
||||
## Frontmatter survival by target
|
||||
|
||||
| Key | Copilot | Claude family | Gemini |
|
||||
|---|---|---|---|
|
||||
| `description` | kept | kept | kept |
|
||||
| `input` | kept as written | becomes `arguments:` | dropped silently |
|
||||
| `allowed-tools` | kept (Copilot ignores it) | kept | dropped silently |
|
||||
| `model` | kept | kept | dropped silently |
|
||||
| `argument-hint` | kept | kept or synthesised | dropped silently |
|
||||
| any other key | kept | dropped with a warning naming the keys | dropped silently |
|
||||
|
||||
The VS Code prompt format uses `agent`, `tools` and `name`, which survive on Copilot only.
|
||||
|
||||
## Body placeholders
|
||||
|
||||
| Syntax in source | Claude family | Gemini | Copilot |
|
||||
|---|---|---|---|
|
||||
| `${input:x}` | `$x` | unchanged | unchanged |
|
||||
| `${{input:x}}` | `$x` | unchanged | unchanged |
|
||||
| `${input:x:placeholder}` | unchanged | unchanged | unchanged |
|
||||
| `$ARGUMENTS` | unchanged | `{{args}}` | unchanged |
|
||||
| `$0`, `$1` | unchanged | unchanged, and an "Arguments: {{args}}" line is prepended | unchanged |
|
||||
|
||||
Claude Code's own documentation supports `$ARGUMENTS`, zero-based `$N` and named `$name` from a declared `arguments:` list, so the rewritten output is native to Claude Code.
|
||||
|
||||
## Workflow-shaped prompts
|
||||
|
||||
Only the top-level keys `interval`, `schedule_hour` and `schedule_day` mark a prompt as a Copilot App workflow, and such prompts are skipped by the command integrator. A plain prompt pointed at `copilot-app` is a hard error. The experimental target was not exercised.
|
||||
|
||||
## Invocation
|
||||
|
||||
Copilot uses its prompt picker. Claude, Cursor, OpenCode and Gemini use `/<name>` followed by arguments. Windsurf uses the workflows menu. Consumers can bypass the picker with an `apm.yml` script and `apm run <script> --param key=value`, which compiles to `.apm/compiled/<name>.txt` (doc only, not exercised).
|
||||
@@ -15,3 +15,80 @@
|
||||
- **Status:** `extracted`
|
||||
|
||||
Note: `releasing.md`'s `--check-clean`/`--check-versions` scope, `apm pack` exit-code semantics, and the `.apm/`-vs-root-flat-dir mutual exclusivity referenced there were additionally cross-checked directly against `apm_cli/bundle/plugin_exporter.py`, `apm_cli/commands/pack.py`, and `apm_cli/marketplace/drift_check.py` in the installed `apm-cli` 0.28.0 package (`/root/.local/pipx/venvs/apm-cli/`), not just Context7 doc snippets — confirmed by a live `apm pack --format plugin` run inside `plugins/bin` that reproduced the documented `[!] Skipping root-level skills/ because .apm/ is present` warning.
|
||||
|
||||
## apm-docs-site
|
||||
|
||||
- **URL:** https://microsoft.github.io/apm/
|
||||
- **Description:** Official apm documentation site, specifically the instructions-and-agents authoring page and the targets and compile pages: frontmatter requirements, unconditional-rule wording, per-target deploy paths, compile behaviour and flags. Fetched through subagent summaries, so lossy.
|
||||
- **Contributing files:** instructions-primitive-schema.md, instructions-target-mapping.md, instructions-gotchas.md
|
||||
- **Status:** `extracted`
|
||||
|
||||
## claude-code-memory-docs
|
||||
|
||||
- **URL:** https://code.claude.com/docs/en/memory
|
||||
- **Description:** Claude Code memory documentation: `.claude/rules/` loading, the `paths` frontmatter field (only field read, invalid YAML ignored), AGENTS.md versus CLAUDE.md precedence, size guidance.
|
||||
- **Contributing files:** instructions-primitive-schema.md, instructions-target-mapping.md, instructions-gotchas.md
|
||||
- **Status:** `extracted`
|
||||
|
||||
## github-copilot-custom-instructions-docs
|
||||
|
||||
- **URL:** https://docs.github.com/en/copilot/how-tos/configure-custom-instructions/add-repository-instructions
|
||||
- **Description:** GitHub Copilot repository custom-instructions documentation: `.github/instructions/*.instructions.md`, the `applyTo` and `excludeAgent` frontmatter, the separate repo-wide `copilot-instructions.md`, where path-specific files apply.
|
||||
- **Contributing files:** instructions-target-mapping.md, instructions-gotchas.md
|
||||
- **Status:** `extracted`
|
||||
|
||||
## cursor-rules-docs
|
||||
|
||||
- **URL:** https://cursor.com/docs/context/rules
|
||||
- **Description:** Cursor project rules documentation: `.mdc` requirement, `description`, `globs` and `alwaysApply` frontmatter, rule types (always, auto-attached, apply intelligently, manual), size guidance.
|
||||
- **Contributing files:** instructions-target-mapping.md, instructions-gotchas.md
|
||||
- **Status:** `extracted`
|
||||
|
||||
## apm-cli-0-28-0-experiments
|
||||
|
||||
- **URL:** https://pypi.org/project/apm-cli/0.28.0/
|
||||
- **Description:** The installed apm-cli 0.28.0 package (source under the pipx venv for apm-cli) read for integrator, target-table and pattern-parsing code, plus throwaway install, compile and audit experiments run in a scratchpad outside the repo to confirm validation severity, unquoted-glob handling, discovery asymmetry, dedup, overwrite and exit-code behaviour.
|
||||
- **Contributing files:** instructions-primitive-schema.md, instructions-target-mapping.md, instructions-gotchas.md
|
||||
- **Status:** `extracted`
|
||||
|
||||
## apm-docs-author-prompts
|
||||
|
||||
- **URL:** https://microsoft.github.io/apm/producer/author-primitives/prompts/
|
||||
- **Description:** Official "Author a prompt" page: file layout, the five preserved frontmatter keys, body conventions, per-target output paths, invocation, and the pitfalls list (dropped keys, input-name regex, Codex, collisions, hidden-Unicode scan).
|
||||
- **Contributing files:** prompt-primitive-schema.md, prompt-target-mapping.md, prompt-gotchas.md
|
||||
- **Status:** `extracted`
|
||||
|
||||
## apm-docs-llms-full
|
||||
|
||||
- **URL:** https://microsoft.github.io/apm/llms-full.txt
|
||||
- **Description:** The complete apm documentation dump (about 2.1M characters) read in chunks through a summarising fetch for prompt-related content: primitive catalogue, manifest `type` field, `apm run` parameters, target matrix, install ownership and stale-cleanup rules, spec requirements. Lossy; quoted strings are not byte-verified.
|
||||
- **Contributing files:** prompt-primitive-schema.md, prompt-target-mapping.md, prompt-gotchas.md
|
||||
- **Status:** `extracted`
|
||||
|
||||
## apm-docs-producer-ramp
|
||||
|
||||
- **URL:** https://microsoft.github.io/apm/_llms-txt/producer-ramp.txt
|
||||
- **Description:** Producer-ramp documentation bundle covering prompt authoring, dual-surface naming, the verify loop (`apm compile --validate`, `--dry-run`, `apm audit`) and marketplace publishing. The fetch reported truncating a middle stretch.
|
||||
- **Contributing files:** prompt-target-mapping.md, prompt-gotchas.md
|
||||
- **Status:** `extracted`
|
||||
|
||||
## apm-docs-cli-run
|
||||
|
||||
- **URL:** https://microsoft.github.io/apm/reference/cli/run/
|
||||
- **Description:** `apm run` reference: script resolution, prompt discovery fallback, compilation to `.apm/compiled`, `--param` substitution, exit codes. Marked experimental.
|
||||
- **Contributing files:** prompt-gotchas.md
|
||||
- **Status:** `extracted`
|
||||
|
||||
## apm-docs-cli-compile
|
||||
|
||||
- **URL:** https://microsoft.github.io/apm/reference/cli/compile/
|
||||
- **Description:** `apm compile` reference, read for what it does with prompts (ignores them) and what `--validate` checks. Does not address prompts-only packages.
|
||||
- **Contributing files:** prompt-gotchas.md
|
||||
- **Status:** `extracted`
|
||||
|
||||
## apm-cli-0-28-0-prompt-experiments
|
||||
|
||||
- **URL:** https://pypi.org/project/apm-cli/0.28.0/
|
||||
- **Description:** The installed apm-cli 0.28.0 exercised with local-path throwaway packages in a scratchpad outside the repo: root-level and nested prompt discovery, manifest `type:` values, compile on prompts-only packages, per-target install output and dropped-key warnings, input-name and YAML edge cases, collision, stale-cleanup and hand-edit behaviour, hidden-Unicode scanning and audit, and `apm pack --format plugin`. Source files `command_integrator.py`, `prompt_integrator.py` and `plugin_exporter.py` were read to cross-check. Experimental targets and `apm run` were not exercised.
|
||||
- **Contributing files:** prompt-target-mapping.md, prompt-gotchas.md
|
||||
- **Status:** `extracted`
|
||||
@@ -0,0 +1,25 @@
|
||||
---
|
||||
topic: claude-code-commands
|
||||
source_keys:
|
||||
- claude-code-slash-commands
|
||||
---
|
||||
|
||||
## Status
|
||||
|
||||
Custom commands have been merged into skills. A file at `.claude/commands/deploy.md` and a skill at `.claude/skills/deploy/SKILL.md` both create `/deploy` and behave the same. Command files are described as the older format that still works; the docs recommend skills for new work. Nothing is deprecated. This is the format an apm prompt becomes on the Claude target.
|
||||
|
||||
## Frontmatter
|
||||
|
||||
A command file accepts the same fields as a skill except `name` and `paths`. Relevant fields: `description` (the first non-empty body line is used if absent), `argument-hint`, `arguments` (named positional arguments, as a space-separated string or YAML list), `allowed-tools` (space or comma separated, or a list), `model`, `disable-model-invocation`, `user-invocable`, `effort`, `context`, `agent`, `hooks`, `shell` and others. Unrecognised fields are ignored without an error. Malformed YAML loads the body with empty metadata.
|
||||
|
||||
## Arguments and substitution
|
||||
|
||||
`$ARGUMENTS` is the whole argument string, `$ARGUMENTS[N]` and `$N` are zero-based positional arguments (`$0` is the first), and `$name` is a named argument declared in `arguments`. This answers the open question in the apm research: Claude Code does honor an `arguments:` list with `$name` substitution, alongside `$ARGUMENTS` and zero-based `$N`. An unmatched named placeholder becomes empty and an unmatched indexed placeholder stays literal. If no placeholder consumes the arguments, the text `ARGUMENTS: <value>` is appended. Literal dollar signs are escaped with a backslash. Inline shell injection with an exclamation-mark backtick form runs commands through permission rules and aborts the invocation on failure.
|
||||
|
||||
## Naming and precedence
|
||||
|
||||
Files in subdirectories get a colon-joined name, so `frontend/component.md` is `/frontend:component`. A skill beats a command file of the same name. Enterprise beats personal and personal beats project. Plugin skills are namespaced. The `anthropic-skills` name is reserved.
|
||||
|
||||
## Standards relationship
|
||||
|
||||
The page links to the agentskills.io evaluation guide, which shows Claude Code skills follow that open standard. Nothing on the page suggests command files are an open standard; treat `.claude/commands/` as Claude Code specific.
|
||||
@@ -0,0 +1,21 @@
|
||||
---
|
||||
topic: dotprompt
|
||||
source_keys:
|
||||
- dotprompt-site
|
||||
---
|
||||
|
||||
## What it is
|
||||
|
||||
Dotprompt is Google's executable prompt template format: a `.prompt` file with YAML frontmatter and a Handlebars body extended with generative-AI helpers. The Firebase Genkit library is the reference consumer, loading prompts from a `prompts` directory by base name. There is another unrelated project that also uses the name, so confirm which one a source means.
|
||||
|
||||
## Confirmed schema
|
||||
|
||||
Only a few fields were confirmed from the getting-started example: `model`, `input.schema`, `output.format` and `output.schema`, with schemas written in a compact Picoschema-style syntax. The helpers, partials, variants and config field names were not confirmed because the full spec in the repository was not read. Treat everything beyond that list as unverified.
|
||||
|
||||
## Governance and adoption
|
||||
|
||||
Apache-2.0, maintained by Google and Firebase, with implementations in JavaScript, Python, Go, Rust and Java, editor plugins and a CLI. About 570 stars at fetch time. No standards body and no spec version were found, and Genkit is the only confirmed consumer. The implementors page is a stub marked under construction.
|
||||
|
||||
## Relevance
|
||||
|
||||
A template-and-schema format for application code calling models, not for coding-agent slash commands. Not a candidate to replace `.prompt.md`.
|
||||
@@ -0,0 +1,21 @@
|
||||
---
|
||||
topic: mcp-prompts
|
||||
source_keys:
|
||||
- mcp-prompts-spec
|
||||
---
|
||||
|
||||
## Layer
|
||||
|
||||
MCP prompts are a server-to-client protocol primitive, not a file format. A server declares the `prompts` capability and clients call `prompts/list` and `prompts/get` with named string arguments. The latest revision at fetch time was dated 2026-07-28. There is no on-disk location, naming convention or frontmatter, and storage is out of scope.
|
||||
|
||||
## Shape
|
||||
|
||||
A prompt definition has `name`, optional `title`, `description` and `icons`, and an `arguments` list whose entries carry `name`, `description` and `required`. `prompts/get` returns `messages`, each with a `user` or `assistant` role and a content item (text, image, audio, resource link or embedded resource). There is no system role and no template syntax: the server substitutes arguments and returns finished messages. There is no field for allowed tools, model or invocation control.
|
||||
|
||||
## Interaction model
|
||||
|
||||
Prompts are described as user-controlled, meaning the user explicitly selects one, for example as a slash command, though the protocol mandates no UI. Errors use JSON-RPC codes, and implementations must validate inputs and outputs.
|
||||
|
||||
## Relevance
|
||||
|
||||
MCP prompts and apm prompts solve different problems: one delivers prompt content at runtime from a server, the other authors a static file that is compiled into each tool's command directory. They are not substitutes. Whether a given client surfaces MCP prompts as slash commands was not confirmed from the spec page.
|
||||
@@ -0,0 +1,37 @@
|
||||
---
|
||||
topic: overview
|
||||
source_keys:
|
||||
- awesome-agent-standards
|
||||
- vscode-prompt-files
|
||||
- prompty-site
|
||||
- dotprompt-site
|
||||
- claude-code-slash-commands
|
||||
- mcp-prompts-spec
|
||||
---
|
||||
|
||||
## Verdict
|
||||
|
||||
No vendor-neutral, versioned open standard for prompt files exists in the way agentskills.io exists for skills. What exists is a set of overlapping, vendor-owned formats that differ in file extension, frontmatter and templating, plus one protocol primitive that sits at a different layer. The one list that tries to index agent standards names no prompt-file standard with a neutral steward. The neutral foundation it does record covers AGENTS.md (project context), and SKILL.md is tied to the agentskills.io spec; neither is a prompt format.
|
||||
|
||||
## The candidates
|
||||
|
||||
| Format | Extension and location | Owner | Open spec? | Who consumes it |
|
||||
|---|---|---|---|---|
|
||||
| Copilot / VS Code prompt files | `.prompt.md`, `.github/prompts/` | Microsoft (VS Code, GitHub Copilot) | Documented feature, no separate spec | VS Code local sessions, Copilot; apm treats it as the native form |
|
||||
| Claude Code command files | `.md`, `.claude/commands/` | Anthropic | Documented feature; being folded into skills | Claude Code |
|
||||
| Prompty | `.prompty` | Microsoft, MIT licence | Published spec with fixtures, no standards body, no tagged spec version found | Microsoft runtimes and a VS Code extension; no coding-agent consumers found |
|
||||
| Dotprompt | `.prompt` | Google / Firebase, Apache-2.0 | Repo-hosted spec, no standards body | Genkit (reference consumer); several language implementations |
|
||||
| MCP prompts | none, JSON-RPC `prompts/list` and `prompts/get` | MCP project | Normative protocol spec | Any MCP client; surfaced as slash commands in some |
|
||||
| Generic `.prompt` | informal | none | No | Promptfoo parses it natively |
|
||||
|
||||
## Why none of these is the agentskills.io equivalent
|
||||
|
||||
agentskills.io defines one directory-and-frontmatter format that many agent tools implement identically. For prompts the formats do not converge. Copilot and Claude Code both use Markdown with YAML frontmatter, but the field sets diverge (`agent`, `tools` and `name` on one side; `allowed-tools`, `arguments` and `disable-model-invocation` on the other) and the variable syntax differs (`${input:x}` versus `$x`, `$ARGUMENTS` and `$0`). Prompty and Dotprompt are execution formats that carry model configuration, typed input and output schemas and templating, which makes them a different kind of artifact from an instruction-only slash command. MCP prompts are a delivery protocol with no on-disk format.
|
||||
|
||||
## What this means for apm and prompt-author
|
||||
|
||||
apm's `.prompt.md` is the only cross-target authoring surface in play, and it adopts the Copilot file form as the source and transforms it per target. That makes apm's own docs, not an external standard, the authoritative contract for a prompt-author skill. The skill should not cite an open standard for prompts. It can cite Copilot's format as the native source form and Claude Code's command format as the main transform target. Where the Claude Code docs now steer new work towards skills, the skill should say a prompt is the right primitive when the user invokes the workflow on demand and a skill is the right one when the agent should discover it.
|
||||
|
||||
## Maturity signals worth tracking
|
||||
|
||||
Prompty and Dotprompt are active but single-vendor. If a neutral body adopts a prompt format, the likely routes are the Agentic AI Foundation, which now stewards AGENTS.md, or the agentskills.io community extending its spec. Neither has been observed doing so.
|
||||
@@ -0,0 +1,21 @@
|
||||
---
|
||||
topic: prompty
|
||||
source_keys:
|
||||
- prompty-site
|
||||
---
|
||||
|
||||
## What it is
|
||||
|
||||
Prompty is a Markdown file format for LLM prompts: YAML frontmatter plus a Markdown body in a single `.prompty` file. It is an execution-oriented format with a Render, Parse, Execute, Process pipeline and a v2 agentic turn runtime. Version 1 and version 2 documentation both exist, so check which a source describes.
|
||||
|
||||
## Frontmatter
|
||||
|
||||
Top-level fields include `name`, `displayName`, `description`, `metadata`, `model` (id, provider, apiType, connection, options), `inputs` and `outputs` (typed properties), `tools` (function, MCP, OpenAPI or custom) and `template` (format defaulting to `jinja2`). Unknown top-level properties must not raise an error. Frontmatter strings support `${env:VAR}` and `${file:path}` references, with path traversal and symlink escapes rejected by default. Body role markers are `system:`, `user:` and `assistant:`.
|
||||
|
||||
## Governance and adoption
|
||||
|
||||
MIT licence, Microsoft-sponsored, roughly 1.3k stars, with runtimes in Python, TypeScript, C#, Rust, Java, Go and Swift. The schema is authored in TypeSpec and the spec treats its test fixtures as normative. No standards body, no multi-vendor governance and no tagged spec version were found. The awesome-agent-standards list claims use by Promptflow, LangChain and Semantic Kernel; that is unverified here. No coding agent was found consuming `.prompty` files.
|
||||
|
||||
## Relevance
|
||||
|
||||
Prompty carries model configuration, typed I/O and tools, which a `.prompt.md` slash command does not. It is not interchangeable with apm prompts and apm has no target for it.
|
||||
@@ -0,0 +1,43 @@
|
||||
# Sources
|
||||
|
||||
## awesome-agent-standards
|
||||
|
||||
- **URL:** https://github.com/GuilhermeAlbert/awesome-agent-standards
|
||||
- **Description:** Curated index of agent standards, read to see whether any vendor-neutral prompt-file standard is recorded. Fetched through a summarising model, so lossy; its claims about Prompty adoption and AGENTS.md governance are unverified.
|
||||
- **Contributing files:** overview.md, prompty.md
|
||||
- **Status:** `extracted`
|
||||
|
||||
## vscode-prompt-files
|
||||
|
||||
- **URL:** https://code.visualstudio.com/docs/agent-customization/prompt-files
|
||||
- **Description:** VS Code documentation for `.prompt.md` prompt files: location, frontmatter fields, input variables, invocation and limits. Page dated 10/14/2026; fetched through a summarising model.
|
||||
- **Contributing files:** overview.md, vscode-copilot-prompt-files.md
|
||||
- **Status:** `extracted`
|
||||
|
||||
## prompty-site
|
||||
|
||||
- **URL:** https://prompty.ai
|
||||
- **Description:** Prompty home page, core concepts, file-format specification and reference, plus the GitHub repository root. Other spec sections and the Jinja grammar were not read.
|
||||
- **Contributing files:** overview.md, prompty.md
|
||||
- **Status:** `extracted`
|
||||
|
||||
## dotprompt-site
|
||||
|
||||
- **URL:** https://google.github.io/dotprompt/
|
||||
- **Description:** Google Dotprompt site (home, getting started, implementors) and the repository README. The full spec folder was not read, so schema detail is thin.
|
||||
- **Contributing files:** overview.md, dotprompt.md
|
||||
- **Status:** `extracted`
|
||||
|
||||
## claude-code-slash-commands
|
||||
|
||||
- **URL:** https://code.claude.com/docs/en/slash-commands
|
||||
- **Description:** Claude Code "Custom slash commands and skills" page: command files merged into skills, shared frontmatter, argument substitution, naming and precedence. Version markers seen up to v2.1.280.
|
||||
- **Contributing files:** overview.md, claude-code-commands.md
|
||||
- **Status:** `extracted`
|
||||
|
||||
## mcp-prompts-spec
|
||||
|
||||
- **URL:** https://modelcontextprotocol.io/specification/latest/server/prompts
|
||||
- **Description:** MCP specification page for server prompts (revision 2026-07-28): capability, list and get messages, prompt and argument types, content types and errors.
|
||||
- **Contributing files:** overview.md, mcp-prompts.md
|
||||
- **Status:** `extracted`
|
||||
@@ -0,0 +1,25 @@
|
||||
---
|
||||
topic: vscode-copilot-prompt-files
|
||||
source_keys:
|
||||
- vscode-prompt-files
|
||||
---
|
||||
|
||||
## Role
|
||||
|
||||
This is the native format apm copies verbatim for Copilot, so it is the closest thing to a source-of-truth for the `.prompt.md` shape. It is a documented feature of VS Code and GitHub Copilot, not a standalone specification.
|
||||
|
||||
## Location and naming
|
||||
|
||||
Files use the `.prompt.md` extension. Workspace prompts live in `.github/prompts`; user-profile prompts live in VS Code user data, per profile, and are available across workspaces. Monorepo parent-root discovery is opt-in through a setting. The command name defaults to the file name and can be overridden with a `name` field.
|
||||
|
||||
## Frontmatter
|
||||
|
||||
All fields are optional: `description`, `name`, `argument-hint`, `agent` (`ask`, `agent`, `plan` or a custom agent name), `model` and `tools`. Setting `tools` silently changes the default agent to `agent`. Tools that are not available are ignored without an error. The older `mode` field is not mentioned on the current page, so whether it is still accepted is unconfirmed. Tool precedence runs from the prompt file to the referenced custom agent to the selected agent's defaults.
|
||||
|
||||
## Body syntax
|
||||
|
||||
User input uses `${input:variableName}` or `${input:variableName:placeholder}`. `${selection}` is mentioned; a `${file}` variable is not confirmed. Tool references use `#tool:<name>`, and file references use Markdown links or `#file:`, resolved relative to the prompt file. Invocation arguments can be passed as `/name key=value`, but how they bind to variables is not documented.
|
||||
|
||||
## Limits worth knowing
|
||||
|
||||
Prompt files work only in local harness sessions. For other harnesses the page points to agent skills and says existing prompt files can be converted to skills, which is the same direction Claude Code takes. No schema or formal validation is described, and the customization editor is in preview.
|
||||
@@ -0,0 +1,68 @@
|
||||
name: mattpocock
|
||||
version: 0.2.0
|
||||
description: Matt Pocock's agent skills — planning, grilling, test-first development, triage and bug diagnosis — redistributed from upstream at a pinned release.
|
||||
author:
|
||||
name: Defame1297
|
||||
email: [email protected]
|
||||
url: https://git.rkdr.net/Defame1297/
|
||||
license: MIT
|
||||
homepage: https://git.rkdr.net/Defame1297/holocron/src/branch/main/plugins/mattpocock
|
||||
repository: https://git.rkdr.net/Defame1297/holocron/src/branch/main/plugins/mattpocock
|
||||
keywords:
|
||||
- wayfinder
|
||||
- planning
|
||||
- grilling
|
||||
- domain-modeling
|
||||
- tdd
|
||||
- triage
|
||||
|
||||
# Constrains what .apm/ may contain: instructions, skill, hybrid, or prompts
|
||||
type: hybrid
|
||||
|
||||
targets:
|
||||
- claude
|
||||
- copilot
|
||||
- codex
|
||||
|
||||
# "auto" publishes the authoritative local source layout, or list explicit
|
||||
# repo paths to define the complete publication set.
|
||||
includes: auto
|
||||
|
||||
# This package carries no primitives of its own — it exists so the marketplace
|
||||
# can redistribute upstream skills from github.com/mattpocock/skills (MIT). A
|
||||
# `marketplace.packages` entry takes a local `source:` path, so a third-party
|
||||
# repo cannot be listed directly (same constraint and mechanism as
|
||||
# plugins/onedev, ADR-0026).
|
||||
#
|
||||
# Why these skills, not the whole upstream set:
|
||||
# - `wayfinder` is hand-invoked upstream (`disable-model-invocation: true`) and
|
||||
# its body calls `grilling`, `domain-modeling`, `research` and `prototype`,
|
||||
# and reads the tracker doc written by `setup-matt-pocock-skills`.
|
||||
# - `grill-me`, `grill-with-docs`, `tdd`, `prototype`, `improve-codebase-architecture`,
|
||||
# `triage` and `diagnosing-bugs` replace hand-maintained copies that used to
|
||||
# live in plugins/bin. Upstream's `grill-me`, `grill-with-docs`, `triage` and
|
||||
# `improve-codebase-architecture` are hand-invoked, so another skill cannot
|
||||
# route to them through the Skill tool.
|
||||
# - `research` is not listed: bin's own `research` is first-party and kept, and
|
||||
# so are bin's `diagnose`, `write-docs`, `caveman` and `zoom-out`.
|
||||
#
|
||||
# Pinned on purpose: tracking a third-party `main` would import someone else's
|
||||
# drift. Bump every tag together, deliberately, so the skills stay at one
|
||||
# upstream revision.
|
||||
dependencies:
|
||||
apm:
|
||||
- mattpocock/skills/skills/engineering/wayfinder#v1.3.2
|
||||
- mattpocock/skills/skills/productivity/grilling#v1.3.2
|
||||
- mattpocock/skills/skills/engineering/domain-modeling#v1.3.2
|
||||
- mattpocock/skills/skills/engineering/setup-matt-pocock-skills#v1.3.2
|
||||
- mattpocock/skills/skills/productivity/grill-me#v1.3.2
|
||||
- mattpocock/skills/skills/engineering/grill-with-docs#v1.3.2
|
||||
- mattpocock/skills/skills/engineering/tdd#v1.3.2
|
||||
- mattpocock/skills/skills/engineering/prototype#v1.3.2
|
||||
- mattpocock/skills/skills/engineering/improve-codebase-architecture#v1.3.2
|
||||
- mattpocock/skills/skills/engineering/triage#v1.3.2
|
||||
- mattpocock/skills/skills/engineering/diagnosing-bugs#v1.3.2
|
||||
mcp: []
|
||||
devDependencies:
|
||||
apm: []
|
||||
scripts: {}
|
||||
@@ -1072,6 +1072,44 @@ body_case body-arrow-bare-not-notation silent "" \
|
||||
body_case body-fenced-example silent "" \
|
||||
$'```\nRun /no-such-fenced-skill instead.\n```'
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Skills a package pulls from a subdirectory of a third-party repo
|
||||
# ---------------------------------------------------------------------------
|
||||
# plugins/mattpocock declares `owner/repo/<path>/<skill>#ref` entries and ships no
|
||||
# skills of its own. A skill in ANOTHER plugin that routes to one of those names
|
||||
# must resolve, with no apm_modules/ and no install; a whole-repo dependency
|
||||
# (`host/owner/repo`) names no skill and must not mint one.
|
||||
echo ""
|
||||
echo "--- a name pulled from a third-party repo subpath resolves; a whole-repo dependency mints none ---"
|
||||
VROOT="$TMPDIR_T/virtual"
|
||||
write_skill "$VROOT/plugins/subject-plugin/.apm/skills/my-skill" my-skill \
|
||||
"Use when doing the thing. Not the other thing -> \`pulled-skill\`. Not a repo name -> \`whole-repo\`."
|
||||
mkdir -p "$VROOT/plugins/wrapper-plugin"
|
||||
cat > "$VROOT/plugins/wrapper-plugin/apm.yml" <<'YML'
|
||||
name: wrapper-plugin
|
||||
version: 0.1.0
|
||||
dependencies:
|
||||
apm:
|
||||
- someowner/somerepo/skills/engineering/pulled-skill#v1.0.0
|
||||
- code.example.com/someowner/whole-repo#v1.0.0
|
||||
mcp: []
|
||||
YML
|
||||
mkdir -p "$VROOT/plugins/wrapper-plugin/.apm/skills/anchor"
|
||||
write_skill "$VROOT/plugins/wrapper-plugin/.apm/skills/anchor" anchor "Use when anchoring."
|
||||
set +e
|
||||
VOUT="$(bash "$HOOK" "$VROOT/plugins/subject-plugin/.apm/skills/my-skill/SKILL.md" 2>&1)"
|
||||
set -e
|
||||
if [[ "$VOUT" != *"routes to 'pulled-skill'"* ]]; then
|
||||
pass "a skill pulled from a third-party repo subpath resolves"
|
||||
else
|
||||
fail "the subpath dependency did not resolve: $VOUT"
|
||||
fi
|
||||
if [[ "$VOUT" == *"routes to 'whole-repo'"* ]]; then
|
||||
pass "a whole-repo dependency does not mint a skill name"
|
||||
else
|
||||
fail "a whole-repo dependency resolved as a skill: $VOUT"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "Results: $PASS passed, $FAIL failed"
|
||||
[[ $FAIL -eq 0 ]]
|
||||
Reference in new issue
Block a user