dirty-worktree-discipline

dirty-worktree-discipline is a skill for Claude Code, Codex from joelbrilliant/agentic-delivery-skills. It costs 52 tokens per session (567 once invoked), scanned A, original, MIT.

A set of repository-safety instructions for working in a Git project that already contains changes, generated files, or work from other people. Git is a system for tracking code changes and collaborating safely.

In plain words
What is it for?
It is for inspecting a messy worktree, separating relevant files from unrelated ones, staging only the intended changes, and reviewing them before a commit.
Why use it?
It reduces the risk of deleting, reverting, formatting, or committing someone else’s work by requiring precise checks and file selection.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit It is for inspecting a messy worktree, separating relevant files from unrelated ones, staging only the intended changes, and reviewing them before a commit.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/joelbrilliant/agentic-delivery-skills/dirty-worktree-discipline
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.

Any agent
npx skills add joelbrilliant/agentic-delivery-skills --skill dirty-worktree-discipline
Clone the repo
git clone --depth 1 https://github.com/joelbrilliant/agentic-delivery-skills

Made for: Claude Code, Codex.

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 dirty-worktree-discipline

README.md
[![agentmods](https://agentmods.dev/badge/skills/joelbrilliant/agentic-delivery-skills/dirty-worktree-discipline/github.svg)](https://agentmods.dev/skills/joelbrilliant/agentic-delivery-skills/dirty-worktree-discipline)
Your own site
<a href="https://agentmods.dev/skills/joelbrilliant/agentic-delivery-skills/dirty-worktree-discipline"><img src="https://agentmods.dev/badge/skills/joelbrilliant/agentic-delivery-skills/dirty-worktree-discipline/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 dirty-worktree-discipline

Your own site · 80×15
<a href="https://agentmods.dev/skills/joelbrilliant/agentic-delivery-skills/dirty-worktree-discipline"><img src="https://agentmods.dev/badge/skills/joelbrilliant/agentic-delivery-skills/dirty-worktree-discipline.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 52 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 567 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.00052 $0.00567
Opus 5 $0.00026 $0.00283
Sonnet 5 $0.00010 $0.00113
Haiku 4.5 $0.00005 $0.00057

Measured 11d ago against content hash 6c7c54e9eee8, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

dirty-worktree-discipline 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 11d 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.

skills/dirty-worktree-discipline/SKILL.md · 96 lines

How it starts

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

Dirty Worktree Discipline

Overview

Use this skill before editing, staging, committing, or reverting in a repository that already has unrelated changes.

A dirty worktree is not an excuse to stop. It is a reason to be precise.

When to Use

  • git status is not clean.
  • Generated files are present.
  • Multiple agents or humans are working in the same repo.
  • You need to commit only your slice.
  • You are tempted to run broad cleanup or reset commands.
  • A deploy or review requires exact source state.

Preflight

Capture:

git status --short --branch
git rev-parse --show-toplevel
git diff --name-only
git diff --cached --name-only

Classify files:

  • yours;
  • pre-existing unrelated;
  • generated artefacts;
  • unknown and risky;
  • ignored/cache/temp.

Rules

  1. Never run broad reset/clean by default. No git reset --hard, no git clean -fd, no mass restore without explicit scope.
  2. Stage by path. Use git add path1 path2, not git add ..
  3. Inspect staged diff. Run git diff --cached --stat and git diff --cached --name-only before commit.
  4. Preserve unrelated work. Do not format, revert, or move files outside your slice.
  5. Generated artefacts need intent. If build output is required for deploy, say so. Otherwise leave it uncommitted.
  6. Dirty state is part of evidence. Report what remains dirty and why.

Commit Protocol

Before commit:

Intended files:
Staged files:
Excluded dirty files:
Validation run:

After commit:

Commit SHA:
Files committed:
Repo still dirty: yes/no
Unrelated dirty state preserved:

Safe Commands

Good:

git add specific/file another/file
git diff --cached --name-only
git restore -- specific/generated-file

Risky, use only with explicit approval:

git add .
git reset --hard
git clean -fd
git checkout .

Anti-patterns

  • "Workspace was messy so I committed everything."
  • "I cleaned generated files and accidentally deleted someone else's artefacts."
  • "I deployed from a dirty tree but did not report it."
  • "I used broad restore because the diff was noisy."

Read the full file on GitHub · 96 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. 11d ago First seen · 96 lines · 52 tokens per session scan A 6c7c54e9eee8

Subscribe to this mod's changes

dirty-worktree-discipline is a skill published in the GitHub repository joelbrilliant/agentic-delivery-skills (2 stars, last pushed 3mo ago), licensed MIT. It adds 52 tokens to every session and 567 once invoked, about $0.0003 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-31.

Related

Other skills, from other repositories

mcore-split-pr

Split a PR into multiple PRs to reduce the number of required CODEOWNERS reviewer groups.

NVIDIA/skills · 25 tokens

stacked-prs

Manages dependent branch stacks and stacked pull requests using safe Git topology rules. Triggers on: "create stacked PRs", "publish this stack", "sync my PR stack", "rebase this stack", "merge the stack", "retarget child PRs", "split this branch into stacked PRs", "validate this stack", "cleanup stacked branches", or…

Mathews-Tom/armory · 122 tokens

pr-swarm

Parallelizes two or more independent "own PR to green" loops for a single repository using isolated git worktrees and separate headless Claude Code sessions per PR — resolving merge conflicts, clearing review feedback, and watching CI to completion without one PR's diff or feedback leaking into another's context.…

Mathews-Tom/armory · 171 tokens

changelog-composer

Generates structured changelogs and release notes from git history and PRs, classifying breaking changes, features, fixes, performance, docs. Triggers on: "generate changelog", "write release notes", "what changed since", "prepare release", "release notes for", "diff since tag".

Mathews-Tom/armory · 67 tokens

engineering-retro

Git-based engineering retrospective analyzing commits, PRs, and velocity over configurable windows with monorepo path scoping. Triggers on: "retrospective", "sprint retro", "weekly review", "what did we ship", "engineering retro", "dev summary", "commit analysis".

Mathews-Tom/armory · 63 tokens

repo-sentinel

Full security audit for public repositories across 12 attack surfaces: git history, secrets, CI/CD, containers, dependencies, licenses. Triggers on: "push to GitHub", "make repo public", "open source this", "is this safe to push", "release audit", "secret leaks".

Mathews-Tom/armory · 65 tokens