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.
npx skills add wan-huiyan/agent-traffic-control --skill worktree-historical-test-replay-missing-dirsgit clone --depth 1 https://github.com/wan-huiyan/agent-traffic-controlWrote 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.
[](https://agentmods.dev/skills/wan-huiyan/agent-traffic-control/worktree-historical-test-replay-missing-dirs)<a href="https://agentmods.dev/skills/wan-huiyan/agent-traffic-control/worktree-historical-test-replay-missing-dirs"><img src="https://agentmods.dev/badge/skills/wan-huiyan/agent-traffic-control/worktree-historical-test-replay-missing-dirs/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.
<a href="https://agentmods.dev/skills/wan-huiyan/agent-traffic-control/worktree-historical-test-replay-missing-dirs"><img src="https://agentmods.dev/badge/skills/wan-huiyan/agent-traffic-control/worktree-historical-test-replay-missing-dirs.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00239 | $0.01832 |
| Opus 5 | $0.00120 | $0.00916 |
| Sonnet 5 | $0.00048 | $0.00366 |
| Haiku 4.5 | $0.00024 | $0.00183 |
Grade A, and why
worktree-historical-test-replay-missing-dirs scanned grade A with 1 finding 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 7d 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.
Runs shell commandslowCapability
Expected in a hook, worth knowing in a rule or an instructions file.
subprocess.run(["pytest", *existing, "--tb=no", "-q"], cwd=worktree_path) How it starts
The opening of the file, as written. The whole thing — 176 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Worktree historical test replay — missing dirs
Problem
You're replaying historical bugs by checking out each pre-fix SHA in a temp worktree and running the project's canonical test command. At HEAD the command works (e.g. 159 tests collect). At older SHAs you get:
ERROR: file or directory not found: scripts/overnight/tests/
no tests ran in 0.01s
Exit code 4, duration 1-2 seconds. Pytest aborted before collection because one of the test directories you passed didn't exist yet at that commit.
This silently corrupts a historical-replay audit: you can't tell apart "the suite passed and missed the bug" from "the suite never ran." Both look like pytest failures from the outside.
Context / Trigger Conditions
- You're running historical incident replay, mutation testing, git bisect, or any other "check out an old SHA and run the suite" workflow
- The project's test layout grew over time (test dirs added, removed, reorganized in subsequent commits)
- The test command embeds explicit directory paths:
pytest scripts/overnight/tests/ <analytics_pkg>/tests/ ... - Pytest exits 4 (
USAGE_ERROR) in <5 seconds with no test execution - The SAME test command works at HEAD but fails at pre-fix SHAs older than the test layout's current shape
Solution
Before invoking the test command at each SHA, filter the test directory list to only those that exist in the worktree at that SHA:
# Inside the worktree at the target SHA:
TEST_DIRS=()
for d in scripts/overnight/tests <analytics_pkg>/tests <analytics_pkg>/cloudrun/<dashboard_app>/tests; do
[ -d "$d" ] && TEST_DIRS+=("$d")
done
if [ ${#TEST_DIRS[@]} -eq 0 ]; then
# No test dirs existed at this SHA — classify as 'unrunnable', skip.
echo "STATUS=unrunnable_no_test_dirs_at_sha"
exit 0
fi
PYTHONPATH=. pytest "${TEST_DIRS[@]}" --tb=no -q
In Python:
test_dirs_at_head = ["scripts/overnight/tests", "<analytics_pkg>/tests"]
existing = [d for d in test_dirs_at_head if (worktree_path / d).is_dir()]
if not existing:
return {"status": "unrunnable", "reason": "no test dirs existed at this SHA"}
subprocess.run(["pytest", *existing, "--tb=no", "-q"], cwd=worktree_path)
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.
- 7d ago First seen · 176 lines · 239 tokens per session scan A c29f20348320
worktree-historical-test-replay-missing-dirs is a skill published in the GitHub repository wan-huiyan/agent-traffic-control (3 stars, last pushed today), licensed MIT. It adds 239 tokens to every session and 1,832 once invoked, about $0.0012 per session on Opus 5. A static security scan graded it A with 1 finding (runs shell commands). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-05.
Other skills, from other repositories
cloudflare-workers-testing
Comprehensive testing guide for Cloudflare Workers using Vitest and @cloudflare/vitest-pool-workers. Use for test setup, binding mocks (D1/KV/R2/DO), integration tests, or encountering test failures, mock errors, coverage issues.
bun-test-lifecycle
Use for test lifecycle hooks: beforeAll, afterAll, beforeEach, afterEach, fixtures, preload.
bun-test-mocking
Use for mock functions in Bun tests, spyOn, mock.module, implementations, and test doubles.
bun-test-basics
Use for bun:test syntax, assertions, describe/it, test.skip/only/each, and basic patterns.
bun-test-coverage
Use for test coverage with Bun, --coverage flag, lcov reports, thresholds, and CI integration.
precommit
Pre-commit checks — lint:fix -> build -> test.