mcpbeat Sign in

Nw Mikado Method Agent Skill

Enhanced Mikado Method for complex architectural refactoring - systematic dependency discovery, tree-based planning, and bottom-up execution

1k tokens
context cost
the whole folder, loaded on every use
1
files
instructions only
0
copies elsewhere
how many repositories repackaged it
588
stars on the repo
on the repository, not the skill itself

Install

one command, takes just this skill from the repository
npx skills add https://github.com/nWave-ai/nWave --skill nw-mikado-method

The instruction itself

18 sections, as written by the author

Mikado Method

Use for complex refactoring where direct implementation causes cascading failures across multiple classes/modules.

When to Use

  • Refactoring goal affects multiple classes/modules | Direct implementation causes cascade of failures
  • Dependencies not immediately clear | High risk of breaking existing functionality

Core Process

Cycle: Set Goal > Experiment > Visualize prerequisites > Revert to working state.

Treat compilation/test failures as valuable information -- each failure reveals a prerequisite node in the dependency graph. Revert keeps codebase shippable at all times.

Discovery-Tracking Protocol

Commit immediately after each dependency discovery to preserve exploration history and enable interrupt/resume.

Commit Formats

  • Dependency: Discovery: [Class.Method(params)] requires [Prerequisite] in [File:Line]
  • False leaf: Discovery: False leaf - [Node] blocked by [Dependency]
  • Exploration complete: Discovery: No new dependencies found - exploration complete for [GoalArea]
  • Ready: Ready: True leaves identified - [Count] leaves ready for execution

Exhaustive Exploration Algorithm

Sequence: EXPERIMENT > LEARN > GRAPH > COMMIT GRAPH > REVERT

  • Experiment: Attempt naive implementation of stated goal
  • Learn: Capture ALL compilation and test failures immediately
  • Graph: Create concrete prerequisite nodes with exact specifications
  • Commit Graph: Commit discovery with mandatory format
  • Revert: Revert ALL code changes to maintain clean state

Termination Criteria

  • Every apparent leaf candidate systematically attempted | No new dependencies emerge from leaf attempts
  • Tree structure stable across multiple exploration cycles | True leaves confirmed with zero prerequisites

Concrete Node Specification

Nodes require method-level specificity:

  • Method signatures: ClassName.MethodName(parameter types) -> ReturnType
  • File locations: src/Services/UserService.cs, line 45
  • Access modifiers: public | private | internal | protected
  • Refactoring technique: Extract Method | Move Method | etc.
  • Atomic transformation: Rename | Extract | Inline | Move | Safe Delete
  • Code smell target: Long Method | Feature Envy | etc.

Tree File Management

File Structure

  • Directory: docs/mikado/ | Filename: <goal-name>.mikado.md
  • Format: - [ ] pending, - [x] completed | Indentation: 4 spaces per nesting level
  • Dependencies indented deeper than dependents

Tree Structure Rules

  • Root goal at 0 indentation
  • Direct dependencies at 4-space indentation
  • Sub-dependencies at 8-space, continuing per level
  • Child nodes must complete before parent nodes
  • Nodes at same indentation level are independent (parallelizable)

Two-Mode Operation

Exploration Mode

  • Attempt naive implementation of refactoring goal
  • Capture compilation/test failures with full details
  • Create concrete prerequisite nodes with method-level specificity
  • Add dependencies to tree file with proper indentation nesting
  • Commit tree discovery only (specific format)
  • Revert code changes completely except tree file
  • Repeat until no new dependencies discovered

Execution Mode

  • Identify deepest indentation level with incomplete nodes
  • Select only true leaves (most nested, zero prerequisites)
  • Execute one leaf at a time for safety
  • Complete all nodes at current level before moving up
  • Never attempt parent node until all children complete
  • Implement minimal possible change per leaf
  • Validate with full test execution
  • Commit implementation, update tree marking node complete
  • Proceed bottom-up to next true leaf

Tree Example

- [ ] Goal: Replace direct DB calls in OrderController with repository pattern
    - [ ] Update OrderController constructor to use IOrderRepository
        - [ ] Implement SqlOrderRepository : IOrderRepository
            - [ ] Create IOrderRepository interface
                - [ ] Define GetOrderById(int orderId) -> Order? method signature
                - [ ] Define SaveOrder(Order order) -> Task method signature
            - [ ] Add constructor SqlOrderRepository(IDbContext context)
                - [ ] Verify IDbContext is registered in DI container
        - [ ] Implement GetOrderById method
            - [ ] Handle null order case with OrderNotFoundException
                - [x] Create OrderNotFoundException class
    - [ ] Register IOrderRepository in DI container
    - [ ] Remove IDbContext _context field from OrderController

Execution order: deepest leaves first, working up level by level.

Timeboxed Experimentation

10-minute timebox per attempt. If change can't be made in 10 min, it's too complex -- break down further.

  • Success: commit, check off node, move to next
  • Fail: revert, identify missing prerequisites, write subgoals

Goal Definition

Convert technical goals to stakeholder-understandable business value:

  • Correct: "Customer address is retrieved using the latest version of the third-party API for improved reliability"
  • Incorrect: "Update third-party API to version X"

Integration with TDD

  • All Mikado execution steps maintain passing tests (green bar)
  • Each leaf execution = one atomic commit with tests passing
  • If any step breaks tests, revert immediately and reassess dependencies
  • Baby steps rhythm: test-commit-integrate every small change

Other skills for the same job

different authors, same section of the catalogue
Git Commit
by github
vendor ×3

Execute git commit with conventional commit message analysis, intelligent staging, and message generation. Use when user asks to commit changes, create a git commit, or mentions "/commit". Supports: (1) Auto-detecting type and scope from changes, (2) Generating conventional commit messages from diff, (3) Interactive commit with optional type/scope/description overrides, (4) Intelligent file staging for logical grouping

799 tokens
Github Code Review
by ComeOnOliver
×3

Comprehensive GitHub code review with AI-powered swarm coordination

13k tokens
Commit Work
by softaworks
×2

Create high-quality git commits: review/stage intended changes, split into logical commits, and write clear commit messages (including Conventional Commits). Use when the user asks to commit, craft a commit message, stage changes, or split work into multiple commits.

2k tokens
Verification & Quality Assurance
by Microck
×2

Comprehensive truth scoring, code quality verification, and automatic rollback system with 0.95 accuracy threshold for ensuring high-quality agent outputs and codebase reliability.

4k tokens
Gh CLI
by christophacham
×2

GitHub CLI (gh) comprehensive reference for repositories, issues, pull requests, Actions, projects, releases, gists, codespaces, organizations, extensions, and all GitHub operations from the command line.

10k tokens
Github
by Dicklesworthstone
×2

GitHub CLI - manage repositories, issues, pull requests, actions, releases, and more from the command line.

1k tokens
Codebase Cleanup Refactor Clean
by ComeOnOliver
×2

You are a code refactoring expert specializing in clean code principles, SOLID design patterns, and modern software engineering best practices. Analyze and refactor the provided code to improve its quality, maintainability, and performance.

9k tokens
Codebase Cleanup Tech Debt
by ComeOnOliver
×2

You are a technical debt expert specializing in identifying, quantifying, and prioritizing technical debt in software projects. Analyze the codebase to uncover debt, assess its impact, and create acti

6k tokens

How to use it

Copy the folder

Take nwave-ai/nw-mikado-method from the repository into ~/.claude/skills for personal use, or into .claude/skills inside a project.

Check the name does not clash

The agent identifies a skill by the name field in its header. Two skills with the same name cannot sit side by side — one of them will be ignored.