home / skills / shotaiuchi / dotclaude / wf7-pr

wf7-pr skill

/dotclaude/skills/wf7-pr

This skill creates or updates a pull request after verification passes, guiding you through title, body, and state updates.

npx playbooks add skill shotaiuchi/dotclaude --skill wf7-pr

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
2.3 KB
---
name: wf7-pr
description: PRを作成または更新
argument-hint: "[update]"
---

**Always respond in Japanese.**

# /wf7-pr

Create or update a Pull Request after verification passes.

## Usage

```
/wf7-pr [subcommand]
```

## Subcommands

- `(none)`: Create a new PR
- `update`: Update existing PR (push changes and optionally update description)

## Processing

### 1. Check Prerequisites

Get active work from state.json. Verify current phase is `wf6-verify` or later. Check that verification has passed (no test/build failures recorded).

### 2. Check Existing PR

Query `gh pr view` to check if a PR already exists for the current branch. If exists and no `update` subcommand, inform user and suggest `update`.

### 3. Push Branch

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

Get branch name from state.json.

### 4. Generate PR Title

1. Read Goal from `01_KICKOFF.md`
2. For GitHub source: append `(#<issue_number>)` to link the issue
3. Keep title concise (under 72 characters)

### 5. Create PR (`gh pr create`)

Generate PR body with:

```markdown
## Summary

<1-3 bullet points from Kickoff Goal and Spec>

## Changes

<List of main changes from Plan steps>

## Test Plan

<Testing approach from Spec or verification results>

## Related Issues

Closes #<issue_number>

---
📄 [Kickoff](docs/wf/<work-id>/01_KICKOFF.md) | [Spec](docs/wf/<work-id>/02_SPEC.md) | [Plan](docs/wf/<work-id>/03_PLAN.md)
```

Execute:
```bash
gh pr create --title "<title>" --body "<body>"
```

### 6. Update PR (`update` subcommand)

1. Push latest changes: `git push`
2. Optionally update PR description via `gh pr edit` if significant changes

### 7. Update state.json

```json
{
  "current": "wf7-pr",
  "next": "complete",
  "pr": {
    "number": 123,
    "url": "https://github.com/..."
  }
}
```

### 8. Completion Message

Display:
- PR number and URL
- PR title
- Base ← Branch
- Suggest requesting review

## Error Handling

| Error | Action |
|-------|--------|
| Verification not passed | Instruct to run `/wf6-verify` first |
| PR already exists | Suggest `update` subcommand |
| Push fails | Show error, suggest checking remote status |
| `gh` not authenticated | Instruct `gh auth login` |

## Notes

- Cannot create PR if verification has not passed
- Issue number is automatically linked via `(#N)` in title and `Closes #N` in body
- Existing PR is detected and handled gracefully

Overview

This skill automates creating or updating a Pull Request after verification passes. It ensures the branch is pushed, generates a concise title and a structured PR body, and records the PR metadata in state.json. It prevents PR creation if verification failed and guides updates for existing PRs.

How this skill works

The skill reads the current work state and ensures the workflow is at or past the verification phase with no failures. It checks for an existing PR for the branch, pushes the branch to origin, builds a title from the kickoff Goal (optionally linking an issue), composes a markdown body from Kickoff/Spec/Plan, and runs gh pr create or gh pr edit as needed. After success it updates state.json with PR number and URL and prints the summary.

When to use it

  • You have completed wf6-verify and verification reports show no failures.
  • You are ready to publish changes for review and want a structured PR created automatically.
  • You need to push a branch and link the PR to the originating issue and docs.
  • You want to update an existing PR after making additional commits or changing the description.

Best practices

  • Run wf6-verify and confirm no test/build failures before creating a PR.
  • Keep PR titles concise (under 72 characters) and include the issue number as (#N).
  • Use the Kickoff, Spec, and Plan docs to populate a clear Summary, Changes, and Test Plan.
  • If a PR already exists, use the update subcommand to push and optionally edit the description.
  • Ensure gh CLI is authenticated (gh auth login) and git remote is configured before running.

Example use cases

  • Create a PR automatically after CI verification passes to request code review.
  • Push and update an existing PR with new commits and refreshed description after addressing feedback.
  • Link the PR to the tracked issue and include Kickoff/Spec/Plan links for reviewers.
  • Fail fast when verification has not passed, prompting the user to run the verification step first.

FAQ

What happens if verification has not passed?

The skill stops and instructs you to run the verification step (wf6-verify) before creating a PR.

How does the title link an issue?

The title appends (#<issue_number>) when an issue is referenced so GitHub links it automatically; the body also includes 'Closes #N'.

How do I update an existing PR?

Use the update subcommand: it pushes recent commits and can call gh pr edit to update the description if significant changes occurred.