skills/prepare-pr/SKILL.md
Prepare a feature branch for PR — strip design files, generate PR body, create the pull request, and post design file references to Linear. Use when user says "prepare PR", "create PR", "ready for review", "ship it", "open PR", "submit PR", "PR time", or wants to finalize a feature branch for merge. Also triggers on "strip designs", "clean up for merge", or "ready to merge". Handles both branches with and without design files.
npx skillsauth add ash4180/vorbit prepare-prInstall 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.
Finalize a feature branch for merge: run pre-flight checks, strip design files per the management standard, generate a PR body from Linear context and commit history, create the pull request, and post design file recovery references to the Linear ticket.
MCP namespace: This skill optionally uses
mcp__plugin_linear_linear__*for Linear integration (skipped when no issue ID is detected). See_shared/mcp-tool-routing.mdfor the Plugin Tool Index and the announce-the-plugin rule.
Locate
_shared/: This skill ships as a plugin, so_shared/files live in the plugin cache, not your project. Before reading any_shared/...path below, runls -d ~/.claude/plugins/cache/local/vorbit/*/skills/_shared 2>/dev/null | head -1and use the output as the absolute base for every_shared/...reference.
Design files (.pen) live on feature branches during development so teammates can review them. But they must never reach dev, main, or demo — a CI gate (design-files-check) blocks PRs that contain designs/. This skill automates the stripping, records the recovery hash (the only way to get designs back after branch deletion), and posts references to both the PR and Linear ticket so the design is never lost.
For branches without design files, the skill still handles PR body generation and Linear integration.
Goal: Verify the branch is ready for PR creation.
Get current branch and determine base:
git branch --show-current
dev if it exists, otherwise mainmain, dev, or demo → "You're on a protected branch. Switch to a feature branch first." → STOPExtract issue-id from branch name — first match of [a-zA-Z]+-\d+ (case-insensitive):
feature/on-329-ux-improvement → ON-329fix/tl-42-broken-auth → TL-42Check git state:
Detect design files:
designs/ directory exist with .pen files?Check mock data (informational):
.claude/mock-registry.json exist with entries?/cleanup-mocks first."Suggest review (informational):
/review? Consider it before creating the PR."Output: Branch state confirmed, blockers surfaced
Goal: Catch merge conflicts on your machine instead of discovering them in the GitHub PR review. Rebase onto the latest base when clean; walk the user through fixing them when not.
Skip this phase if --skip-rebase flag is set.
Require a clean working tree. Rebase cannot run with uncommitted changes. If git status --porcelain shows any output, stop: "You have uncommitted changes. Commit or stash, then run again." Do NOT auto-stash — that hides the user's in-progress work.
Fetch the latest base:
git fetch origin {base-branch}
Check if behind:
git rev-list --count HEAD..origin/{base-branch}
Attempt the rebase:
git rebase origin/{base-branch}
Assisted conflict resolution. The rebase halts at the first conflicting commit. Walk the user through each conflict — never auto-pick a side.
a. List conflicted files:
git diff --name-only --diff-filter=U
b. For each conflicted file, read it to find conflict blocks (markers <<<<<<<, =======, >>>>>>>). For each block, show the user using AskUserQuestion:
File: {path}, lines {start}-{end}
From {base-branch}:
{their version}
Your branch:
{your version}
Pick a resolution:
1. Keep base version
2. Keep my version
3. Keep both (base first, then mine)
4. Let me edit this file manually
5. Show more context (5 lines above and below)
c. Apply the choice:
{file}, remove all <<<<<<< / ======= / >>>>>>> markers, then say 'continue'." When they reply, run git diff --check. If markers remain, ask them to finish. If clean, proceed.d. Stage the resolved file:
git add {file}
e. After all files in the current commit are resolved, continue the rebase:
git rebase --continue
Abort path. At any point during step 5, if the user says "abort", "stop", or "cancel":
git rebase --abort
Branch returns to its pre-rebase state. Stop the entire skill: "Rebase aborted. Branch unchanged. PR not created."
Push the rebased branch:
git push --force-with-lease
--force-with-lease refuses to push if someone else updated the remote branch since the last fetch — prevents wiping a teammate's work. Never use plain --force.
Report:
Synced with {base-branch}:
{N} commits applied
{M} conflicts resolved (if any)
Output: Branch is up to date with base, ready for design stripping and PR creation.
Skip this phase if no designs/ directory exists, or if --skip-designs flag is set.
Convention: Design files (.pen files from /vorbit:design:pencil work) live at designs/{issue-id}/ during development. This is a manual designer convention — /pencil writes to the Pencil app's internal storage; the designer copies/exports the .pen file into designs/{issue-id}/ and commits it on the feature branch so teammates can review. The path is also documented in the Pencil Design Files in Git Management Standard.
Goal: Strip design files and record the recovery reference. The recovery hash is captured BEFORE stripping because it points to the last commit where the files still exist — this is the only way to recover them later.
Record the recovery hash — this MUST happen before any git rm:
git log -1 --format="%H" -- designs/
Store this hash. It points to the last commit where design files exist.
Inventory design files being stripped:
find designs/ -name "*.pen" -type f
Record the full paths (e.g., designs/on-329/scheduling.pen).
Strip design files:
git rm -r designs/{issue-id}/
Only remove the issue-specific directory. If other issue directories exist under designs/, leave them — they belong to other features.
Commit the stripping — this is a mechanical commit, do NOT add Co-Authored-By or any AI attribution:
git commit -m "chore: strip design files before merge"
Build the design files reference block for use in the PR body:
## Design files
Design files were stripped before merge per the [management standard](https://www.notion.so/vibranium-labs/Pencil-Design-Files-in-Git-Management-Standard-313477245840818dbf27dcc2d6774bde).
To view them:
git checkout {full-hash} -- {path-to-each-pen-file}
If multiple .pen files, list each recovery command on its own line.
Output: Design files stripped, recovery reference prepared
Goal: Generate a complete PR body from Linear context and commit history.
Fetch Linear issue (if issue-id was found):
mcp__plugin_linear_linear__get_issue with the issue identifierurl field — use it for the "Related" section linksAnalyze commit history on this branch:
git log {base-branch}...HEAD --format="%h %s" --no-merges
Read ALL commits to understand the full scope of work. Group by type (feat, fix, refactor, chore). Ignore the "strip design files" commit — it's mechanical.
Generate PR body using this template:
## Summary
- [2-5 bullet points summarizing what was built/changed]
## Design files
[Include the design files reference block from Phase 3]
[Omit this entire section if no design files were stripped]
## Notable decisions
[Key architectural/UX decisions worth calling out]
[Omit this section if nothing notable]
## Related
- [{ISSUE-ID}]({linear-issue-url})
- Parent epic: [{epic-id}]({epic-url}) {epic title} if applicable
## Test plan
- [ ] [AC 1 from Linear issue]
- [ ] [AC 2]
- [ ] ...
[If no ACs found, ask user for test plan items]
Generate PR title:
{type}: {Linear issue title} ({issue-id})Present for review — Use AskUserQuestion:
PR ready for review:
Title: {title}
Body:
{body}
Base: {base-branch}
Edit anything? Or say "go" to create.
The user can modify the title, body, add Jam links, screenshots, or approve as-is.
Output: Approved PR title and body
Goal: Push, create the PR, and post references.
Push branch (if not already pushed or has new commits):
git push -u origin {branch-name}
Create the PR — use the approved body exactly as the user approved it. Do NOT append 🤖 Generated with Claude Code or Co-Authored-By footers:
gh pr create --base {base-branch} --title "{title}" --body "$(cat <<'EOF'
{approved body}
EOF
)"
Post design recovery reference to Linear (if design files were stripped):
mcp__plugin_linear_linear__save_comment on the issue:
📐 Design files archived
Design files were stripped before merge per management standard.
Commit: {full-hash}
Recovery:
git checkout {full-hash} -- {path-to-each-pen-file}
PR: {pr-url}
This comment is the PERMANENT reference. It survives branch deletion, PR archival, and repo history compaction. The design file was already referenced on this ticket when it was created by Pencil — this comment closes the loop.
Update Linear issue status:
mcp__plugin_linear_linear__save_issue with state: "In Review"Report:
PR created: {pr-url}
Branch: {branch} → {base}
Design files: {count} stripped, recovery hash recorded
Linear: {issue-id} → "In Review", design reference posted
--skip-rebase: Skip Phase 2. Use when the team's workflow does conflict resolution at merge time (squash-and-merge), or when you intentionally want the reviewer to see the conflicts in GitHub.--skip-designs: Skip Phase 3 even if designs/ exists. For PRs where design files should remain (e.g., the PR sets up the design file infrastructure itself).--draft: Create as draft PR (gh pr create --draft). For early feedback before the feature is complete.--base {branch}: Override base branch detection. Default: dev or main.git push --force instead of --force-with-lease after a rebase — plain force will silently overwrite a teammate's work if they pushed to the same branch since your last fetch--skip-rebase is explicitly passed, never as a "fall-through" fallbackgit rm, because after stripping git log -- designs/ returns the strip commit, not the one with actual filesdesigns/library/ — that's the shared template directory (gitignored), not feature-specificdesigns/on-500/ when working on on-329)main or devdevelopment
Sync design tokens and components from a codebase to a Pencil canvas (`.pen` files), or set up a Pencil canvas from a style guide when no codebase exists. Use when the user says "sync pencil", "setup pencil", "configure pencil", "pencil sync", "sync tokens to pencil", "build pencil component library", or names Pencil/`.pen` files explicitly. Also triggers when mockups generated by Pencil don't match project conventions.
development
--- name: figma version: 1.6.0 description: Use when user says "figma", "figma it", "sync figma", "figma mockup", "create figma file", "design to figma", "figma from PRD", "figma from journey", "build in figma", or "figma design system" — anything that creates, syncs, or updates Figma design systems, components, variables, mockups, or front-end-ready screens. Always enumerates the linked Figma library FIRST (library-driven discovery, not per-need search), produces a block→DS mapping table for us
development
Use when the user wants to build Webflow pages, templates, or components, with or without Figma designs as reference.
testing
Use when the user wants to verify an implementation, validate acceptance criteria, or run a Vorbit-style post-change check using shared project rules.