# Tflo Create Pr

> PR-creation workflow for the tflo (Intelliforia Trello Flow) module. Pushes the ticket branch, opens a PR with a type-aware body (QA instructions for code, summary of findings for discovery, design rationale for design, scannability notes for doc), generates a retro doc, mirrors learnings to Hindsight, moves the Trello card to In Review, and resets the FSM to idle.

- Skill: `delorenj/tflo-create-pr` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add delorenj/tflo-create-pr`
- Raw SKILL.md: https://api.skillmd.com/api/skills/delorenj/tflo-create-pr/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Product & Planning
- Author: delorenj (https://skillmd.com/u/delorenj)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/delorenj/tflo-create-pr

---


# tflo-create-pr — Ship the work and close the cycle

## Overview

Final phase of the tflo loop. Takes the verified deliverable and ships it: pushes the branch, opens a PR with a type-aware body, generates a retro, retains learnings to Hindsight, updates the Trello card, and hands control back to triage (or idle, depending on `loop` mode).

## Preconditions

- `_bmad/memory/tflo/current-ticket.md` exists with `phase: pr-ready`
- All deliverables exist for the ticket type (commits for code, deliverable.md for discovery, etc.)
- The ticket branch has commits beyond `claimed_from_branch` (otherwise there's nothing to PR — for discovery/design/doc, the doc commit counts)

## Type-routing for PR body

| Type | PR body emphasis |
|---|---|
| `code`, `feature` | Summary, what changed, **QA instructions**, risk, rollback |
| `bug` | Summary, **root cause**, regression test, **QA instructions** to reproduce the original bug + verify fix, rollback |
| `refactor` | Summary, **what was preserved** (behavior-equivalence claims), what changed under the hood, performance notes if relevant |
| `discovery` | **Findings** (1-2 paragraph summary), **recommendations**, links to deliverable.md |
| `design` | Embedded mockup / link to design.md, design decisions, accessibility notes |
| `doc` | What's documented, who the audience is, where the doc lives, scannability call-out (TOC / examples / checklists) |

## Capabilities

### Push branch

```bash
git push -u origin <branch>
```

Never force-push without explicit human OK. If the branch already exists on origin and has diverged, surface to user.

### Open PR

```bash
gh pr create --base <target> --title "<title>" --body-file <generated-body>
```

Where:
- `<target>` is `staging` (project's PR target per CLAUDE.md) unless overridden
- `<title>` is `tflo({idShort}): <card name truncated to 60 chars>`
- `<generated-body>` is built from the type-aware template (see below)

### Generate type-aware PR body

```markdown
## Summary
{1-3 bullets, drawn from architect plan + commits OR deliverable.md}

## Trello
{card url} — {card name}

## Type
{code|bug|feature|refactor|discovery|design|doc}

## What changed
{drawn from commits + architect plan, OR deliverable artifact for non-code}

## QA instructions
{numbered steps with expected results, drawn from test plan + AC}
{for non-code: "Review the deliverable doc at <relative path> and check it against the goals in the Trello card"}

## Risk / Rollback
{drawn from architect plan "alternatives" and "risks" sections; for non-code: usually "low risk — no code change" or "doc-only"}

## Story / Deliverable
{relative link to story.md OR deliverable.md / design.md}

## Retro
{relative link to retro.md}

🤖 Generated by tflo-create-pr
```

### Generate retro

Synthesize from session memory + transitions.jsonl + verify-log.md:

```markdown
# Retro: {ticket name}

## State assessment
- What we had: {initial state}
- What we needed: {target state from card / architect plan}
- Gap: {summary}

## Action decomposition
- Planned: {summary from architect plan}
- Actual: {summary from commits / deliverable}
- Variance: {what differed and why}

## Reflection
- Worked: {bullets, factual}
- Didn't work: {bullets, drawn from verify-log if any retries}

## Reusable patterns extracted
- {named pattern}: {description}
{each pattern is also retained to Hindsight bank=intelliforia, context=session-summary}
```

Write to `_bmad/memory/tflo/tickets/{id}/retro.md`.

### Mirror to Hindsight (best-effort)

For each pattern in retro:
```bash
hindsight memory retain intelliforia "{pattern}" --context session-summary
```

If `hindsight` CLI is missing or fails, log warning and continue. Local retro doc is sufficient.

### Update Trello card

1. Comment on the card with: PR URL + retro link + 1-line summary
2. Move card from `In-Progress` to `In Review` (using configured `tflo_review_list`)
3. Optionally add label `tflo:pr-ready` if it exists on the board

### Hand back to triage

Reset `current-ticket.md` (delete it; idle = no file present). Append final transition `pr-ready → idle` to per-ticket `transitions.jsonl`.

If orchestrator is in `loop` mode and budget remains: invoke `tflo-triage` to start the next cycle.

If orchestrator is in single-cycle mode: stop. User can fire `start` again when ready.

## Failure modes

| Symptom | Action |
|---|---|
| `gh pr create` fails (auth / permission / no push access) | Surface error. Don't reset FSM. PR creation is not retried automatically. |
| PR base branch doesn't exist (`staging` missing) | Default to `main`. Document mismatch. |
| Trello move fails after PR is created | PR is the authoritative ship signal. Log Trello failure, continue with retro + handoff. Re-attempt Trello on next loop iteration. |
| Hindsight retain fails | Log warning. Retro doc is the local source of truth. |

## Inputs

- All per-ticket files
- `current-ticket.md`
- transitions.jsonl + verify-log.md entries for retro generation

## Outputs

- PR URL (returned to orchestrator)
- `_bmad/memory/tflo/tickets/{id}/retro.md`
- Hindsight retain entries (best-effort)
- Updated Trello card (moved + commented)
- `current-ticket.md` deleted (FSM idle)

## Handoff

- Loop mode → `tflo-triage` (next cycle)
- Single mode → orchestrator returns to user with summary

