pydantic-ai: Skill for Claude Code

.agents/skills/initialize-worktree/SKILL.md

initialize-worktree is a skill for Claude Code from pydantic/pydantic-ai. It costs 47 tokens per session (1,751 once invoked), scanned A, original, MIT.

A guided workflow for taking a new coding problem or GitHub issue from investigation to a possible pull request. A worktree is a separate checkout of a Git repository, so the work starts isolated from other branches.

In plain words
What is it for?
Use it to study an issue, inspect the relevant code and guidance, plan a fix, optionally implement it, and open the first pull request.
Why use it?
It keeps new work separate and makes the required project instructions and issue details part of the starting process. It also distinguishes fresh work from an existing pull request that should be continued instead.

Skill for Claude Code

Written for Claude Code: user-invocable in frontmatter. Also seen: reads .claude/ paths; installed under .agents/ (shared by several agents); mentions AGENTS.md.

This is pydantic/pydantic-ai's own configuration. It tells Claude Code how to work on pydantic-ai itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything pydantic-ai configures →

About the project

Pydantic AI is a typed Python SDK for building AI agents that can use different language models and interfaces, including voice, image generation, and embeddings. Developers use it for applications ranging from structured data extraction to long-running multi-agent work. The catalogue entries provide workflows and configuration for its coding-agent and harness features.

pydantic/pydantic-ai · 20,771 stars · on GitHub · pydantic.dev

Reuse

Borrowing it

Nothing to install: this file belongs to pydantic/pydantic-ai. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/pydantic/pydantic-ai/main/.agents/skills/initialize-worktree/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/pydantic/pydantic-ai

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for initialize-worktree

README.md
[![agentmods](https://agentmods.dev/badge/skills/pydantic/pydantic-ai/initialize-worktree/github.svg)](https://agentmods.dev/skills/pydantic/pydantic-ai/initialize-worktree)
Your own site
<a href="https://agentmods.dev/skills/pydantic/pydantic-ai/initialize-worktree"><img src="https://agentmods.dev/badge/skills/pydantic/pydantic-ai/initialize-worktree/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for initialize-worktree

Your own site · 80×15
<a href="https://agentmods.dev/skills/pydantic/pydantic-ai/initialize-worktree"><img src="https://agentmods.dev/badge/skills/pydantic/pydantic-ai/initialize-worktree.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 47 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,751 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00047 $0.01751
Opus 5.5 $0.00019 $0.00700
Sonnet 5.5 $0.00009 $0.00350
Haiku 4.5 $0.00005 $0.00175

Measured yesterday against content hash b588ac9d4a1b, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

initialize-worktree scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.agents/skills/initialize-worktree/SKILL.md · 155 lines

How it starts

The opening of the file, as written. The whole thing — 155 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Initialize Worktree — From Problem to PR

Study a problem or GitHub issue, research the codebase, plan a fix, optionally implement it, and open the initial PR. Assumes the branch is already checked out.

Startup

  1. Read the root AGENTS.md, agent_docs/index.md and its relevant topic guides, plus every directory-specific AGENTS.md governing a file you expect to touch. Reading these from the checked-out tree is correct here and only here: this skill starts fresh work on your own branch off the target branch, so nobody else has written them. Check that before you rely on it — if the branch already carries commits you did not author, stop and use /adopt-pr, which reads them from a policy-base checkout instead.
  2. Read the pushing-commits-to-the-repo skill — it owns the PR lifecycle this skill hands off to

Step 1 — Parse Input

Parse $ARGUMENTS:

  • GitHub issue URL or number (e.g. https://github.com/pydantic/pydantic-ai/issues/1234 or #1234) → fetch via gh issue view <number> --json title,body,comments,labels,state,updatedAt
  • Free text → treat as problem description
  • Empty → ask the user to link an issue or describe the problem.

Step 2 — Study

Inspect the codebase to understand the problem:

  • For issues: read all comments to understand discussion, decisions, maintainer guidance
  • Identify key files, affected areas, related tests
  • Search for prior attempts or related PRs if relevant

Be thorough — this research informs everything downstream.

Step 3 — Write the branch-context files

Write .claude/skills/branch-context/issue-brief.md from scratch — the file does not exist on a clean checkout. The same schema ships as issue-brief.template.md beside it; use this one — keep it tight, this file is autoloaded on every future session and token cost compounds:

---
last_fetched_at: <ISO timestamp now>
last_fetched_comment_count: <count from gh issue view>
branch: <git rev-parse --abbrev-ref HEAD>
related_pr: TBD
issues:
  - number: <N>
    url: <url>
    title: "<title>"
    type: <bug|improvement|feature>
    role: <primary|related|follow-up>
    updated_at: <issue updatedAt from GitHub>
    comments_fingerprint: <output of issue-comment-fingerprint for this issue>
---

# Issue Brief

## Issues
- [#<N> — <title>](<url>) — type: <...> — role: <...>

## Problem
<1–2 sentences>

## Current behavior vs. expected
(bugs only — omit for features/improvements)

## Scope
**In:**
- <...>

**Out:**
- <...>

## Success criteria
| # | Criterion | Test |
|---|-----------|------|
| 1 | <...> | <test path or "to add"> |

## Constraints
- <backwards-compat / public-API / provider-parity statements>

## Affected surface
- <file> — <role>

## References
- [<label>](<url>) — <relevance>

Read the full file on GitHub · 155 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 155 lines · 47 tokens per session scan A b588ac9d4a1b

Subscribe to this mod's changes

initialize-worktree is a skill published in the GitHub repository pydantic/pydantic-ai (20,771 stars, last pushed today), licensed MIT. It adds 47 tokens to every session and 1,751 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-10-21.

Related

Other skills, from other repositories