Skip to content
Back to skills

Workflow Refactor

ASecurity

Workflow for behavior-preserving restructuring, from local cleanup through complex refactors.

  • 7 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 23, 2026
ai-agentsrefactoringcode-reviewapisecuritydocumentation

Works with

  • api

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned November 23, 2026

npx -y skills add aloilor/lean-coding-agent --skill workflow-refactor --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Workflow Refactor?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Workflow Refactor
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/aloilor-workflow-refactor/badge)](https://www.skillsdirectory.com/skills/aloilor-workflow-refactor)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: workflow-refactor
description: Workflow for behavior-preserving restructuring, from local cleanup through complex refactors.
disable-model-invocation: true
---

# Code Refactoring Workflow

Use this workflow for clear, small, localized refactors and complex behavior-preserving restructuring. The approved plan records the behavior and contracts to preserve, scope, risks, documentation impact, and verification needed for the work. Every run produces the standard durable plan, implementation report, and review pass artifacts.

The main agent orchestrates this workflow and owns user communication and closeout. Follow the shared scaffolding in `AGENTS.md` — **Workflow Delegation**, **Standard Artifacts**, and **Shared Stop Conditions**.

## Steps

1. **Plan and approve.** Spawn `planner` with the request and this workflow's planning requirements. The plan records current behavior and contracts to preserve, boundaries, baseline and post-refactor verification, behavior-drift and rollback risks, and documentation impact. The main agent obtains explicit user approval before implementation. If the work reveals behavior change, stop and request user direction; do not switch workflows automatically.
2. **Establish the baseline and refactor in green steps.** After plan approval, spawn `implementer` with the approved plan. Apply `$refactor` and the test-strategy guidance from `$tdd`. Run focused tests before restructuring; add characterization tests when behavior to preserve is uncovered. Make one small behavior-preserving change at a time and rerun focused tests after each meaningful step. The implementer records its TDD, baseline, documentation, and verification evidence in `.agents/implementation-reports/implementation_YYYYMMDD_<name>.md`.
3. **Review independently.** Spawn `code-reviewer` with the approved plan, implementation report, touched files, tests, and verification evidence. The reviewer checks behavior drift, scope creep, missed tests, unnecessary abstraction, code smells, and documentation staleness. Missing or stale required documentation is a `BLOCK`. Each review pass is recorded under `.agents/code-reviews/review_YYYYMMDD_<name>_pass_N.md`.
4. **Resolve and verify.** On `BLOCK`, send only the concrete findings back to `implementer`, preserve the approved plan, rerun focused checks, and repeat review until `APPROVE` or a Shared Stop Condition triggers. Treat `WARNING` as actionable when tied to the plan, behavior drift, or a meaningful test gap. Run broader final verification whenever shared behavior, API contracts, persistence, auth, security, or user-facing workflows are touched.

In the final response, identify the artifact paths, independent reviewer verdict, and main-agent closeout review. Report the preserved behavior, structural improvement, exact verification results, residual risks, and omissions.

Files in this skill

  • SKILL.md2.8 KB
  • agents/openai.yaml471 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.