Organon Tools Developer Skill
A Claude skill for agents developing organon-tools — ensures the tools that enforce methodology are built using methodology.
When to Use This Skill
Use this skill when:
- Adding a new CLI command (
organon <command>)
- Adding a new verification gate
- Adding a new MCP tool/prompt/resource
- Evolving the methodology specification (book-llms/)
- Fixing bugs or refactoring organon-tools code
Purpose: Ensure organon-tools development follows its own ETHOS.md constraints and PHILOSOPHY.md design decisions.
Identity Check (Always Start Here)
Before any work, load and internalize:
- Read
organon/domains/tools/ETHOS.md - 6 invariants, 5 principles, 8 heuristics
- Read
organon/domains/tools/PHILOSOPHY.md - 5 design decisions and trade-offs
- Read
book-llms/three-layer-architecture.md - If working on verification gates
Critical constraint: This tool builds tools that enforce methodology. The builder must follow what it builds.
The 6 Invariants (Never Violate)
From organon/domains/tools/ETHOS.md:
- Schema fidelity - Frontmatter parser matches
book-llms/frontmatter-system.md exactly
- Every command has tests - No untested code ships
- Gates fail builds, not warn - Verification gates produce pass/fail, never soft warnings
- Machine-parsable output - All commands support
--format json
- Idempotent operations - Same input = same output, no side effects
- Breaking changes require major version bump - CLI, JSON schema, frontmatter schema
If your change violates any invariant, STOP and redesign.
The 5 Design Principles (Prioritized)
From organon/domains/tools/ETHOS.md:
- Schema fidelity over convenience - When book-llms/ spec conflicts with ease-of-use, spec wins
- Fail-fast over forgiving - Invalid input blocks execution, errors surface immediately
- Composability over monoliths - Commands work in Unix pipelines
- Testability over implementation speed - Pure functions with tests, thin CLI wrappers
- Clarity over brevity - Error messages explain what failed and how to fix it
Core Architecture Pattern
From organon/domains/tools/PHILOSOPHY.md:
src/
├── core/ ← Pure functions (no I/O, no console, no process.exit)
│ ├── types.ts ← FileSystem interface, result types
│ ├── <feature>.ts ← Pure logic with tests
│ └── <feature>.test.ts ← Vitest tests (>90% coverage)
├── cli/commands/ ← Thin wrappers (yargs handlers)
│ └── <command>.ts ← Parse args → call core → format output
└── mcp/ ← Thin MCP adapters
├── tools.ts ← Wrap core functions as MCP tools
└── prompts.ts ← Methodology workflow templates
Pattern: Core logic is pure and testable. CLI and MCP are thin adapters.
Workflow 1: Adding a New CLI Command
Example: Adding organon check-links command
Design phase (before coding):
Implementation phase:
# Create core utility (pure function)
touch src/core/check-links.ts
touch src/core/check-links.test.ts
# Create CLI command wrapper
touch src/cli/commands/check-links.ts
Core utility structure (src/core/check-links.ts):
import { FileSystem, Result } from './types';
export interface CheckLinksOptions {
projectRoot: string;
// ... other options
}
export interface CheckLinksResult {
success: boolean;
brokenLinks: Array<{ file: string; link: string; reason: string }>;
}
export async function checkLinks(
options: CheckLinksOptions,
fs: FileSystem
): Promise<CheckLinksResult> {
// Pure logic here - no console.log, no process.exit
// Return structured results
}
Write tests first (src/core/check-links.test.ts):
import { describe, it, expect } from 'vitest';
import { checkLinks } from './check-links';
import { MockFileSystem } from './test-utils';
describe('checkLinks', () => {
it('detects broken links', async () => {
const fs = new MockFileSystem({ ... });
const result = await checkLinks({ projectRoot: '.' }, fs);
expect(result.brokenLinks).toHaveLength(1);
});
// ... more tests
});
CLI wrapper (src/cli/commands/check-links.ts):
import yargs from 'yargs';
import { checkLinks } from '../../core/check-links';
import { NodeFileSystem } from '../../core/node-fs';
export const checkLinksCommand: yargs.CommandModule = {
command: 'check-links',
describe: 'Check for broken links in organon files',
builder: (yargs) => {
return yargs
.option('format', {
choices: ['human', 'json'] as const,
default: 'human' as const,
});
},
handler: async (args) => {
const fs = new NodeFileSystem();
const result = await checkLinks({ projectRoot: process.cwd() }, fs);
if (args.format === 'json') {
console.log(JSON.stringify(result, null, 2));
} else {
// Human-readable output
if (result.brokenLinks.length === 0) {
console.log('✓ No broken links found');
} else {
console.error('✗ Found broken links:');
result.brokenLinks.forEach(l => {
console.error(` ${l.file}: ${l.link} (${l.reason})`);
});
}
}
process.exit(result.success ? 0 : 1);
},
};
Register command (in src/cli/index.ts):
import { checkLinksCommand } from './commands/check-links';
yargs
.command(checkLinksCommand)
// ... other commands
Verification checklist:
Workflow 2: Adding a New Verification Gate
Example: Adding a "freshness" gate that checks last-modified dates
Update specification first:
Implementation (follow Workflow 1 pattern):
# Core logic
touch src/core/verify-freshness.ts
touch src/core/verify-freshness.test.ts
Gate structure (src/core/verify-freshness.ts):
import { FileSystem, VerificationResult } from './types';
export async function verifyFreshness(
projectRoot: string,
fs: FileSystem
): Promise<VerificationResult> {
return {
gate: 'freshness',
passed: boolean,
errors: Array<{ file: string; message: string; fix: string }>,
warnings: [], // Gates never warn, only fail
};
}
Register gate (in src/core/verify.ts):
import { verifyFreshness } from './verify-freshness';
const GATES = {
'freshness': verifyFreshness,
// ... other gates
};
Test coverage requirements:
Update CLI (src/cli/commands/verify.ts):
.option('gate', {
type: 'array',
choices: ['frontmatter', 'references', 'triplets', 'coverage', 'freshness'],
description: 'Run specific gates (defaults to all)',
})
Verification checklist:
Workflow 3: Adding a New MCP Tool/Prompt
Example: Adding organon_check_dependencies MCP tool
Core function exists (or create it following Workflow 1)
Add MCP tool (src/mcp/tools.ts):
{
name: 'organon_check_dependencies',
description: 'Check if organon file dependencies are satisfied',
inputSchema: {
type: 'object',
properties: {
file: { type: 'string', description: 'Path to organon file' },
},
required: ['file'],
},
handler: async (args) => {
const result = await checkDependencies(args.file, fs);
return {
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
};
},
}
Add MCP prompt (src/mcp/prompts.ts) - If it's a workflow:
{
name: 'check-organon-dependencies',
description: 'Workflow for verifying organon dependency chains',
arguments: [
{ name: 'scope', description: 'Scope to check (product, domain, feature)', required: false },
],
handler: async (args) => {
return {
messages: [
{
role: 'user',
content: {
type: 'text',
text: `# Check Organon Dependencies Workflow\n\n...`,
},
},
],
};
},
}
Verification checklist:
Workflow 4: Evolving the Methodology (RFC-Aware)
Example: Adding a new frontmatter field
DANGER ZONE: Changes to book-llms/ affect ALL projects using Organon.
RFC pattern (from book-llms/patterns.md):
Breaking change checklist (requires major version bump):
Invariant check:
- Schema fidelity: Implementation must match spec exactly
- Breaking changes require major version bump: Semver enforced
Common Pitfalls (Don't Do This)
- ❌ Adding logic to CLI commands → ✅ Add to
src/core/, CLI is thin wrapper
- ❌ Using
console.log in core functions → ✅ Return structured results, CLI formats
- ❌ Using
process.exit in core functions → ✅ Return success/failure, CLI exits
- ❌ Writing tests after code → ✅ Write tests first (TDD pattern)
- ❌ Making gates warn instead of fail → ✅ Gates fail builds (INV-TOOLS-3)
- ❌ Skipping
--format json support → ✅ All commands must support it (INV-TOOLS-4)
- ❌ Implementing before spec updated → ✅ Update book-llms/ spec first
- ❌ Auto-fixing invalid frontmatter → ✅ Fail-fast, force user to fix (principle #2)
Pre-Commit Verification
Before committing ANY code:
# 1. Tests pass
npm test
# 2. No TypeScript errors
npm run build
# 3. Self-verification (dogfooding)
npm run organon verify
# 4. Coverage check (>90% for core, 100% for gates)
npm run test:coverage
If any fail, do not commit.
When in Doubt
- Check ETHOS.md - Does this violate an invariant?
- Check PHILOSOPHY.md - Does this align with design decisions?
- Check three-layer-architecture.md - Is this the right pattern for gates?
- Ask: Would this tool enforce what I'm about to build?
Remember: Organon-tools builds tools that enforce methodology. If you wouldn't want the tool to allow this pattern, don't implement it.
Meta-Principle
The tools that enforce constraints must be built with more discipline than the code they govern.
If organon-tools has untested code, how can it enforce test coverage on others?
If organon-tools has invalid frontmatter, how can it validate others?
If organon-tools violates its own ETHOS.md, the methodology loses credibility.
Build the tools you wish existed when auditing someone else's work.
Error Recovery
| Failure |
Recovery Action |
| Tests fail |
Fix implementation to match test expectations. Do not skip or disable tests. |
| Coverage below threshold (>90% core, 100% gates) |
Add missing test cases for uncovered branches. Use npm run test:coverage to identify gaps. |
| TypeScript compilation errors |
Fix type issues. Do not use any or @ts-ignore as workarounds. |
| Gate warns instead of failing |
Change gate to produce pass/fail exit codes. Invariant INV-TOOLS-3: gates fail builds, never warn. |
--format json not supported |
Add JSON output format. Invariant INV-TOOLS-4: all commands must support --format json. |
| Breaking change detected |
Bump major version. Invariant INV-TOOLS-6: breaking changes require major version bump. |
| Spec not updated before implementation |
Stop. Update book-llms/ specification first, then implement to match. Spec is source of truth. |
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1---2name: organon-tools-developer3description: Enforces organon-tools ETHOS.md and PHILOSOPHY.md constraints during development. Use when adding CLI commands, verification gates, MCP tools, or fixing bugs in packages/tools/. Ensures 6 invariants (schema fidelity, test coverage, gates fail not warn, machine-parsable output, idempotency, semver) and 5 design principles (fail-fast, composability, testability, clarity). Use when this capability is needed.4---56# Organon Tools Developer Skill78> A Claude skill for agents developing organon-tools — ensures the tools that enforce methodology are built using methodology.910---1112## When to Use This Skill1314Use this skill when:15- Adding a new CLI command (`organon <command>`)16- Adding a new verification gate17- Adding a new MCP tool/prompt/resource18- Evolving the methodology specification (book-llms/)19- Fixing bugs or refactoring organon-tools code2021**Purpose:** Ensure organon-tools development follows its own ETHOS.md constraints and PHILOSOPHY.md design decisions.2223---2425## Identity Check (Always Start Here)2627Before any work, load and internalize:28291. **Read `organon/domains/tools/ETHOS.md`** - 6 invariants, 5 principles, 8 heuristics302. **Read `organon/domains/tools/PHILOSOPHY.md`** - 5 design decisions and trade-offs313. **Read `book-llms/three-layer-architecture.md`** - If working on verification gates3233**Critical constraint:** This tool builds tools that enforce methodology. The builder must follow what it builds.3435---3637## The 6 Invariants (Never Violate)3839From `organon/domains/tools/ETHOS.md`:40411. **Schema fidelity** - Frontmatter parser matches `book-llms/frontmatter-system.md` exactly422. **Every command has tests** - No untested code ships433. **Gates fail builds, not warn** - Verification gates produce pass/fail, never soft warnings444. **Machine-parsable output** - All commands support `--format json`455. **Idempotent operations** - Same input = same output, no side effects466. **Breaking changes require major version bump** - CLI, JSON schema, frontmatter schema4748**If your change violates any invariant, STOP and redesign.**4950---5152## The 5 Design Principles (Prioritized)5354From `organon/domains/tools/ETHOS.md`:55561. **Schema fidelity over convenience** - When book-llms/ spec conflicts with ease-of-use, spec wins572. **Fail-fast over forgiving** - Invalid input blocks execution, errors surface immediately583. **Composability over monoliths** - Commands work in Unix pipelines594. **Testability over implementation speed** - Pure functions with tests, thin CLI wrappers605. **Clarity over brevity** - Error messages explain what failed and how to fix it6162---6364## Core Architecture Pattern6566From `organon/domains/tools/PHILOSOPHY.md`:6768```69src/70├── core/ ← Pure functions (no I/O, no console, no process.exit)71│ ├── types.ts ← FileSystem interface, result types72│ ├── <feature>.ts ← Pure logic with tests73│ └── <feature>.test.ts ← Vitest tests (>90% coverage)74├── cli/commands/ ← Thin wrappers (yargs handlers)75│ └── <command>.ts ← Parse args → call core → format output76└── mcp/ ← Thin MCP adapters77 ├── tools.ts ← Wrap core functions as MCP tools78 └── prompts.ts ← Methodology workflow templates79```8081**Pattern:** Core logic is pure and testable. CLI and MCP are thin adapters.8283---8485## Workflow 1: Adding a New CLI Command8687**Example:** Adding `organon check-links` command88891. **Design phase** (before coding):90 - [ ] What does it do? (one sentence)91 - [ ] Is it idempotent? (same input = same output?)92 - [ ] Does it support `--format json`?93 - [ ] What exit codes? (0 = success, 1 = failure)94 - [ ] Does it compose with other commands?95962. **Implementation phase**:97 ```bash98 # Create core utility (pure function)99 touch src/core/check-links.ts100 touch src/core/check-links.test.ts101102 # Create CLI command wrapper103 touch src/cli/commands/check-links.ts104 ```1051063. **Core utility structure** (`src/core/check-links.ts`):107 ```typescript108 import { FileSystem, Result } from './types';109110 export interface CheckLinksOptions {111 projectRoot: string;112 // ... other options113 }114115 export interface CheckLinksResult {116 success: boolean;117 brokenLinks: Array<{ file: string; link: string; reason: string }>;118 }119120 export async function checkLinks(121 options: CheckLinksOptions,122 fs: FileSystem123 ): Promise<CheckLinksResult> {124 // Pure logic here - no console.log, no process.exit125 // Return structured results126 }127 ```1281294. **Write tests first** (`src/core/check-links.test.ts`):130 ```typescript131 import { describe, it, expect } from 'vitest';132 import { checkLinks } from './check-links';133 import { MockFileSystem } from './test-utils';134135 describe('checkLinks', () => {136 it('detects broken links', async () => {137 const fs = new MockFileSystem({ ... });138 const result = await checkLinks({ projectRoot: '.' }, fs);139 expect(result.brokenLinks).toHaveLength(1);140 });141142 // ... more tests143 });144 ```1451465. **CLI wrapper** (`src/cli/commands/check-links.ts`):147 ```typescript148 import yargs from 'yargs';149 import { checkLinks } from '../../core/check-links';150 import { NodeFileSystem } from '../../core/node-fs';151152 export const checkLinksCommand: yargs.CommandModule = {153 command: 'check-links',154 describe: 'Check for broken links in organon files',155 builder: (yargs) => {156 return yargs157 .option('format', {158 choices: ['human', 'json'] as const,159 default: 'human' as const,160 });161 },162 handler: async (args) => {163 const fs = new NodeFileSystem();164 const result = await checkLinks({ projectRoot: process.cwd() }, fs);165166 if (args.format === 'json') {167 console.log(JSON.stringify(result, null, 2));168 } else {169 // Human-readable output170 if (result.brokenLinks.length === 0) {171 console.log('✓ No broken links found');172 } else {173 console.error('✗ Found broken links:');174 result.brokenLinks.forEach(l => {175 console.error(` ${l.file}: ${l.link} (${l.reason})`);176 });177 }178 }179180 process.exit(result.success ? 0 : 1);181 },182 };183 ```1841856. **Register command** (in `src/cli/index.ts`):186 ```typescript187 import { checkLinksCommand } from './commands/check-links';188189 yargs190 .command(checkLinksCommand)191 // ... other commands192 ```1931947. **Verification checklist**:195 - [ ] Core function is pure (no I/O, no console, no process.exit)196 - [ ] Tests exist and pass (`npm test`)197 - [ ] Coverage >90% for core logic198 - [ ] Command supports `--format json`199 - [ ] Command is idempotent200 - [ ] Help text exists (`organon check-links --help`)201 - [ ] Error messages are clear and actionable202 - [ ] README.md updated with example usage203 - [ ] No TypeScript compilation errors (`npm run build`)204205---206207## Workflow 2: Adding a New Verification Gate208209**Example:** Adding a "freshness" gate that checks last-modified dates2102111. **Update specification first**:212 - [ ] Add gate description to `book-llms/three-layer-architecture.md`213 - [ ] Define what it checks, when it fails, how to fix214 - [ ] Commit spec changes before implementation2152162. **Implementation** (follow Workflow 1 pattern):217 ```bash218 # Core logic219 touch src/core/verify-freshness.ts220 touch src/core/verify-freshness.test.ts221 ```2222233. **Gate structure** (`src/core/verify-freshness.ts`):224 ```typescript225 import { FileSystem, VerificationResult } from './types';226227 export async function verifyFreshness(228 projectRoot: string,229 fs: FileSystem230 ): Promise<VerificationResult> {231 return {232 gate: 'freshness',233 passed: boolean,234 errors: Array<{ file: string; message: string; fix: string }>,235 warnings: [], // Gates never warn, only fail236 };237 }238 ```2392404. **Register gate** (in `src/core/verify.ts`):241 ```typescript242 import { verifyFreshness } from './verify-freshness';243244 const GATES = {245 'freshness': verifyFreshness,246 // ... other gates247 };248 ```2492505. **Test coverage requirements**:251 - [ ] 100% coverage for verification gate logic (stricter than general 90% requirement)252 - [ ] Test pass cases253 - [ ] Test all failure modes254 - [ ] Test fix suggestions are actionable2552566. **Update CLI** (`src/cli/commands/verify.ts`):257 ```typescript258 .option('gate', {259 type: 'array',260 choices: ['frontmatter', 'references', 'triplets', 'coverage', 'freshness'],261 description: 'Run specific gates (defaults to all)',262 })263 ```2642657. **Verification checklist**:266 - [ ] Spec updated in `book-llms/three-layer-architecture.md` FIRST267 - [ ] Gate fails builds (exit 1), never warns268 - [ ] 100% test coverage for gate logic269 - [ ] Error messages include file path, line number, and fix suggestion270 - [ ] Gate registered in verify.ts271 - [ ] CLI updated with new gate option272 - [ ] README.md documents the new gate273 - [ ] `organon verify --gate freshness` works274275---276277## Workflow 3: Adding a New MCP Tool/Prompt278279**Example:** Adding `organon_check_dependencies` MCP tool2802811. **Core function exists** (or create it following Workflow 1)2822832. **Add MCP tool** (`src/mcp/tools.ts`):284 ```typescript285 {286 name: 'organon_check_dependencies',287 description: 'Check if organon file dependencies are satisfied',288 inputSchema: {289 type: 'object',290 properties: {291 file: { type: 'string', description: 'Path to organon file' },292 },293 required: ['file'],294 },295 handler: async (args) => {296 const result = await checkDependencies(args.file, fs);297 return {298 content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],299 };300 },301 }302 ```3033043. **Add MCP prompt** (`src/mcp/prompts.ts`) - If it's a workflow:305 ```typescript306 {307 name: 'check-organon-dependencies',308 description: 'Workflow for verifying organon dependency chains',309 arguments: [310 { name: 'scope', description: 'Scope to check (product, domain, feature)', required: false },311 ],312 handler: async (args) => {313 return {314 messages: [315 {316 role: 'user',317 content: {318 type: 'text',319 text: `# Check Organon Dependencies Workflow\n\n...`,320 },321 },322 ],323 };324 },325 }326 ```3273284. **Verification checklist**:329 - [ ] Tool wraps existing core function (don't duplicate logic)330 - [ ] Input schema is clear and validates properly331 - [ ] Output is structured JSON332 - [ ] Tool registered in `src/mcp/server.ts`333 - [ ] MCP-SETUP.md updated with usage example334 - [ ] Test with `organon mcp` and verify tool appears335336---337338## Workflow 4: Evolving the Methodology (RFC-Aware)339340**Example:** Adding a new frontmatter field341342**DANGER ZONE:** Changes to `book-llms/` affect ALL projects using Organon.3433441. **RFC pattern** (from `book-llms/patterns.md`):345 - [ ] Create `book-llms/rfcs/RFC-NNN-<title>.md`346 - [ ] Document: Problem, Proposal, Trade-offs, Migration path347 - [ ] Get consensus (in this project: ensure it aligns with ETHOS.md)348 - [ ] Update spec (`book-llms/frontmatter-system.md`)349 - [ ] Update implementation (`packages/tools/src/core/frontmatter-parser.ts`)350 - [ ] Update tests351 - [ ] Document migration in CHANGELOG.md352 - [ ] Bump version (breaking = major, additive = minor)3533542. **Breaking change checklist** (requires major version bump):355 - [ ] Does it change frontmatter schema? (breaking)356 - [ ] Does it change CLI interface? (breaking)357 - [ ] Does it change JSON output schema? (breaking)358 - [ ] Does it remove/rename a command? (breaking)359 - [ ] If any YES, bump major version3603613. **Invariant check**:362 - **Schema fidelity:** Implementation must match spec exactly363 - **Breaking changes require major version bump:** Semver enforced364365---366367## Common Pitfalls (Don't Do This)3683691. **❌ Adding logic to CLI commands** → ✅ Add to `src/core/`, CLI is thin wrapper3702. **❌ Using `console.log` in core functions** → ✅ Return structured results, CLI formats3713. **❌ Using `process.exit` in core functions** → ✅ Return success/failure, CLI exits3724. **❌ Writing tests after code** → ✅ Write tests first (TDD pattern)3735. **❌ Making gates warn instead of fail** → ✅ Gates fail builds (INV-TOOLS-3)3746. **❌ Skipping `--format json` support** → ✅ All commands must support it (INV-TOOLS-4)3757. **❌ Implementing before spec updated** → ✅ Update book-llms/ spec first3768. **❌ Auto-fixing invalid frontmatter** → ✅ Fail-fast, force user to fix (principle #2)377378---379380## Pre-Commit Verification381382Before committing ANY code:383384```bash385# 1. Tests pass386npm test387388# 2. No TypeScript errors389npm run build390391# 3. Self-verification (dogfooding)392npm run organon verify393394# 4. Coverage check (>90% for core, 100% for gates)395npm run test:coverage396```397398**If any fail, do not commit.**399400---401402## When in Doubt4034041. **Check ETHOS.md** - Does this violate an invariant?4052. **Check PHILOSOPHY.md** - Does this align with design decisions?4063. **Check three-layer-architecture.md** - Is this the right pattern for gates?4074. **Ask:** Would this tool enforce what I'm about to build?408409**Remember:** Organon-tools builds tools that enforce methodology. If you wouldn't want the tool to allow this pattern, don't implement it.410411---412413## Meta-Principle414415> The tools that enforce constraints must be built with more discipline than the code they govern.416417If organon-tools has untested code, how can it enforce test coverage on others?418If organon-tools has invalid frontmatter, how can it validate others?419If organon-tools violates its own ETHOS.md, the methodology loses credibility.420421**Build the tools you wish existed when auditing someone else's work.**422423---424425## Error Recovery426427| Failure | Recovery Action |428|---------|-----------------|429| Tests fail | Fix implementation to match test expectations. Do not skip or disable tests. |430| Coverage below threshold (>90% core, 100% gates) | Add missing test cases for uncovered branches. Use `npm run test:coverage` to identify gaps. |431| TypeScript compilation errors | Fix type issues. Do not use `any` or `@ts-ignore` as workarounds. |432| Gate warns instead of failing | Change gate to produce pass/fail exit codes. Invariant INV-TOOLS-3: gates fail builds, never warn. |433| `--format json` not supported | Add JSON output format. Invariant INV-TOOLS-4: all commands must support `--format json`. |434| Breaking change detected | Bump major version. Invariant INV-TOOLS-6: breaking changes require major version bump. |435| Spec not updated before implementation | Stop. Update `book-llms/` specification first, then implement to match. Spec is source of truth. |436437---438> Converted and distributed by [TomeVault](https://tomevault.io/claim/vledicfranco) — claim your Tome and manage your conversions.439<!-- tomevault:4.0:skill_md:2026-04-15 -->