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/helmedeiros/clean-code-skills/refactor-extract-methodnpx skills add helmedeiros/clean-code-skills --skill refactor-extract-methodgit clone --depth 1 https://github.com/helmedeiros/clean-code-skillsWrote 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/helmedeiros/clean-code-skills/refactor-extract-method)<a href="https://agentmods.dev/skills/helmedeiros/clean-code-skills/refactor-extract-method"><img src="https://agentmods.dev/badge/skills/helmedeiros/clean-code-skills/refactor-extract-method.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.00051 | $0.00805 |
| Opus 5 | $0.00026 | $0.00402 |
| Sonnet 5 | $0.00010 | $0.00161 |
| Haiku 4.5 | $0.00005 | $0.00081 |
Grade A, and why
refactor-extract-method 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 4d 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 — 91 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Refactoring: Extract Method
Identify blocks of code that do a distinct thing and extract them into well-named methods to improve readability, reduce duplication, and enable reuse.
When This Skill Applies
- A method is longer than 10-15 lines of logic
- A comment explains what the next block of code does (the comment becomes the method name)
- The same code block appears in multiple places
- A method operates at mixed levels of abstraction
- The user asks to simplify or decompose a function
Core Principle
If you need a comment to explain what a block of code does, that block should be a method whose name replaces the comment. Short, focused methods with intention-revealing names make code read like prose. Extract until each method does exactly one thing at one level of abstraction.
Workflow
Step 1: Identify the Extraction Candidate
Look for code blocks separated by blank lines or comments, nested blocks inside loops or conditionals, or duplicated logic. The block should have a clear single purpose.
Step 2: Name the New Method
Choose a name that describes what the code does, not how it does it. Use verbs for actions: calculateTotal, validateInput, formatAddress. If you struggle to name it, the block may be doing too much.
Step 3: Determine Parameters and Return Value
Identify which local variables the block reads (these become parameters) and which it writes (these become the return value). Minimize parameters — more than three suggests the block needs further decomposition or a parameter object.
Step 4: Extract and Replace
Move the code block to a new method. Replace the original block with a call to the new method. Ensure all variable references are resolved through parameters or return values.
Step 5: Verify
Run the test suite. The behavior must not change. If tests fail, the extraction introduced a bug — review parameter passing and variable scope.
Detection / Indicators
- Methods longer than 15 lines of logic
- Comments that explain "what" rather than "why"
- Deeply nested code (3+ levels of indentation)
- Repeated code blocks across methods
- Methods that mix high-level orchestration with low-level details
What ships with it
1 file 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.
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.
- 4d ago First seen · 91 lines · 51 tokens per session scan A 92820fd83c5a
refactor-extract-method is a skill published in the GitHub repository helmedeiros/clean-code-skills (2 stars, last pushed 6mo ago), licensed MIT. It adds 51 tokens to every session and 805 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.
Other skills, from other repositories
creating-explainers
Use when creating an interactive explainer - a single self-contained HTML page with hand-built Canvas figures. Handles source-file explainers, topic-driven research explainers, and mixed intake where files provide the spine and research adds support. Trigger phrases include "make an explainer", "turn this paper into…
explaining-codebases
Use when creating an interactive explainer about a codebase, repository, or source files. Handles onboarding overviews, architecture maps, and deep-dives on real implementation paths. Trigger phrases include "explain this codebase", "interactive guide to this repo", "walk through how X works in the code", or…
openehr-assistant
This skill should be used when a conversation touches openEHR outside a task owned by a dedicated skill — e.g. "what is an archetype?", "how do openEHR templates work?", "which composition category fits this data?", "find me a guide on X", "where do I start with openEHR modeling?" — or names openEHR concepts (ADL…
gan-zhong-xue
在你干真实开发时(边干边挖:搞懂 AI 正在做的这步,掌控方向)或干完提交后(事后挖: 回头搞懂一个甩手没懂的改动),就地陪你走一轮"先让你猜、再揭示、逼到原理"的回合制, 把黑盒变成你真懂、能复述、能迁移的东西。治的是 vibe-coding 的病:交付物在增加, 理解没跟上。触发词:"干中学"、"帮我搞懂 AI 正在做的这步"、"我刚才那段没懂"、 "这个 commit 我说不清"、"帮我真正搞懂刚才做的";掌舵(任务中途):"等等这步我没懂"、 "为什么这么改"、"这步我没跟上"。 English triggers: "learning by doing", "help me actually understand what…
modelcontextprotocol-python-sdk-context
Answers questions about the official Model Context Protocol (MCP) Python SDK (mcp package on PyPI, modelcontextprotocol/python-sdk on GitHub). Tracks the main branch (v2 pre-alpha — MCPServer/snakecase/constructor-on handlers). Use when working with MCP servers or clients in Python, debugging v1→v2 migrations, or…
criativos-qa-instagram
Generate 10 Instagram Q&A creatives from a lesson transcript. Identity-cloned photos (same face/body as expert), Instagram sticker overlay, Stories (9:16) and Feed (4:5) formats.