Help us improve
Share bugs, ideas, or general feedback.
From grimoire
Recursively debounces complex single-domain problems by matching skills to sub-problems until each is covered by a best practice or resolved directly.
npx claudepluginhub jeffreytse/grimoire --plugin grimoireHow this skill is triggered — by the user, by Claude, or both
Slash command
/grimoire:apply-best-practice-treeThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Recursively apply the best-matching skill to a problem, match each resulting sub-problem to a best practice, and repeat until every sub-problem is covered or fully resolved.
Breaks down complex, multi-domain problems into sub-problems using MECE and Design Thinking, then sequences best-practice skills by dependency and executes them one at a time.
Enforces mandatory Skill tool invocation before any response or clarifying questions at conversation start to discover and apply relevant skills.
Enforces workflows for skill discovery and invocation before tasks: check all skills first, read relevant ones, brainstorm before coding, create todos for checklists.
Share bugs, ideas, or general feedback.
Recursively apply the best-matching skill to a problem, match each resulting sub-problem to a best practice, and repeat until every sub-problem is covered or fully resolved.
Adopted by: Divide-and-conquer is foundational in computer science (Knuth, 1968) and is the basis of virtually every structured problem-solving system — used by Google's SRE incident analysis, McKinsey's issue-tree methodology, and NASA's fault-tree analysis. Case-Based Reasoning (CBR), the formal basis for "use the most similar practice when no exact match exists," is deployed in IBM's Watson, medical diagnosis systems (Aamodt & Plaza, 1994), and legal precedent reasoning.
Impact: Aamodt & Plaza (1994) demonstrated that CBR reduces problem-solving time by 40–60% in domains with partial-match knowledge bases, by reusing prior solutions rather than solving from scratch. Divide-and-conquer reduces cognitive load by bounding each decision to a tractable sub-problem — the primary mechanism behind McKinsey's documented success with MECE issue trees (Rasiel, The McKinsey Way, 1999).
Why best: Flat skill matching — "find one skill for the whole problem" — fails on complex problems because no single skill covers all dimensions. MECE decomposition (the alternative in plan-best-practice-solution) requires full domain expertise upfront before any skill is applied, which is unavailable when the problem space is new. Recursive skill decomposition uses the skills themselves as the decomposition engine, allowing the knowledge base to guide the breakdown without requiring prior expertise. It also degrades gracefully: when no exact skill exists, it applies the closest match with an explicit adaptation note rather than halting.
Sources: Knuth, The Art of Computer Programming (1968); Aamodt & Plaza, "Case-Based Reasoning: Foundational Issues" (1994); Rasiel, The McKinsey Way (1999)
Before matching any skill, silently determine:
| Check | Action |
|---|---|
| Single skill matches clearly (confidence ≥ 0.7, no decomposition needed) | Defer to suggest-best-practice |
| Problem spans 3+ independent domains requiring cross-domain sequencing | Defer to plan-best-practice-solution (which may call back into this skill for complex sub-problems) |
| Complex, single-domain, needs recursive drill-down | Proceed with this skill |
Do not announce this check — just route correctly.
Score all installed skills:
score = (tag_overlap × 2) + (description_match × 3) + (domain_plausibility × 1)
Route by result:
| Result | Condition | Action |
|---|---|---|
| Sole clear match | 1 skill ≥ 0.7, second < 0.4 | Apply directly |
| Multiple candidates | 2+ skills ≥ 0.4 | Present ranked list with ★ recommendation, wait for user choice |
| Fuzzy match | 1 skill 0.4–0.69, no others ≥ 0.4 | Offer with adaptation note |
| No match | All < 0.4 | Decompose manually → step 4 |
When multiple candidates exist, present:
Multiple best practices match this problem:
★ [top-skill] — [one sentence: what it solves] ← recommended
[second-skill] — [one sentence: what it solves]
[third-skill] — [one sentence: what it solves]
Then collect the user's choice using the best available method for your platform:
AskUserQuestion / question — ★ recommended first with "(Recommended)" appended, multiSelect: falseask_user — type: "select", ★ recommended first1. [top-skill] ★ (recommended) — [what it solves]
2. [second-skill] — [what it solves]
Which would you like? (Enter number or name)
Load and run the matched skill. After it completes, identify the sub-problems it surfaces:
Announce each sub-problem explicitly:
Step 1 complete. Sub-problems identified:
A. [sub-problem description]
B. [sub-problem description]
Matching best practices for each...
For each sub-problem, apply the same matching logic:
Sole clear match (1 skill ≥ 0.7, second < 0.4) — apply directly:
Sub-problem A → [skill-name] (confidence 0.82). Applying now...
Multiple candidates (2+ skills ≥ 0.4) — present options with ★ recommendation, wait for choice:
Sub-problem B → multiple practices apply:
★ [top-skill] — [one sentence] ← recommended
[second-skill] — [one sentence]
Then collect the user's choice using the best available method for your platform:
AskUserQuestion / question — ★ recommended first with "(Recommended)" appended, multiSelect: falseask_user — type: "select", ★ recommended first1. [top-skill] ★ (recommended) — [what it solves]
2. [second-skill] — [what it solves]
Which would you like? (Enter number or name)
Fuzzy match (1 skill 0.4–0.69, no others ≥ 0.4) — apply with explicit adaptation note:
Sub-problem C → no exact match. Closest: [skill-name] (confidence 0.55).
Applying with adaptation: step 3 maps to [your context] instead of [skill's default context].
No match (< 0.4) — recurse: decompose the sub-problem into 2–4 smaller parts and repeat from step 2:
Sub-problem D → no close match (best: 0.28). Decomposing further:
D1. [smaller problem]
D2. [smaller problem]
Max depth reached (depth = 3) — flag for manual resolution:
⚠ [sub-problem]: recursion limit reached. Manual research needed — no installed skill covers this.
Never apply more than one skill without user confirmation:
Ready to apply [skill-name] for [sub-problem]. Continue?
Wait for confirmation. After completion, reassess:
State any changes before continuing:
[skill-name] revealed [new constraint]. Adding [sub-problem D] to the queue. Continue?
Stop when:
Summarize what was covered and what (if anything) requires manual follow-up:
Solved:
✅ [sub-problem A] → [skill-name]
✅ [sub-problem B] → [skill-name] (adapted)
✅ [sub-problem C1] → [skill-name]
✅ [sub-problem C2] → direct resolution
Needs manual research:
⚠ [sub-problem C3] — no installed skill covers this area
suggest-best-practice if one skill clearly covers the full problem (≥ 0.7, no decomposition needed)plan-best-practice-solution if the problem spans 3+ independent domainsplan-best-practice-solution for a deep sub-problem, treat the sub-problem as the top-level input — do not re-classify at the multi-domain levelSkipping the classifier (step 1): applying this skill to simple single-skill problems adds unnecessary overhead. Check first.
Silent adaptation: applying a fuzzy-matched skill without noting the adaptation misleads the user into thinking the skill is a perfect fit.
Infinite recursion: a problem that keeps decomposing without ever reaching a skill match is a signal that no relevant domain is installed — flag it at depth 3, don't recurse further.
Ignoring new sub-problems: skills often reveal constraints or next steps the user didn't mention. Reassess after every skill application.