Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsBlogPro
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Authors
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges
  • Chrome Extension
  • Skill Manager

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

ProTermsPrivacyRefunds
Back to skills

Pr Rewrite

ASecurity

Rewrite an existing PR description from scratch against the branch's current net change, carrying forward context that still matters

3 stars
0 votes
0 copies
2 views
Added 9/19/2026
ai-agentsgobashgit

Works with

claude code

Security Analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned 9/19/2026

$npx -y skills add tony/skills --skill pr-rewrite --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Pr Rewrite?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Pr Rewrite
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/tony-pr-rewrite/badge)](https://www.skillsdirectory.com/skills/tony-pr-rewrite)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
Files
SKILL.md
---
name: pr-rewrite
description: >-
  Rewrite an existing PR description from scratch against the branch's
  current net change, carrying forward context that still matters
disable-model-invocation: true
allowed-tools: ["Bash", "Read", "Write", "AskUserQuestion"]
metadata:
  argument-hint: "[PR number or URL, and/or a template path or hint]"
  source: "plugins/pr/skills/rewrite/SKILL.md"
---

# Rewrite PR Description

Regenerate an existing PR's description from scratch. Where
the `pr-refresh` skill patches stale content inside the existing structure,
this skill discards the old structure and drafts a fresh gold-standard
description of the branch's current net change — after mining the old
description for context worth carrying forward.

User input: $ARGUMENTS

## Context

Current branch — run this command and read the output:

```bash
git branch --show-current
```

PR for current branch (if any) — run this command and read the output:

```bash
gh pr view --json number,title,url,baseRefName 2>/dev/null || echo "(no PR for current branch — expect a PR number/URL in the argument)"
```

---

## Procedure

### 1. Resolve the PR and its target

- If `$ARGUMENTS` contains a PR number or URL, use it; otherwise use
  the current branch's PR. No PR found → report that and stop
  (`/pr` handles branches without a PR).
- Fetch the full PR:
  ```
  gh pr view <number> --json number,title,body,url,baseRefName,headRefName,state
  ```
- The diff base is the PR's **`baseRefName`** — stack-aware, never an
  assumed trunk. Gather the net change:
  ```
  git fetch origin <baseRefName>
  ```
  ```
  git log origin/<baseRefName>..HEAD --oneline
  ```
  ```
  git diff origin/<baseRefName>...HEAD --stat
  ```
  ```
  git diff origin/<baseRefName>...HEAD
  ```

### 2. Back up the current description

Save the existing body and title verbatim before drafting:

```
mkdir -p .git/pr-backups/$(date -u +%Y%m%d-%H%M%SZ)-pr<number>
```

Write `body.md` and `title.txt` there and tell the user the path. The
old description can be restored with
`gh pr edit <number> --body-file <backup>/body.md`.

### 3. Mine the old description for context

Read the existing body and inventory everything that is **not**
derivable from the diff:

- Issue keywords and links (`Fixes #N`, `Closes #N`), companion PR
  links, tracking issues
- Setup-required steps, deployment or rollout notes
- Screenshots, recordings, benchmark numbers, external links
- Reviewer commitments and @-mentions, unchecked test-plan items
- Hand-written rationale or "why" context absent from commit messages

Classify each item: **carry forward** (still applies), **drop**
(obsolete given the current diff), or **unclear**. For unclear items,
ask the user via `ask-user-choice` — quote the item and offer carry /
drop. If an item is dropped, it survives in the backup.

### 4. Resolve the template

Follow `references/template-resolution.md`: a
template mentioned in the user's message wins; otherwise the
repository's PR template; otherwise the gold-standard structure. Ask
when multiple candidate templates are in play — never guess between
them.

### 5. Draft the new description

Apply the drafting rules from the `/pr` command — read
the `pr` skill, section *Draft PR Description*,
and follow its title, section, table, and proportionality patterns,
including *What NOT to include* and the whole-branch perspective. Then:

- Weave every carry-forward item from step 3 into the appropriate
  place in the new structure.
- Describe the branch's **current net change** only — the old
  description's framing of superseded approaches does not carry over.

### 6. Present and apply

- Show the proposed title and full body.
- Summarize what was carried forward from the old description and what
  was dropped (with one-line reasons), so the user can veto drops.
- Ask whether to apply. On approval, write the body to
  `body.new.md` in the backup directory and run:
  ```
  gh pr edit <number> --title "..." --body-file <file>
  ```
- Confirm with the PR URL and repeat the backup path.

---

## Rules

- **Backed up before rewritten**: never call `gh pr edit` before the
  old body is on disk and its path reported.
- **Stack-aware**: the diff base is the PR's `baseRefName`.
- **Context is preserved or surfaced, never silently lost**: every
  non-diff-derivable item from the old description is carried, asked
  about, or listed as dropped at the presentation gate.
- **Template ambiguity → ask**; an explicitly mentioned template wins
  without asking.
- **Whole-branch perspective**: describe the net result against the
  base, not the branch's internal evolution.
- **No brittle details**: no test counts, SHAs, line numbers, or
  file-changed counts.
- **Never** force-push, push, or run destructive git commands; the only
  write is `gh pr edit` after approval.


## Portability notes

- `ask-user-choice` — present the listed options and wait for the user to pick one. Hosts with a structured multiple-choice tool (Claude Code's `AskUserQuestion`) should use it; otherwise print a numbered list and wait for a numbered reply. Never proceed on an assumed answer.
- `$ARGUMENTS` — the text the user passed when invoking this skill. If your host does not substitute it, read it as the user's request in the current turn, and ask when there is none.
- Bundled files — every relative path in this skill points at a file shipped inside this skill directory. Read them from here, not from the host's plugin tree.

Attribution

tonytony
View sourceSee grades on GitHubMore from tony →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

Caveman

Terse caveman voice: answer first, fluff gone, every technical fact kept. Use for /caveman, "caveman mode", "talk like caveman", "be brief", "less tokens". Stays on until "stop caveman" or "normal mode".

1100021 votes

Hyperplan

Adversarial multi-agent planning skill. Self-orchestrates 5 hostile category members (unspecified-low, unspecified-high, deep, ultrabrain, artistry) via team-mode for ruthless cross-critique debate, distills only the defensible insights, then MANDATORILY hands the distilled insight bundle to the `plan` agent for executable plan formalization. Use when planning needs maximum rigor and surfacing of weak assumptions, blind spots, and over-engineering. Triggers: 'hyperplan', 'hpp', '/hyperplan', ...

698431 votes

Writing Skills

Create and manage Claude Code skills in HASH repository following Anthropic best practices. Use when creating new skills, modifying skill-rules.json, understanding trigger patterns, working with hooks, debugging skill activation, or implementing progressive disclosure. Covers skill structure, YAML frontmatter, trigger types (keywords, intent patterns), UserPromptSubmit hook, and the 500-line rule. Includes validation and debugging with SKILL_DEBUG. Examples include rust-error-stack, cargo-dep...

3931 votes

Mcp Code Execution

Routes multi-tool workflows through MCP servers for large datasets and pipelines. Use when Bash tool overhead is limiting throughput on data-heavy tasks.

3421 votes

catchup

Recovers the conversation and failed tool calls of a previous Codex, Amp, Claude Code, Antigravity, Cline, Copilot CLI, Cursor, DeepSeek Harness, Grok Build, Kimi, OpenCode, Pi Agent, or ZCode session. Use when the user says "catch up", "what did the last session do", "get me up to speed", "I switched agents", asks to recover/summarize a previous session before continuing, or asks to diagnose or report a catchup failure. Do NOT use for the current conversation, git history, or any non-agent log.

741 votes
View all in ai-agents →