mcpField
M
mikado-method

mikado-method

github.com/bseneDevelopment7145 installsUpdated 1d ago
Repository

About mikado-method

mikado-method is a skill that guides developers through graph-driven, incremental refactoring while keeping the codebase stable. It organizes prerequisites and directs work from ready leaf steps toward a defined goal.

Key features

  1. 01Builds a prerequisite map
  2. 02Defines actionable refactoring goals
  3. 03Works from prerequisite leaves
  4. 04Reverts failed attempts to stable code
  5. 05Plans atomic implementation steps

Use cases

  1. 01Breaking a large refactor into steps
  2. 02Surfacing dependencies before changes
  3. 03Keeping the codebase stable during refactoring

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/bsene/skills --skill mikado-method

After installing, type/mikado-methodin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

references/
execution-and-situations.md
graph-building.md
organizational-change.md

Details

From the project README

Mikado Method Skill

A skill for guiding developers through the Mikado Method: a disciplined, graph-driven approach to safe, incremental refactoring that keeps the codebase in a working state at all times.


What is the Mikado Method?

Named after the Pickup Sticks game (Mikado), where you must remove the topmost sticks without disturbing the pile before reaching the high-value stick at the bottom. In software, your goal (the "Mikado") sits beneath a pile of dependencies. The method surfaces those dependencies visually so you can remove them one by one, safely.


Core Definitions

TermMeaning
GoalThe root node. Must define two things: a starting point (what's true now) and success criteria (what "done" looks like). A goal missing either is not actionable — decompose it until you find a prerequisite that has both. Circle it twice.
PrerequisiteA dependency that must be resolved before its parent node can be done.
Leaf nodeA node with no further prerequisites. Safe to implement immediately.
Mikado MapThe full tree of goal + prerequisites. Your "save game" for the refactoring.
RevertUndoing all changes to return to a stable state. The map survives; the broken code does not.

Quick Reference Card

MIKADO LOOP
───────────
① Write goal (root) → circle it twice
② Attempt naively in code
③ Every error = a prerequisite bubble
④ REVERT (always, immediately)
⑤ Pick a leaf → repeat from ②
⑥ Leaf passes cleanly → ask: does this still serve the goal?
   → no: discard, do NOT commit, pick the next leaf
   → yes: commit → prune
⑦ Repeat until goal is reached

RULES
─────
• Never build on broken code
• One atomic change per commit
• No behavior changes in refactoring commits
• Leaves only touch one concern
• The map is the work — protect it

Common Mistakes to Correct

MistakeCorrection
Fixing errors in place instead of reverting"Revert now. Add these errors as prerequisite nodes instead."
Building on top of broken code"This violates the core rule. Revert to green before continuing."
One giant commit with multiple changes"Split into one commit per leaf node."
Skipping the graph for "small" refactors"Start with even a 3-node graph. It prevents scope creep."
Using mocks to avoid test data setup pain"Use Test Data Builders as Mikado leaf nodes instead."
Long-lived refactoring branches"Work on main. Only commit leaves that don't break anything."
Committing a leaf just because it's green"Passing isn't enough — does it actually serve the goal? If not, discard it and move to the next prerequisite."

Output Format

When helping a user apply the Mikado Method, always produce:

1. The Mikado Map (Mermaid diagram)
graph TD
    G(["🎯 GOAL: <goal name>"]) --> P1["Prerequisite A"]
    G --> P2["Prerequisite B"]
    P1 --> L1["🟢 Leaf: step 1"]
    P1 --> L2["🟢 Leaf: step 2"]
    P2 --> L3["🟢 Leaf: step 3"]

Use 🟢 for current leaves, ⬜ for unreachable prerequisites, ✅ for completed nodes.

2. Ordered implementation plan

A numbered list of leaf-first steps, each with the atomic refactoring gesture, a one-line verification test, and the suggested commit message.

3. Revert reminder

After any naive attempt: "Revert now — git restore <touched files> — your map is saved, the broken code is not needed." (Scope the revert to the files you touched; git checkout . would discard all uncommitted work, not just the naive attempt.)


Read On Demand

Read WhenFile
Starting a graph, populating prerequisites, evaluating leaves, shared prerequisitesGraph Building
Execution order, committing strategy, legacy code, large refactors, hygiene rules, non-actionable goalsExecution & Situations
Applying Mikado to team, process, or organizational change (Agile/CI adoption, impediments)Organizational Change

Sources


Benchmark

Scenario: .benchmarks/scenarios/mikado-method-001-revert-discipline.md

ModelWithoutWithDelta
claude-opus-4-829%100%+71%
claude-sonnet-4-629%100%+71%
claude-haiku-4-514%57%+43%

PASS (run 2026-06-25). Large gains (opus/sonnet +71) — baselines don't apply always-revert + one-commit-per-leaf + the 3-part output unaided. haiku reaches only 57% with the skill (weaker map/revert adherence) — candidate for a haiku-targeted salience pass. Gate per .agents/skills/skill-optimizer/rules/release-gates.md.

Comments

Markdown supported