28 eval-informed mental models and critical-thinking skills for Claude Code, GitHub Copilot, Codex, Cursor, and other Agent Skills-compatible tools
JavaScript agent-skillsai-toolsanthropicclaudeclaude-codecritical-thinkingdecision-makingfirst-principlesmental-modelsproblem-solvingsystems-thinking
Merge remote-tracking branch 'origin/main' into pr-2
Travis Boudreaux11513e171058
diff --cc evals/tests/registry-validation.test.jsindex 0000000,232b8fc..873d934mode 000000,100644..100644--- a/evals/tests/registry-validation.test.js+++ b/evals/tests/registry-validation.test.js@@@ -1,0 -1,348 +1,392 @@@+ 'use strict';++ const test = require('node:test');+ const assert = require('node:assert/strict');+ const fs = require('fs');+ const path = require('path');+ const os = require('os');++ const {+ validateSkillContent,+ validateAllSkills,+ DEFAULT_REQUIRED_SECTIONS,++ parseFrontmatter,++ listSkillDirs,+ } = require('../../scripts/validate-skills');+ const {+ validateDatasetSplits,+ validateAuthoredFile,+ promptHash,+ resolveExternalReportPath,+ REPO_ROOT,+ } = require('../validate-dataset-splits');++ const LEAN_BODY = `---+ name: thinking-example+ description: Short situation-named description under two hundred characters.+ disable-model-invocation: true+ ---++ ## When to Use+ Use when X is observed.++ ## When NOT to Use+ Do not use for routine Y.++ ## Procedure+ 1. Observe evidence.+ 2. Decide.+ 3. Stop.++ ## Output+ Return a decision artifact.++ ## Verification+ Stop if evidence is missing.+ `;++ test('required sections are When to Use / NOT / Procedure / Output / Verification', () => {+ assert.deepEqual(DEFAULT_REQUIRED_SECTIONS, [+ 'When to Use',+ 'When NOT to Use',+ 'Procedure',+ 'Output',+ 'Verification',+ ]);+ const ok = validateSkillContent(LEAN_BODY, {+ name: 'thinking-example',+ maxWords: 100,+ enforceBudget: true,+ });+ assert.equal(ok.pass, true, JSON.stringify(ok.failed));+ });++ test('manual quarantine and procedure depth are enforced', () => {+ const missingQuarantine = LEAN_BODY.replace('disable-model-invocation: true\n', '');+ const quarantineResult = validateSkillContent(missingQuarantine, {+ name: 'thinking-example',+ maxWords: 100,+ enforceBudget: true,+ requireDisableModelInvocation: true,+ });+ assert.equal(quarantineResult.pass, false);+ assert.ok(quarantineResult.failed.some(check => check.name === 'Manual-only Quarantine'));++ const shallowProcedure = LEAN_BODY.replace('2. Decide.\n3. Stop.', '2. Decide.');+ const procedureResult = validateSkillContent(shallowProcedure, {+ name: 'thinking-example',+ maxWords: 100,+ enforceBudget: true,+ });+ assert.equal(procedureResult.pass, false);+ assert.ok(procedureResult.failed.some(check => check.name === 'Procedure Steps'));++ const deletedReference = `${LEAN_BODY}\nNever invoke thinking-deleted-example.\n`;+ const referenceResult = validateSkillContent(deletedReference, {+ name: 'thinking-example',+ maxWords: 100,+ enforceBudget: true,+ forbiddenSkillIds: ['deleted-example'],+ });+ assert.equal(referenceResult.pass, false);+ assert.deepEqual(referenceResult.forbidden_skill_refs, ['deleted-example']);+ });++ test('validator fails missing required sections and overlong description', () => {+ const body = `---+ name: thinking-example+ description: ${'x'.repeat(201)}+ ---++ ## Overview+ Old shape only.+ `;+ const result = validateSkillContent(body, {+ name: 'thinking-example',+ maxWords: 50,+ enforceBudget: true,+ });+ assert.equal(result.pass, false);+ const failedNames = result.failed.map(f => f.name);+ assert.ok(failedNames.includes('Description Length'));+ assert.ok(failedNames.some(n => n.includes('When to Use')));+ assert.ok(failedNames.some(n => n.includes('When NOT to Use')));+ assert.ok(failedNames.some(n => n.includes('Procedure')));+ assert.ok(failedNames.some(n => n.includes('Output')));+ assert.ok(failedNames.some(n => n.includes('Verification')));+ });+++test('parseFrontmatter returns identical fields for LF and CRLF', () => {++ const crlf = LEAN_BODY.replace(/\r?\n/g, '\r\n');++ const lfParsed = parseFrontmatter(LEAN_BODY);++ const crlfParsed = parseFrontmatter(crlf);++ assert.equal(crlfParsed.has_frontmatter, true);++ assert.deepEqual(crlfParsed.frontmatter, lfParsed.frontmatter);++++ const crlfResult = validateSkillContent(crlf, {++ name: 'thinking-example',++ maxWords: 100,++ enforceBudget: true,++ });++ assert.equal(crlfResult.pass, true, JSON.stringify(crlfResult.failed));++});++++test('router emits invocable thinking-skills IDs; NONE means no invocation', () => {++ const routerPath = path.join(REPO_ROOT, 'skills', 'thinking-model-router', 'SKILL.md');++ const content = fs.readFileSync(routerPath, 'utf8');++ const plugin = JSON.parse(++ fs.readFileSync(path.join(REPO_ROOT, '.claude-plugin', 'plugin.json'), 'utf8'),++ );++++ // Positive: the invocation rule's exact ID is the plugin namespace plus a real++ // skill directory, so `thinking-skills:thinking-<slug>` resolves for the catalog.++ assert.equal(plugin.name, 'thinking-skills');++ assert.ok(content.includes('`thinking-skills:thinking-<slug>`'));++ const catalog = new Set(listSkillDirs());++ for (const dir of catalog) {++ assert.ok(dir.startsWith('thinking-'), `${dir} breaks the thinking-skills:<dir> ID rule`);++ }++++ // Every fully-qualified thinking-* token the router cites must resolve to a++ // shipped skill (regression: 11 stale IDs in the original PR table did not).++ const refs = new Set([...content.matchAll(/thinking-[a-z0-9-]+/g)].map(m => m[0]));++ refs.delete('thinking-model-router');++ refs.delete('thinking-skills');++ assert.deepEqual([...refs].filter(slug => !catalog.has(slug)), []);++++ // Negative: NONE is explicitly defined as no invocation.++ assert.ok(/`?NONE`? means no invocation/.test(content));++});+++ test('word budget failure is observable for survivors', () => {+ const words = Array.from({ length: 120 }, () => 'word').join(' ');+ const body = `---+ name: thinking-example+ description: ok description+ ---++ ## When to Use+ x++ ## When NOT to Use+ y++ ## Procedure+ z++ ## Output+ o++ ## Verification+ v++ ${words}+ `;+ const result = validateSkillContent(body, {+ name: 'thinking-example',+ maxWords: 50,+ enforceBudget: true,+ });+ assert.equal(result.pass, false);+ assert.ok(result.failed.some(f => f.name === 'Word Budget'));+ });++ test('current lean catalog satisfies every structural contract', () => {+ const report = validateAllSkills();+ assert.equal(report.found_count, 28);+ assert.equal(report.expected_count, 28);+ assert.equal(report.ok, true, report.failed.map(result => result.name).join(', '));+ assert.equal(report.failed.length, 0);+ assert.equal(report.summary.passed, 28);+ assert.equal(report.summary.failed, 0);+ for (const result of report.results) {+ assert.ok(result.procedure_steps >= 3 && result.procedure_steps <= 7, result.name);+ assert.equal(result.frontmatter['disable-model-invocation'], 'true', result.name);+ assert.deepEqual(result.forbidden_skill_refs, [], result.name);+ }+ });++ test('validate-skills does not write quality-report.json', () => {+ const reportPath = path.join(__dirname, '..', '..', 'scripts', 'quality-report.json');+ const before = fs.existsSync(reportPath) ? fs.statSync(reportPath).mtimeMs : null;+ // invoke pure API only+ validateAllSkills();+ const after = fs.existsSync(reportPath) ? fs.statSync(reportPath).mtimeMs : null;+ assert.equal(after, before);+ });++ test('global split validator checks ids and clusters without requiring tracked output', () => {+ const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'split-val-'));+ const authored = path.join(tmp, 'authored');+ fs.mkdirSync(authored);+ // two rows same cluster across splits -> fail+ const rows = [+ {+ id: 'a1',+ prompt: 'hello one',+ cluster_id: 'c1',+ source_family: 'f',+ split: 'dev',+ cluster_basis: 'x',+ },+ {+ id: 'a2',+ prompt: 'hello two',+ cluster_id: 'c1',+ source_family: 'f',+ split: 'heldout',+ cluster_basis: 'x',+ },+ ];+ fs.writeFileSync(path.join(authored, 'sample.jsonl'), rows.map(r => JSON.stringify(r)).join('\n') + '\n');++ const fileResult = validateAuthoredFile('sample.jsonl', authored);+ assert.equal(fileResult.status, 'failed');+ assert.ok(fileResult.errors.some(e => /cluster overlap/.test(e)));++ // prompt hash helper is stable+ assert.equal(promptHash({ prompt: 'abc' }), promptHash({ prompt: 'abc' }));+ assert.notEqual(promptHash({ prompt: 'abc' }), promptHash({ prompt: 'abd' }));++ // full validator on real tree should return structure and not throw+ const real = validateDatasetSplits();+ assert.ok(real.summary);+ assert.ok(Array.isArray(real.authored));+ assert.ok(Array.isArray(real.workflow));+ assert.ok(real.global);+ // ensure workflow-cases-replication is included when present+ assert.ok(real.workflow.some(w => w.file.includes('replication')) || !fs.existsSync(path.join(__dirname, '..', 'datasets', 'workflow-cases-replication.jsonl')));+ });++ test('consumed provisional authored rows are dev-only and non-fresh', () => {+ const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'split-consumed-'));+ const authored = path.join(tmp, 'authored');+ fs.mkdirSync(authored);+ const consumed = {+ id: 'consumed-1',+ prompt: 'already evaluated',+ cluster_id: 'consumed-cluster',+ source_family: 'legacy',+ split: 'heldout',+ cluster_basis: 'legacy reuse',+ evidence_status: 'consumed_provisional',+ freshness_eligible: false,+ };+ fs.writeFileSync(path.join(authored, 'consumed.jsonl'), `${JSON.stringify(consumed)}\n`);+ const invalid = validateAuthoredFile('consumed.jsonl', authored);+ assert.equal(invalid.status, 'failed');+ assert.ok(invalid.errors.some(error => /must use split=dev/.test(error)));++ consumed.split = 'dev';+ fs.writeFileSync(path.join(authored, 'consumed.jsonl'), `${JSON.stringify(consumed)}\n`);+ const valid = validateAuthoredFile('consumed.jsonl', authored);+ assert.equal(valid.status, 'passed', valid.errors.join('; '));+ });++ test('global validator detects cross-file authored id collisions', () => {+ const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'split-global-'));+ const authored = path.join(tmp, 'authored');+ const workflow = path.join(tmp, 'workflow');+ fs.mkdirSync(authored);+ fs.mkdirSync(workflow);+ const row = {+ id: 'dup-id',+ prompt: 'unique prompt text alpha',+ cluster_id: 'cluster-a',+ source_family: 'f',+ split: 'dev',+ cluster_basis: 'x',+ };+ const row2 = {+ id: 'dup-id',+ prompt: 'unique prompt text beta',+ cluster_id: 'cluster-b',+ source_family: 'f',+ split: 'heldout',+ cluster_basis: 'y',+ };+ fs.writeFileSync(path.join(authored, 'one.jsonl'), JSON.stringify(row) + '\n');+ fs.writeFileSync(path.join(authored, 'two.jsonl'), JSON.stringify(row2) + '\n');+ const report = validateDatasetSplits({+ authoredDir: authored,+ workflowDir: workflow,+ workflowFiles: [],+ });+ assert.equal(report.ok, false);+ assert.ok(report.global.errors.some(e => /global duplicate id/.test(e)));+ });++ test('EVAL_SPLIT_OUT refuses in-repo paths and leaves them absent', () => {+ const inRepo = path.join(REPO_ROOT, 'evals', 'results', 'latest', 'dataset-split-validation.json');+ const decision = resolveExternalReportPath(inRepo, REPO_ROOT);+ assert.equal(decision.ok, false);+ assert.match(decision.reason, /outside the repository/);++ const external = path.join(os.tmpdir(), `split-out-${Date.now()}.json`);+ const ok = resolveExternalReportPath(external, REPO_ROOT);+ assert.equal(ok.ok, true);+ assert.equal(ok.path, path.resolve(external));++ // Ensure resolve helper does not create the refused path+ // (file may already exist historically; only assert helper refusal).+ assert.ok(!decision.ok);+ });++ test('workflow base and expanded share heldout; cluster overlap is not leakage', () => {+ const {+ validateGlobal,+ effectiveSplit,+ } = require('../validate-dataset-splits');++ assert.equal(effectiveSplit({ kind: 'workflow', role: 'base' }), 'heldout');+ assert.equal(effectiveSplit({ kind: 'workflow', role: 'expanded' }), 'heldout');+ assert.equal(effectiveSplit({ kind: 'workflow', role: 'replication' }), 'replication');+ assert.equal(effectiveSplit({ kind: 'authored', role: 'dev' }), 'dev');++ const authoredResults = [{+ file: 'a.jsonl',+ rows: [{+ id: 'auth-1',+ prompt: 'authored heldout prompt',+ cluster_id: 'auth-heldout-cluster',+ source_family: 'f',+ split: 'heldout',+ cluster_basis: 'x',+ }],+ }];+ const sharedCluster = 'wf-shared-cluster';+ const workflowResults = [+ {+ file: 'workflow-cases.jsonl',+ role: 'base',+ rows: [{+ id: 'wf-base-1',+ case_brief: 'workflow base brief one',+ cluster_id: sharedCluster,+ }],+ },+ {+ file: 'workflow-cases-expanded.jsonl',+ role: 'expanded',+ rows: [{+ id: 'wf-exp-1',+ case_brief: 'workflow expanded brief two',+ cluster_id: sharedCluster,+ }],+ },+ ];++ const global = validateGlobal(authoredResults, workflowResults);+ assert.ok(!global.errors.some(e => /wf-shared-cluster/.test(e)), global.errors.join('; '));+ // still flag true cross-split leakage+ const leak = validateGlobal(authoredResults, [{+ file: 'workflow-cases-replication.jsonl',+ role: 'replication',+ rows: [{+ id: 'wf-repl-1',+ case_brief: 'replication brief',+ cluster_id: 'auth-heldout-cluster',+ }],+ }]);+ assert.ok(leak.errors.some(e => /auth-heldout-cluster/.test(e) && /effective heldout and replication/.test(e)));+ });diff --cc scripts/validate-skills.jsindex ecb8ea8,7c0caa9..4098149mode 100644,100755..100755--- a/scripts/validate-skills.js+++ b/scripts/validate-skills.js@@@ -10,139 -17,288 +17,288 @@@const fs = require('fs');const path = require('path');- const SKILLS_DIR = path.join(__dirname, '..', 'skills');-- // Required sections and their markers- const REQUIRED_SECTIONS = [- { name: 'YAML Frontmatter', pattern: /^---\r?\n[\s\S]*?name:[\s\S]*?description:[\s\S]*?---/m },- { name: 'Overview', pattern: /^## Overview/m },- { name: 'Core Principle', pattern: /\*\*Core Principle:\*\*/m },- { name: 'When to Use', pattern: /^## When to Use/m },- { name: 'Decision Flow', pattern: /```[\s\S]*?→[\s\S]*?```/m },- { name: 'Process/Steps', pattern: /^### Step \d|^## The .* Process|^## .*Process$/m },- { name: 'Examples', pattern: /^## .*Example|Example:|```markdown[\s\S]*?##/m },- { name: 'Template', pattern: /^## .*Template|Template:/m },- { name: 'Verification Checklist', pattern: /^## Verification Checklist/m },- { name: 'Key Questions', pattern: /^## Key Questions/m },- { name: 'Wisdom/Attribution', pattern: /Wisdom|".*"/m }+ const REPO_ROOT = path.join(__dirname, '..');+ const SKILLS_DIR = path.join(REPO_ROOT, 'skills');++ let loadRegistry;+ let validateRegistry;+ let getSkillBudget;+ try {+ ({ loadRegistry, validateRegistry, getSkillBudget } = require(path.join(REPO_ROOT, 'evals', 'lib', 'registry')));+ } catch (_) {+ loadRegistry = null;+ }++ const DEFAULT_REQUIRED_SECTIONS = [+ 'When to Use',+ 'When NOT to Use',+ 'Procedure',+ 'Output',+ 'Verification',];- // Quality metrics- const QUALITY_CHECKS = [- {+ const DEFAULT_DESCRIPTION_MAX = 200;++ function listSkillDirs(skillsDir = SKILLS_DIR) {+ if (!fs.existsSync(skillsDir)) return [];+ return fs.readdirSync(skillsDir)+ .filter(d => d.startsWith('thinking-'))+ .filter(d => fs.existsSync(path.join(skillsDir, d, 'SKILL.md')))+ .sort();+ }++ function parseFrontmatter(content) {- const m = content.match(/^---\n([\s\S]*?)\n---/);++ const m = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);+ const fm = {};+ if (!m) return { frontmatter: fm, body: content, has_frontmatter: false };- for (const line of m[1].split('\n')) {++ for (const line of m[1].split(/\r?\n/)) {+ const kv = line.match(/^(\w[\w-]*):\s*(.*)$/);+ if (kv) fm[kv[1]] = kv[2].trim();+ }+ const body = content.slice(m[0].length);+ return { frontmatter: fm, body, has_frontmatter: true };+ }++ function countWords(text) {+ return String(text || '').trim().split(/\s+/).filter(Boolean).length;+ }++ function sectionHeadingPattern(name) {+ // Match ## When to Use / ## When NOT to Use etc.+ const escaped = name.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');+ return new RegExp(`^##\\s+${escaped}\\s*$`, 'mi');+ }++ function hasSection(content, name) {+ return sectionHeadingPattern(name).test(content);+ }++ function sectionBody(content, name) {+ const match = sectionHeadingPattern(name).exec(content);+ if (!match) return '';+ const start = match.index + match[0].length;+ const remainder = content.slice(start);+ const next = remainder.search(/^##\s+/m);+ return (next === -1 ? remainder : remainder.slice(0, next)).trim();+ }++ function numberedStepCount(content) {+ return sectionBody(content, 'Procedure')+ .split('\n')+ .filter(line => /^\s*\d+\.\s+\S/.test(line))+ .length;+ }++ /**+ * Pure validation of a single skill body.+ * @returns {object} structured result with pass/fail details+ */+ function validateSkillContent(content, opts = {}) {+ const skillName = opts.name || 'unknown';+ const requiredSections = opts.requiredSections || DEFAULT_REQUIRED_SECTIONS;+ const descriptionMax = opts.descriptionMax ?? DEFAULT_DESCRIPTION_MAX;+ const maxWords = opts.maxWords != null ? opts.maxWords : null;+ const enforceBudget = opts.enforceBudget !== false && maxWords != null;+ const requireDisableModelInvocation = opts.requireDisableModelInvocation === true;+ const forbiddenSkillIds = opts.forbiddenSkillIds || [];++ const { frontmatter, has_frontmatter } = parseFrontmatter(content);+ const words = countWords(content);+ const description = frontmatter.description || '';+ const descriptionLen = description.length;+ const procedureSteps = numberedStepCount(content);+ const nonEmptySections = requiredSections.filter(name => sectionBody(content, name).length > 0);+ const forbiddenRefs = forbiddenSkillIds.filter(id => content.includes(`thinking-${id}`));++ const sections = requiredSections.map(name => ({+ name,+ found: hasSection(content, name),+ }));++ const checks = [];+ checks.push({+ name: 'YAML Frontmatter',+ pass: has_frontmatter &&+ frontmatter.name === skillName &&+ Boolean(frontmatter.description),+ detail: has_frontmatter+ ? `name=${frontmatter.name || 'missing'}`+ : 'missing frontmatter',+ });+ checks.push({name: 'Description Length',- check: (content) => {- const match = content.match(/description:\s*(.+)/);- if (!match) return { pass: false, detail: 'No description found' };- const len = match[1].length;- return {- pass: len <= 200,- detail: `${len} chars (max 200)`- };- }- },- {- name: 'Has Multiple Examples',- check: (content) => {- const examples = (content.match(/Example[s]?:/gi) || []).length +- (content.match(/```markdown[\s\S]*?##/g) || []).length;- return {- pass: examples >= 2,- detail: `Found ${examples} example(s)`- };- }- },- {- name: 'Has Tables',- check: (content) => {- const tables = (content.match(/\|.*\|.*\|/g) || []).length;- return {- pass: tables >= 3,- detail: `Found ${tables} table row(s)`- };- }- },- {- name: 'Has Checklists',- check: (content) => {- const checks = (content.match(/- \[ \]/g) || []).length;- return {- pass: checks >= 3,- detail: `Found ${checks} checklist item(s)`- };- }- },- {- name: 'Has Code Blocks',- check: (content) => {- const blocks = (content.match(/```/g) || []).length / 2;- return {- pass: blocks >= 3,- detail: `Found ${Math.floor(blocks)} code block(s)`- };- }- },- {- name: 'Word Count (500-3000)',- check: (content) => {- const words = content.split(/\s+/).length;- return {- pass: words >= 500 && words <= 3000,- detail: `${words} words`- };- }- },- {- name: 'Has Anti-patterns/Failure Modes',- check: (content) => {- const hasAntiPatterns = /anti-pattern|failure mode|common mistake|when not to|don't use/i.test(content);- return {- pass: hasAntiPatterns,- detail: hasAntiPatterns ? 'Found warnings' : 'No anti-patterns documented'- };- }+ pass: descriptionLen > 0 && descriptionLen <= descriptionMax,+ detail: descriptionLen+ ? `${descriptionLen} chars (max ${descriptionMax})`+ : 'No description found',+ });++ for (const section of sections) {+ checks.push({+ name: `Section: ${section.name}`,+ pass: section.found,+ detail: section.found ? 'found' : 'missing',+ });}- ];+ checks.push({+ name: 'Required Section Content',+ pass: nonEmptySections.length === requiredSections.length,+ detail: nonEmptySections.length === requiredSections.length+ ? 'all required sections are non-empty'+ : `empty: ${requiredSections.filter(name => !nonEmptySections.includes(name)).join(', ')}`,+ });+ checks.push({+ name: 'Procedure Steps',+ pass: procedureSteps >= 3 && procedureSteps <= 7,+ detail: `${procedureSteps} numbered steps (required 3-7)`,+ });+ if (requireDisableModelInvocation) {+ checks.push({+ name: 'Manual-only Quarantine',+ pass: frontmatter['disable-model-invocation'] === 'true',+ detail: `disable-model-invocation=${frontmatter['disable-model-invocation'] || 'missing'}`,+ });+ }+ checks.push({+ name: 'Deleted Skill References',+ pass: forbiddenRefs.length === 0,+ detail: forbiddenRefs.length === 0+ ? 'none'+ : forbiddenRefs.map(id => `thinking-${id}`).join(', '),+ });- function validateSkill(skillPath) {- const content = fs.readFileSync(skillPath, 'utf8');- const skillName = path.basename(path.dirname(skillPath));+ if (enforceBudget) {+ checks.push({+ name: 'Word Budget',+ pass: words <= maxWords,+ detail: `${words} words (max ${maxWords})`,+ });+ } else if (maxWords != null) {+ checks.push({+ name: 'Word Budget',+ pass: true,+ detail: `${words} words (budget ${maxWords}; not enforced for non-survivors)`,+ });+ }- const results = {+ const failed = checks.filter(c => !c.pass);+ const score = checks.filter(c => c.pass).length;+ const maxScore = checks.length;++ return {name: skillName,+ description,+ description_length: descriptionLen,+ words,+ max_words: maxWords,+ procedure_steps: procedureSteps,+ forbidden_skill_refs: forbiddenRefs,+ sections,+ checks,+ failed,+ score,+ maxScore,+ pass: failed.length === 0,+ frontmatter,+ };+ }++ function validateSkillFile(skillPath, opts = {}) {+ const content = fs.readFileSync(skillPath, 'utf8');+ const skillName = opts.name || path.basename(path.dirname(skillPath));+ return {+ ...validateSkillContent(content, { ...opts, name: skillName }),path: skillPath,- sections: [],- quality: [],- score: 0,- maxScore: 0};+ }- // Check required sections- for (const section of REQUIRED_SECTIONS) {- const found = section.pattern.test(content);- results.sections.push({- name: section.name,- found- });- results.maxScore += 1;- if (found) results.score += 1;+ function loadCatalogExpectations(registryPath) {+ if (!loadRegistry) {+ return {+ expectedCount: null,+ requiredSections: DEFAULT_REQUIRED_SECTIONS,+ descriptionMax: DEFAULT_DESCRIPTION_MAX,+ budgets: {},+ registry: null,+ registryValidation: null,+ };}+ const { registry } = loadRegistry(registryPath);+ const registryValidation = validateRegistry(registry);+ const budgets = {};+ for (const [id, skill] of Object.entries(registry.skills || {})) {+ const b = getSkillBudget(registry, id);+ if (b != null) budgets[id] = b;+ }+ return {+ expectedCount: registry.catalog?.expected_count ?? registry.catalog?.baseline_count ?? null,+ requiredSections: registry.required_skill_sections || DEFAULT_REQUIRED_SECTIONS,+ descriptionMax: registry.frontmatter?.description_max_chars ?? DEFAULT_DESCRIPTION_MAX,+ budgets,+ survivors: new Set(registry.catalog?.survivors || []),+ quarantined: new Set(Object.entries(registry.skills || {})+ .filter(([, skill]) => skill.disposition?.disable_model_invocation_until_elevated === true)+ .map(([id]) => id)),+ deletions: new Set(registry.catalog?.deletions || []),+ registry,+ registryValidation,+ };+ }- // Check quality metrics- for (const check of QUALITY_CHECKS) {- const result = check.check(content);- results.quality.push({- name: check.name,- ...result- });- results.maxScore += 1;- if (result.pass) results.score += 1;+ /**+ * Validate all skills under skillsDir. Pure: no file writes.+ */+ function validateAllSkills(opts = {}) {+ const skillsDir = opts.skillsDir || SKILLS_DIR;+ const catalog = loadCatalogExpectations(opts.registryPath);+ const dirs = listSkillDirs(skillsDir);+ const results = [];++ for (const dir of dirs) {+ const id = dir.replace(/^thinking-/, '');+ const maxWords = catalog.budgets[id] != null ? catalog.budgets[id] : null;+ // Enforce budget only for declared survivors (Phase 3 lean contracts).+ // Baseline pre-rewrite bodies will fail budgets/sections — that is intentional observability.+ const enforceBudget = catalog.survivors ? catalog.survivors.has(id) : maxWords != null;+ const skillPath = path.join(skillsDir, dir, 'SKILL.md');+ results.push(validateSkillFile(skillPath, {+ name: dir,+ requiredSections: catalog.requiredSections,+ descriptionMax: catalog.descriptionMax,+ maxWords,+ enforceBudget,+ requireDisableModelInvocation: catalog.quarantined?.has(id) || false,+ forbiddenSkillIds: [...(catalog.deletions || [])],+ }));}- return results;+ const errors = [];+ if (catalog.expectedCount != null && results.length !== catalog.expectedCount) {+ errors.push(`catalog count ${results.length} != expected ${catalog.expectedCount}`);+ }+ if (catalog.registryValidation && !catalog.registryValidation.ok) {+ for (const e of catalog.registryValidation.errors) errors.push(`registry: ${e}`);+ }++ const failedSkills = results.filter(r => !r.pass);+ return {+ ok: errors.length === 0 && failedSkills.length === 0,+ catalog_errors: errors,+ expected_count: catalog.expectedCount,+ found_count: results.length,+ required_sections: catalog.requiredSections,+ results,+ failed: failedSkills,+ summary: {+ total: results.length,+ passed: results.filter(r => r.pass).length,+ failed: failedSkills.length,+ },+ registry_validation: catalog.registryValidation,+ };}- function printResults(results) {+ function printResults(report) {const GREEN = '\x1b[32m';const RED = '\x1b[31m';const YELLOW = '\x1b[33m';diff --cc skills/thinking-model-router/SKILL.mdindex 19a6697,13503f8..517905d--- a/skills/thinking-model-router/SKILL.md+++ b/skills/thinking-model-router/SKILL.md@@@ -5,401 -6,80 +6,84 @@@ disable-model-invocation: tru# Model Router- ## Overview+ **Core rule:** Prefer NONE or one primary skill. Route by mechanism fit, not habit. Combine only when roles are distinct and necessary.- This is the **master routing skill** for all mental models. Instead of knowing 38 frameworks, start here. Identify your domain and problem type, and this skill points you to the right model(s). Think of it as the "which tool do I use?" guide.+ ## When to Use- **Core Principle:** Don't memorize models—memorize how to find the right one. Domain + Problem Type → Model.+ - The right thinking skill is unclear and you would otherwise guess or stack tools.+ - Several catalog skills seem plausible and you need a single primary (or explicit NONE).+ - High-stakes work where a wrong frame is costly and a quick domain×type match helps.- ## Short-Circuit: Skip the Router+ ## When NOT to Use- **If you already know the right model, invoke it directly — don't route.** This skill is for when you're *unsure* which model fits. If the problem obviously calls for a specific model (e.g., "where's the bottleneck?" → theory-of-constraints; "how would an attacker break this?" → red-team), go straight to it. Routing is overhead you only pay when the match isn't obvious. Likewise, if no model clearly helps, just reason directly — don't force one.+ - The match is already known or obvious ("where's the bottleneck?" → theory-of-constraints) — invoke that skill directly; do not route for show.+ - The task is routine implementation with no analytical unknown — reason directly (NONE).+ - You are mid-execution of an agreed plan and only need the next concrete step.+ - The ask is outside this catalog (pure coding syntax, tool ops with no judgment call) — NONE.+## Invoking a Model (Skill IDs)+- Every model below is a skill in this plugin. After routing, invoke the chosen model with the Skill tool using the exact ID `thinking-skills:thinking-<slug>`. Slugs are NOT always the display name lowercased (e.g. Systems Thinking → `thinking-systems`, 5 Whys Plus → `thinking-five-whys-plus`). Full mapping:-- | Model | Skill ID |- |---|---|- | 5 Whys Plus | `thinking-skills:thinking-five-whys-plus` |- | Archetypes | `thinking-skills:thinking-archetypes` |- | Bayesian | `thinking-skills:thinking-bayesian` |- | Bounded Rationality | `thinking-skills:thinking-bounded-rationality` |- | Circle of Competence | `thinking-skills:thinking-circle-of-competence` |- | Cynefin | `thinking-skills:thinking-cynefin` |- | Debiasing | `thinking-skills:thinking-debiasing` |- | Dual-Process | `thinking-skills:thinking-dual-process` |- | Effectuation | `thinking-skills:thinking-effectuation` |- | Feedback Loops | `thinking-skills:thinking-feedback-loops` |- | Fermi Estimation | `thinking-skills:thinking-fermi-estimation` |- | First Principles | `thinking-skills:thinking-first-principles` |- | Inversion | `thinking-skills:thinking-inversion` |- | Jobs to be Done | `thinking-skills:thinking-jobs-to-be-done` |- | Kepner-Tregoe | `thinking-skills:thinking-kepner-tregoe` |- | Leverage Points | `thinking-skills:thinking-leverage-points` |- | Lindy Effect | `thinking-skills:thinking-lindy-effect` |- | Map-Territory | `thinking-skills:thinking-map-territory` |- | Margin of Safety | `thinking-skills:thinking-margin-of-safety` |- | Model Combination | `thinking-skills:thinking-model-combination` |- | Model Selection | `thinking-skills:thinking-model-selection` |- | Occam's Razor | `thinking-skills:thinking-occams-razor` |- | OODA | `thinking-skills:thinking-ooda` |- | Opportunity Cost | `thinking-skills:thinking-opportunity-cost` |- | Pre-mortem | `thinking-skills:thinking-pre-mortem` |- | Probabilistic | `thinking-skills:thinking-probabilistic` |- | Red Team | `thinking-skills:thinking-red-team` |- | Regret Minimization | `thinking-skills:thinking-regret-minimization` |- | Reversibility | `thinking-skills:thinking-reversibility` |- | Scientific Method | `thinking-skills:thinking-scientific-method` |- | Second-Order | `thinking-skills:thinking-second-order` |- | Socratic | `thinking-skills:thinking-socratic` |- | Steel-manning | `thinking-skills:thinking-steel-manning` |- | Systems Thinking | `thinking-skills:thinking-systems` |- | Theory of Constraints | `thinking-skills:thinking-theory-of-constraints` |- | Thought Experiment | `thinking-skills:thinking-thought-experiment` |- | TRIZ | `thinking-skills:thinking-triz` |- | Via Negativa | `thinking-skills:thinking-via-negativa` |-- ## Quick Router-- ### Step 1: What's Your Domain?-- | Domain | You're working on... |- |--------|---------------------|- | **Coding/Debugging** | Bugs, errors, performance issues, root cause |- | **Architecture** | System design, technical decisions, scalability |- | **Product** | Features, user needs, prioritization, roadmap |- | **Business Strategy** | Competition, growth, market, organization |- | **Personal Decisions** | Career, life choices, major commitments |- | **Abstract/Analytical** | Arguments, ideas, theories, pure reasoning |- | **Risk/Safety** | What could go wrong, preparation, resilience |- | **Innovation** | New ideas, breakthroughs, creative solutions |-- ### Step 2: What's Your Problem Type?-- | Type | You need to... |- |------|----------------|- | **Diagnose** | Find root cause, understand why |- | **Decide** | Choose between options |- | **Understand** | Grasp how something works |- | **Create** | Generate new solutions |- | **Evaluate** | Judge quality or validity |- | **Predict** | Forecast outcomes |- | **Optimize** | Improve performance |-- ----- ## Domain → Model Maps-- ### 🖥️ Coding & Debugging-- ```- PROBLEM → MODEL(S)- ─────────────────────────────────────────────────────- Bug with unknown cause → Scientific Method, 5 Whys Plus- Performance degradation → Theory of Constraints, Systems Thinking- Spans multiple services → Systems Thinking, Feedback Loops- Incident postmortem → 5 Whys Plus, Systems Thinking- Flaky/intermittent behavior → Scientific Method (hypothesis testing)- "It works on my machine" → Map-Territory (model vs reality gap)- ```-- **Default for debugging:** Start with **5 Whys Plus**, escalate to **Systems Thinking** if it spans components.-- ----- ### 🏗️ Architecture & Technical Decisions-- ```- PROBLEM → MODEL(S)- ─────────────────────────────────────────────────────- Technology choice → Lindy Effect, Reversibility- Build vs buy → Opportunity Cost, First Principles- Scalability design → Systems Thinking, Leverage Points- Microservices vs monolith → Cynefin, Reversibility- Database selection → Lindy Effect, Theory of Constraints- API design tradeoffs → TRIZ (resolve contradictions)- Should we rewrite? → Second-Order, Opportunity Cost- ```-- **Default for architecture:** Start with **Reversibility** (is this Type 1 or Type 2?), then **Systems Thinking** for interconnections.-- ----- ### 📦 Product & Feature Development-- ```- PROBLEM → MODEL(S)- ─────────────────────────────────────────────────────- What should we build? → Jobs to be Done- Feature prioritization → Opportunity Cost, Theory of Constraints- Why aren't users engaging? → Jobs to be Done, 5 Whys Plus- New product exploration → Effectuation, First Principles- Should we pivot? → Regret Minimization, Reversibility- Product-market fit → Jobs to be Done, Bayesian- Roadmap planning → Theory of Constraints, Opportunity Cost- A/B test interpretation → Bayesian, Probabilistic- ```-- **Default for product:** Start with **Jobs to be Done** (what job is the user hiring this for?).-- ----- ### 📈 Business Strategy-- ```- PROBLEM → MODEL(S)- ─────────────────────────────────────────────────────- Competitive analysis → Red Team, Second-Order- Market entry → Cynefin, Effectuation- Growth strategy → Feedback Loops, Leverage Points- Organizational dysfunction → Archetypes, Systems Thinking- Resource allocation → Theory of Constraints, Opportunity Cost- Startup strategy → Effectuation, Margin of Safety- M&A evaluation → Pre-mortem, Steel-manning- Pricing decisions → First Principles, Fermi Estimation- ```-- **Default for strategy:** Start with **Cynefin** (what domain is this problem in?), then match approach.-- ----- ### 🧑 Personal & Career Decisions-- ```- PROBLEM → MODEL(S)- ─────────────────────────────────────────────────────- Should I take this job? → Regret Minimization, Reversibility- Career direction → Circle of Competence, Regret Minimization- Major life decision → Regret Minimization, Pre-mortem- Learning what to learn → Circle of Competence, Lindy Effect- Negotiation prep → Steel-manning, Red Team- Should I start a company? → Effectuation, Margin of Safety, Pre-mortem- Time allocation → Opportunity Cost, Theory of Constraints- ```-- **Default for personal:** Start with **Regret Minimization** (what will 80-year-old you think?).-- ----- ### 🧠 Abstract & Analytical Thinking-- ```- PROBLEM → MODEL(S)- ─────────────────────────────────────────────────────- Evaluating an argument → Steel-manning, Bayesian- Challenging assumptions → First Principles, Socratic- Estimating unknowns → Fermi Estimation, Probabilistic- Updating beliefs → Bayesian, Probabilistic- Exploring edge cases → Thought Experiment, Inversion- Finding logical flaws → Inversion, Steel-manning- Complex causation → Systems Thinking, Feedback Loops- Philosophical questions → Thought Experiment, First Principles- ```-- **Default for abstract:** Start with **Steel-manning** (argue the strongest opposing view first).-- ----- ### ⚠️ Risk & Safety-- ```- PROBLEM → MODEL(S)- ─────────────────────────────────────────────────────- What could go wrong? → Pre-mortem, Red Team- Security review → Red Team, Inversion- Disaster preparation → Pre-mortem, Margin of Safety- Avoiding catastrophic failure → Margin of Safety, Via Negativa- Stress-testing plans → Red Team, Pre-mortem- Probability of failure → Probabilistic, Bayesian- Building resilience → Via Negativa, Margin of Safety- ```-- **Default for risk:** Start with **Pre-mortem** (assume failure, explain why).-- ----- ### 💡 Innovation & Creativity-- ```- PROBLEM → MODEL(S)- ─────────────────────────────────────────────────────- Breakthrough needed → First Principles, TRIZ- Stuck on contradictions → TRIZ- Limited resources → Effectuation, Via Negativa- Simplification → Via Negativa, Occam's Razor- Challenging "impossible" → First Principles, TRIZ- New market creation → Effectuation, Jobs to be Done- Removing complexity → Via Negativa, Occam's Razor- ```-- **Default for innovation:** Start with **First Principles** (strip to fundamentals, rebuild).-- ----- ## Quick Reference Card-- ```- ┌─────────────────────────────────────────────────────────────────┐- │ MENTAL MODEL QUICK ROUTER │- ├─────────────────────────────────────────────────────────────────┤- │ │- │ "Why is this broken?" → 5 Whys Plus, Scientific Method │- │ "How does this system work?" → Systems Thinking, Feedback Loops│- │ "What should we build?" → Jobs to be Done │- │ "Should I do this?" → Reversibility, Regret Min │- │ "What could go wrong?" → Pre-mortem, Red Team │- │ "How do I innovate?" → First Principles, TRIZ │- │ "What's the probability?" → Bayesian, Probabilistic │- │ "Where's the bottleneck?" → Theory of Constraints │- │ "What am I giving up?" → Opportunity Cost │- │ "Is this argument valid?" → Steel-manning │- │ "Will this technology last?" → Lindy Effect │- │ "How complex is this?" → Cynefin │- │ "What to remove?" → Via Negativa │- │ "Is this safe enough?" → Margin of Safety │- │ │- └─────────────────────────────────────────────────────────────────┘- ```-- ## Decision Flow-- ```- START HERE- │- ▼- ┌─────────────────────┐- │ What's your domain? │- └──────────┬──────────┘- │- ┌─────┴─────┬──────────┬──────────┬──────────┐- ▼ ▼ ▼ ▼ ▼- Coding Architecture Product Strategy Personal- │ │ │ │ │- ▼ ▼ ▼ ▼ ▼- ┌─────────────────────┐- │ What problem type? │- │ Diagnose/Decide/ │- │ Understand/Create/ │- │ Evaluate/Predict │- └──────────┬──────────┘- │- ▼- ┌─────────────────────┐- │ Look up in domain │- │ table above │- └──────────┬──────────┘- │- ▼- ┌─────────────────────┐- │ Single model enough?│- └──────────┬──────────┘- │- ┌──────┴──────┐- ▼ ▼- YES NO- │ │- ▼ ▼- Apply it Use Model Combination- (Sequential/Parallel/Nested)- ```-- ## Model Inventory by Category-- ### Diagnostic Models (Find root cause)- - `5 Whys Plus` - Iterative "why" with bias guards- - `Scientific Method` - Hypothesis → Test → Learn- - `Kepner-Tregoe` - Systematic problem/decision analysis-- ### Decision Models (Choose wisely)- - `Reversibility` - Type 1 vs Type 2 decisions- - `Regret Minimization` - What will future-you think?- - `Opportunity Cost` - What are you giving up?- - `Bayesian` - Update beliefs with evidence- - `Probabilistic` - Calibrated probability estimates-- ### Systems Models (Understand interconnections)- - `Systems Thinking` - Feedback, emergence, non-linearity- - `Feedback Loops` - Reinforcing and balancing loops- - `Theory of Constraints` - Find and exploit the bottleneck- - `Leverage Points` - Where small changes have big effects- - `Archetypes` - Recurring system patterns-- ### Risk Models (Prepare for failure)- - `Pre-mortem` - Assume failure, explain why- - `Red Team` - Attack your own plan- - `Margin of Safety` - Build in buffers- - `Inversion` - Identify paths to failure, avoid them-- ### Innovation Models (Create breakthroughs)- - `First Principles` - Strip to fundamentals, rebuild- - `TRIZ` - Resolve technical contradictions- - `Effectuation` - Start with means, not goals- - `Via Negativa` - Improve by removing-- ### Evaluation Models (Judge quality)- - `Steel-manning` - Argue strongest opposing view- - `Lindy Effect` - Older = likely to last longer- - `Circle of Competence` - Know your expertise boundaries- - `Occam's Razor` - Prefer simpler explanations-- ### Context Models (Match approach to situation)- - `Cynefin` - Clear/Complicated/Complex/Chaotic domains- - `Model Selection` - Choose the right model- - `Model Combination` - Use multiple models together-- ### Product Models (Build the right thing)- - `Jobs to be Done` - What job is user hiring this for?- - `Thought Experiment` - Structured imagination-- ### Estimation Models (Size unknowns)- - `Fermi Estimation` - Order-of-magnitude calculations-- ## When to Combine Models-- Use **Model Combination** when:-- | Situation | Combination Pattern | Example |- |-----------|--------------------| --------|- | High-stakes decision | Sequential | Reversibility → Pre-mortem → Opportunity Cost |- | System diagnosis | Nested | Cynefin (macro) → ToC (meso) → OODA (micro) |- | Validating strategy | Parallel | Red Team + Steel-manning + Second-Order |- | Innovation under constraints | Sequential | First Principles → TRIZ → Effectuation |- | Career decision | Temporal | 5 Whys (past) → Circle of Competence (present) → Regret Min (future) |-- ## Template-- ```markdown- # Model Router Analysis-- ## Context- Domain: [Coding/Architecture/Product/Strategy/Personal/Abstract/Risk/Innovation]- Problem: [Brief description]- Problem Type: [Diagnose/Decide/Understand/Create/Evaluate/Predict/Optimize]-- ## Routed Models- Primary: [Main model to use]- Secondary: [If needed]- Combination pattern: [Sequential/Parallel/Nested/None]-- ## Application- [Apply the selected model(s) here]++The router outputs bare slugs (e.g. `id: five-whys-plus`). Invoke a routed skill with the Skill tool using the exact ID `thinking-skills:thinking-<slug>` — never invent a slug not cited in Procedure. `NONE` means no invocation.+++ ## Procedure++ 1. **Short-circuit.** If one skill clearly fits by mechanism, return that skill alone. If no skill clearly improves the work, return **NONE** and reason directly. Stop.+ 2. **Characterize.** Record domain (coding, architecture, product, strategy, personal, abstract, risk, innovation) and problem type (diagnose, decide, understand, create, evaluate, predict, optimize). Note constraints: time, information, stakes, reversibility, complexity.+ 3. **Candidate by type defaults (override when constraints demand).** Keep only active catalog skills:+ - Diagnose → five-whys-plus or scientific-method (kepner-tregoe if IS/IS-NOT matrix needed)+ - Decide → reversibility first; then opportunity-cost or probabilistic+ - Understand → systems (map-territory if model-vs-reality gap; cynefin if approach domain unclear)+ - Create → first-principles (triz for contradictions; effectuation for means-driven; via-negativa for remove-first)+ - Evaluate → steel-manning (socratic if assumptions/definitions are the unknown)+ - Predict → probabilistic+ - Optimize → theory-of-constraints (ooda under time pressure; bounded-rationality for search stop)+ - Risk / "what fails?" → pre-mortem or red-team; margin-of-safety for buffers+ - Product "what to build?" → jobs-to-be-done+ - Competence / durability → circle-of-competence, lindy-effect+ - Controlled hypothetical → thought-experiment+ - Multi-lens only after one primary fails a blind-spot check → model-combination+ 4. **Select with criteria (satisficing).** Score only if 2+ candidates remain or stakes make a forced default unsafe. Rate each criterion 1–5 (1 = absent/wrong fit; 3 = usable with gaps; 5 = direct fit): problem fit (30%), available inputs (20%), time to apply (15%), stakeholder usability (15%), competence to apply correctly (20%). A route must score problem fit ≥4 and weighted total ≥3.5; otherwise return **NONE**. For totals within 0.25, prefer fewer inputs and shorter execution; if still tied, choose NONE unless the skills answer distinct complementary questions.+ 5. **Multi-skill only as exception.** Add a second or third skill only when each has a distinct complementary role the primary leaves open. Cap at three. Prefer sequential over parallel. Near-neighbors and synonyms do not stack. For composition patterns, hand off to model-combination after naming the primary.+ 6. **Exit.** State abandon signals (forced fit, ignored factors, no insight ~15 minutes). On mismatch, re-route once or fall back to NONE — never force a frame.++ **Domain cheat-map (primary first; still default to one or NONE):**++ | Domain signal | Prefer |+ |---------------|--------|+ | Bug / root cause / flaky | five-whys-plus, scientific-method, systems |+ | Architecture / tech choice | reversibility, systems, lindy-effect, opportunity-cost |+ | Feature / roadmap / engagement | jobs-to-be-done, opportunity-cost, theory-of-constraints |+ | Strategy / competition / growth | cynefin, systems, red-team, second-order |+ | Personal / career commitment | opportunity-cost, reversibility, circle-of-competence, pre-mortem |+ | Argument / belief update | steel-manning, probabilistic, socratic, first-principles |+ | Security / disaster / ruin | pre-mortem, red-team, margin-of-safety, via-negativa |+ | Innovation / contradiction / simplify | first-principles, triz, effectuation, via-negativa |++ ## Output++ ```text+ outcome: NONE | one | multi+ routes:+ - id: <primary skill id or NONE>+ role: <job this skill performs>+ unique_question: <question only this route answers>+ - id: <secondary skill id, only for multi>+ role: <distinct complementary job>+ unique_question: <distinct open question>+ - id: <tertiary skill id, only for multi>+ role: <distinct complementary job>+ unique_question: <distinct open question>+ domain: <domain>+ problem_type: <type>+ constraints: <time/info/stakes/reversibility>+ rationale: <mechanism fit in one sentence>+ blind_spots: <what primary still ignores, if any>+ exit: <when to abandon or re-route>+ ```++ Default fill: `outcome: NONE` with one `id: NONE` route, or `outcome: one` with one route. Use `multi` only when every listed skill has a distinct role and unique question.## Verification- - [ ] Domain correctly identified- - [ ] Problem type matches- - [ ] Model fits the situation- - [ ] Considered if combination needed- ```-- ## Key Questions-- - "What domain am I operating in?"- - "What type of problem is this—diagnose, decide, understand, create, or evaluate?"- - "What's the default model for this domain + type?"- - "Does one model cover it, or do I need to combine?"- - "Am I using a model because it fits, or because it's familiar?"-- ---- **Remember:** You don't need to know all 38 models. You need to know how to find the right one. Start with domain, identify problem type, look it up, apply. That's it.+ - **Falsify / stop:** If the route is habit or familiarity rather than mechanism fit, discard and re-score or return NONE. If multi-skill entries lack distinct roles, collapse to the single best primary. If no candidate clearly helps, NONE is correct — do not invent a route.+ - **Over-application guard:** Do not route when the skill is already obvious. Do not return more than three skills. Do not cite deleted or non-catalog names. Do not treat the router as a prerequisite for leaf skills invoked directly.