Write prd

From tam159/next-role · View interactive version

Write prd is an AI agent skill from the GitHub repository tam159/next-role. Generate a concise PRD for the feature built in the current session and save it to docs/prd/. Use this skill whenever the user says "write a PRD", "generate a PRD", "/write-prd", asks to document the feature just shipped, or otherwise requests a product/feature spec for work done in this session — e

How to use this skill

Skill file

Write a PRD that captures the feature implemented in the current session, in the house style of docs/prd/. That folder is an OKF (Open Knowledge Format) knowledge bundle — see docs/prd/README.md — so every PRD is a markdown concept document with YAML frontmatter, and the relative links between PRDs draw the edges of the bundle's knowledge graph.

The audience is a future developer or AI agent reading the file cold — months later, after the code has drifted. The point is not to restate what the diff shows; it is to capture the why and the non-obvious decisions that the code alone can't explain. The frontmatter description doubles as the PRD's one line in docs/prd/index.md — it is what an AI agent reads to decide whether to open the file at all, so make it carry the feature's essence.

Workflow

  1. Anchor on the existing style. Read at least one existing PRD in docs/prd/ (e.g. 10_print_file_as_pdf.md or 03_jd_url_extraction.md) before writing. Match its tone, density, and section order. Do not invent new sections.
  1. Mine the session for content. The conversation history is your source material — pull from:
  1. Propose a filename and version, then confirm. Filename is NN_snake_case.md — NN is the zero-padded next number in sequence (ls docs/prd/ for the current highest; e.g. 28_feature_name.md). Version is v1 for a new feature, v2 etc. if extending one — check whether a related PRD already exists. Briefly tell the user the proposed path and version in one line, then write it. Don't block on a long confirmation cycle; the user can rename if needed.
  1. Write the PRD using the template below. Save to docs/prd/NN_<name>.md.
  1. Update the bundle indexes. Add the PRD's line to docs/prd/index.md under # PRD — title-alphabetical order, format * [Title](NN_name.md) - <description from frontmatter> — then regenerate docs/prd/viz.html (commands live in docs/prd/README.md → "Adding or updating a PRD"; expect the reported concept count to go up by one).
  1. Show the user the path and a one-line summary of what was written. Don't dump the PRD back into chat — they can open the file.

PRD template

Use this exact structure. Section names and order are not negotiable — they're the contract that lets future readers skim across PRDs. The **Extends:** line is included only when the feature builds on an earlier PRD. (Example links here use placeholder targets like NN_other.md deliberately — never put real NN_*.md targets inside a code fence; the graph's edge scanner reads fences too.)

---
type: PRD
title: "<Feature Name — no 'PRD:' prefix, no version suffix>"
description: "<One sentence distilled from Why — becomes the index.md line. Ends with a period.>"
tags: [<2-4 from the taxonomy below>]
timestamp: '<now, ISO 8601 with offset, e.g. 2026-07-18T12:00:00+07:00>'
status: "shipped"
scope: "<which app/area>"
version: v<N>
---

**Extends:** [<other PRD title>](NN_other.md)

# Why

<1–2 paragraphs. What problem did this solve? What was painful or impossible before? Why now? Reference the README or upstream PRD if the feature is part of a larger flow.>

# What the user sees

<The user-visible surface, in plain language. Where the button is, what gets typed, what file appears. Include accepted formats / limits / edge UI behavior if they exist. If a surface was *deliberately not added* (e.g. "no paperclip in the chat composer"), say so and why — negative space is often the most valuable thing to record.>

# How — the key architectural choice[s]

<The 1–3 design decisions that shaped the implementation. For each: state the decision in bold, then explain why this shape and not the obvious alternative. This is the heart of the PRD — if a future reader skims only one section, it's this one.>

# Files of interest

| Concern | Path |
|---|---|
| <what this file does> | `<path>` [(`<symbol>`, lines ~A–B)] |
| ... | ... |

# Decisions worth remembering

- **<Short decision title>.** <One paragraph explaining what was chosen, what was rejected, and why. Include the failure mode the rejected option would have caused if non-obvious.>
- ...

# Deferred (intentional non-goals for v<N>)

- **<Thing we explicitly didn't do>.** <Why it's out of scope, and what would trigger revisiting it.>
- ...

# How to verify end-to-end

1. <Concrete step a human can run, starting from a fresh `docker compose up -d` if relevant.>
2. <...>

OKF rules

Superseding an earlier PRD

When the new feature replaces an old one, both files change:

The worked pair to copy: 16_disable_subagent_streaming.md / 18_langchain_react_migration.md.

Writing style — match the existing PRDs

Do not

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.