Skip to main content
skill CX Codex

051-design-two-steps-methods — Claude Code skill: refactor safely

The 051-design-two-steps-methods skill splits complex or risky code changes into two steps: first refactor to improve design while preserving behavior, then apply the intended behavior change.

Apache-2.0 170 installs ★ 465 updated 2026-10-21

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add jabrena/plinth --skill 051-design-two-steps-methods -a claude-code
Open on GitHub

What 051-design-two-steps-methods does

The skill follows Kent Beck's principle: make the change easy, then make the easy change. It guides you through defining the target behavior, identifying design obstacles, planning preparatory refactoring, validating that behavior stayed the same, and only then applying the behavior change itself.

The workflow enforces clear separation between preparation and behavior modification. Each step requires validation: existing tests and checks after refactoring to confirm behavior is preserved, focused tests after the behavior change to confirm it works. If an obstacle cannot be fully separated, the skill documents assumptions and risks.

Works across all platforms: Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode. Trigger it with requests like "make this change safer," "refactor before changing behavior," or "separate preparation from the actual change."

What it helps with

  • split a risky change into smaller, validated steps
  • prepare the design with refactoring before modifying logic
  • verify behavior stays unchanged after preparation
  • keep refactoring separate from behavior change and validate both
  • reduce bugs in complex code modifications

Example prompts for the agent

  • Split this change into two steps using Beck's method
  • Make this modification safer—refactor first, then change behavior
  • Prepare the design, then I'll apply the actual behavior change

How to install 051-design-two-steps-methods

1Skills CLI (Vercel)

npx skills add jabrena/plinth --skill 051-design-two-steps-methods -a claude-code

2Manually: put the files in place

~/.claude/skills/051-design-two-steps-methods/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/051-design-two-steps-methods/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about 051-design-two-steps-methods

How do I install 051-design-two-steps-methods in Claude Code?

Run npx skills add jabrena/plinth --skill 051-design-two-steps-methods -a claude-code, then open ~/.claude/skills/051-design-two-steps-methods/SKILL.md.

What does the 051-design-two-steps-methods skill do?

It breaks complex changes into two phases: behavior-preserving refactoring first, then the intended behavior change. Each step is validated to prevent unexpected bugs.

When should I use this skill?

Use it for risky or intricate Java changes where you want to separate design preparation from behavior modification. The skill enforces validation after each step to keep changes safe and reviewable.

Source text

SKILL.md · Apache-2.0
---
name: 051-design-two-steps-methods
description: Use when a complex or risky code change should be split into Kent Beck's two-step method by first making the change easy through behavior-preserving preparatory refactoring, then making the intended behavior change once the design supports it. This should trigger for requests such as Apply two-step change; Make this risky change safer; Refactor before changing behavior; Separate preparation from behavior change. Part of Plinth Toolkit
license: Apache-2.0
metadata:
  author: Juan Antonio Breña Moral
  version: 0.19.0
---
# Two-Step Change Method

Guide Java developers through complex or risky changes by keeping design preparation separate from behavior modification. **This is an interactive SKILL**.

**What is covered in this Skill?**

- Clarifying the intended behavior change before editing
- Identifying design obstacles that make the change difficult or risky
- Step 1: behavior-preserving preparatory refactoring that makes the change easy
- Validation that Step 1 preserves existing behavior
- Step 2: the smallest intended behavior change after the design supports it
- Verification that Step 2 delivers the intended behavior
- Handoff to focused Java, framework, persistence, messaging, API, or testing skills while preserving the two-step sequence

## Constraints

Separate behavior-preserving preparation from behavior-changing work, and validate after each step.

- **MUST**: State the intended behavior change before proposing preparatory refactoring
- **MUST**: Keep Step 1 behavior-preserving; do not mix broad refactoring with the intended behavior change
- **MUST**: Verify existing behavior after Step 1 using the project-appropriate tests, build, characterization tests, or manual checks
- **MUST**: Make Step 2 only after the design has been prepared and validated
- **MUST**: Verify the intended behavior after Step 2 with focused tests and relevant build checks
- **MUST**: Record assumptions and risks when preparation cannot be fully separated from behavior change

## When to use this skill

- Apply two-step change
- Make this risky change safer
- Refactor before changing behavior
- Separate preparation from behavior change
- Make the change easy, then make the easy change

## Workflow

1. **Define the intended change**

Read `references/051-design-two-steps-methods.md`, inspect the relevant code and tests, and state the exact behavior or capability that must change. Identify why the current design makes the change complex, risky, or hard to verify.

2. **Plan preparatory refactoring**

Choose the smallest behavior-preserving refactoring that reduces the obstacle: extract method or class, clarify names, isolate dependencies, add seams for testing, move responsibilities, improve types, or add characterization tests before touching behavior.

3. **Make the change easy**

Apply Step 1 as focused preparatory refactoring only. Keep commits, notes, or task boundaries clear enough that reviewers can see no intended behavior change is included.

4. **Validate preserved behavior**

Run the relevant existing tests, build checks, characterization tests, or manual verification. If behavior changes unexpectedly, fix or revert the preparation before proceeding.

5. **Make the easy behavior change**

Apply the smallest intended behavior change now that the design supports it. Use focused Java, framework, persistence, messaging, API, or testing skills when detailed implementation guidance is needed.

6. **Verify and report the outcome**

Verify the intended behavior with targeted tests and relevant project validation. Report what was preparation, what changed behavior, what was verified after each step, and any remaining risks.

## Reference

For detailed guidance, examples, and constraints, see [references/051-design-two-steps-methods.md](references/051-design-two-steps-methods.md).

© Juan Antonio Breña Moral · Apache-2.0 · jabrena/plinth

Similar skills

All skills for Code review and refactoring →
design-patterns decebals Practical design patterns reference for Java with production-ready code examples. Guides coding agents to implement Builder, Factory, or Strategy during refactoring. CX Codex +1 389installs unit-test-utility-methods giuseppe-trisciuoglio unit-test-utility-methods writes unit tests for utility classes and static methods, covering nulls, empty input, boundaries and floating-point precision. CX Codex +1 3,900installs java-refactoring-extract-method official github The java-refactoring-extract-method skill guides Extract Method refactoring for complex Java methods while preserving behaviour. Use it when a method needs smaller, focused units backed by tests. CX Codex +1 9,284installs java-refactoring-remove-parameter official github The java-refactoring-remove-parameter skill guides an agent through removing unused or derivable parameters from Java methods and updating their callers. Use it when the change must preserve behavior and be checked with tests. CX Codex +1 8,900installs clean-code decebals clean-code guides your coding assistant to write readable code using DRY, KISS, and YAGNI principles. Useful when dealing with bloated methods and vague naming. CX Codex +1 448installs java-architect VoltAgent java-architect — a subagent for tasks that require Java application architecture work: large codebase structure, JVM behavior, framework boundaries. Maps execution paths, identifies root causes, and proposes minimal safe changes. CX Codex ★ 6,505repo stars

From the same set123

The whole set →
055-design-parallel-change The 055-design-parallel-change skill guides you through designing safe database schema changes when old and new application versions must run simultaneously. It breaks complex migrations into three separately deployable phases. CX Codex +1 172installs 052-design-hamburger-method 052-design-hamburger-method splits oversized user stories and specs into thin vertical slices using the Hamburger Method. Delivers end-to-end observable value instead of isolated technical tasks. CX Codex +1 172installs 053-design-simple-rules 053-design-simple-rules is a Claude skill that checks Java design and refactoring decisions against Kent Beck's four rules, in order. CX Codex +1 172installs 057-design-feature-toggles 057-design-feature-toggles — an interactive skill for designing and reviewing feature toggles in Java services, including kill switches, staged rollouts, experiments, and cleanup. CX Codex +1 171installs 045-planning-azure-devops 045-planning-azure-devops manages Azure Boards work items via the Azure DevOps CLI. It verifies tool availability first and restricts query outputs strictly to IDs and counts. CX Codex +1 168installs 811-regulations-eu-market-abuse-regulation The 811-regulations-eu-market-abuse-regulation skill reviews Java systems for EU Market Abuse Regulation controls, reviewable evidence, alert decisions, and escalation paths. CX Codex +1 166installs 813-regulations-iso-42001 813-regulations-iso-42001 reviews Java systems that use GenAI against ISO/IEC 42001 concerns and turns findings into engineering controls, evidence, and owner handoffs. CX Codex +1 165installs 812-regulations-eu-product-liability-directive 812-regulations-eu-product-liability-directive turns EU Product Liability Directive 2024/2853 checks into engineering artefacts: scope inventory, hazardous-scenario tests, update history and user warnings for Java and AI products. CX Codex +1 165installs

Project sponsors

Companies that keep this analytics open