Pr assistant

From KjellKod/quest · View interactive version

Pr assistant is an AI agent skill from the GitHub repository KjellKod/quest. Creates and updates GitHub pull requests in draft mode. Generates PR title and description from branch commits, shows for approval before executing. Use when the user asks to create a PR, update a PR description, or open a pull request.

How to use this skill

Skill file

PR Assistant

Generate a pull request title and description from the current branch, then create or update the PR via gh CLI. PRs are always created in draft mode.


Sync with the default branch (before creating the PR)

Before pushing or running gh pr create, sync the PR branch with the remote

default branch from the source worktree:

  1. Run python3 scripts/quest_pr_sync_default_branch.py --json.
  2. If the payload is status: "up_to_date", continue with the normal PR

creation flow.

  1. If the payload is status: "clean", run

python3 scripts/quest_pr_sync_default_branch.py --apply --json, parse the apply

payload, and continue only when it reports status: "synced" or

status: "up_to_date". The inspect result is a best-effort merge-based

estimate; the --apply result is the source of truth for the default rebase

strategy.

  1. If either payload is status: "conflict", surface the listed

conflict_files. The inspect path can be filename-only; when hunks or

conflict markers are not available, pause instead of guessing. Attempt a

resolution only when the hunks are available and the fix is clearly safe and

non-destructive: additive / adjacent / whitespace / import-or-list ordering,

where both sides' intent is preserved and nothing from main is dropped. If

the correct resolution would overwrite or delete code/instructions from

main, or the right resolution is ambiguous, pause and ask the human. When

in doubt, pause.

  1. If either payload is status: "error", stop and surface the reason and

message fields before any push or PR mutation.

  1. Never use blanket -X theirs or -X ours resolution.
  2. If the applied sync reports force_with_lease: true, push with

git push --force-with-lease -u origin HEAD on the first push, or

git push --force-with-lease when the branch already has an upstream;

otherwise push normally.

Force-with-lease exception

Syncing the author's own not-yet-merged PR branch onto the default branch with

git push --force-with-lease is the narrow, lease-protected exception to the

general force-push caution. It does not require a permission prompt or allowlist

entry because --force-with-lease refuses to clobber remote work that appeared

since the last fetch, and the branch is the author's PR branch.


Before Writing

  1. Run git log --oneline main..HEAD (or the appropriate base branch) to see all commits on this branch.
  2. Run git diff main...HEAD --stat to see the scope of changes.
  3. Run gh pr list --head $(git branch --show-current) to check if a PR already exists for this branch.

Rules

Analyze the full branch

Title

Body structure

Use this format:

## ⭐ Why this matters
<1–3 sentences in plain language that make a busy human immediately see the VALUE — the problem this removes or the capability it unlocks — before any technical detail. Lead with impact, not mechanics.>
<Optionally follow with 2–3 bold one-line benefit bullets.>

---

## Summary
<Single sentence capturing the full intent — what this PR does and why.>
- Supporting bullet with additional context if needed.
- Supporting bullet with additional context if needed.

> [!WARNING or !IMPORTANT or !NOTE — only if applicable]
> Alert content here. Most PRs should have NO callouts.

## Changes
- **<Category>**:
  - Description of change referencing `specific_file.js` or `functionName()` where helpful
  - Description of change
- **<Category>**:
  - Description of change

## Validation
- [ ] Concrete verification step describing what to do and what to expect
- [ ] Another verification step
Watch for: <known risk or edge case, if any>

## Notes (optional — include only if there is non-obvious context)
- Important implementation/deployment/reviewer context that is not obvious from the diff.
- Do not repeat the Summary; only include unique, high-signal details reviewers should know.

Why this matters section (required — first thing in the body)

This is the value-first executive summary. It sits at the very top so a busy human grasps why they should care at a glance, before any technical detail.

Summary section

Callouts (optional — use sparingly)

Use GitHub callout syntax only when something needs to jump out before a reviewer digs into the details. Most PRs should have zero callouts.

| Callout | Use when... |

|---------|-------------|

| > [!WARNING] | Breaking change, data migration, or irreversible action |

| > [!IMPORTANT] | Reviewer must do something specific (e.g. "needs env var set before deploy") |

| > [!NOTE] | Non-obvious context that prevents confusion (e.g. "intentionally duplicates X because...") |

Rules:

Changes section formatting

Group changes by domain or concern, not by git operation (add/modify/remove).

Choose category names that reflect what area of the system is affected.

Reference specific file names, function names, config keys, and constants inline with backticks where they help a reviewer understand or locate the change.

Common categories (use what fits, invent others as needed):

Rules:

Validation section

Purpose

The goal of validation is not just correctness — it is comprehension. Write steps as a guided walkthrough so that a reviewer who follows them will have used the new functionality and built a mental model of the change, not just confirmed it didn't error.

Principles
Rules
Structured format (required for every non-CI step)

Every validation step that is not a simple automated command must use this structure:

  1. Prerequisites — what must be set up before testing (env vars, credentials, running services, test data, app state)
  2. Action — the specific command, API request, or UI action to perform. Include full addresses and copy-pasteable commands.
  3. Expected result — what the reviewer should observe, including specific fields, status codes, or visible behavior.
  4. Negative/edge cases — include at least one when the feature introduces meaningful failure modes or graceful-degradation behavior.

Do not write vague steps like "test this with the real API" or "verify it works". Write the setup, action, and expected outcome clearly enough that someone unfamiliar with the project can execute the check without guessing.

Example (illustrative — adapt to your project)

Bad:

- [ ] Verify the new command works

Good:

- [ ] **Walkthrough — run the new export command**: Prerequisites: build the project (make or project-equivalent). Action: run ./quest export --format json --output /tmp/out.json, then inspect /tmp/out.json. Expected: valid JSON containing entries matching the current quest state, with status and slug fields populated. Then run with a nonexistent quest dir (--quest-dir /tmp/bogus) — observe a clear error message and non-zero exit code.

The good example walks the reviewer through the feature so they understand what was built, not just whether it errors.

Notes section (optional)

Use ## Notes for important context reviewers should know before merge or rollout. Omit the section entirely if there is nothing non-obvious to add.

Rules:

Bot-generated content

If a bot appends an auto-generated summary to the PR, leave it in place. Do not duplicate or conflict with its content in the human-written sections.

When updating an existing PR body, preserve bot-managed sections exactly:

Draft mode (required)

Use gh CLI

Truthfulness


Trailer

Append this block at the end of the PR body:

<pre>
     ▐▛███▜▌
    ▝▜█████▛▘
      ▘▘ ▝▝
Quest/Co-Authored by
<model lines — one per model that participated>
in collaboration with <human author identity>
</pre>

Each model line uses standard Co-Authored-By: format:

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Codex <noreply@openai.com>

Rules:

Never omit the trailer.


Approval

Always show the intended PR title and full body to the user and wait for explicit approval before executing gh pr create or gh pr edit. Do not create or update the PR automatically. Present the content as a plain text block and ask the user to confirm.


Output

Output only the final PR title and body. Do not use emojis beyond the template's fixed ## ⭐ Why this matters header.

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.