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 nirelbaz/promptpit --skill refactorgit clone --depth 1 https://github.com/nirelbaz/promptpitWrote 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/nirelbaz/promptpit/refactor)<a href="https://agentmods.dev/skills/nirelbaz/promptpit/refactor"><img src="https://agentmods.dev/badge/skills/nirelbaz/promptpit/refactor/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/nirelbaz/promptpit/refactor"><img src="https://agentmods.dev/badge/skills/nirelbaz/promptpit/refactor.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.00041 | $0.00383 |
| Opus 5.5 | $0.00016 | $0.00153 |
| Sonnet 5.5 | $0.00008 | $0.00077 |
| Haiku 4.5 | $0.00004 | $0.00038 |
Grade A, and why
refactor 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.
What it actually says
Refactor
Clean up code. Make it simpler, clearer, or more maintainable without changing what it does.
When to refactor
- You're about to add a feature and the existing code makes it hard
- You see the same logic in three or more places
- A function is longer than 40 lines
- You need to read a function twice to understand it
- Nesting is deeper than 3 levels
When NOT to refactor
- Code you're not otherwise touching. Stay focused on the task at hand.
- Code that works and nobody needs to change. Leave it alone.
- Right before a deadline. Refactoring is for when you have room to verify.
Techniques
- Extract function: repeated code becomes a named function
- Early return: replace nested if/else with guard clauses
- Rename: if the name doesn't explain the purpose, change it
- Inline: if a function is called once and adds no clarity, inline it
- Split file: if a file has two unrelated responsibilities, split it
Process
- Make sure tests pass before you start
- Make one small change at a time
- Run tests after each change
- Commit when tests pass
- Repeat
Rules
- Never refactor and change behavior in the same commit. Refactoring means the tests still pass with no changes to the tests.
- Don't abstract prematurely. Three concrete examples before you extract a pattern.
- Simpler is better. If your refactor adds more code than it removes, reconsider.
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 · 46 lines · 41 tokens per session scan A 772d2bdd8e2b
refactor is a skill published in the GitHub repository nirelbaz/promptpit (6 stars, last pushed 2mo ago), licensed MIT. It adds 41 tokens to every session and 383 once invoked, about $0.0002 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
cn-check
Install and run the Continue CLI (cn) to execute AI agent checks on local code changes. Use when asked to "run checks", "lint with AI", "review my changes with cn", or set up Continue CI locally.
yfm
YAML front matter (YFM) for any markdown article. x-cmd's default is three top-level fields: tags, description, memo. Default borrows the Agent Skills frontmatter shape — see . The yfm module is a helper: x yfm ls / init / lint.
pr-writing-review
Extract and analyze writing improvements from GitHub PR review comments. Use when asked to show review feedback, style changes, or editorial improvements from a GitHub pull request URL. Handles both explicit suggestions and plain text feedback. Produces structured output comparing original phrasing with reviewer…
hypotheses
Turns a research direction into testable hypotheses with predictions, competing explanations and the experiments that discriminate between them, including the design (controls, randomization, blocking), sample size or seed count, the pre-specified analysis, and the result that would falsify each hypothesis. Use when a…
check
Comprehensive rule-based check. Triggered by "/check [target]" to evaluate all source files against project rules and report every violation.
review
Review pull requests or code changes. Triggered by "/review [prlink]" or when user asks to review pending changes.