worktree-deliver

A command for packaging work from a Git worktree into a commit, pushing it, and opening a pull request. A worktree is a separate working folder connected to a repository branch.

In plain words
What is it for?
Use it to review changes, remove the temporary task file, stage and commit work, push the branch, and create a pull request after confirmation.
Why use it?
It turns completed changes into a reviewable contribution and checks the branch, task file, and changed files before delivery.

Command for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/davila7/claude-code-templates/worktree-deliver
Clone the repo
git clone --depth 1 https://github.com/davila7/claude-code-templates

Made for: Claude Code.

Per session 12 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,000 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00012 $0.01000
Opus 5 $0.00006 $0.00500
Sonnet 5 $0.00002 $0.00200
Haiku 4.5 $0.00001 $0.00100

Measured 2d ago against content hash ec3a16c296b8, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

worktree-deliver 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 2d ago.

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.

.claude/commands/worktree-deliver.md · 128 lines

How it starts

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

Worktree Deliver

Commit all work, push, and create a pull request from the current worktree.

Instructions

You are inside a worktree. Package up the work and deliver it as a PR.

Step 1: Validate Environment

  1. Verify this is a worktree (not the main working tree) using git worktree list
  2. Get current branch: git branch --show-current
  3. Verify branch follows claude/*, claude-daniel/*, or review/* pattern. If not, warn the user and ask if they want to continue.
  4. Read .worktree-task.md if it exists to get the original task description

Step 2: Review Changes

  1. Run git diff --stat and git diff --cached --stat to show all changes
  2. Run git status --short to show the full picture
  3. If there are no changes at all (clean working tree, no commits ahead of main), inform the user there's nothing to deliver and stop.

Step 3: Clean Up Task File

Before staging anything, remove the worktree task file so it doesn't end up in the commit:

rm -f .worktree-task.md

Step 4: Confirm Files to Commit

Use AskUserQuestion to show the user what will be committed and ask for confirmation. List all modified, added, and untracked files.

Options:

  • "Stage all changes" — stage everything
  • "Let me choose" — user will specify which files to include

If the user wants to choose, ask them which files to stage.

Step 5: Stage and Commit

  1. Stage the confirmed files with git add
  2. Generate a commit message following conventional commits format

Commit Message Strategy:

  1. Analyze the diff to determine the conventional commit type:

    • feat: — New functionality, new files, new exports, new API endpoints
    • fix: — Bug fixes, error corrections, fixing broken behavior
    • refactor: — Code restructuring without changing behavior
    • docs: — Documentation only changes
    • test: — Adding or modifying tests
    • chore: — Build scripts, configs, maintenance tasks
  2. Generate a commit message based on:

    • The task description from .worktree-task.md (if it was found)
    • A brief summary of what the diff actually changed
    • Format: <type>: <subject> (max 72 characters)

Read the full file on GitHub · 128 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. 2d ago First seen · 128 lines · 12 tokens per session scan A ec3a16c296b8

Subscribe to this mod's changes

worktree-deliver is a command published in the GitHub repository davila7/claude-code-templates (30,476 stars, last pushed today), licensed MIT. It adds 12 tokens to every session and 1,000 once invoked, about $0.0001 per session on Opus 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-08-30.