Help us improve
Share bugs, ideas, or general feedback.
From grimoire
Proactively checks for applicable best practices before starting any user task, applying or offering them automatically. Inspired by poka-yoke error prevention.
npx claudepluginhub jeffreytse/grimoire --plugin grimoireHow this skill is triggered — by the user, by Claude, or both
Slash command
/grimoire:intercept-best-practiceThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Before any task begins, silently check whether an applicable best practice exists — apply it proactively if confident, offer it if plausible, proceed silently if no match.
Auto-classifies user input to relevant domains and applies or suggests best practices. Use when the user describes a situation, problem, or goal without specifying a domain.
Enforces workflows for skill discovery and invocation before tasks: check all skills first, read relevant ones, brainstorm before coding, create todos for checklists.
Discovers and invokes agent skills for engineering workflows. Helps identify and apply the right skill for the current development phase or task.
Share bugs, ideas, or general feedback.
Before any task begins, silently check whether an applicable best practice exists — apply it proactively if confident, offer it if plausible, proceed silently if no match.
Adopted by: Toyota's poka-yoke principle (Shingo, 1986) is the foundation of error prevention in manufacturing — checking conditions before an action begins, not after defects appear. This principle is applied across aviation (pre-flight checklists), surgery (WHO Surgical Safety Checklist), and software (pre-commit hooks, CI gates). Impact: The WHO Surgical Safety Checklist reduced surgical complications by 36% and deaths by 47% — not by changing technique, but by systematically intercepting the moment before each critical step (Haynes et al., 2009, NEJM). Pre-commit hooks catch an estimated 30–40% of common defects before they enter the codebase (GitHub internal data). Why best: Reactive systems wait for the user to ask. Proactive interception closes the "I didn't know a best practice existed" gap — the most common reason practices aren't applied. The cost is minimal (a silent confidence check); the benefit is consistent practice application without requiring the user to know what to ask.
Sources: Shingo (1986) "Zero Quality Control: Source Inspection and the Poka-Yoke System"; Haynes et al. (2009) NEJM; GitHub Engineering blog
Resolution order — first match wins:
<project-root>/.grimoire/preferences.md — project-level~/.config/grimoire/preferences.md OR ~/.grimoire/preferences.md — global-levelCLAUDE.md ## Grimoire Preferences section — legacy fallbackFor the relevant domain, check if a practice is already pinned:
"[practice] is pinned for this session only. Save it for future sessions? [y/n]"
If yes, invoke pin-best-practice-preference to write it to project or global file."You have [X] pinned for [domain]. Suggest changing it? [y/n]"From the user's request, identify:
| Signal | Extract |
|---|---|
| Task type | What operation? (create, review, fix, design, write, calculate, plan…) |
| Domain | Which field? (engineering, law, finance, health, cooking…) |
| Subject | What specifically? (unit test, contract, retirement plan, training program…) |
| Maturity | Starting fresh, or improving existing work? |
Do not ask the user anything — infer from the request.
Score installed grimoire skills using the same model as suggest-best-practice:
score = (tag_overlap × 2) + (description_match × 3) + (domain_plausibility × 1)
Cap at top 3 matches. Compute silently — do not announce scoring is happening.
| Condition | Action |
|---|---|
| 1 skill ≥ 0.7, second < 0.4 | Announce + apply, then complete original task |
| 2+ skills ≥ 0.4 (any scores) | Brief ranked offer with ★ recommendation, wait for choice |
| 1 skill 0.4–0.69, no others ≥ 0.4 | Brief offer: apply or skip |
| All skills < 0.4 | Proceed silently — no announcement, no interruption |
Sole clear match (1 skill ≥ 0.7, second < 0.4):
Best practice detected: [skill-name] ([domain/subdomain])
Applying before proceeding...
Multiple matches (2+ skills ≥ 0.4):
Multiple best practices apply to this task:
★ [top-skill] ([domain]) — recommended
[second-skill] ([domain])
[third-skill] ([domain])
Apply ★ [top-skill] first? [y / n / 2 / 3 — or just continue]
Keep this offer concise — this is an interception, not a discovery session. One line per option.
Single medium-confidence match (0.4–0.69):
A best practice exists for this: [skill-name] ([domain/subdomain]).
Apply it first? [y/n — or just continue and I'll proceed with your request]
Low confidence (< 0.4): No output. Proceed with original request.
After the matched skill applies (or if no match), always complete the user's original request. The skill output becomes context for fulfilling the request — never abandon the task.
If the skill redirects significantly, state:
Best practice applied. Proceeding with your original request using the above framework.
suggest-best-practicesuggest-best-practice | intercept-best-practice | |
|---|---|---|
| Trigger | User describes a problem | User starts any action |
| Low confidence | Asks clarifying question | Proceeds silently |
| After skill | Routes to skill | Applies skill, THEN completes original task |
| Browse mode | Supported | Not supported |
| Interrupts flow | Yes (it IS the flow) | Only at ≥ 0.4 confidence |
Blocking low-confidence tasks: if score < 0.4, say nothing and proceed. Interrupting the user for uncertain matches destroys trust.
Abandoning the original task: always complete what the user asked for after applying a skill.
Intercepting explicit skill invocations: if the user said /write-unit-test, they already know what they want. Don't re-intercept.
Announcing scoring: "Checking for best practices..." on every action is disruptive. Only speak when there is a match.