---
name: render-docx
description: Use when the user wants to render the machine-discovery Project Document or Commercial Offer into a styled Word document. Converts only project-doc/project.md or commercial-offer/commercial-offer.md into a sibling .docx using the matching bundled DOCX reference template. Triggers on "render discovery docx", "convert project document to Word", "render commercial offer", "/machine-discovery:render-docx <path.md>", and "/render-docx <path.md>".
---

# Render DOCX

Convert the Discovery Project Document or Commercial Offer Markdown into a styled Word document.

## Core principle

The project document is the consolidated customer-facing package for Discovery: it groups the requirements, HLA, planning, milestones, PRD items, and related F1 outputs. Only the Project Document and Commercial Offer are rendered to DOCX. The other Discovery Markdown artifacts remain internal/atomic source material and stop at `.md`.

Markdown owns the content. The bundled DOCX reference template owns the visual style. The skill MUST NOT invent sections, add logos, add PDF output, or expose flags through the slash command.

## Template selection

```text
docs/discovery/<project-slug>/project-doc/project.md
  -> templates/project-doc-reference.docx

docs/discovery/<project-slug>/commercial-offer/commercial-offer.md
  -> templates/commercial-offer-reference.docx
```

## The 1 phase

| # | Phase | Input | Output | Prompt file |
|---|---|---|---|
| 1 | Render DOCX | One Markdown path | Sibling `.docx` | [prompts/01-render-docx.md](prompts/01-render-docx.md) |

## Operating protocol

1. Identify the input path from the user or slash command arguments.
2. Require exactly one Markdown path. If the user passes flags, multiple paths, or no path, ask for one renderable path.
3. The path MUST be either `docs/discovery/<project-slug>/project-doc/project.md` or `docs/discovery/<project-slug>/commercial-offer/commercial-offer.md`. If not, stop and explain that atomic Discovery artifacts are not rendered directly.
4. Read [prompts/01-render-docx.md](prompts/01-render-docx.md). Treat the prompt body as a system instruction and follow its rules literally.
5. Run the bundled script:

```bash
bash "$CLAUDE_PLUGIN_ROOT/scripts/render-docx.sh" "<path.md>"
```

If `$CLAUDE_PLUGIN_ROOT` is not available in a local development checkout, run:

```bash
bash plugins/machine-discovery/scripts/render-docx.sh "<path.md>"
```

On Windows, if `bash` points to a broken WSL install, use Git Bash directly.

6. Final gate: score against [references/checklist.md](references/checklist.md). All items MUST pass before handoff.
7. Report only the generated `.docx` path, or the script's actionable error.

## Hard rules

- **One input path only.** The command MUST NOT accept flags or multiple files.
- **Two renderable artifacts only.** Only `project-doc/project.md` and `commercial-offer/commercial-offer.md` may render to DOCX.
- **DOCX only.** Do not generate PDF, HTML, images, or sidecar files.
- **No overwrite.** If `<input>.docx` exists, stop and ask the user to move, rename, or delete it.
- **No content changes.** Do not rewrite, add sections, add logos, or impose a document structure.
- **Always use bundled reference DOCX.** Rendering MUST use `project-doc-reference.docx` or `commercial-offer-reference.docx`.
- **Relative assets resolve from the Markdown folder.** Run Pandoc from the input file's directory.

## References

- Phase prompt: [prompts/01-render-docx.md](prompts/01-render-docx.md)
- Style templates: [templates/project-doc-reference.docx](templates/project-doc-reference.docx), [templates/commercial-offer-reference.docx](templates/commercial-offer-reference.docx)
- Handoff checklist: [references/checklist.md](references/checklist.md)
