Skip to content
52-execute-refactor-150 logo

Execute-Refactor 150 Protocol

52-execute-refactor-150

[52] EXECUTE. Three-stage refactoring workflow: (1) iterative research of refactor/modularization options, (2) plan + risk/edge-case analysis + Scope150 validation, then implement with tests after user confirmation, and (3) apply Scout105 cleanup protocol. Use when asked to refactor, modularize, ...

SKILL.md

Full skill instructions

Execute-Refactor 150 Protocol

Overview

Run in three stages:

  1. Research refactor options (iterative, no code changes).
  2. Plan + confirm + implement with tests and validation.
  3. Apply Scout105 cleanup (objective, small, user-approved).

Stage 1 — Research refactor options (iterative)

  1. Create or reuse the session log at .sessions/​SESSION_[date]-[name].md.

    • If the file does not exist, create it and add the investigation template below.
    • Keep all research notes inside the session log only (no scattered notes in chat).
  2. Define the core question (the refactor goal).

    • Write a single sentence: “We need to refactor X to achieve Y.”
    • Example: “Refactor SermonCard to reduce duplication and isolate date logic.”
  3. Define scope (Scope150).

    • Core (100%): list files and behaviors you will directly change.
    • Boundary (50%): list callers, dependent modules, tests, configs, and data flow.
    • If unsure, add a “to verify” bullet and resolve it during observations.
  4. Perform observations (search/​read) in ordered layers.

    • Interface layer: find entry points (routes, public APIs, UI entry points).
    • Domain layer: identify entities, i18n keys, enums, types.
    • Pattern layer: locate hooks, services, clients, shared utilities.
    • Usage layer: trace imports and call sites.
    • For each layer, read the minimum number of files that explain the behavior.
  5. Record findings in the log with sources.

    • Each fact must include a source (file path + line reference or command).
    • Separate facts from hypotheses. Do not mix them.
  6. Generate hypotheses and refactor options.

    • For each option, note: goal, steps, benefits, risks, and test impact.
    • Prefer at least 2 options so tradeoffs are explicit.
  7. Decide if more research is needed.

    • If user says “research more”, expand scope or inspect new files.
    • Update the log with new branches and continue Stage 1.
  8. Stop before implementation.

    • End Stage 1 with: options summary, remaining unknowns, and a recommended path.

Investigation log template

## Investigations

### Investigation: <short topic>

#### Core question
- ...

#### Scope
- Core (100%):
  - ...
- Boundary (50%):
  - ...

#### Findings
- <fact> (source: file path / command)
  - Subfinding

#### Hypotheses
- H1: ...
  - Prediction: ...
  - Test: ...
  - Status: pending/​confirmed/​rejected

#### Refactor options
- Option A: ... (pros/​cons)
- Option B: ... (pros/​cons)

#### Next branches
- ...

Stage 2 — Plan, confirm, implement

  1. Write a refactor plan.

    • Break into ordered steps with file-level granularity.
    • Include expected intermediate states (what should still pass after each step).
  2. List risks and edge cases.

    • Identify behavior changes, API contract risks, and hidden coupling.
    • Explicitly note any breaking-change risk.
  3. Define a validation checklist.

    • Tests to run (unit/​integration).
    • Manual checks if needed (UI flows, API calls).
    • Expected outputs and what would indicate failure.
  4. Perform Scope150 validation planning.

    • Core (100%): ensure each planned change has a test or validation step.
    • Boundary (50%): list all callers/​integrations/​tests to be checked.
  5. Ask for user confirmation before editing.

    • Provide plan, risks, and validation checklist.
    • Do not edit until the user approves.
  6. Implement the refactor.

    • Follow the plan in order.
    • Keep changes minimal and reversible.
  7. Add or update tests.

    • Cover changed logic and any new boundaries.
    • Avoid brittle tests; prefer behavior-based assertions.
  8. Run validation.

    • Execute all tests from the checklist.
    • Record results and fix failures before moving to Stage 3.

Stage 3 — Scout105 cleanup protocol

Apply only objective cleanup after a Key Point (phase complete). Do not add features.

Trigger (Key Point)

  • Apply only after a milestone where the user would see complete value.
  • Do not run per-file; run once per phase.

Allowed cleanup categories (objective only)

  • Unused code: unused imports/​vars/​fields (provable by grep/​IDE).
  • Typos: spelling errors in comments/​strings (spellcheckable).
  • Formatting inconsistencies: breaks the file’s own pattern.
  • Dead code: commented debug lines or unreachable code.
  • Obviously wrong logic: provably incorrect (duplicate checks, impossible types).

Constraints

  • Only in files already touched by the primary task.
  • Remove garbage only; no new features or refactors.
  • Each cleanup must take ≤ 30 seconds to verify + fix.
  • Total cleanup time ≤ 5% of primary task time.
  • Must be objectively measurable; if not measurable, skip.
  • Require user approval before executing cleanup.

Scout105 report (present to user)

✅ Key Point complete: <brief summary>

Scout105 opportunities:
- <file>: <item> (category, evidence)
- <file>: <item> (category, evidence)

Run Scout105 cleanup? [Yes / Skip / Selective]

Execution

  • If approved, apply all selected cleanups in batch.
  • Run tests/​build to validate no regression.
  • If failures occur, revert or investigate causality before proceeding.

Output expectations

  • Stage 1: Provide refactor options + log path + remaining branches + recommended path.
  • Stage 2: Provide plan, risks, validation checklist, and request confirmation.
  • Stage 3: Provide Scout105 report, decision, and validation result.

More skills from diegosouzapw

accessibility logo
diegosouzapw/awesome-omni-skill

accessibility

Accessibility guidelines for VS Code features — covers accessibility help dialogs, accessible views, verbosity settings, accessibility signals, ARIA alerts/status announcements, keyboard navigation, and ARIA labels/roles. Applies to both new interactive UI surfaces and updates to existing feature...

62 1
View
mermaid-diagrams logo
diegosouzapw/awesome-omni-skill

mermaid-diagrams

Mermaid diagram creation for flowcharts, sequences, ERDs, and more. Generate diagrams from text in markdown files. Use for documentation, architecture diagrams, and visual representations. Triggers on mermaid, flowchart, sequence diagram, ERD, entity relationship, gantt chart, pie chart, class di...

62 1
View
tauri2-react-rust logo
diegosouzapw/awesome-omni-skill

tauri2-react-rust

Guides development of cross-platform desktop apps with Tauri 2, TypeScript, React, and Rust. Use when building Tauri apps, implementing IPC, designing Rust backend or TypeScript/React frontend, when researching or cloning a website (open site, snapshot elements), when verifying local dev or built...

62 1
View
fp-ts-errors logo
diegosouzapw/awesome-omni-skill

fp-ts-errors

Handle errors as values using fp-ts Either and TaskEither for cleaner, more predictable TypeScript code. Use when implementing error handling patterns with fp-ts.

62 0
View
ring:pre-dev-research logo
diegosouzapw/awesome-omni-skill

ring:pre-dev-research

Gate 0 research phase for pre-dev workflow. Dispatches 3 parallel research agents to gather codebase patterns, external best practices, and framework documentation BEFORE creating PRD/TRD. Outputs research.md with file:line references.

62 0
View
create-assistant logo
diegosouzapw/awesome-omni-skill

create-assistant

Create and configure Vapi voice AI assistants with models, voices, transcribers, tools, hooks, and advanced settings. Use when building voice agents, phone bots, customer support assistants, or any conversational AI that handles phone or web calls.

62 0
View
codex-headless logo
diegosouzapw/awesome-omni-skill

codex-headless

Delegiere Aufgaben an OpenAI Codex CLI im Headless-Mode. Nutzt ChatGPT Subscription (KEIN API Key). Nur Workspace-Zugriff, KEIN System-Zugriff. Auto-Accept mit --full-auto. Web-Recherche mit --search.

62 0
View
social-media-scheduler logo
diegosouzapw/awesome-omni-skill

social-media-scheduler

Generate a full week of social media content for any topic. Outputs platform-optimized posts for Twitter/X, LinkedIn, and Instagram with hashtags and posting times.

62 0
View
Data Privacy Compliance logo
diegosouzapw/awesome-omni-skill

Data Privacy Compliance

Data privacy and regulatory compliance specialist for GDPR, CCPA, HIPAA, and international data protection laws. Use when implementing privacy controls, conducting data protection impact assessments, ensuring regulatory compliance, or managing data subject rights. Expert in consent management, da...

62 0
View
triple-review logo
diegosouzapw/awesome-omni-skill

triple-review

Reviews a task using the TRIPLE protocol, as the review agent.

62 0
View
Tech Stack & Architecture Decision logo
diegosouzapw/awesome-omni-skill

Tech Stack & Architecture Decision

Define and document the technology stack and architecture decisions for a project. Use when the user needs to choose a tech stack, make architecture decisions, define infrastructure choices, or document technology selections. Triggers on requests like "define the tech stack", "choose technologies...

62 0
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View