Логотип Refactoring Advisor

Refactoring Advisor

Спільнота
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.

Огляд

ВидавецьFirstp1ck
Репозиторійpi-coding-agent-forge
Назва навичкиrefactoring-advisor
Зірки
93
Форки
22
Файли в пакеті
Лише інструкції
ЛіцензіяMIT
Посилання
  • Інструкції у форматі Markdown

    Файл SKILL.md, який модель завантажує за потреби, тож токени витрачаються лише тоді, коли запит справді відповідає навичці.

  • Працює з будь-якою LLM

    Навички ШІ — це звичайний Markdown, а не код для певного постачальника, тому вони працюють із GPT, Claude, Gemini, Grok або локальною моделлю.

  • Усе необхідне — в інструкціях

    Усе потрібне моделі міститься в інструкціях — жодних додаткових файлів для синхронізації.

  • Відкритий вихідний код

    Опубліковано на GitHub користувачем Firstp1ck. Перегляньте вихідний вміст перед установленням.

Встановлення

Установіть навичку ШІ Refactoring Advisor у TypingMind, щоб використовувати її з будь-якою LLM, або додайте її до іншого агента, що читає SKILL.md.

1

Встановити в TypingMind

TypingMind встановлює навичку безпосередньо з її папки GitHub — читає SKILL.md, збирає файли ресурсів у пакет і зберігає результат локально.

  1. Відкрийте застосунок і перейдіть до Плагіни → Навички.
  2. Виберіть «Встановити з GitHub».
  3. Вставте наведений нижче URL папки навички та підтвердьте встановлення.
    https://github.com/Firstp1ck/pi-coding-agent-forge/tree/main/pi-skill-refactoring-advisor/skills/refactoring-advisor
  4. Увімкніть навичку в кожному чаті, де хочете її використовувати.
Плагіни → Навички → Нова навичка → За URL GitHub, потім вставте URL папки й натисніть «Продовжити».
2

Встановити в іншому агенті

Будь-який агент, що підтримує формат Agent Skills, може використовувати цю навичку — скопіюйте папку до каталогу навичок цього агента.

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
Після копіювання перезапустіть Claude Code, щоб завантажити нову навичку.

Використовуйте навичку в TypingMind

Увімкніть навичку Refactoring Advisor в будь-якому чаті TypingMind, і далі модель усе зробить сама. Назва й опис навички містяться в системному промпті, а щойно надходить відповідний запит, модель самостійно завантажує повні інструкції — вам не потрібно викликати навичку вручну, і до фактичного використання вона не витрачає токенів.

Модель самостійно завантажує навичку Refactoring Advisor, щойно надходить відповідний запит.

Працює з будь-якою моделлю ШІ

Навички ШІ — це звичайні інструкції Markdown, а не код для певного постачальника, тому навичка Refactoring Advisor не прив’язана до моделі, для якої її створено. Установіть її один раз у TypingMind і використовуйте з GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama або локальною моделлю, яку ви запускаєте самостійно, — усе з вашими власними ключами API.

  • Завантажується лише за потреби

    Системний промпт містить лише назву й опис. Інструкції завантажуються за першого відповідного запиту, тож невикористана навичка нічого не коштує.

  • Змінюйте моделі під час чату

    Оскільки навичка — це інструкції, а не код, зміна моделі не порушує її роботу: наступна модель читає той самий файл SKILL.md.

Інструкції навички

Це вміст файлу SKILL.md, який завантажує модель. Прочитайте його перед установленням — навичка містить інструкції, яких дотримуватиметься ваша модель.

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

Поширені запитання

Що робить навичка ШІ 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.

Навіщо використовувати Refactoring Advisor у TypingMind?

Тому що ви встановлюєте її один раз і використовуєте з будь-якою моделлю. Refactoring Advisor — це звичайний Markdown, а не код для конкретного постачальника, тому та сама навичка працює з GPT-5, Claude, Gemini, Grok або локальною моделлю. Ви можете змінити модель навіть посеред чату, і навичка продовжить працювати. TypingMind використовує ваші власні ключі API, тож ви платите безпосередньо постачальникам замість передплати за кожне місце користувача, а ваші навички й чати залишаються у вашому сховищі.

Як встановити Refactoring Advisor у TypingMind?

Відкрийте в TypingMind Плагіни → Навички → Встановити з GitHub і вставте https://github.com/Firstp1ck/pi-coding-agent-forge/tree/main/pi-skill-refactoring-advisor/skills/refactoring-advisor. TypingMind прочитає файл SKILL.md і встановить навичку, яку можна вмикати окремо для кожного чату.

Які моделі ШІ можуть використовувати Refactoring Advisor?

Будь-яка модель, яку ви підключите в TypingMind. Навички ШІ — це звичайні інструкції у форматі Markdown, а не код для конкретного постачальника, тому GPT, Claude, Gemini, Grok і локальні моделі можуть завантажувати цю навичку, коли запит їй відповідає.

Зі скількома моделями ШІ можна використовувати Refactoring Advisor?

Зі скількома забажаєте. Якщо модель підтримує навички, ви можете використовувати з нею Refactoring Advisor — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama та інші — усе в TypingMind із власними ключами API.

Чи безкоштовна навичка ШІ Refactoring Advisor?

Так. Навичку опубліковано на GitHub: Firstp1ck, за ліцензією MIT. Ви платите лише своєму постачальнику ШІ за використані токени.

Що таке навички ШІ?

Навичка ШІ — це багаторазовий набір інструкцій, який навчає модель ШІ виконувати одне конкретне завдання. Він відповідає відкритому формату Agent Skills: файл SKILL.md із назвою та описом, а також скрипти, шаблони чи довідкові файли, які можуть знадобитися моделі. Модель читає інструкції лише тоді, коли ваш запит відповідає навичці, тому встановлена навичка нічого не коштує, доки її не використано.

Чим навички ШІ відрізняються від плагінів або серверів MCP?

Плагін або сервер MCP надає моделі нові інструменти для виклику — код, який десь виконується й повертає результат. Натомість навичка ШІ надає моделі знання та порядок дій: як підійти до завдання, яких кроків дотримуватися та яким має бути якісний результат. Навички — це звичайний Markdown, тож їм не потрібні ні сервер, ні ключ API, ні середовище виконання, і вони працюють із будь-якою моделлю.

Усі

Створіть власний ШІ-простір уже зараз

Підпишіться на нашу розсилку, щоб дізнаватися про нові функції та майбутні розіграші 👇