Desenvolvimento
AI code refactoring: five repos, one practical method
November 20, 2026
Why it matters
An AI coding session can leave you with a working feature and several new maintenance decisions. Which component owns the behavior? Why are there three versions of the same error message? Which abstraction is helping, and which one exists because the agent anticipated a future requirement?
Sean Kochel’s five repositories address different parts of that situation: architecture diagrams, simplification, voice input, improvement plans, and skill inspection. My preference would be to introduce them around a specific maintenance problem. That gives each tool a job and makes its contribution easier to judge.
AI code refactoring needs a clear definition of success. Refactoring improves internal structure while preserving observable behavior, following Martin Fowler’s definition. Changing product rules or replacing a model call with a lookup may involve additional behavior and performance decisions. The workflow below makes those decisions explicit, so a convincing audit report can become a change you can actually evaluate.
Key points
- 01:06 drawio-skill makes the system easier to inspect. The demonstration uses an architecture diagram to locate responsibilities before investigating a problem. The project produces editable diagrams. I would verify the important connections against the implementation and use the diagram to ask better questions. Official repository.
- 09:24 Ponytail challenges unnecessary complexity. The demonstrated audit looks for things to remove or simplify. Similar error components provide a useful example: determine whether their differences deserve separate implementations or can remain clear as parameters. Simplification is the central premise of Ponytail.
- 12:44 Handy lowers the effort of explaining a problem. Dictation can help capture details that disappear from a hurried typed request. Handy is a free, open source application with offline transcription. Review the resulting text before submitting it, especially technical names and constraints.
- 15:27 Improve turns investigation into a reviewable plan. In the video, findings become proposed work before implementation starts. This creates a useful point for reviewing scope and reasoning. Written plans remain central to the Improve project.
- 18:17 A local fix can leave equivalent paths untouched. The demonstration finds an optimization already implemented in one function but missing elsewhere. That suggests a focused audit question: which similar inputs follow different decision paths, and are those differences intentional?
- 19:58 Findings need boundaries before they become assignments. Sean creates issues from the plans for later implementation. The transferable practice is to preserve the reason for a change, its scope, and its review criteria. The number of issues created says little about the value eventually delivered.
- 22:45 SkillSpector examines the agent’s extensions. The demonstration applies scrutiny to skills being considered for installation. SkillSpector identifies risk patterns that require interpretation. Executable scripts or documentation in an unfamiliar language do not establish malicious intent.
- 26:38 Inspection has an operating cost. Sean reports roughly $5 for that scan and lower amounts for other scans. Those are observations from his usage. Your decision should use your provider’s actual consumption, the scope inspected, and any gaps in coverage.
How to apply
Scope AI code refactoring around one hypothesis
Pick a user journey you can exercise from beginning to end: retrieving an order, saving a profile, or processing a message. Describe the maintenance problem in terms someone else can verify.
“Clean up this application” leaves too many decisions open. “Changing an error message requires editing three components with equivalent behavior” provides a specific starting point. I would keep one hypothesis per change and record unrelated discoveries for separate consideration.
That boundary also makes review easier. A structural cleanup should preserve the behavior you agreed to retain. If investigation reveals a product bug, decide explicitly whether fixing it belongs in the same task.
Build a small map, then check it
Ask drawio-skill to diagram only the selected journey. Request source file references for the components and clear labels for inferred connections.
Follow a representative input through validation, decision making, storage, and response generation. Inspect connections to external services particularly carefully. The map earns its place when it helps you locate the implementation and explain dependencies to another person.
Match the tool to the question
| Working question | Candidate tool | Evidence to request | |---|---|---| | Where does this behavior live? | drawio-skill | A path verified against files and functions | | What could be simpler? | Ponytail | An alternative preserving required behavior | | What context is missing? | Handy | Reviewed text with examples and constraints | | How should this finding become a task? | Improve | A bounded, verifiable implementation plan | | What risks does this skill introduce? | SkillSpector | Findings tied to code and permissions |
A maintenance task may need just one of these tools. I would use the table to choose an intervention, then judge whether it improved the work enough to keep using it.
Capture behavior before changing structure
Collect representative inputs and expected outcomes. Include failure cases that matter to the selected journey. For products serving multiple markets, cover the actual conventions your users encounter: accented names, decimal separators, date formats, and identifiers with leading zeros.
Suppose an order query contains an exact identifier. Routing it directly to a database lookup might reduce model usage. First establish the expected authorization checks, missing-order response, and handling of ambiguous requests. If the new route changes answers or decisions, evaluate those changes as part of an optimization with its own acceptance criteria.
For interface components, capture relevant visual states and actions. Consolidating implementations is useful when the remaining differences stay understandable and easy to change.
Request a plan with a stopping condition
Here is a prompt I would start with, whether typed or dictated and edited:
Inspect only the order lookup flow. Propose one simplification and identify the files supporting your diagnosis. Preserve authorization rules and the behavior of the supplied examples. Produce a plan first, including scope, risks, verification steps, and a stopping condition. Explain what remains uncertain.
The video demonstrates Improve’s planning stage. Its current documentation also offers delegated execution through execute, so check which mode you are invoking. Current Improve workflow.
Evaluate the outcome, including review effort
Run the same examples before and after the change. A structural refactor should preserve required behavior and make maintenance easier to reason about. For an optimization, also compare latency, model calls, and cost. Track the time spent reviewing the proposal and repairing mistakes.
My approach to technical debt would favor recurring friction. A stable abstraction that looks awkward may be less urgent than a fragile path the team changes every week. Deleted lines describe part of the result; approval needs evidence that the change helps the project.
Before installing skills, inspect their source and requested access. SkillSpector’s LLM analysis sends eligible content to the configured provider. --no-llm keeps content analysis local, although vulnerability lookups may transmit dependency names and versions. The scanner does not contain an installed skill’s execution. Trust model.
Keep the accepted plan, verification results, and final decision together. That record gives the next maintenance session a reliable starting point and reduces dependence on a previous chat’s explanation.
Resources mentioned
- drawio-skill · Skill aberta para diagramas editáveis no draw.io; o agente utilizado pode ter custo.
- Ponytail · Projeto aberto para simplificação e revisão; os comandos evoluíram desde a demonstração.
- Handy · Aplicativo gratuito e aberto de transcrição offline.
- Improve · Skill aberta de auditoria e planejamento; o uso dos modelos pode ser cobrado.
- SkillSpector · Scanner aberto de skills; a análise opcional com LLM pode gerar cobrança do provedor.