bsene/skills

mikado-method

Enforce and guide the Mikado Method for large, graph-driven refactors where a single naive change cascades into many failing call sites.

Ver código fuente
Documento original del Skill

Contenido del repositorio de origen con títulos, ejemplos, código, tablas, enlaces e imágenes preservados.

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)

mermaid
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

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.
del mismo repositorio

Más Skills

Todos los Skills
bsene
Comunidad

c4-diagram

Generates C4 model architecture diagrams using Structurizr DSL (primary) or Mermaid C4 (fallback). Use when: user asks to "draw a diagram", "create a C4 diagram", "show architecture as a diagram", "generate architecture diagram", "document the system". DO NOT USE for code explanation or walkthroughs (use explain-code), class/sequence/ER diagrams (C4 is system-architecture only), or when a diagram is incidental to a code change — only when a C4 diagram is the primary deliverable.

instalaciones
1
GitHub Stars
5
Actualizado
21 sept
bsene
Comunidad

clean-code

Use when writing new code, naming modules/files/functions/classes/variables, reviewing or refactoring code for readability, assessing/reducing complexity, deciding whether an abstraction belongs, or reviewing with CUPID. For behavior-preserving refactors within a function, class, or file, route to the refactoring/ sub-skill. Trigger on requests like "name this function", "is this a good variable name", "review this for clean code", "reduce complexity", "should I add a comment here", "should I abstract this", "review with CUPID", "code smell", "extract method", or "refactor this class". Covers human-scale design, naming, complexity budgets, comments, CUPID, and in-place refactoring. Pairs with language-specific skills (typescript, go, clojurescript) for syntax/idiom concerns.

instalaciones
1
GitHub Stars
5
Actualizado
21 sept
bsene
Comunidad

clojurescript

Write, review, debug, and configure ClojureScript code and projects. Use this whenever the user mentions ClojureScript, .cljs/.cljc files, shadow-cljs, figwheel, the CLJS compiler, JS interop from Clojure, Reagent/re-frame/Reagent-style UI code, or asks to convert JS/TS logic into ClojureScript. Also use it for questions about CLJS compiler options (:optimizations, :main, :npm-deps, :externs, etc.), consuming JS/npm libraries from CLJS, source maps, Google Closure Library usage, or the newer ^:async/await function support. Also trigger for CLJS recursion/stack-overflow/trampoline questions. Trigger even if the user just pastes CLJS code with an error and asks "what's wrong here" or asks to set up a new CLJS project. Do NOT use for nbb (babashka/nbb) scripts, nbb.edn projects, or anything meant to run via nbb script.cljs/npx nbb — those have a different (SCI-interpreted, no-Closure-Compiler) language surface; those are out of scope for this skill — consult nbb's own documentation.

instalaciones
1
GitHub Stars
5
Actualizado
21 sept
bsene
Comunidad

communication

Analyze a real communication artifact (Slack/Teams message, email, meeting transcript, pitch or presentation draft, CV, or resume) and coach it sharper using seven rhetoric + structure techniques: ethos/logos/pathos, reframing tough questions, centering the other person, the Pyramid Principle, pattern interrupt, making ideas feel safe, and the cognitive-load through-line. Diagnose what works, what's missing, then rewrite. TRIGGER when: user wants to improve communication, "review my email/Slack/CV", "analyze this transcript", prep for a meeting/pitch/presentation, "how do I say this", be more persuasive/assertive, handle a tough question, talk to execs, "is this too long-winded". Also trigger for author style presets under references/authors/: DHH (blunt/direct), Uncle Bob (defend a quality/testing standard), Jessitron (reflective systems-thinking essay), Martin Fowler (measured mixed-feelings stance). DO NOT USE for raw text generation with no analysis, marketing/copywriting, translation, or code/docs.

instalaciones
1
GitHub Stars
5
Actualizado
21 sept