Files
Holocron/plugins/kyberforge/docs/research/docs/microsoft-apm/prompt-gotchas.md
T
Defame1297andClaude Sonnet 5.5 8381c9f395 fix(kyberforge): correct prompt-author claims found in clean-context review
Three clean-context reviewers checked the skill against apm 0.28.0. Fix what
they showed to be wrong: a failed hidden-character install still writes the
Copilot and Gemini outputs and withholds only the Claude command; a multi-key
input item turns each key into an argument. Add the symptom row, use "prompt
file" for the source concept, name the Claude slash-commands source for the
forge discriminator, drop an ambiguous Step 3 pointer and a "trim" heading
with no trim guidance, and tighten two bats assertions. CONTEXT.md now says
"a single-file command that is not a SKILL.md".

Refs #149

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_012CqgnwEGtmfsjcoG9QwByN
2026-10-15 16:16:27 +00:00

8.5 KiB

topic, source_keys
topic source_keys
prompt-gotchas
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.