batch-bug-shepherd

A workflow for handling a group of suspected bugs in Microsoft APM, from the initial issue list through proposed fixes and merge-ready pull requests. A pull request is a set of code changes submitted for review before merging.

In plain words
What is it for?
Use it to classify issues as legitimate, unclear, or already fixed; connect legitimate bugs to existing work; create fixes; and drive the resulting pull requests toward merging. It can also post comments, push commits, and close outdated pull requests.
Why use it?
It removes the manual work of checking each issue, comparing it with existing pull requests, confirming it fits project principles, and following fixes through review and CI checks.

Skill for Claude CodeCodex

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 skills/microsoft/apm/batch-bug-shepherd
Any agent
npx skills add microsoft/apm --skill batch-bug-shepherd
Clone the repo
git clone --depth 1 https://github.com/microsoft/apm

Made for: Claude Code, Codex.

Per session 227 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 5,631 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.00227 $0.05631
Opus 5 $0.00113 $0.02815
Sonnet 5 $0.00045 $0.01126
Haiku 4.5 $0.00023 $0.00563

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

Security

Grade A, and why

batch-bug-shepherd 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.

The scan reads SKILL.md. This mod also ships 1 executable file (scripts/run_evals.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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/batch-bug-shepherd/SKILL.md · 446 lines

How it starts

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

batch-bug-shepherd - Outer-loop bug-queue orchestrator

This skill is an A10 ORCHESTRATOR-SAGA over fan-out waves (triage, strategic-alignment, PR-cross-reference, fix, drive-to-merge, conflict-resolution) with a persisted ground-truth table between phases. It COMPOSES the shepherd-driver skill as the per-PR drive-to-merge engine -- it does NOT re-implement the review + fold + push + CI loop. shepherd-driver transitively COMPOSES apm-review-panel; this skill inherits that edge and never reaches into panel internals directly. It also COMPOSES the apm-ceo persona (host-repo agent at .apm/agents/apm-ceo.agent.md) for the strategic-alignment gate, which checks every LEGIT bug against PRINCIPLES.md before allowing fix / drive work to proceed. Per-PR shepherding is delegated to shepherd-driver; per-issue verification, strategic alignment, PR-in-flight branching, greenfield fix dispatch, post-wave mergeability re-probe, and the cross-session table are owned here.

The skill is ADVISORY at the panel layer and EXECUTIVE at the orchestrator layer: it WILL push commits, open PRs, post comments, close superseded PRs. Every consequential write goes through a deterministic CLI (gh, git, uv run ruff) wrapped in plan + execute + verify (A9 SUPERVISED EXECUTION).

Architecture invariants

These 18 rules bind every wave. The one-line essence is below; the FULL binding text (rationale, edge cases, inherited-from-driver detail) lives in references/invariants.md. Load references/invariants.md before planning Phase 0 -- the summaries here are dispatch anchors, not the complete contract.

  • Fan-out, not serial. Triage / alignment / fix / drive run as parallel child threads; single-loop is an anti-pattern.
  • Verify before fix. No fix dispatched until the bug reproduces on HEAD (LEGIT); UNCLEAR -> human, FIXED-AT-HEAD -> close.
  • PR-in-flight detection is mandatory. gh pr list every legit issue before any fix; duplicating community work is the worst failure mode this skill defends against.
  • Drive, do not split shepherd from complete. ONE shepherd-driver subagent owns the whole per-PR loop; no separate panel + completion waves.
  • Mutation-break gate. A regression trap is real only if deleting the production guard makes the test FAIL.
  • Canonical-owner gate (driver-enforced). Every fix gets one architecture classification vs .github/instructions/architecture.instructions.md; a new owner, centralization, or split-authority repair needs the full dual guardrail (behavioral + static + test_architecture_* + mutation break) before ready-to-merge. shepherd-driver enforces and returns it; the orchestrator only records the evidence.
  • Superseding-PR fallback (inherited). On contributor-fork push failure the driver opens an authorship-preserving PR under microsoft/apm and returns superseded.
  • Single-writer interlock. One idempotent panel comment + one driver advisory per PR; the orchestrator never posts to a PR.
  • ASCII only. Printable ASCII in every artifact (cp1252 safety).
  • Lint contract is the push gate (inherited). ruff check + ruff format --check silent before any git push.
  • Ground-truth table is the single source of truth. One plan.md table, rewritten on every return, re-read at each wave start (B4 PLAN MEMENTO + B8 ATTENTION ANCHOR).
  • Cross-session message reports only on green. Failures stay in the subagent session until resolved or escalated to a human.
  • Operator visibility is a contract. Progress mermaid + live table at every boundary; dispatch table before every fan-out (assets/progress-diagram.md).
  • Mergeability is post-wave truth. Re-probe mergeStateStatus before claiming ready; Phase 5 resolves conflicts with --force-with-lease (bare --force prohibited).
  • Two-comment-per-PR cap. Driver advisory + resolution confirmation only; the in-loop panel comment is idempotent and does not add to the count. No third comment, ever.
  • Bias toward folding (inherited). The driver folds in-scope follow-ups into the PR; only genuinely separable work becomes a tracking issue.
  • Strategic-alignment gate before drive. Phase 1.5 runs one apm-ceo subagent per LEGIT row; demoted rows skip Phase 2-5; the gate fails open to aligned, aborts only if the persona / PRINCIPLES.md is missing.
  • Worktree isolation. Every fix and drive child runs in its OWN git worktree (one per issue/PR); never fan out mutating children against a shared REPO_ROOT (they would race on .git/index and the checked-out branch). Triage is read-only and may share one.

Read the full file on GitHub · 446 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 · 446 lines · 227 tokens per session scan A c5b0f8752e72

Subscribe to this mod's changes

batch-bug-shepherd is a skill published in the GitHub repository microsoft/apm (3,668 stars, last pushed 2d ago), licensed MIT. It adds 227 tokens to every session and 5,631 once invoked, about $0.0011 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.

Related

Other skills, from other repositories

review

Review a proposed change before applying it.

narumiruna/aru · 10 tokens

create-skill-sample

This skill should be used when the user asks to "create a new skill sample", "add a skill", "scaffold a new skill", "contribute a skill", "create a GitHub Copilot skill", "build a custom skill", or needs to create a new GitHub Copilot custom skill sample with proper folder structure, SKILL.md, README, and sample.json…

pnp/copilot-prompts · 102 tokens

create-system-prompt

This skill should be used when the user asks to "create an agent instruction", "add agent instructions", "scaffold an agent sample", "create a system prompt sample", "add a system prompt", "create a new agent", "build an agent", or needs to create a new agent instruction sample with proper folder structure, README…

pnp/copilot-prompts · 99 tokens

mcp-server-review

Review a Model Context Protocol (MCP) server implementation against the 2026-07-28 protocol revision, which removed the initialize handshake and Mcp-Session-Id and made the protocol stateless. Use when the user asks to review, audit, upgrade or migrate an MCP server, asks whether their MCP server is spec compliant…

pnp/copilot-prompts · 93 tokens

code-review-csharp

Perform structured code reviews of C# source code covering naming conventions, performance, security, readability, and .NET best practices. Trigger phrases include "review this C# code", "check my C# for best practices", "analyze this C# class", "find issues in my C# code".

pnp/copilot-prompts · 66 tokens

prompt-of-the-week

Generates a weekly PowerPoint slide from a PnP copilot-prompts GitHub sample URL (for example, samples/agent-instructions/creator-agent), derives the correct weekly title from the sample folder, and produces a styled .pptx file that matches the Prompt-K template layout.

pnp/copilot-prompts · 64 tokens