Adopt Pr logo

Adopt Pr

Organization
pydantic
adopt-pr

Bootstrap branch-context on an existing PR. Writes issue-brief.md from the linked issue(s) + current PR state, and backfills pr-decisions.md with decision-bearing entries from already-resolved review threads. Use when picking up a PR mid-flight (yours or someone else's) without prior local context.

Overview

Publisherpydantic
Repositorypydantic-ai-harness
Skill nameadopt-pr
Stars
954
Forks
150
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by pydantic on GitHub. Read the source before you install it.

Installation

Install the Adopt Pr AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/pydantic/pydantic-ai-harness/tree/main/.agents/skills/adopt-pr
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/pydantic/pydantic-ai-harness.git /tmp/pydantic-ai-harness
mkdir -p .claude/skills
cp -r /tmp/pydantic-ai-harness/.agents/skills/adopt-pr .claude/skills/adopt-pr
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Adopt Pr in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Adopt Pr on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Adopt Pr is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Adopt PR -- bootstrap branch-context on an existing PR

Populate issue-brief.md and pr-decisions.md for a worktree whose PR already exists and has history.

When to use

  • You checked out an existing PR and the branch-context files are empty templates (or absent).
  • You are picking up someone else's PR.
  • Your own PR predates the branch-context setup and you want to backfill.

Do not use this for fresh work with no PR yet -- write the brief from the linked issue directly.

Startup

Bootstrapping presumes the linked issue describes a real problem. If you have not confirmed that, skim the issue before adopting -- authorship (a bot, contributor, or automated sweep) is not proof the problem is real.

  1. Read CLAUDE.md for project context.
  2. Instantiate the branch-context instances if they do not exist:
    bash
    cd "$(git rev-parse --show-toplevel)"
    D=.claude/skills/branch-context
    [ -f "$D/issue-brief.md" ]   || cp "$D/issue-brief.template.md" "$D/issue-brief.md"
    [ -f "$D/pr-decisions.md" ]  || cp "$D/pr-decisions.template.md" "$D/pr-decisions.md"
    If issue-brief.md already has populated issues: frontmatter, ask via AskUserQuestion whether to overwrite the brief, re-seed decisions, both, or neither, before proceeding.

Step 1 -- Resolve the PR

Parse $ARGUMENTS:

  • PR number/URL -> use it directly.
  • Empty -> detect from the current branch:
    bash
    PR_NUMBER=$(gh pr view --json number -q .number 2>/dev/null)
    If detection fails, ask via AskUserQuestion.

Fetch PR metadata:

bash
gh pr view "$PR_NUMBER" --json number,title,url,state,headRefName,body,closingIssuesReferences,createdAt,author

Step 2 -- Resolve linked issues

Two sources, in order:

  1. closingIssuesReferences from the PR metadata (canonical -- set via the PR sidebar or Fixes #N keywords).
  2. Fallback: grep the PR body for (?:Fixes|Closes|Resolves|Relates to) #\d+ if (1) is empty.

For each linked issue:

bash
gh issue view "<N>" --json number,url,title,state,body,labels,comments

If there is no linked issue and the body has no problem description worth linking, proceed with issues: [] (free-text problem) -- ask the user whether to continue or abort.

Step 3 -- Study the existing diff

Understand the code before synthesizing the brief:

bash
git fetch origin main 2>/dev/null || git fetch origin master
MERGE_BASE=$(git merge-base HEAD origin/main 2>/dev/null || git merge-base HEAD origin/master)
git diff --stat "$MERGE_BASE"..HEAD
git log --oneline "$MERGE_BASE"..HEAD

Map the changes: which files/modules are touched, which tests exist on the branch (existing tests are implied success criteria), which public symbols changed, any notable new abstractions.

Step 4 -- Write issue-brief.md

Use the schema in issue-brief.template.md. Adaptations for adoption:

  • related_pr: the PR URL (not TBD -- the PR already exists).
  • branch: git rev-parse --abbrev-ref HEAD.
  • Success criteria -- derive from the issue text and from tests already on the branch (each existing test is a de facto criterion; cross-reference them in the table).
  • Affected surface -- extract from the diff, not from a planning pass.
  • Constraints -- include anything reviewers have already emphasized in comments (e.g. "must preserve backwards-compat" from a maintainer reply).

Write to .claude/skills/branch-context/issue-brief.md, overwriting the template.

Step 5 -- Backfill pr-decisions.md from resolved threads

Fetch resolved review threads via the GraphQL API:

bash
read -r OWNER REPO < <(gh repo view --json owner,name -q '.owner.login + " " + .name')
gh api graphql -f query='
query($owner:String!,$repo:String!,$pr:Int!){
  repository(owner:$owner,name:$repo){
    pullRequest(number:$pr){
      reviewThreads(first:100){ nodes{
        isResolved
        comments(first:50){ nodes{ author{login} bodyText url path } }
      }}
    }
  }
}' -F owner="$OWNER" -F repo="$REPO" -F pr="$PR_NUMBER" \
  --jq '.data.repository.pullRequest.reviewThreads.nodes | map(select(.isResolved))'

For each resolved thread, read the full conversation, then classify:

  • Decision-bearing -- the thread debated two or more options, or a reviewer flagged a concern and the author adjusted the code (e.g. "use kwargs over positional", "renamed the public method", "moved the helper to a different module").
  • Noise -- typo fixes, "nit: missing docstring", "good catch thanks", resolved without a code change. Skip these.

For each decision-bearing thread, append an entry (Source is the root comment's url):

bash
.claude/skills/branch-context/append-pr-decision.sh \
  --title "thread: <short title>" \
  --decision "<one-line summary of what was decided>" \
  --why "<one-line reason, quoting reviewer or author if concise>" \
  --source "<thread URL>" \
  --iter "-"

Decision budget: aim for <=10 entries. If more resolved threads than that seem worth logging, you are probably over-including noise -- re-apply the filter.

Step 6 -- Seed an "adoption" meta-entry

Append one final entry marking the boundary between backfilled decisions (everything above) and live-logged ones (everything below):

bash
.claude/skills/branch-context/append-pr-decision.sh \
  --title "adopted PR #<N> at <DATE>" \
  --decision "Branch-context bootstrapped from existing PR + issue(s). Decisions above are backfilled from resolved threads." \
  --why "PR predates the branch-context setup" \
  --source "<PR URL>" \
  --iter "-"

Step 7 -- Report

Print a concise summary:

Adopted PR #<N> -- "<title>"
  Issues linked: #<A>, #<B>
  Resolved threads seeded: <count> decisions
  Unresolved threads (for later triage): <count>

Rules

  • Do not open a new PR (it already exists). Do not commit anything to the branch during adoption -- only read, classify, and write the two branch-context files.
  • Do not re-classify unresolved threads during adoption -- just report the count.
  • Do not log every resolved thread -- only decision-bearing ones. The decisions log is meant to reward reading; diluting it with noise defeats the point.
  • Every backfilled entry must have a thread URL in Source:. If you cannot find one, you are over-inferring -- skip it.
  • If the existing brief/decisions files are already populated (not templates), the user's Startup confirmation governs whether to overwrite.

Frequently asked questions

What does the Adopt Pr AI skill do?

Bootstrap branch-context on an existing PR. Writes issue-brief.md from the linked issue(s) + current PR state, and backfills pr-decisions.md with decision-bearing entries from already-resolved review threads. Use when picking up a PR mid-flight (yours or someone else's) without prior local context.

Why use Adopt Pr on TypingMind?

Because you install it once and use it with any model. Adopt Pr is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Adopt Pr in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/pydantic/pydantic-ai-harness/tree/main/.agents/skills/adopt-pr. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Adopt Pr?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Adopt Pr?

As many as you like. As long as a model supports skills, you can use Adopt Pr with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Adopt Pr AI skill free?

Yes. It is published on GitHub by pydantic under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇