skills/write-a-prd/SKILL.md
--- name: write-a-prd description: Generate a PRD through an interactive interview. Defers to /ro:repo-mode for output target — `personal` repos publish the PRD as a GitHub issue (Matt Pocock's 7-section template with ready-for-agent label, agent-native repo pattern); `work` repos write to gitignored `.ralph/<name>/prd.md` so nothing leaks to the work GH/Jira/ADO project. First-run prompt picks the mode and persists per-repo; suggested default comes from the gh remote owner. Falls back to local
npx skillsauth add RonanCodes/ronan-skills skills/write-a-prdInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Interactive interview that produces a PRD ready for slicing into vertical-slice issues and consumption by a Ralph-style or planner-worker autonomous loop.
Resolution order (highest precedence first):
--target gh|local flag — always wins./ro:repo-mode resolution. Per-repo .claude/repo-mode, then global ~/.claude/repo-mode. If personal → --target gh. If work → --target local (no GH issue created — keeps the work GH/Jira/ADO project clean).unset: run the first-run prompt described in /ro:repo-mode § "First-run prompt" (auto-suggest based on gh repo view --json owner, save to .claude/repo-mode, ask once whether to also save as ~/.claude/repo-mode global default). This prompt fires exactly once per repo, then never again.gh remote exists → force --target local regardless of mode (gh issue create would fail).The resolver is the same 4-line snippet documented in /ro:repo-mode:
mode=""
[ -f .claude/repo-mode ] && mode="$(tr -d '[:space:]' < .claude/repo-mode)"
[ -z "$mode" ] && [ -f "$HOME/.claude/repo-mode" ] && mode="$(tr -d '[:space:]' < "$HOME/.claude/repo-mode")"
case "$mode" in personal|work) ;; *) mode="unset" ;; esac
When --target gh is selected, after the interview render the PRD content into the body template and publish via:
gh issue create \
--title "<feature short title>" \
--label "kind:prd" \
--label "${LIFECYCLE_LABEL}" \
--body-file - # piped from the rendered template
Lifecycle label rules (per the canonical label system, ~/Dev/ronan-skills/canon/labels.md):
LIFECYCLE_LABEL=needs-grilling. PRDs start as raw ideas. /ro:day-shift will pick them up and grill via AskUserQuestion, then flip to ready-for-agent when concrete.--skip-grill is passed, or the user explicitly bypassed the grill during this run (interactive grilling completed inline): LIFECYCLE_LABEL=ready-for-agent. Also add needs-grilling-skipped so the reviewer knows ACs may be thinner.kind:prd is always added: this is a parent PRD that /ro:slice-into-issues will split into kind:slice children referencing #$PARENT via ## Parent.Legacy project synonyms (e.g. Sandcastle in mattpocock/course-video-manager) still work via --label <name>. Detect via gh label list --json name,description --jq '.[] | select(.description | contains("agent"))' or docs/agents/triage-labels.md.
After issue creation, point the user at /ro:day-shift to start the grill — that's where needs-grilling becomes ready-for-agent.
## Problem Statement
The problem the user is facing, from the user's perspective.
## Solution
The solution to the problem, from the user's perspective.
## User Stories
A long, numbered list. Each one shaped:
1. As a <actor>, I want <feature>, so that <benefit>
2. ...
Be extensive. Cover all aspects of the feature.
## Implementation Decisions
Modules to build or modify (favour deep modules). Interfaces. Technical clarifications. Architectural decisions. Schema changes. API contracts. Specific interactions.
Do NOT include file paths or code snippets — they go stale fast. Exception: a prototype-derived snippet (state machine, reducer, schema, type shape) that encodes a decision more precisely than prose can. Trim to the decision-rich parts.
## Testing Decisions
What makes a good test for this feature (external behaviour, not implementation). Which modules will be tested. Prior art for similar tests in the codebase.
> **Every slice this PRD generates inherits the close-the-loop test ACs (unit + integration + e2e + 30-second live smoke). Do not skip.** Captured at `[[close-the-loop-tests-acs]]` and enforced by `/ro:slice-into-issues` (which emits the `### Close-the-loop tests` subsection in every slice body) and `/ro:planner-worker` (which refuses to dispatch slices missing that section).
## Out of Scope
What this PRD explicitly does NOT cover.
## Further Notes
Anything else worth recording.
Output: the new GH issue number. Call it $PARENT. Hand off to /ro:slice-into-issues which will create child issues referencing #$PARENT via ## Parent\n\n#$PARENT.
/write-a-prd --quick my-feature # Resolve target via /ro:repo-mode; personal -> GH issue, work -> .ralph/prd.json
/write-a-prd --plan my-feature # Same; --plan adds reviewable plan.md gate
/write-a-prd --target local my-feature # Force local .ralph/prd.json regardless of repo-mode
/write-a-prd --target gh --label Sandcastle my-feature # Force GH issue, custom label
/write-a-prd my-feature # Defaults to --quick + repo-mode resolution
Ask these in order, one at a time. Adapt follow-ups based on answers.
Create .ralph/prd.json (create .ralph/ directory if needed):
{
"project": "<project-name from package.json or directory name>",
"branchName": "ralph/<feature-name>",
"description": "<feature description from interview>",
"userStories": [
{
"id": "US-001",
"title": "Short story title",
"description": "As a <who>, I want <what> so that <why>",
"acceptanceCriteria": [
"Criterion from interview",
"Another criterion"
],
"priority": 1,
"passes": false,
"notes": ""
}
]
}
Show the generated PRD to the user. Ask: "Does this look right? Any stories to add, remove, or reorder?"
Apply changes if requested, then confirm the final version.
Same questions as quick mode, plus:
Create plans/<feature-name>.md (create plans/ directory if needed) with these sections:
Present the plan. Ask: "Review this plan. What would you change?" Iterate until the user approves (possibly multiple rounds), then proceed.
Convert the approved plan into .ralph/prd.json using the same format as quick mode. Flatten all phases into a single ordered story list, preserving priority order. Confirm: "Plan converted to .ralph/prd.json — ready for /ralph."
llm-wiki-ai-research:vertical-slices-tracer-bullets.llm-wiki-ai-research:smart-zone-dumb-zone.If the PRD is non-trivial, run /slice-into-issues immediately after this skill. That step proposes a module map (favouring deep modules per llm-wiki-ai-research:deep-modules-for-ai) before emitting one issue file per slice into .ralph/issues/. The pair (write-a-prd + slice-into-issues) is the canonical input to /ralph --kanban and to /matt-pocock-coding-workflow.
When the PRD describes an app with a web UI, an authenticated user, or an HTTP API, you MUST emit the following stories (or mark "N/A — <reason>" if genuinely skippable). Otherwise the gap surfaces mid-build:
/api/openapi/json + rendered viewer (Scalar / Swagger / Redoc) at /api-docs..dev.vars, .env.local) from CI secrets before any job runs the dev server./api/health AND the new route is reachable. Green CI alone is not enough./onboarding-flow skill + [[onboarding-checklist-ux]] canon./share-assets skill.Ask the user up-front "is this a web app, a CLI, or a library?" — if web, run through the checklist before generating prd.json.
development
--- name: worktree description: Coordinate multiple agents on one repo via a worktree-lock pool, so two agents never clobber each other's working tree. Acquire the first free slot (main, then beta/gamma… worktrees, created on demand), work there on your own branch, release when you've pushed. Use before modifying any repo that might be in use by another agent (factory, dataforce, etc.), or whenever you're told a repo is being worked on. Backed by `ro worktree`. category: development argument-hin
testing
--- name: ship description: Ship a feature branch the local-CI-first way — run the full local gate, push, open a PR, squash-merge, then deploy, without waiting on GitHub Actions. Use when a branch is ready for main and you want it merged and deployed now. Reads CI policy from `ro ci` (default skips remote CI because GitHub Actions billing keeps hitting limits). Sibling to /ro:gh-ship (waits on GitHub checks) and /ro:cf-ship (the deploy half). Triggers on "ship it", "ship this", "merge and deploy
testing
--- name: setup-logging description: Set up (or audit) the observability stack in a TanStack Start + Cloudflare Workers app so it is "diagnosable by default" — structured logging (logtape) with a request context carrying trace_id + userId + tenant/orgId, a trace_id propagated FE→BE→logs→Sentry→PostHog, Cloudflare Workers observability enabled, and Sentry + PostHog wired. Two modes: `setup` (wire it into an app) and `audit` (check an existing app + report gaps). Use when scaffolding a new app, wh
development
Manage credentials INSIDE the active ~/.claude/.env file — read which token/account to use for a given app (Simplicity vs Dataforce vs Ronan-personal), add or update a secret WITHOUT it passing through the chat (an interactive Terminal window prompts for it), and track secrets that were exposed in a transcript so they get rotated. Sibling to /ro:context (which switches WHICH env file is active). Use when the user wants to add an API key/token/secret, asks "which credential do I use for X", needs the env organized/labelled, or a secret was pasted into the chat and should be rotated.