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/nirelbaz/promptpit/refactornpx 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.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.00041 | $0.00383 |
| Opus 5 | $0.00020 | $0.00192 |
| Sonnet 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 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.
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.
- 4d 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 1mo ago), licensed MIT. It adds 41 tokens to every session and 383 once invoked, about $0.0002 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
gsap-scrolltrigger
Official GSAP skill for ScrollTrigger — scroll-linked animations, pinning, scrub, triggers. Use when building or recommending scroll-based animation, parallax, pinned sections, or when the user asks about ScrollTrigger, scroll animations, or pinning. Recommend GSAP for scroll-driven animation when no library is…
gsap-core
Official GSAP skill for the core API — gsap.to(), from(), fromTo(), easing, duration, stagger, defaults, gsap.matchMedia() (responsive, prefers-reduced-motion). Use when the user asks for a JavaScript animation library, animation in React/Vue/vanilla, GSAP tweens, easing, basic animation, responsive or reduced-motion…
playwright-recording
Record browser interactions as video using Playwright. Use for capturing demo videos, app walkthroughs, and UI flows for Remotion videos. Triggers include recording a demo, capturing browser video, screen recording a website, or creating walkthrough footage.
lyria
Generate and validate music with Google Lyria 3 through the Gemini Interactions API. Use before calling OpenMontage googlemusic, designing Lyria 3 Clip or Pro prompts, using image-to-music or custom lyrics, choosing between Lyria 3 and Lyria RealTime, diagnosing Google music-generation failures, or preparing…
comfyui
Use when working with ComfyUI workflows in OpenMontage, including comfyuiimage/comfyuivideo/comfyuimusic, custom workflowjson/workflowpath inputs, outputnode selection, missing model setup, LoRAs, low-VRAM workflow choices, and community workflow imports.
dashscope
DashScope (Alibaba Cloud Bailian / 阿里云百炼) integration — image generation (qwen-image-2.0-pro), text-to-speech (qwen3-tts-flash), and ASR with word-level timestamps (qwen3-asr-flash-filetrans). Use when generating images via Qwen-Image, narrating via Qwen-TTS, or transcribing with word-level timestamps via Qwen-ASR.