ag-refatorar-codigo

ag-refatorar-codigo is a skill for Claude Code from andregusman-raiz/a-gusman-claude. It costs 43 tokens per session (624 once invoked), scanned A, original, MIT.

A guided code-refactoring workflow that reorganizes code without intentionally changing its behavior, using small steps and separate commits.

In plain words
What is it for?
Use it to extract modules, rename code across a project, reorganize files, and document the changes while preserving behavior.
Why use it?
It lowers the risk of regressions by requiring existing tests and checking them after each structural change.

Skill for Claude Code

Written for Claude Code: disable-model-invocation in frontmatter. Also seen: model in frontmatter; mentions subagents.

Good fit Use it to extract modules, rename code across a project, reorganize files, and document the changes while preserving behavior.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/andregusman-raiz/a-gusman-claude/ag-refatorar-codigo
Install

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.

Any agent
npx skills add andregusman-raiz/a-gusman-claude --skill ag-refatorar-codigo
Clone the repo
git clone --depth 1 https://github.com/andregusman-raiz/a-gusman-claude

Made for: Claude Code.

Wrote 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.

agentmods badge for ag-refatorar-codigo

README.md
[![agentmods](https://agentmods.dev/badge/skills/andregusman-raiz/a-gusman-claude/ag-refatorar-codigo/github.svg)](https://agentmods.dev/skills/andregusman-raiz/a-gusman-claude/ag-refatorar-codigo)
Your own site
<a href="https://agentmods.dev/skills/andregusman-raiz/a-gusman-claude/ag-refatorar-codigo"><img src="https://agentmods.dev/badge/skills/andregusman-raiz/a-gusman-claude/ag-refatorar-codigo/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.

agentmods 80×15 button for ag-refatorar-codigo

Your own site · 80×15
<a href="https://agentmods.dev/skills/andregusman-raiz/a-gusman-claude/ag-refatorar-codigo"><img src="https://agentmods.dev/badge/skills/andregusman-raiz/a-gusman-claude/ag-refatorar-codigo.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 43 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 624 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 1 finding, 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 Excessive Agency · line 4
    Skill selects an external model or provider that may use a different account or billing plan than the operator expects. Undisclosed model switches can cause unexpected cost or quota consumption.
    Fix: Remove the model/provider override or disclose it prominently and require explicit operator approval before invoking an external coding CLI or billed model.
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5.1 $0.00043 $0.00624
Opus 5 $0.00022 $0.00312
Sonnet 5 $0.00009 $0.00125
Haiku 4.5 $0.00004 $0.00062

Measured 9d ago against content hash 42c4f2c3cd24, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

ag-refatorar-codigo 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 9d 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.

skills/ag-refatorar-codigo/SKILL.md · 67 lines

How it starts

The opening of the file, as written. The whole thing — 67 lines — stays where its author put it; the contents beside it link to each section on GitHub.

ag-refatorar-codigo — Refatorar Codigo

Spawn the ag-refatorar-codigo agent to restructure code without changing behavior.

Invocation

Use the Agent tool with:

  • subagent_type: ag-refatorar-codigo
  • mode: bypassPermissions
  • run_in_background: true
  • prompt: Compose from template below + $ARGUMENTS

Prompt Template

Projeto: [CWD or user-provided path]
Escopo: [module or pattern to refactor from $ARGUMENTS]


## Output
- refactor-report.md com analise antes/depois
- Commits incrementais (1 por step de refatoracao)
- Testes existentes continuam passando (zero regressao)

Protocolo incremental:
1. Mudar UMA coisa → Rodar testes → Pass → Commit
2. Repetir ate completar escopo
3. Se teste falha → Revert → Investigar

Pre-condicao: RECUSAR se nao existem testes.
Output: refactor-report.md (antes → depois, arquivos, commits, diagrama).
Worktree isolation ativo.

Important

  • ALWAYS spawn as Agent subagent — do NOT execute inline
  • After spawning, confirm to the user that the refactor agent is running
  • REFUSES to refactor without existing passing tests
  • Each step is a separate commit for safe rollback
  • Uses worktree isolation

Code Smell → Refactoring Map

Code Smell Refactoring Trigger
Funcao > 40 linhas Extract Function Limites Clean Code
Classe > 300 linhas Extract Class Limites Clean Code
Switch/if-else chain (>= 3 branches) Replace Conditional with Polymorphism Complexidade
Primitivo com regras de dominio Replace Primitive with Value Object Email, Money, CPF
Parametros demais (>3) Introduce Parameter Object Clean Code limit
Feature Envy Move Method Metodo usa mais dados de outra classe
Duplicacao Extract Method + reuse DRY

Regras de Ouro para Refatoracao

  1. NUNCA refatorar sem testes passando — testes sao a rede de seguranca
  2. NUNCA misturar refactoring e feature no mesmo commit — impossibilita rollback
  3. Cada passo deve manter testes verdes — se quebraram, reverter imediatamente
  4. Preferir refatoracoes pequenas e incrementais — 5 commits pequenos > 1 commit grande

Read the full file on GitHub · 67 lines

Changes

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.

  1. 9d ago First seen · 67 lines · 43 tokens per session scan A 42c4f2c3cd24

Subscribe to this mod's changes

ag-refatorar-codigo is a skill published in the GitHub repository andregusman-raiz/a-gusman-claude (19 stars, last pushed 3d ago), licensed MIT. It adds 43 tokens to every session and 624 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-09-03.

Related

Other skills, from other repositories

go-testing

Trigger: Go tests, go test coverage, Bubbletea teatest, golden files. Apply focused Go testing patterns.

Gentleman-Programming/gentle-ai · 26 tokens

verify-implementation

A workflow that runs a project’s verification skills to produce a report on coding patterns, architecture rules, and project conventions. It is intended for work after implementation, before a pull request, or during code review.

sangrokjung/claude-forge · 37 tokens

test-fixing

Run tests and systematically fix all failing tests using smart error grouping. Use when user asks to fix failing tests, mentions test failures, runs test suite and failures occur, or requests to make tests pass.

mhattingpete/claude-skills-marketplace · 44 tokens

code-qualities-assessment

Assess code maintainability through 5 foundational qualities (cohesion, coupling, encapsulation, testability, non-redundancy) with quantifiable scoring rubrics. Works at method/class/module levels across multiple languages. Produces markdown reports with remediation guidance. Use when you ask to "assess…

rjmurillo/ai-agents · 108 tokens

improving-tests

Improve test design, speed, and coverage with behavior-focused tests, useful seams, characterization tests, TDD, and test refactoring. Use when improving tests, optimizing slow suites, adding coverage, refactoring brittle tests, removing test waste, or working test-first. NOT for fixing production bugs (use…

alexei-led/cc-thingz · 89 tokens

react-testing-workflows

Testing strategy and execution for React applications. Covers Vitest configuration, React Testing Library patterns, custom hook testing, Playwright E2E, Storybook stories and play functions, and coverage reporting. Keywords: test, vitest, testing library, playwright, storybook, coverage, unit test, integration test…

PMDevSolutions/Aurelius · 0 tokens