Everything is in place. Let me write the final response.

---

## 1. Existing conventions

- **Test framework**: none currently. The closest reference is `pi-subagents` (the adapter that consumes these prompts), whose `package.json` declares `node --test --experimental-strip-types` as the unit-test runner. I matched that convention exactly so this directory lines up with the surrounding pi extension ecosystem.
- **Assertion style**: `node:assert/strict` (no third-party assertion lib, no chai/jest).
- **Test file pattern**: `test/<name>.test.ts`, dependency-free, ESM with `.ts` imports.
- **Fixtures / support helpers**: one `test/support/frontmatter.ts` containing a small dependency-free YAML frontmatter + chain-string parser (mirrors the subset of YAML the on-disk files actually use: `key: value`, `key: "quoted"`, and `key: |` block scalars). The parser is itself covered by self-tests inside the suite.
- **No fixtures on disk for prompts** — every `c-*.md` and `p-*.md` is a real production file, so tests read them in place (no copy-paste, no drift).

## 2. Test cases to add

All tests live in one file, `test/chain-workflow.test.ts`, in 11 `describe` blocks / 100 tests.

**Happy path** — primary expected behavior
- `loads c-*.md` (4 tests, one per recipe)
- `c-*.md has description, argument-hint, and chain fields` (4)
- `c-*.md.chain parses to [expected sequence]` (4)
- `c-*.md contains a $@ placeholder for the user argument` (4)
- `step p-* exists as a p-*.md file` (10 — every step named in any chain)
- `p-* declares subagent: true` / `fork: true` / `description` / `argument-hint` / `$@ body` (10 × 4 = 40)

**Edge cases** — boundaries, off-by-one, format
- `every chain has at least one step`
- `no chain has a duplicate step`
- `every chain step is lowercase kebab-case starting with 'p-'`
- `chain frontmatter uses ' -> ' (single space) and not bare '->'`
- `every chain ends with a real prompt file, not a typo`
- `every argument-hint is non-empty`
- `argument-hints are wrapped in [...]` (matches the documented convention in Doc/chain-commands.md)
- Self-tests for the parser: empty fence, unterminated fence, block-scalar de-indent, comment handling, CRLF, empty chain value, chain with no separator, chain with extra spaces, single-dash not splitting.

**Error cases** — invalid input, missing deps
- `rejects a chain file with no closing fence` (returns empty frontmatter, mirroring the upstream adapter)
- `rejects a chain value with no separator at all`
- `flags a chain step that does not exist on disk`
- `every chain recipe has a non-empty description`
- `no p-* used in a chain is missing the subagent/fork flags` (the exact failure mode Doc/chain-commands.md's troubleshooting table calls out: "Steps seem disconnected → `fork: true` is required on each `p-*.md`. Check frontmatter.")
- Cross-doc consistency: every recipe has a table row in **both** `Doc/prompts.md` and `Doc/chain-commands.md`, and each row's listed step sequence matches the actual `chain:` frontmatter.

**Directory sanity** — accidental deletion
- At least one `c-*.md` and one `p-*.md` exist; both Doc pages exist; no orphan files in `Doc/`; the prompts root contains only `c-*`, `p-*`, `Doc/`, `test/`, or dotfiles.

## 3. Test code

Runnable with Node 26 (already on the box). Files added:

- `test/support/frontmatter.ts` — 123-line dependency-free frontmatter + chain parser, with full block-scalar + quote + comment + CRLF support.
- `test/chain-workflow.test.ts` — 492 lines, 100 tests, 11 suites.
- `test/fixtures/valid-prompt.md` — small fixture demonstrating block-scalar frontmatter (not referenced directly by the test, kept for future fixture-based tests).
- `test/package.json` — single `test` / `test:file` script.

## 4. How to run

From inside `.pi/agent/prompts/`:

```bash
# Run all tests in this file
node --test --experimental-strip-types test/chain-workflow.test.ts

# Or via the package.json script
cd test && npm test

# Run just the new tests (this is the only test file)
cd .. && node --test --experimental-strip-types test/chain-workflow.test.ts
```

Final run: **100 tests, 11 suites, 0 failures, 147 ms**.

## 5. Coverage gaps

Things that **cannot** be tested without a refactor, flagged but not fixed:

1. **End-to-end chain execution** — the actual `/prompt-workflow c-...` path goes through the pi-subagents adapter, which dispatches to an LLM subagent. There is no deterministic way to test that without mocking the LLM. The static tests here are the highest-value, lowest-flakiness layer (frontmatter shape, cross-doc consistency, file existence, sequence matching).
2. **The real `parseFrontmatter` in `pi-subagents`** — my test parser is a from-scratch reimplementation. A future hardening pass could replace `test/support/frontmatter.ts` with a thin re-export of the adapter's own parser to eliminate drift, but that would add a cross-package test dep which the parent asked to avoid.
3. **Pre-existing inconsistency in the prompts tree** (not a test gap, but uncovered while writing tests): `p-explain.md` and `p-doc.md` do **not** declare `subagent: true` / `fork: true`, while Doc/chain-commands.md says "Only the `p-*.md` files are marked with `subagent: true` and `fork: true`." This is consistent with the fact that neither prompt is currently used in any chain recipe (only chain-used prompts are required to have the flags, per Doc/chain-commands.md's troubleshooting table), so the tests are correct as written. The two docs are slightly out of sync about whether *all* p-*.md or only chain-used p-*.md must have those flags. Worth a doc clarification, not a test change.

**Smallest-viable-setup callout**: this codebase had no test scaffolding. I added the minimum needed (one parser helper, one test file, one `package.json` with a `test` script). All four new files are inside a new `test/` directory; no existing files in `.pi/agent/prompts/` were modified.