/everything-backend:backend-refactorfrom everything-backend
Performs behavior-preserving refactoring of backend code (Node.js/TypeScript, Python, Go, Java): splitting controllers/services, extracting modules, reducing coupling, dependency inversion, renames/moves, strangler-fig replacement, and legacy modernization.
Ships in everything-backend. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Restructure existing backend code without changing what it does. Every increment is checked against a locked test baseline, and every change can be undone from the run's own patches.
| Request | Route to |
|---|---|
| Fix a bug, a failing test, a 500, wrong output, or any intended behavior change | backend-debug |
| Add a feature, endpoint, field, or capability | backend-implement |
| Change the database schema or data | backend-migrate |
| Build a test suite from scratch | backend-test |
| Redesign the architecture or plan greenfield work | backend-architect |
"Migrate" here means code or framework migration (e.g. strangler fig, an old API to a new one). Database migrations belong to backend-migrate.
Refactors never share a change set with a fix or a feature. If the request mixes them, do the refactor first (or ask which comes first) and hand the rest off.
HARD RULE: a refactor MUST NOT change observable behavior. Request and response shapes, status codes, error types, side effects and their order, transaction scope, event payloads, CLI output, and log or metric names that alerts depend on stay identical. If you cannot show that behavior is preserved, stop and ask.
HARD RULE (query safety): a refactor MUST NOT change how a query is parameterized or drop an owner predicate. Bound values stay bound, allowlisted identifiers stay allowlisted, and every tenant_id/user_id predicate bound from the authenticated principal survives the move (<shared>/sql-safety.md -> The Rules, 1-3). Moving a query into a repository, a helper or a new ORM API is where these get lost.
<shared>"): first _shared/ inside this skill's folder (bundled installs), then ../_shared/ next to it; other fallbacks are in <shared>/context-loading.md -> Resolving _shared/ Files. A missing shared doc is a warning, not a stop.<shared>/tool-rules.md (mode=auto contract, Production Targets, Test Integrity, checkpoints) and <shared>/host-tools.md if the actions below don't match your host's tool names. Read <shared>/principles.md for the target structure, and <shared>/memory-schema.md before updating memory.<shared>/context-loading.md: always project-overview.md and tech-stack.md; api-patterns.md for controllers and routes; db-schema.md for data access; decisions.md when the refactor applies an architectural pattern; test-strategy.md for runner conventions. If project-overview.md or tech-stack.md is missing, run backend-scan with mode=auto first, or note the gap and discover the layout by finding files and searching file contents.<shared>/stacks/, read it.<shared>/sql-safety.md in full. If it touches handlers, validation, auth checks, process calls, file paths, outbound HTTP, parsers, crypto or logging, read <shared>/secure-coding.md -> The Rules: a refactor must not remove or weaken any control it lists (validation schema, DTO allowlist, role or owner check, path containment, SSRF check, signature check, size limit).Paths are relative to this skill's folder.
references/patterns.md: read in Step 4 to pick and apply a pattern (split, extract, reduce coupling, dependency inversion, modernize, rename/move), and for grouping heuristics when proposing module boundaries.references/strangler-fig.md: read when replacing a module or service side by side, or when a strangler migration spans several sessions.references/baseline-and-verification.md: read in Steps 1, 2 and 7 for test-file detection, per-runner baseline commands (bash and PowerShell), normalization, characterization tests, and the implicit-contract checklist.references/increments-and-rollback.md: read in Step 5 before the first increment, when an increment fails, when resuming, and when rolling back.references/memory-updates.md: read in Step 8 for the summary template and memory entries.All three are REQUIRED. If one fails, stop and report; do not refactor.
pyproject.toml or go.mod; patterns per stack in references/baseline-and-verification.md), and the baseline run must execute more than zero tests. If there is none, hand off to backend-test to build a characterization suite first.git status --porcelain -- . ":(exclude).opencode/everything-backend-memory". The skills' memory folder is excluded on purpose; if it appears as untracked elsewhere, suggest adding .opencode/everything-backend-memory/ to .gitignore (ask first).
pre_existing_changes[] as off-limits (never edited, never touched by rollback). If an off-limits file is inside the refactor scope, the user must commit or stash it first.tool-rules.md -> Always Ask First).tool-rules.md -> Command Time Budgets and after the Target Check (Production Targets). A run that does not complete is "not verified", never green. If tests fail, stop and report: failing tests go to backend-debug, not into a refactor.Follow tool-rules.md -> mode=auto Contract; it wins over anything here. This skill may run the baseline and verification suites when every target is provably local, write characterization tests, and edit source files in scope.
Pause and ask when:
Pick a feature slug (e.g. split-order-service). Start a checkpoint before the first edit:
node <shared>/scripts/checkpoint.js start --skill backend-refactor --feature <slug> --steps "baseline,behavior-lock,discovery,plan,refactor,verify,report"
references/increments-and-rollback.md -> Resume) or restart with --restart.git rev-parse HEAD as start-sha.txt in the run folder .opencode/everything-backend-memory/.checkpoints/<id>/ (called <run-dir>).checkpoint.js record), mark each workflow step finished (checkpoint.js record --done <step>), snapshot after each green increment, and close the checkpoint when done. If Node is unavailable, follow <shared>/tool-rules.md -> Concurrent & Partial Work by hand (see references/increments-and-rollback.md -> Manual Fallback).Done when: the checkpoint is open and the run-start SHA is recorded.
tee), and record the runner's exit code. Commands per runner and shell: references/baseline-and-verification.md.<run-dir>/baseline-results.json: sorted {id, status} entries, no timings or logs.Done when: baseline-results.json exists, every baseline test in scope passes, and more than zero tests ran.
Write down what must not change for this scope: public signatures, HTTP contracts, error types, return shapes, side-effect order, event emissions, and the implicit contracts that apply (transaction scope, framework proxies such as @Transactional self-invocation, DI wiring, query count on hot paths, log and metric names, and query safety for data-access code: placeholders, identifier allowlists, owner predicates). Checklist: references/baseline-and-verification.md -> Implicit-Contract Checklist. Planning only, no code changes.
Done when: the contract list is written into the plan.
Map the blast radius before moving anything:
require() paths, route tables.Done when: every caller of the code in scope is listed.
Choose the pattern from references/patterns.md. For in-process moves across many files, use an alias or facade; use a strangler fig (references/strangler-fig.md) only to replace a module or service side by side.
Write the plan: the target structure, the increments in order, the files each touches, and any file deletions. If the plan creates new modules or services or changes module boundaries, present the proposed decomposition (groups, what moves where, and why, using the grouping heuristics) and wait for approval, in mode=auto too.
Done when: the plan is written, and approved if it changes module boundaries.
Read references/increments-and-rollback.md before the first increment. For each increment:
<run-dir>/in-progress.json, then make one structural change (extract one method, move one class, rename one symbol) and update its callers from Step 3.checkpoint.js record), run checkpoint.js snapshot, and save <run-dir>/step-<N>.patch.git checkout -- <file>, git reset --hard, or git clean.Rules:
javax to jakarta) that cannot be split may be one increment if it is green afterwards.HEAD moves, follow Committed Increments in the reference.mode=auto too.<module>". This is not a Test Integrity exception: a test that fails while its code still exists is never removed or loosened.backend-test.issues.md for backend-debug (Step 8) and keep the characterization test asserting the current behavior.file:line and severity (<shared>/sql-safety.md -> Verification, step 5: Critical if reachable from a public or low-privilege endpoint), log it in issues.md, and hand it to backend-debug. A Critical finding is raised at once, not only in the Step 8 summary.Done when: the plan's increments are all applied and the last one is green.
Follow references/strangler-fig.md: the seam defaults to the old path, parity is checked against both implementations, flipping the flag in any shared or deployed environment is the user's call, and the migration is tracked in decisions.md and issues.md across sessions.
Done when: the step's planned callers route through the new code and the default path is still green.
baseline-results.json: every baseline passed test still passes; moved or renamed tests are mapped old id to new id; retired tests are listed; new tests pass; timings and order are ignored. Anything else missing or failing is a regression.any types, suppressed errors, disabled lint rules, or lint violations.<shared>/sql-safety.md -> Verification steps 1-2 on the changed files: the static search over every changed file, and a full read of every changed repository/DAO file. Compare each moved query with its original: same placeholders, same allowlist, same owner predicate. A query this run made string-built or less scoped is a regression (Step 9); one that was already unsafe goes to backend-debug per the Unsafe queries rule in Step 5.node <shared>/scripts/security-scan.js --changed (or with the changed files). Compare with the same scan on the baseline: a finding the refactor introduced is a regression (Step 9); one that already existed is reported, not silently fixed.Done when: all checks pass, or a failing check sends you to Step 9. A check that did not run is reported as "not run", never as passed.
Use references/memory-updates.md:
file:line and severity (or "none found", or "not run" if Step 7 check 7 did not run), checks not run, and follow-ups.project-overview.md (Structure, Module Boundaries) when the layout or boundaries changed.decisions.md when an architectural pattern was applied or a strangler migration started.issues.md. Creating an issue in an external tracker needs approval.checkpoint.js record --memory), then checkpoint.js close --skill backend-refactor --feature <slug> --status completed.Done when: the summary is reported, memory reflects the new structure, and the checkpoint is closed.
If verification fails and the fix is not obvious, or the user asks to undo:
checkpoint.js rollback --dry-run, then checkpoint.js rollback. Full procedure: references/increments-and-rollback.md -> Rollback of the Whole Run.pre_existing_changes[] are never touched. Created files are deleted (--delete-created) only after the user confirms.HEAD moved because of user commits, committed increments are undone only by a git revert the user approves.Never leave the code in a state that is not green against the baseline. That is what "partially refactored" means here; a strangler migration paused between green steps is fine.
Done when: the code matches the last green state or the run-start state, and the checkpoint is closed as abandoned if the run stops.
backend-test.backend-debug.references/patterns.md).backend-migrate; dependency changes are Always Ask First.references/baseline-and-verification.md. Never write patches or reports with a PowerShell > redirect.backend-orchestrator: routes refactor requests here.backend-scan: fills the memory files used as context.backend-test: builds the safety net when none exists; replaces characterization tests after verification.backend-debug: bugs and behavior changes found or requested during a refactor, including unsafe queries found in scope.backend-security: a wider injection or BOLA audit when a refactor turns up more than one unsafe query.backend-implement: new features (out of scope here).backend-architect: redesigns beyond behavior-preserving refactoring.backend-doctor: health check after a refactor.backend-visualize: diagrams of the new structure, after memory is updated.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
TypeScript, JavaScript, Python, Go, Java
npx claudepluginhub codeworksid/everything-backend --plugin everything-backend16 skills in this plugin
/backend-api-designDesigns API contracts before code is written: resources, endpoints, request and response schemas, error format, pagination, versioning and per-endpoint authorization rules. Writes the contract to an OpenAPI spec (docs/api/openapi.yaml by default, or the existing spec) and records conventions in api-patterns.md memory. REST is fully covered; GraphQL schemas and gRPC .proto contracts get basic guidance. Use when the user says 'design the API', 'what endpoints do I need', 'plan routes', 'write an OpenAPI spec', 'Swagger', 'define the API contract', 'design a GraphQL schema', 'write a proto file', 'add an endpoint to the spec', or 'version or deprecate an endpoint'. Not for writing handler code (backend-implement), choosing the login mechanism or auth endpoints (backend-auth), or reviewing API security (backend-security)./backend-architectDesigns backend architecture for new and existing systems, including architecture pattern (monolith, modular monolith, microservices, serverless), tech stack, module boundaries, consistency rules and non-functional targets, then records the result as docs/architecture/overview.md, numbered ADR files in docs/adr/ and project memory. Use when the user says "design the architecture", "plan the backend", "how should I structure this", "what tech stack should I use", "should we split into microservices", "write an ADR", "redesign this system", or is starting a new project or a major feature. Hands diagrams to backend-visualize and detailed schema and API work to backend-db-design and backend-api-design.Other plugins' skills for the same job