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 jimmc414/claude-code-plugin-marketplace --skill refactor-decompose-functiongit clone --depth 1 https://github.com/jimmc414/claude-code-plugin-marketplaceWrote 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/jimmc414/claude-code-plugin-marketplace/refactor-decompose-function)<a href="https://agentmods.dev/skills/jimmc414/claude-code-plugin-marketplace/refactor-decompose-function"><img src="https://agentmods.dev/badge/skills/jimmc414/claude-code-plugin-marketplace/refactor-decompose-function/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/jimmc414/claude-code-plugin-marketplace/refactor-decompose-function"><img src="https://agentmods.dev/badge/skills/jimmc414/claude-code-plugin-marketplace/refactor-decompose-function.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.00028 | $0.00802 |
| Opus 5.5 | $0.00011 | $0.00321 |
| Sonnet 5.5 | $0.00006 | $0.00160 |
| Haiku 4.5 | $0.00003 | $0.00080 |
Grade A, and why
refactor-decompose-function 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 1mo 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.
How it starts
The opening of the file, as written. The whole thing — 103 lines — stays where its author put it; the contents beside it link to each section on GitHub.
refactor-decompose-function
When to Use
- Function is longer than 10-15 lines
- Multiple levels of nesting
- Hard to understand at a glance
- Difficult to test parts independently
- Code has natural "chunks" with different purposes
When NOT to Use
- Function is already simple and clear
- Decomposition would obscure the algorithm
- Helpers would only be used once with no clarity gain
The Pattern
Extract cohesive chunks into named helper functions. Each function should do one thing.
# BEFORE: Long, hard to test
def process_data(data):
# Validate
if not data:
raise ValueError("Empty data")
if not all(isinstance(x, int) for x in data):
raise TypeError("Non-integer data")
# Transform
result = []
for x in data:
if x > 0:
result.append(x * 2)
else:
result.append(0)
# Summarize
total = sum(result)
avg = total / len(result)
return {'data': result, 'total': total, 'average': avg}
# AFTER: Decomposed, each part testable
def process_data(data):
validate(data)
transformed = transform(data)
return summarize(transformed)
def validate(data):
if not data:
raise ValueError("Empty data")
if not all(isinstance(x, int) for x in data):
raise TypeError("Non-integer data")
def transform(data):
return [x * 2 if x > 0 else 0 for x in data]
def summarize(data):
total = sum(data)
return {'data': data, 'total': total, 'average': total / len(data)}
Example (from pytudes)
# Spelling correction (spell.py) - beautifully decomposed
def correction(word):
"""Most probable spelling correction for word."""
return max(candidates(word), key=P)
def candidates(word):
"""Generate possible spelling corrections for word."""
return known([word]) or known(edits1(word)) or known(edits2(word)) or [word]
def known(words):
"""The subset of words that appear in the dictionary."""
return set(w for w in words if w in WORDS)
def edits1(word):
"""All edits one edit away from word."""
letters = 'abcdefghijklmnopqrstuvwxyz'
splits = [(word[:i], word[i:]) for i in range(len(word) + 1)]
deletes = [L + R[1:] for L, R in splits if R]
transposes = [L + R[1] + R[0] + R[2:] for L, R in splits if len(R) > 1]
replaces = [L + c + R[1:] for L, R in splits if R for c in letters]
inserts = [L + c + R for L, R in splits for c in letters]
return set(deletes + transposes + replaces + inserts)
def edits2(word):
"""All edits two edits away from word."""
return (e2 for e1 in edits1(word) for e2 in edits1(e1))
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.
- 1mo ago First seen · 103 lines · 28 tokens per session scan A 2727b365e575
refactor-decompose-function is a skill published in the GitHub repository jimmc414/claude-code-plugin-marketplace (4 stars, last pushed today), licensed MIT. It adds 28 tokens to every session and 802 once invoked, about $0.0001 per session on Opus 5.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.
Other skills, from other repositories
audit-comment-residue
Read-only classifier that flags residue in code comments: history narration, plan or session references, conversational asides, ticket or PR back-references, origin notes, and workarounds with no link or removal condition. Use when asked to 'audit code comments' or report which comments only make sense with the chat…
improve
Codebase scan for module-level friction (shallow modules, seam leaks, locality gaps): an HTML candidate report, then a Design-It-Twice interview on the chosen one. Use when 'improve architecture', 'find deepening opportunities', 'shallow modules', 'design it twice', 'compare alternative interfaces', 'make code more…
code-review
CI code-review lane for a GitHub pull request. High-signal correctness and maintainability findings only, scoped out of security when a security lane exists. Use when: 'CI code review', 'claude-review lane', '/review:code-review', or a reusable workflow invokes the org code-review plugin command.
phpunit-test-reconciling
Internal sub-skill. Do not auto-activate. Use only when explicitly invoked by name by another skill or agent.
extract-ssot
Deduplicate repeated markdown (rule files, skill bodies, ADRs, docs) into one named source of truth and migrate every call site to cite it by exact heading. Use when the same prose, literal, or concept recurs across files: 'DRY this prose', 'extract a shared rule', 'single source of truth for X', a value-bump diff…
morning-brief
Operator's read-only morning view of the current GitHub repo in one pass: open counts per queue label, merge-ready PRs, parked decisions with their RECOMMENDED lines, loop-lane telemetry freshness, and per CI lane the week's failures by class, limit stops, restarts and turn headroom, and model usage per activity and…