---
name: fp-pr-summary
description: Generate a PR body from the linked ERD + commits on the current branch. Outputs markdown. Piping-friendly — the CLI prints to stdout so `gh pr create --body "$(fastpace pr-summary)"` works. Triggers on /fp-pr-summary [slug].
---

# fp-pr-summary

Draft a PR description that's grounded in the feature's ERD/PRD, the branch's commits, and any acceptance criteria from the execution plan. Not from nothing — from what the team already wrote.

## Invocation

```
/fp-pr-summary              # infer slug from current branch or newest watch card
/fp-pr-summary <slug>       # use a specific watch card
```

## Preflight

- Confirm a watch card exists (preferred source of truth). If not, fall back to the current git branch name.
- Read the linked ERD + PRD if known. If neither exists, generate a slim summary from commits alone and mark the ERD section as TBD.

## Process

1. Prefer the CLI:
   ```
   fastpace pr-summary                # body only, to stdout
   fastpace pr-summary --title        # also print conventional commit title
   ```
2. Fallback:
   - Look up `fastpace/watch-cards/<slug>.json`; read `artifacts.prd_path`, `artifacts.erd_path`, `artifacts.plan_path`.
   - Pull `## Acceptance criteria` from the ERD as a checklist.
   - Pull `## Security` and `## Rollout` sections if non-empty.
   - `git log --no-merges --reverse --format=%s <base>..<head>` for the Changes list.

## PR body format (emit as-is)

```markdown
## Summary

<first paragraph after frontmatter of the linked ERD, or PRD if no ERD>

## Linked artifacts

- PRD: `fastpace/docs/prd/<slug>.md`
- ERD: `fastpace/docs/erd/<slug>.md`
- Plan: `fastpace/exec-plans/<slug>.json`

## Acceptance

- [ ] <criterion 1 from ERD>
- [ ] <criterion 2 from ERD>

## Security

<Security section body from the ERD — only if non-empty>

## Rollout

<Rollout section body from the ERD — only if non-empty>

## Changes

- <commit subject 1>
- <commit subject 2>

## Test plan

- [ ] Unit tests pass
- [ ] Manually verified acceptance criteria above
- [ ] Checked reviewers' notes from /fp-review-pr

---
_Generated by `fastpace pr-summary`. Edit as needed before submitting._
```

## Rules

- **Never invent acceptance criteria.** If the ERD doesn't have an "Acceptance" section, omit the block entirely rather than generate one.
- **No generic copy.** Do not write "This PR adds X" without source material. If there's nothing to summarize, write "TBD — update before submitting" inline.
- **Conventional commit title.** If the branch is `feat/…`, use `feat: …`; `fix/…` → `fix: …`, else `feat: …`. Suggest the title on stderr (CLI) or as a `# suggested title:` comment line (skill) so it doesn't pollute the body.
- **Merge, don't overwrite.** If the repo has a `.github/pull_request_template.md`, note the overlap at the end: "Your team has a PR template at `.github/pull_request_template.md` — merge manually."
- **Never include secrets**, token values, or inline `.integrations.local.json` content.
- **No AI prose.** The output is a human-editable draft, not a polished write-up.

## Integration

- After emitting, suggest:
  ```
  gh pr create --title "feat: <title>" --body "$(fastpace pr-summary)"
  ```
- If the ERD had unresolved Open Questions, surface them at the top: "The ERD still lists N open questions — answer them or strip before submitting."

## Exit criteria

- PR body printed to stdout.
- A suggested title printed (to stderr in CLI, to a `#` comment in skill output).
- Zero files modified.
