Use when breaking up a god class, extracting responsibilities from an oversized module, incrementally replacing legacy code, or when old and new must coexist during a refactor — symptoms include classes over 500 lines, modules with mixed concerns, or "we can't rewrite this all at once"
From harnessnpx claudepluginhub donovan-yohan/belayer --plugin harnessThis skill uses the workspace's default tool permissions.
references/gate-patterns.mdreferences/steps-by-context.mdFetches up-to-date documentation from Context7 for libraries and frameworks like React, Next.js, Prisma. Use for setup questions, API references, and code examples.
Retrieves current documentation, API references, and code examples for libraries, frameworks, SDKs, CLIs, and services via Context7 CLI. Ideal for API syntax, configs, migrations, and setup queries.
Uses ctx7 CLI to fetch current library docs, manage AI coding skills (install/search/generate), and configure Context7 MCP for AI editors.
Decompose an incremental refactoring into production-safe goals using the Strangler Fig pattern — build new alongside old, redirect traffic, then remove legacy. Informed by Martin Fowler's StranglerFigApplication and Shopify's incremental migration approach.
Execute three phases interactively with the user:
Use strangler fig thinking and the dependency analysis from Phase 2 to identify natural goal boundaries. Each goal must be safe to merge to production independently.
Grouping heuristic: combine steps that cannot be independently verified or deployed into a single goal. A goal is the smallest unit of work that is safe to ship alone.
Production-safety criteria — a goal is production-safe if it meets at least one:
For each goal, provide:
Output format:
Goals table:
| # | Goal | Description | Depends On | Production Safety |
|---|---|---|---|---|
| 1 | kebab-goal-name | What this goal accomplishes | — | Additive-only / Feature flag / etc. |
| 2 | kebab-goal-name | What this goal accomplishes | Goal 1 | Unconsumed scaffolding |
| … | … | … | … | … |
Execution Order: Describe which goals are sequential and which can be parallelized. Goals with no shared dependency can be worked in parallel by separate engineers or teams.
Merge Criteria: For each goal, document what reviewers should verify before merging. This is advisory guidance for human reviewers — not an automated gate.
The 7 strangler fig steps are a reference framework for analysis during Phases 2-3. They help identify what work needs to happen but do not dictate goal boundaries. The agent groups these into production-safe goals based on the project's actual needs.
| Step | What | Applies When |
|---|---|---|
| 1. Define new interface | Create the new module/class/component with extracted responsibilities | Always |
| 2. Redirect consumers | Update callers/importers to use the new interface | Always |
| 3. Establish new data source | Create new storage (DB table, state store, context, cache) | Persistent state involved |
| 4. Dual writes | Write to both old and new sources simultaneously for consistency | Persistent state involved |
| 5. Backfill | Migrate existing data from old source to new | Historical data exists |
| 6. Switch reads | Move read operations from old source to new | Persistent state involved |
| 7. Remove legacy | Delete old code, old storage, old dependencies | Always |
For detailed examples per refactor type, read the reference file at:
plugins/harness/skills/strangler-fig/references/steps-by-context.md
For common merge criteria patterns and observation strategies, read:
plugins/harness/skills/strangler-fig/references/gate-patterns.md
Produce a goal dependency graph and per-goal summaries as structured content. Do NOT save files — the invoking command (/harness:refactor) handles document creation.
| Mistake | Why It's Dangerous | Fix |
|---|---|---|
| Scoping a goal that isn't production-safe to merge independently | If the PR breaks prod when merged alone, it's not a valid goal boundary | Restructure: add a feature flag, split further, or make the change additive-only |
| Making goals too granular (15 PRs for a simple extraction) | Review fatigue, coordination overhead, unclear progress | Combine steps that can't be independently verified into a single goal |
| Making goals too coarse (one mega-PR) | Defeats the purpose of incremental safety; hard to review and impossible to roll back cleanly | Split at seams where production safety is naturally maintained |
| Not documenting rollback for each goal | You won't remember how to undo under incident pressure | Every goal needs a rollback note written before implementation |
| Not identifying which goals can parallelize | Missed opportunity to reduce calendar time | Explicitly map which goals have no shared dependency and can run in parallel |
All of these mean: revisit goal boundaries, restore production safety, then proceed.