Catalog
affaan-m/orch-refine-code

affaan-m

orch-refine-code

Orchestrate a behavior-preserving refactor — confirm tests are green, restructure without changing behavior, keep tests green, review, and gated commit. Use when the structure should improve but behavior must not change.

NewUpdated Jul 14, 2026

orch-refine-code

Actor · action · target: orch · refine · code. Thin wrapper over the shared engine in orch-pipeline.

When to Use

  • Same behavior, better structure: extract modules, remove duplication, kill dead code, reduce nesting, rename for clarity.
  • Distinguish from siblings: if behavior is meant to change at all, this is the wrong skill (orch-change-feature / orch-fix-defect).

Operation settings

  • Default size floor: standard — restructures touch multiple files.
  • Phase mask: 0 → 2 (plan the restructure) → 4 (keep green) → 5 → 6. No new behavior tests are written — the existing suite is the safety net.
  • First move (phase 4): confirm the relevant tests exist and are green before touching code; if coverage is thin, add characterization tests first. Then restructure in small steps, re-running tests after each.

How It Works

  1. Run the orch-pipeline engine with the settings above.
  2. For dead-code / duplication sweeps, delegate to the refactor-cleaner agent (it runs knip / depcheck / ts-prune and removes safely).
  3. Stop at Gate 1 (restructure plan) and Gate 2 (pre-commit).
  4. Commit as refactor: — the diff must be behavior-neutral.

Example

orch-refine-code: extract the NWS HTTP client out of poller.py
→ confirm tests green → plan extraction  [GATE 1: approve]
→ move in small steps, tests green throughout → code-review
→ commit refactor:  [GATE 2: confirm]
Files1
1 files · 1.0 KB

Select a file to preview

Overall Score

82/100

Grade

B

Good

Grades are signals, not a certification. Always review a skill yourself before use.

Safety

85

Quality

80

Clarity

85

Completeness

75

Summary

An orchestration skill that guides agents through behavior-preserving code refactoring—extract modules, remove duplication, reduce nesting, and rename for clarity—while keeping test suites green throughout. It delegates to a shared pipeline engine and optional dead-code cleanup tools, with gated approval at plan and pre-commit stages to ensure safety.

Detected Capabilities

orchestrate code modificationrun test suitesgit operations (commit)delegate to analysis tools (knip, depcheck, ts-prune)structured gating workflow

Trigger Keywords

Phrases that agents use to match this skill to user intent.

extract modulesremove dead codereduce duplicationrefactor structureclean up nestingimprove code organization

Use Cases

  • Extract tightly coupled modules into separate files without changing behavior
  • Remove dead code or duplication detected by linting tools (knip, depcheck, ts-prune)
  • Refactor deeply nested control flow for readability while preserving test coverage
  • Rename variables, functions, and modules for clarity and consistency
  • Reduce cyclomatic complexity through structural improvements without behavioral changes

Quality Notes

  • Skill clearly distinguishes itself from behavioral-change skills (orch-change-feature, orch-fix-defect), reducing misuse
  • Phase mask (0→2→4→5→6) is specific and prevents skipping critical test validation steps
  • First move requires pre-existing test greenness; characterization tests can be added for thin coverage—excellent safety pattern
  • Gating at plan and pre-commit ensures human review at critical junctures
  • Skill delegates to orch-pipeline engine and refactor-cleaner agent—assumes those are available but does not reproduce their logic
  • Example is concrete and shows gate interaction clearly
  • Scope is tightly constrained: no behavior changes allowed, only structure
  • Risk of skill misuse is mitigated by explicit distinction from siblings and behavior-change constraint
Model: claude-haiku-4-5-20251001Analyzed: Jul 14, 2026

Reviews

Add this skill to your library to leave a review.

No reviews yet

Be the first to share your experience.

Version History

  1. v1.1

    Content updated

    ✦ AINo behavioral changes detected.

    2026-07-14

    LATEST
  2. v1.0

    2026-06-07

    View This VersionInitial version

Use affaan-m/orch-refine-code in your dev environment

Command Palette

Search for a command to run...

affaan-m/orch-refine-code | SkillRepo