Logo van Refactoring Advisor

Refactoring Advisor

Community
Firstp1ck
refactoring-advisor

Agents should invoke this skill for refactors, code smells, migrations, duplication removal, module splitting, API cleanup, or restructuring plans. Emphasizes small safe steps, behavior preservation, and verification after each change.

Overzicht

UitgeverFirstp1ck
Repositorypi-coding-agent-forge
Skillnaamrefactoring-advisor
Sterren
93
Forks
22
Meegeleverde bestanden
Alleen instructies
LicentieMIT
Links
  • Instructies in Markdown

    Een SKILL.md-bestand dat het model laadt wanneer nodig, zodat het alleen tokens kost als een verzoek er daadwerkelijk bij past.

  • Werkt met elk LLM

    AI-skills zijn gewone Markdown, geen aanbiederspecifieke code. Daardoor werken ze met GPT, Claude, Gemini, Grok of een lokaal model.

  • Compleet zonder extra bestanden

    Alles wat het model nodig heeft, staat in de instructies — geen extra bestanden om te synchroniseren.

  • Open source

    Gepubliceerd door Firstp1ck op GitHub. Lees de broninhoud voordat je de skill installeert.

Installatie

Installeer de AI-skill Refactoring Advisor in TypingMind om deze met elke LLM te gebruiken, of voeg de skill toe aan een andere agent die SKILL.md kan lezen.

1

Installeren in TypingMind

TypingMind installeert een skill rechtstreeks vanuit de GitHub-map — het leest SKILL.md, bundelt de bijbehorende bestanden en slaat het resultaat lokaal op.

  1. Open de app en ga naar Plug-ins → Skills.
  2. Kies "Installeren via GitHub".
  3. Plak de onderstaande URL van de skillmap en bevestig.
    https://github.com/Firstp1ck/pi-coding-agent-forge/tree/main/pi-skill-refactoring-advisor/skills/refactoring-advisor
  4. Schakel de skill in elke chat in waarin je deze beschikbaar wilt hebben.
Plug-ins → Skills → Nieuwe skill → Via GitHub-URL. Plak vervolgens de map-URL en druk op Doorgaan.
2

Installeren in een andere agent

Elke agent die het Agent Skills-formaat kan lezen, kan deze skill gebruiken — kopieer de map naar de skillmap van die agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/Firstp1ck/pi-coding-agent-forge.git /tmp/pi-coding-agent-forge
mkdir -p .claude/skills
cp -r /tmp/pi-coding-agent-forge/pi-skill-refactoring-advisor/skills/refactoring-advisor .claude/skills/refactoring-advisor
Start Claude Code na het kopiëren opnieuw op, zodat de nieuwe skill wordt herkend.

Gebruik deze skill in TypingMind

Schakel Refactoring Advisor in een willekeurige chat in TypingMind in en het model doet de rest. De naam en beschrijving staan in de systeemprompt. Zodra een verzoek erbij past, laadt het model zelf de volledige instructies — je hoeft de skill nooit handmatig aan te roepen en deze kost pas tokens wanneer je de skill daadwerkelijk gebruikt.

Het model laadt Refactoring Advisor automatisch zodra een verzoek erbij past.

Werkt met elk AI-model

AI-skills zijn gewone Markdown-instructies in plaats van aanbiederspecifieke code. Daardoor is Refactoring Advisor niet gebonden aan het model waarvoor de skill is geschreven. Installeer de skill één keer in TypingMind en gebruik deze met GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama of een lokaal model dat je zelf draait — allemaal met je eigen API-sleutels.

  • Alleen geladen wanneer nodig

    De systeemprompt bevat alleen de naam en beschrijving. De instructies worden bij het eerste bijpassende verzoek opgehaald, dus een ongebruikte skill kost niets.

  • Wissel van model tijdens een chat

    Omdat de skill uit instructies bestaat en niet uit code, blijft deze werken als je van model wisselt — het volgende model leest hetzelfde SKILL.md-bestand.

Skillinstructies

Dit is de inhoud van SKILL.md die het model laadt. Lees deze vóór de installatie — een skill bestaat uit instructies die je model zal volgen.

Refactoring Advisor

Systematic code smell detection and safe refactoring planning. Every refactoring plan ensures the codebase compiles and passes tests at every intermediate step.

Quick Start

Identify and Plan a Refactoring

  1. Detect the smell: What's wrong and why does it matter?
  2. Assess the risk: What could break? How large is the blast radius?
  3. Check test coverage: Are the affected areas covered? If not, add tests first.
  4. Plan incremental steps: Each step should leave the code in a working state.
  5. Estimate effort: Size the work (S/M/L/XL) and identify dependencies.

Common Code Smells by Language

Rust

SmellDescriptionRefactoring
God structOne struct with too many fields/methodsExtract into smaller, focused structs
Unnecessary clones.clone() where borrowing would workReplace with borrows, use lifetimes
Stringly typedUsing String where an enum fitsIntroduce enum with From impls
Match explosionHuge match blocks that grow with every variantExtract match arms into methods, use trait dispatch
Unwrap sprawl.unwrap() scattered through non-test codeReplace with ? operator, proper error handling
Leaky abstractionpub on internal implementation detailsReduce to pub(crate) or pub(super)
Monolithic lib.rsEverything in one fileSplit into focused modules
Over-genericGenerics where a concrete type sufficesSimplify to concrete types until generics are needed

TypeScript / React

SmellDescriptionRefactoring
Prop drillingProps passed through 3+ component levelsExtract to context, composition, or custom hook
God componentComponent with 200+ lines or multiple responsibilitiesSplit into focused components
Barrel file bloatIndex files re-exporting everythingDirect imports, remove barrel files
Any escape hatchas any or // @ts-ignore hiding type issuesFix the types, use type guards or discriminated unions
useEffect spaghettiMultiple unrelated effects in one componentSplit effects, extract to custom hooks
Inline styles sprawlStyles defined inline instead of using design systemExtract to CSS modules, Tailwind classes, or styled components
Callback prop chainsPassing callbacks through many layersUse context or state management
State duplicationSame data stored in multiple state variablesDerive computed values, single source of truth

Django / Python

SmellDescriptionRefactoring
Fat viewsBusiness logic in views instead of servicesExtract to service layer
Circular importsModules importing each otherRestructure boundaries, use lazy imports
God modelOne model with 20+ fields and many methodsSplit into related models, use composition
N+1 queriesDatabase queried in a loopAdd select_related() / prefetch_related()
Magic stringsHardcoded strings for choices, status, etc.Use TextChoices / IntegerChoices enums
Untyped functionsMissing type hints on public functionsAdd type annotations, run mypy
Test-free codeNo tests for critical business logicAdd tests before refactoring
Signal spaghettiComplex logic hidden in Django signalsReplace with explicit method calls

Refactoring Safety Protocol

Before Any Refactoring

  1. Verify test coverage. Run existing tests. If the area being refactored has no tests, write characterization tests first.
  2. Create a checkpoint. Ensure all changes are committed. The refactoring starts from a clean state.
  3. Define the end state. What does "done" look like? How will you verify success?

During Refactoring

  1. One change at a time. Each commit should be a single, focused refactoring step.
  2. Compile after every change. (cargo check, tsc --noEmit, python -m py_compile)
  3. Run tests after every change. If tests fail, fix before proceeding.
  4. No behavior changes. Refactoring changes structure, not behavior. If behavior must change, do it in a separate step.

After Refactoring

  1. Full test suite passes.
  2. Clippy / ESLint / Ruff clean. No new warnings introduced.
  3. Review the diff. Does the change accomplish what was intended? Any accidental behavior changes?

Refactoring Plan Template

When proposing a refactoring, use this structure:

markdown
## Refactoring Plan: [Description]

**Target:** [File/module/component]
**Smell:** [What's wrong]
**Goal:** [What "done" looks like]
**Risk:** Low / Medium / High
**Effort:** S / M / L / XL
**Test coverage:** Adequate / Needs improvement first

### Pre-requisites
- [ ] Tests pass on current code
- [ ] [Any additional pre-reqs]

### Steps

1. **[Step 1 description]**
   - Files affected: [list]
   - Verification: `cargo check && cargo test`

2. **[Step 2 description]**
   - Files affected: [list]
   - Verification: `cargo check && cargo test`

[... more steps ...]

### Rollback
If issues arise: `git revert` to the last passing commit.

### Success Criteria
- [ ] All tests pass
- [ ] No new clippy/lint warnings
- [ ] [Specific architectural improvement verified]

Migration Strategies

Pattern: Strangler Fig

For gradually replacing a legacy module:

  1. Create the new module alongside the old one
  2. Route new features through the new module
  3. Gradually migrate existing callers
  4. Remove the old module when all callers are migrated

Best for: Large-scale replacements where a clean cut is risky.

Pattern: Branch by Abstraction

For replacing an implementation behind an interface:

  1. Introduce an abstraction (trait/interface) over the current implementation
  2. Update callers to use the abstraction
  3. Implement the new version behind the same abstraction
  4. Switch the wiring (dependency injection, feature flag)
  5. Remove the old implementation

Best for: Swapping implementations (database, API client, algorithm).

Pattern: Parallel Change (Expand-Contract)

For changing a widely-used interface:

  1. Expand: Add the new interface alongside the old one
  2. Migrate: Update callers one by one to use the new interface
  3. Contract: Remove the old interface

Best for: API changes, function signature updates, data structure migrations.


Integration

  • Data: Refactoring plans and outcomes logged to MEMORY.md
  • Tests: Always verify test coverage before and after. Use cargo test -- --test-threads=1, bun test, or uv run pytest
  • Tech debt: If a refactoring is deferred, add it to the tech debt registry in MEMORY.md

Arc skill — Refactoring strategies and code smell detection

Veelgestelde vragen

Wat doet de AI-skill Refactoring Advisor?

Agents should invoke this skill for refactors, code smells, migrations, duplication removal, module splitting, API cleanup, or restructuring plans. Emphasizes small safe steps, behavior preservation, and verification after each change.

Waarom Refactoring Advisor gebruiken in TypingMind?

Omdat je deze skill één keer installeert en met elk model kunt gebruiken. Refactoring Advisor bestaat uit gewone Markdown in plaats van aanbiederspecifieke code. Dezelfde skill werkt dus met GPT-5, Claude, Gemini, Grok of een lokaal model, en je kunt midden in een chat van model wisselen zonder dat de skill niet meer werkt. TypingMind werkt met je eigen API-sleutels, dus je betaalt aanbieders rechtstreeks in plaats van een abonnement per gebruikersplek. Je skills en chats blijven in je eigen opslag.

Hoe installeer ik Refactoring Advisor in TypingMind?

Open Plug-ins → Skills → Installeren vanaf GitHub in TypingMind en plak https://github.com/Firstp1ck/pi-coding-agent-forge/tree/main/pi-skill-refactoring-advisor/skills/refactoring-advisor. TypingMind leest het bestand SKILL.md en installeert het als een skill die je per chat kunt inschakelen.

Welke AI-modellen kunnen Refactoring Advisor gebruiken?

Elk model dat je in TypingMind koppelt. AI-skills bestaan uit gewone Markdown-instructies in plaats van aanbiederspecifieke code. GPT, Claude, Gemini, Grok en lokale modellen kunnen deze skill dus allemaal laden wanneer een verzoek erbij past.

Hoeveel AI-modellen kan ik met Refactoring Advisor gebruiken?

Zoveel als je wilt. Zolang een model skills ondersteunt, kun je Refactoring Advisor ermee gebruiken: GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama en meer. Allemaal in TypingMind met je eigen API-sleutels.

Is de AI-skill Refactoring Advisor gratis?

Ja. Deze skill is door Firstp1ck op GitHub gepubliceerd onder de licentie MIT. Je betaalt alleen je eigen AI-aanbieder voor de tokens die je gebruikt.

Wat zijn AI-skills?

Een AI-skill is een herbruikbare bundel instructies die een AI-model leert hoe het één specifieke taak moet uitvoeren. Deze volgt het open Agent Skills-formaat: een bestand met de naam SKILL.md met een naam en beschrijving, plus eventuele scripts, sjablonen of referentiebestanden die het model nodig heeft. Het model leest de instructies alleen als je verzoek bij de skill past. Een geïnstalleerde skill kost dus niets zolang deze niet wordt gebruikt.

Waarin verschillen AI-skills van plug-ins of MCP-servers?

Een plug-in of MCP-server geeft een model nieuwe tools om aan te roepen: code die ergens wordt uitgevoerd en een resultaat teruggeeft. Een AI-skill geeft het model juist kennis en een werkwijze: hoe het een taak moet aanpakken, welke stappen het moet volgen en hoe goede uitvoer eruitziet. Skills bestaan uit gewone Markdown en hebben dus geen server, API-sleutel of runtime nodig. Ze werken met elk model.

Toon alles

Maak nu je eigen AI-werkruimte

Schrijf je in voor onze nieuwsbrief en blijf op de hoogte van nieuwe functies en toekomstige weggeefacties 👇