diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json index 0d1bec8..3b99ba2 100644 --- a/.claude-plugin/marketplace.json +++ b/.claude-plugin/marketplace.json @@ -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.2", + "version": "0.5.3", "owner": { "name": "Defame1297", "email": "defame1297@rkdr.net", @@ -11,7 +11,7 @@ { "name": "kyberforge", "description": "Skills and agents for creating, maintaining, and managing an apm plugin marketplace for Claude Code and GitHub Copilot.", - "version": "2.1.0", + "version": "2.2.0", "category": "Developer Tools", "source": "./plugins/kyberforge" }, diff --git a/CONTEXT.md b/CONTEXT.md index 62ad8ec..f3ac026 100644 --- a/CONTEXT.md +++ b/CONTEXT.md @@ -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//.apm/skills//SKILL.md`. +`plugins//.apm/skills//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/.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//`, consisting of that directory's `apm.yml` plus diff --git a/apm.yml b/apm.yml index 6301d0f..7ec1879 100644 --- a/apm.yml +++ b/apm.yml @@ -1,5 +1,5 @@ name: holocron -version: 0.5.2 +version: 0.5.3 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.1.0: + kyberforge#2.2.0: 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.2 + version: 0.5.3 owner: name: Defame1297 email: defame1297@rkdr.net diff --git a/plugins/kyberforge/.apm/skills/apm-workflow/SKILL.md b/plugins/kyberforge/.apm/skills/apm-workflow/SKILL.md index 7c37f68..7dbf603 100644 --- a/plugins/kyberforge/.apm/skills/apm-workflow/SKILL.md +++ b/plugins/kyberforge/.apm/skills/apm-workflow/SKILL.md @@ -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.2" + version: "1.0.3" category: apm source_keys: - context7-microsoft-apm diff --git a/plugins/kyberforge/.apm/skills/apm-workflow/references/compile.md b/plugins/kyberforge/.apm/skills/apm-workflow/references/compile.md index 4a110e9..8118d26 100644 --- a/plugins/kyberforge/.apm/skills/apm-workflow/references/compile.md +++ b/plugins/kyberforge/.apm/skills/apm-workflow/references/compile.md @@ -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`. To author an instructions file, use `instructions-author` — it covers which fields each target drops. +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 diff --git a/plugins/kyberforge/.apm/skills/forge/SKILL.md b/plugins/kyberforge/.apm/skills/forge/SKILL.md index ee7c6db..e3ae8e3 100644 --- a/plugins/kyberforge/.apm/skills/forge/SKILL.md +++ b/plugins/kyberforge/.apm/skills/forge/SKILL.md @@ -6,7 +6,7 @@ description: > skill -> `skill-author`. Not a named agent -> `agent-author`. Not a named plugin -> `apm-workflow`. metadata: - version: "1.0.3" + version: "1.0.4" category: factory source_keys: - claude-code-subagents-docs @@ -15,7 +15,7 @@ metadata: ## Gotchas -- forge is an optional guided entry point, not a gate — `skill-author`, `agent-author`, `instructions-author`, `factory-audit` and `apm-workflow` all stay directly invokable, and forge never intercepts a direct call to one. +- 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 @@ -34,6 +34,7 @@ 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` | @@ -48,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`, `instructions-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. diff --git a/plugins/kyberforge/.apm/skills/forge/references/author-routes.md b/plugins/kyberforge/.apm/skills/forge/references/author-routes.md index aed6c48..664a626 100644 --- a/plugins/kyberforge/.apm/skills/forge/references/author-routes.md +++ b/plugins/kyberforge/.apm/skills/forge/references/author-routes.md @@ -3,16 +3,19 @@ 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, agent or instructions file 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, an agent/subagent -definition or an instructions file. Route a skill to `skill-author`, an agent to `agent-author` and -an instructions file to `instructions-author`. The branches differ on the author skill only, and -everything below applies to all three — except that `factory-audit` has no instructions flow yet, so -an instructions file is verified by `instructions-author`'s own throwaway-package check and the -clean-context rerun below is skipped for it. +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? @@ -26,6 +29,18 @@ instruction as context, not as enforced configuration, so only a rule belongs th | 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 diff --git a/plugins/kyberforge/.apm/skills/forge/references/sources.md b/plugins/kyberforge/.apm/skills/forge/references/sources.md index 1db9e53..400d842 100644 --- a/plugins/kyberforge/.apm/skills/forge/references/sources.md +++ b/plugins/kyberforge/.apm/skills/forge/references/sources.md @@ -24,6 +24,30 @@ - **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 - **URL:** https://code.claude.com/docs/en/plugins diff --git a/plugins/kyberforge/.apm/skills/forge/references/version-bump.md b/plugins/kyberforge/.apm/skills/forge/references/version-bump.md index 5a5fc25..b9b8440 100644 --- a/plugins/kyberforge/.apm/skills/forge/references/version-bump.md +++ b/plugins/kyberforge/.apm/skills/forge/references/version-bump.md @@ -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` and `instructions-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 +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 diff --git a/plugins/kyberforge/.apm/skills/prompt-author/SKILL.md b/plugins/kyberforge/.apm/skills/prompt-author/SKILL.md new file mode 100644 index 0000000..39d2899 --- /dev/null +++ b/plugins/kyberforge/.apm/skills/prompt-author/SKILL.md @@ -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 `.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. diff --git a/plugins/kyberforge/.apm/skills/prompt-author/assets/README.md b/plugins/kyberforge/.apm/skills/prompt-author/assets/README.md new file mode 100644 index 0000000..f6c8868 --- /dev/null +++ b/plugins/kyberforge/.apm/skills/prompt-author/assets/README.md @@ -0,0 +1,5 @@ +# assets/ + +## templates/ + +- **`prompt.md`** — minimal valid `.apm/prompts/.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`. diff --git a/plugins/kyberforge/.apm/skills/prompt-author/assets/templates/prompt.md b/plugins/kyberforge/.apm/skills/prompt-author/assets/templates/prompt.md new file mode 100644 index 0000000..7cc7966 --- /dev/null +++ b/plugins/kyberforge/.apm/skills/prompt-author/assets/templates/prompt.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: "" # synthesised from input: when omitted +--- +FILL IN: an instruction to the model, written so it works with nothing else loaded. + +Work on ${input:target}. diff --git a/plugins/kyberforge/.apm/skills/prompt-author/references/content.md b/plugins/kyberforge/.apm/skills/prompt-author/references/content.md new file mode 100644 index 0000000..dabfae4 --- /dev/null +++ b/plugins/kyberforge/.apm/skills/prompt-author/references/content.md @@ -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. diff --git a/plugins/kyberforge/.apm/skills/prompt-author/references/create.md b/plugins/kyberforge/.apm/skills/prompt-author/references/create.md new file mode 100644 index 0000000..a9bb002 --- /dev/null +++ b/plugins/kyberforge/.apm/skills/prompt-author/references/create.md @@ -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 +``` + +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`. diff --git a/plugins/kyberforge/.apm/skills/prompt-author/references/improve.md b/plugins/kyberforge/.apm/skills/prompt-author/references/improve.md new file mode 100644 index 0000000..651e968 --- /dev/null +++ b/plugins/kyberforge/.apm/skills/prompt-author/references/improve.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 `.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. diff --git a/plugins/kyberforge/.apm/skills/prompt-author/references/schema.md b/plugins/kyberforge/.apm/skills/prompt-author/references/schema.md new file mode 100644 index 0000000..61424af --- /dev/null +++ b/plugins/kyberforge/.apm/skills/prompt-author/references/schema.md @@ -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/.prompt.md`, flat. A root-level `.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 ` ` 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`. diff --git a/plugins/kyberforge/.apm/skills/prompt-author/references/sources.md b/plugins/kyberforge/.apm/skills/prompt-author/references/sources.md new file mode 100644 index 0000000..ad339f1 --- /dev/null +++ b/plugins/kyberforge/.apm/skills/prompt-author/references/sources.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` diff --git a/plugins/kyberforge/.apm/skills/prompt-author/references/target-mapping.md b/plugins/kyberforge/.apm/skills/prompt-author/references/target-mapping.md new file mode 100644 index 0000000..8bcd152 --- /dev/null +++ b/plugins/kyberforge/.apm/skills/prompt-author/references/target-mapping.md @@ -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/.prompt.md` | Byte copy | +| claude | `.claude/commands/.md` | Reconstructed slash command | +| cursor, opencode, grok-build | `.cursor/commands/`, `.opencode/commands/`, `.grok/commands/` `.md` | Same transform as claude | +| windsurf | `.windsurf/workflows/.md` | Same transform | +| gemini | `.gemini/commands/.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. diff --git a/plugins/kyberforge/.apm/skills/prompt-author/references/verify.md b/plugins/kyberforge/.apm/skills/prompt-author/references/verify.md new file mode 100644 index 0000000..87f1d92 --- /dev/null +++ b/plugins/kyberforge/.apm/skills/prompt-author/references/verify.md @@ -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 /.apm/prompts/.prompt.md "$d/.apm/prompts/" + (cd "$d" && apm install && cat .claude/commands/.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. diff --git a/plugins/kyberforge/.apm/skills/prompt-author/scripts/README.md b/plugins/kyberforge/.apm/skills/prompt-author/scripts/README.md new file mode 100644 index 0000000..4ddedc9 --- /dev/null +++ b/plugins/kyberforge/.apm/skills/prompt-author/scripts/README.md @@ -0,0 +1,3 @@ +# scripts/ + +- **`new-prompt.sh `** — scaffolds `/.apm/prompts/.prompt.md` from `assets/templates/prompt.md`, creating `.apm/prompts/` because `apm init` does not. Walks up from `` 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. diff --git a/plugins/kyberforge/.apm/skills/prompt-author/scripts/new-prompt.sh b/plugins/kyberforge/.apm/skills/prompt-author/scripts/new-prompt.sh new file mode 100755 index 0000000..82cfc31 --- /dev/null +++ b/plugins/kyberforge/.apm/skills/prompt-author/scripts/new-prompt.sh @@ -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 < + +Scaffold an apm prompt file from the bundled template. + +Arguments: + name Kebab-case stem. Becomes .prompt.md and, after install, the + command 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 + /.apm/prompts/.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 /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 diff --git a/plugins/kyberforge/.apm/skills/prompt-author/tests/README.md b/plugins/kyberforge/.apm/skills/prompt-author/tests/README.md new file mode 100644 index 0000000..a8905d3 --- /dev/null +++ b/plugins/kyberforge/.apm/skills/prompt-author/tests/README.md @@ -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 +``` diff --git a/plugins/kyberforge/.apm/skills/prompt-author/tests/new-prompt.bats b/plugins/kyberforge/.apm/skills/prompt-author/tests/new-prompt.bats new file mode 100644 index 0000000..3c3187b --- /dev/null +++ b/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 .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" +} diff --git a/plugins/kyberforge/README.md b/plugins/kyberforge/README.md index 5b1d787..d1365c0 100644 --- a/plugins/kyberforge/README.md +++ b/plugins/kyberforge/README.md @@ -39,10 +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, instructions file, 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 | diff --git a/plugins/kyberforge/apm.yml b/plugins/kyberforge/apm.yml index 150ea86..39f53f6 100644 --- a/plugins/kyberforge/apm.yml +++ b/plugins/kyberforge/apm.yml @@ -1,5 +1,5 @@ name: kyberforge -version: 2.1.0 +version: 2.2.0 description: Skills and agents for creating, maintaining, and managing an apm plugin marketplace for Claude Code and GitHub Copilot. author: name: Defame1297 diff --git a/plugins/kyberforge/docs/research/docs/microsoft-apm/prompt-gotchas.md b/plugins/kyberforge/docs/research/docs/microsoft-apm/prompt-gotchas.md new file mode 100644 index 0000000..1dff0c6 --- /dev/null +++ b/plugins/kyberforge/docs/research/docs/microsoft-apm/prompt-gotchas.md @@ -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 `/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 `$` anywhere in a Gemini body prepends an "Arguments: {{args}}" line. + +## Identity, collisions and ownership + +- **Observed:** a pre-existing hand-written `.claude/commands/.md`, `.github/prompts/.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. diff --git a/plugins/kyberforge/docs/research/docs/microsoft-apm/prompt-primitive-schema.md b/plugins/kyberforge/docs/research/docs/microsoft-apm/prompt-primitive-schema.md index b5331bc..28947b4 100644 --- a/plugins/kyberforge/docs/research/docs/microsoft-apm/prompt-primitive-schema.md +++ b/plugins/kyberforge/docs/research/docs/microsoft-apm/prompt-primitive-schema.md @@ -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). diff --git a/plugins/kyberforge/docs/research/docs/microsoft-apm/prompt-target-mapping.md b/plugins/kyberforge/docs/research/docs/microsoft-apm/prompt-target-mapping.md new file mode 100644 index 0000000..a9a47e8 --- /dev/null +++ b/plugins/kyberforge/docs/research/docs/microsoft-apm/prompt-target-mapping.md @@ -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/.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/.prompt.md` | Byte-identical copy | +| claude | `.claude/commands/.md` | Reconstructed slash command | +| cursor | `.cursor/commands/.md` | Identical transform to claude; output is byte-identical | +| opencode | `.opencode/commands/.md` | Identical transform | +| grok-build | `.grok/commands/.md` | Identical transform | +| windsurf | `.windsurf/workflows/.md` | Identical transform, workflow directory | +| gemini | `.gemini/commands/.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 ` ` 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 `/` followed by arguments. Windsurf uses the workflows menu. Consumers can bypass the picker with an `apm.yml` script and `apm run