Getting it into your agent
It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.
git clone --depth 1 https://github.com/totvs/engpro-advpl-tlpp-skillsnpx agentmods add skills/totvs/engpro-advpl-tlpp-skills/refactorWrote 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/totvs/engpro-advpl-tlpp-skills/refactor)<a href="https://agentmods.dev/skills/totvs/engpro-advpl-tlpp-skills/refactor"><img src="https://agentmods.dev/badge/skills/totvs/engpro-advpl-tlpp-skills/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/totvs/engpro-advpl-tlpp-skills/refactor"><img src="https://agentmods.dev/badge/skills/totvs/engpro-advpl-tlpp-skills/refactor.svg" alt="Reviewed on agentmods" width="80" height="20"></a>- NVIDIA SkillSpector warn
SkillSpector: 2 findings, up to medium
These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →
- medium Prompt Injection · line 385 Large whitespace padding was detected (a block of blank lines or a long run of spaces). This can push injected instructions below or to the right of the visible area so a human reviewer never sees them while the agent still reads them. Manual review of the hidden content is recommended.Fix: Remove the large whitespace padding (blank-line blocks or long space runs) and review any content hidden below or to the right of it. Keep skill files compact and reviewable so no instructions can be
- medium Prompt Injection · line 394 Large whitespace padding was detected (a block of blank lines or a long run of spaces). This can push injected instructions below or to the right of the visible area so a human reviewer never sees them while the agent still reads them. Manual review of the hidden content is recommended.Fix: Remove the large whitespace padding (blank-line blocks or long space runs) and review any content hidden below or to the right of it. Keep skill files compact and reviewable so no instructions can be
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.00076 | $0.03393 |
| Opus 5 | $0.00038 | $0.01697 |
| Sonnet 5 | $0.00015 | $0.00679 |
| Haiku 4.5 | $0.00008 | $0.00339 |
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 10d 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 — 403 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Refactor
Overview
Improve code structure and readability without changing external behavior. Refactoring is gradual evolution, not revolution. Use this for improving existing code, not rewriting from scratch.
When to Use
Use this skill when:
- Code is hard to understand or maintain
- Functions/classes are too large
- Code smells need addressing
- Adding features is difficult due to code structure
- User asks "clean up this code", "refactor this", "improve this"
Refactoring Principles
The Golden Rules
- Behavior is preserved - Refactoring doesn't change what the code does, only how
- Small steps - Make tiny changes, test after each
- Version control is your friend - Commit before and after each safe state
- Tests are essential - Without tests, you're not refactoring, you're editing
- One thing at a time - Don't mix refactoring with feature changes
When NOT to Refactor
- Code that works and won't change again (if it ain't broke...)
- Critical production code without tests (add tests first)
- When you're under a tight deadline
- "Just because" - need a clear purpose
Common Code Smells
Identify and fix these common code smells. See references/code-smells-and-patterns.md for detailed before/after examples.
| # | Smell | Fix |
|---|---|---|
| 1 | Long Method/Function | Break into focused functions |
| 2 | Duplicated Code | Extract common logic |
| 3 | Large Class/Module | Single responsibility per class |
| 4 | Long Parameter List | Group into parameter objects or use builder |
| 5 | Feature Envy | Move logic to the object that owns the data |
| 6 | Primitive Obsession | Use domain types |
| 7 | Magic Numbers/Strings | Named constants |
| 8 | Nested Conditionals | Guard clauses / early returns |
| 9 | Dead Code | Remove it (git has history) |
| 10 | Inappropriate Intimacy | Ask, don't tell — use encapsulation |
| 11 | IIF Usage | Replace IIF() / IF() with If/Else/EndIf for clarity and testability |
| 12 | API Calls in Loops | Move GetMV(), ExistBlock(), Type() out of loops — cache before loop |
| 13 | UI in Transactions | Never call MsgAlert, MsgYesNo, Aviso, Help inside transaction scope |
| 14 | SQL Injection via Concatenation | Replace string concatenation in queries with FWExecStatement |
| 15 | ISAM Driver Usage | Migrate MSCREATE, DBCREATE, CRIATRAB to FWTemporaryTable |
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.
- 10d ago First seen · 403 lines · 76 tokens per session scan A 216854941917
refactor is a skill published in the GitHub repository totvs/engpro-advpl-tlpp-skills (127 stars, last pushed 26d ago), licensed MIT. It adds 76 tokens to every session and 3,393 once invoked, about $0.0004 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-30.
Other skills, from other repositories
autoreview
Pre-commit/ship code review: Codex default; optional Claude or Pi.
rework-rate
Measure and interpret PR rework rate — the emerging 5th DORA metric.
omh-code-review
This is a Hermes-native code-review workflow skill.
revdiff-plan
Review the last Codex assistant message (plan, analysis, or proposal) with inline annotations in a TUI overlay. Extracts the most recent response from Codex rollout files and opens it in revdiff for review and annotation. Activates on "revdiff-plan", "review plan with revdiff", "annotate plan", "review last response"…
code-reviewer
Code review specialist focused on patterns, bugs, security, and performance.
agent-teams-simplify-and-harden
Implementation + audit loop using parallel agent teams with structured simplify, harden, and document passes. Spawns implementation agents to do the work, then audit agents to find complexity, security gaps, and spec deviations, then loops until code compiles cleanly, all tests pass, and auditors find zero issues or…