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 agentmods add skills/rand/cc-polymath/typed-holes-refactornpx skills add rand/cc-polymath --skill typed-holes-refactorgit clone --depth 1 https://github.com/rand/cc-polymathWrote 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/rand/cc-polymath/typed-holes-refactor)<a href="https://agentmods.dev/skills/rand/cc-polymath/typed-holes-refactor"><img src="https://agentmods.dev/badge/skills/rand/cc-polymath/typed-holes-refactor.svg" alt="Measured on agentmods" 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 | $0.00057 | $0.05361 |
| Opus 5 | $0.00028 | $0.02681 |
| Sonnet 5 | $0.00011 | $0.01072 |
| Haiku 4.5 | $0.00006 | $0.00536 |
Grade B, and why
typed-holes-refactor scanned grade B 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 5d 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.
Unrestricted tool accessmediumExcessive agency
A wildcard tool grant or "run any command" leaves no least-privilege boundary at all.
Run any script with `--help` for detailed usage. How it starts
The opening of the file, as written. The whole thing — 764 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Typed Holes Refactoring
Systematically refactor codebases using the Design by Typed Holes meta-framework: treat architectural unknowns as typed holes, resolve them iteratively with test-driven validation, and propagate constraints through dependency graphs.
Core Workflow
Phase 0: Hole Discovery & Setup
1. Create safe working branch:
git checkout -b refactor/typed-holes-v1
# CRITICAL: Never work in main, never touch .beads/ in main
2. Analyze current state and identify holes:
python scripts/discover_holes.py
# Creates REFACTOR_IR.md with hole catalog
The Refactor IR documents:
- Current State Holes: What's unknown about the current system?
- Refactor Holes: What needs resolution to reach the ideal state?
- Constraints: What must be preserved/improved/maintained?
- Dependencies: Which holes block which others?
3. Write baseline characterization tests:
Create tests/characterization/ to capture exact current behavior:
# tests/characterization/test_current_behavior.py
def test_api_contracts():
"""All public APIs must behave identically post-refactor"""
for endpoint in discover_public_apis():
old_result = run_current(endpoint, test_inputs)
save_baseline(endpoint, old_result)
def test_performance_baselines():
"""Record current performance - don't regress"""
baselines = measure_all_operations()
save_json("baselines.json", baselines)
Run tests on main branch - they should all pass. These are your safety net.
Phase 1-N: Iterative Hole Resolution
For each hole (in dependency order):
1. Select next ready hole:
python scripts/next_hole.py
# Shows holes whose dependencies are resolved
2. Write validation tests FIRST (test-driven):
# tests/refactor/test_h{N}_resolution.py
def test_h{N}_resolved():
"""Define what 'resolved correctly' means"""
# This should FAIL initially
assert desired_state_achieved()
def test_h{N}_equivalence():
"""Ensure no behavioral regressions"""
old_behavior = load_baseline()
new_behavior = run_refactored()
assert old_behavior == new_behavior
What ships with it
17 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
- README.md 7.8 KB
- references/CONSTRAINT_RULES.md 11 KB
- references/EXAMPLES.md 22 KB
- references/HOLE_TYPES.md 8.7 KB
- references/VALIDATION_PATTERNS.md 15 KB
- scripts/check_completeness.py 11 KB runs code
- scripts/check_discovery.py 7.6 KB runs code
- scripts/check_foundation.py 9.0 KB runs code
- scripts/check_implementation.py 9.7 KB runs code
- scripts/check_production.py 11 KB runs code
- scripts/discover_holes.py 9.4 KB runs code
- scripts/generate_report.py 8.2 KB runs code
- scripts/holes_to_beads.py 12 KB runs code
- scripts/next_hole.py 5.9 KB runs code
- scripts/propagate.py 2.5 KB runs code
- scripts/validate_resolution.py 6.0 KB runs code
- scripts/visualize_graph.py 12 KB runs code
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.
- 5d ago First seen · 764 lines · 57 tokens per session scan B 55f9ac49ac51
typed-holes-refactor is a skill published in the GitHub repository rand/cc-polymath (140 stars, last pushed 6mo ago), licensed MIT. It adds 57 tokens to every session and 5,361 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it B with 1 finding (unrestricted tool access). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other skills, from other repositories
claude-md-improver
Audit and improve CLAUDE.md files in repositories. Use when user asks to check, audit, update, improve, or fix CLAUDE.md files. Scans for all CLAUDE.md files, evaluates quality against templates, outputs quality report, then makes targeted updates. Also use when the user mentions "CLAUDE.md maintenance" or "project…
agent-platform-rag-engine-management
Manage and query Agent Platform RAG Engine Corpora and retrieve grounded contexts using the Google GenAI SDK. Use when listing RAG corpora or files, inspecting a corpus, retrieving contexts, or generating content grounded in a RAG corpus. Do not use for standard database queries (use SQL/Spanner skills), Google…
agent-platform-model-registry
Agent Platform Model Registry Management. Use when you need to upload, list, describe, update, or delete machine learning models (and their versions) in the Agent Platform Model Registry. Don't use for model training, model deployment to endpoints, or managing non-Agent Platform models.
twitter-reader
Read Twitter/X for financial research using opencli (read-only). Use this skill whenever the user wants to read their Twitter feed, search for financial tweets, view bookmarks, look up user profiles, or gather market sentiment from Twitter/X. Triggers include: "check my feed", "search Twitter for", "show my…
chenhao-limit-up
Use when evaluating A-share limit-up (涨停板) setups through Chen Hao's sentiment and momentum lens: market emotion cycles, board strength, follow-through, and short-term aggressive momentum trading.
comet-github
将 Comet GitHub 维护请求路由到基于证据的 PR 审阅、Issue 分诊、本地想法收集、CI 诊断或 Issue 实施流程。用户提到 Comet GitHub Issue/PR 但未指定流程,或询问下一步如何处理时使用。.