feat(kyberforge): add prompt-author skill for .apm/prompts files

Add prompt-author, shaped like instructions-author: dispatch to create or
improve, a scaffold script that also creates .apm/prompts/, a minimal
template, and references on schema, per-target field survival, content and
verification. Verification is a throwaway apm install because apm compile
never reads prompts.

Forge gains a Prompt file row and a prompt-file-or-hand-invoked-skill
discriminator, and apm-workflow points at prompt-author from compile.md.
Bump kyberforge to 2.2.0 and the root pin, version and marketplace.

Refs #149

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_012CqgnwEGtmfsjcoG9QwByN
This commit is contained in:
Defame1297andClaude Sonnet 5.5 committed 2026-10-15 16:04:33 +00:00
1 parent 59e0f3a3b8
commit 6a3fd48fbd
24 files changed
+719 -19

No files matched your search

@@ -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:
- 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 Step 3 below is done.
## Before touching the filesystem
Confirm, and ask the user for anything missing:
- [ ] What the command 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 `.claude/commands/<stem>.md`, `.github/prompts/<stem>.prompt.md`, `.cursor/commands/<stem>.md` and `.gemini/commands/<stem>.toml` ("not managed by APM") and installs everything else. `--force` overwrites it. List those paths 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,34 @@
---
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. Signals are grill output, audit findings, inline feedback, or a session describing a command that is missing, lost a field or ignores its arguments. Apply what the signals name 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][\w-]{0,63}` and install warned `input: rejected` | Rename it |
| An argument appears twice | Duplicate names are not caught | Remove the duplicate |
| 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; `--force` does not deploy it either | Remove the hidden characters |
Cases not in the table: read `references/target-mapping.md`.
## Step 3 — Split or trim
A prompt 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's name and 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. Object and map forms are accepted, but their descriptions are discarded |
| `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][\w-]{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 as a scheduled workflow that the command integrator skips. Do not use them in a plain prompt. 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 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. Tag characters and bidi overrides are critical: install exits 1 and deploys nothing, even with `--force`, which still exits 0.
## 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.