Skip to content

⛰️ LifeOS — The AI-powered Life Operating System that helps you hill climb to wherever you're going.

feat(skills): add system-createskill and system-createcli meta-skills

Daniel Miessler94f1e22bf359
diff --git a/.claude/skills/system-createcli/SKILL.md b/.claude/skills/system-createcli/SKILL.md
new file mode 100644
index 00000000..7343de95
--- /dev/null
+++ b/.claude/skills/system-createcli/SKILL.md
@@ -0,0 +1,354 @@
+---
+name: system-createcli
+description: Generate production-quality TypeScript CLIs with full documentation, error handling, and best practices. Creates deterministic, type-safe command-line tools following PAI's CLI-First Architecture. USE WHEN user says "create a CLI", "build a command-line tool", "make a CLI for X", or requests CLI generation. (user)
+location: user
+---
+
+# system-createcli
+
+**Automated CLI Generation System**
+
+Generate production-ready TypeScript CLIs with comprehensive documentation, type safety, error handling, and PAI's CLI-First Architecture principles.
+
+---
+
+## 🎯 WORKFLOW ROUTING (SYSTEM PROMPT)
+
+**When user requests CLI creation, follow this routing:**
+
+### Primary Workflow: Create New CLI
+**Triggers:** "create CLI", "build command-line tool", "make CLI for X", "generate CLI"
+**Route to:** `workflows/create-cli.md`
+**Action:** Generate complete CLI from requirements
+
+### Extension Workflow: Add Command
+**Triggers:** "add command to CLI", "extend CLI with", "add feature to existing CLI"
+**Route to:** `workflows/add-command.md`
+**Action:** Add new command to existing CLI
+
+### Migration Workflow: Upgrade Complexity Tier
+**Triggers:** "upgrade CLI", "migrate to Commander", "CLI needs more complexity"
+**Route to:** `workflows/upgrade-tier.md`
+**Action:** Migrate Tier 1 → Tier 2 (manual → Commander.js)
+
+### Testing Workflow: Add Test Suite
+**Triggers:** "add tests to CLI", "test scaffolding", "need CLI tests"
+**Route to:** `workflows/add-testing.md`
+**Action:** Generate comprehensive test suite
+
+### Distribution Workflow: Setup Publishing
+**Triggers:** "publish CLI", "distribute CLI", "make standalone binary"
+**Route to:** `workflows/setup-distribution.md`
+**Action:** Configure npm publishing or binary distribution
+
+---
+
+## 🚀 WHEN TO ACTIVATE THIS SKILL
+
+Activate when you see these patterns:
+
+### Direct Requests
+- "Create a CLI for [API/service/tool]"
+- "Build a command-line interface for X"
+- "Make a CLI that does Y"
+- "Generate a TypeScript CLI"
+- "I need a CLI tool for Z"
+
+### Context Clues
+- User describes repetitive API calls → Suggest CLI
+- User mentions "I keep typing this command" → Suggest CLI wrapper
+- User has bash script doing complex work → Suggest TypeScript CLI replacement
+- User working with API that lacks official CLI → Suggest creating one
+
+### Examples
+- ✅ "Create a CLI for the GitHub API"
+- ✅ "Build a command-line tool to process CSV files"
+- ✅ "Make a CLI for my database migrations"
+- ✅ "Generate a CLI that wraps this API"
+- ✅ "I need a tool like llcli but for Notion API"
+
+---
+
+## 💡 CORE CAPABILITIES
+
+### Three-Tier Template System
+
+**Tier 1: llcli-Style (DEFAULT - 80% of use cases)**
+- Manual argument parsing (process.argv)
+- Zero framework dependencies
+- Bun + TypeScript
+- Type-safe interfaces
+- ~300-400 lines total
+- **Perfect for:** API clients, data transformers, simple automation
+
+**When to use Tier 1:**
+- ✅ 2-10 commands
+- ✅ Simple arguments (flags, values)
+- ✅ JSON output
+- ✅ No subcommands
+- ✅ Fast development
+
+**Tier 2: Commander.js (ESCALATION - 15% of use cases)**
+- Framework-based parsing
+- Subcommands + nested options
+- Auto-generated help
+- Plugin-ready
+- **Perfect for:** Complex multi-command tools
+
+**When to use Tier 2:**
+- ❌ 10+ commands needing grouping
+- ❌ Complex nested options
+- ❌ Plugin architecture
+- ❌ Multiple output formats
+
+**Tier 3: oclif (REFERENCE ONLY - 5% of use cases)**
+- Documentation only (no templates)
+- Enterprise-grade plugin systems
+- **Perfect for:** Heroku CLI, Salesforce CLI scale (rare)
+
+### What Every Generated CLI Includes
+
+**1. Complete Implementation**
+- TypeScript source with full type safety
+- All commands functional and tested
+- Error handling with proper exit codes
+- Configuration management
+
+**2. Comprehensive Documentation**
+- README.md with philosophy, usage, examples
+- QUICKSTART.md for common patterns
+- Inline help text (--help)
+- API response documentation
+
+**3. Development Setup**
+- package.json (Bun configuration)
+- tsconfig.json (strict mode)
+- .env.example (configuration template)
+- File permissions configured
+
+**4. Quality Standards**
+- Type-safe throughout
+- Deterministic output (JSON)
+- Composable (pipes to jq, grep)
+- Error messages with context
+- Exit code compliance
+
+---
+
+## 🏗️ INTEGRATION WITH KAI
+
+### Technology Stack Alignment
+
+Generated CLIs follow PAI's standards:
+- ✅ **Runtime:** Bun (NOT Node.js)
+- ✅ **Language:** TypeScript (NOT JavaScript or Python)
+- ✅ **Package Manager:** Bun (NOT npm/yarn/pnpm)
+- ✅ **Testing:** Vitest (when tests added)
+- ✅ **Output:** Deterministic JSON (composable)
+- ✅ **Documentation:** README + QUICKSTART (llcli pattern)
+
+### Repository Placement
+
+Generated CLIs go to:
+- `~/.claude/bin/[cli-name]/` - Personal CLIs (like llcli)
+- `~/Projects/[project-name]/` - Project-specific CLIs
+- `~/Projects/PAI/examples/clis/` - Example CLIs (PUBLIC repo)
+
+**SAFETY:** Always verify repository location before git operations
+
+### CLI-First Architecture Principles
+
+Every generated CLI follows:
+1. **Deterministic** - Same input → Same output
+2. **Clean** - Single responsibility
+3. **Composable** - JSON output pipes to other tools
+4. **Documented** - Comprehensive help and examples
+5. **Testable** - Predictable behavior
+
+---
+
+## 📚 EXTENDED CONTEXT
+
+**For detailed information, read these files:**
+
+### Workflow Documentation
+- `workflows/create-cli.md` - Main CLI generation workflow (decision tree, 10-step process)
+- `workflows/add-command.md` - Add commands to existing CLIs
+- `workflows/upgrade-tier.md` - Migrate simple → complex
+- `workflows/add-testing.md` - Test suite generation
+- `workflows/setup-distribution.md` - Publishing configuration
+
+### Reference Documentation
+- `framework-comparison.md` - Manual vs Commander vs oclif (with research)
+- `patterns.md` - Common CLI patterns (from llcli analysis)
+- `testing-strategies.md` - CLI testing approaches (Jest, Vitest, Playwright)
+- `distribution.md` - Publishing strategies (npm, standalone binaries)
+- `typescript-patterns.md` - Type safety patterns (from tsx, vite, bun research)
+
+### Tools & Templates
+- `tools/templates/tier1/` - llcli-style templates (default)
+- `tools/templates/tier2/` - Commander.js templates (escalation)
+- `tools/generators/` - Generation scripts (TypeScript)
+- `tools/validators/` - Quality gates (validation)
+
+### Examples
+- `examples/api-cli/` - API client (reference: llcli)
+- `examples/file-processor/` - File operations
+- `examples/data-transform/` - Complex CLI (Commander.js)
+
+---
+
+## 📖 EXAMPLES
+
+### Example 1: API Client CLI (Tier 1)
+
+**User Request:**
+"Create a CLI for the GitHub API that can list repos, create issues, and search code"
+
+**Generated Structure:**
+```
+~/.claude/bin/ghcli/
+├── ghcli.ts # 350 lines, complete implementation
+├── package.json # Bun + TypeScript
+├── tsconfig.json # Strict mode
+├── .env.example # GITHUB_TOKEN=your_token
+├── README.md # Full documentation
+└── QUICKSTART.md # Common use cases
+```
+
+**Usage:**
+```bash
+ghcli repos --user danielmiessler
+ghcli issues create --repo pai --title "Bug fix"
+ghcli search "typescript CLI"
+ghcli --help
+```
+
+---
+
+### Example 2: File Processor (Tier 1)
+
+**User Request:**
+"Build a CLI to convert markdown files to HTML with frontmatter extraction"
+
+**Generated Structure:**
+```
+~/.claude/bin/md2html/
+├── md2html.ts
+├── package.json
+├── README.md
+└── QUICKSTART.md
+```
+
+**Usage:**
+```bash
+md2html convert input.md output.html
+md2html batch *.md output/
+md2html extract-frontmatter post.md
+```
+
+---
+
+### Example 3: Data Pipeline (Tier 2)
+
+**User Request:**
+"Create a CLI for data transformation with multiple formats, validation, and analysis commands"
+
+**Generated Structure:**
+```
+~/.claude/bin/data-cli/
+├── data-cli.ts # Commander.js with subcommands
+├── package.json
+├── README.md
+└── QUICKSTART.md
+```
+
+**Usage:**
+```bash
+data-cli convert json csv input.json
+data-cli validate schema data.json
+data-cli analyze stats data.csv
+data-cli transform filter --column=status --value=active
+```
+
+---
+
+## ✅ QUALITY STANDARDS
+
+Every generated CLI must pass these gates:
+
+### 1. Compilation
+- ✅ TypeScript compiles with zero errors
+- ✅ Strict mode enabled
+- ✅ No `any` types except justified
+
+### 2. Functionality
+- ✅ All commands work as specified
+- ✅ Error handling comprehensive
+- ✅ Exit codes correct (0 success, 1 error)
+
+### 3. Documentation
+- ✅ README explains philosophy and usage
+- ✅ QUICKSTART has common examples
+- ✅ --help text comprehensive
+- ✅ All flags/options documented
+
+### 4. Code Quality
+- ✅ Type-safe throughout
+- ✅ Clean function separation
+- ✅ Error messages actionable
+- ✅ Configuration externalized
+
+### 5. Integration
+- ✅ Follows PAI tech stack (Bun, TypeScript)
+- ✅ CLI-First Architecture principles
+- ✅ Deterministic output (JSON)
+- ✅ Composable with other tools
+
+---
+
+## 🎯 PHILOSOPHY
+
+### Why This Skill Exists
+
+Daniel repeatedly creates CLIs for APIs and tools. Each time:
+1. Starts with bash script
+2. Realizes it needs error handling
+3. Realizes it needs help text
+4. Realizes it needs type safety
+5. Rewrites in TypeScript
+6. Adds documentation
+7. Now has production CLI
+
+**This skill automates steps 1-7.**
+
+### The llcli Pattern
+
+The `llcli` CLI (Limitless.ai API) proves this pattern works:
+- 327 lines of TypeScript
+- Zero dependencies (no framework)
+- Complete error handling
+- Comprehensive documentation
+- Production-ready immediately
+
+**This skill replicates that success.**
+
+### Design Principles
+
+1. **Start Simple** - Default to Tier 1 (llcli-style)
+2. **Escalate When Needed** - Tier 2 only when justified
+3. **Complete, Not Scaffold** - Every CLI is production-ready
+4. **Documentation First** - README explains "why" not just "how"
+5. **Type Safety** - TypeScript strict mode always
+
+---
+
+## 🔗 RELATED SKILLS
+
+- **development** - For complex feature development (not CLI-specific)
+- **system-mcp** - For web scraping CLIs (Bright Data, Apify wrappers)
+- **personal-lifelog** - Example of skill using llcli
+
+---
+
+**This skill turns "I need a CLI for X" into production-ready tools in minutes, following proven patterns from llcli and PAI's CLI-First Architecture.**
diff --git a/.claude/skills/system-createcli/framework-comparison.md b/.claude/skills/system-createcli/framework-comparison.md
new file mode 100644
index 00000000..6da0cd58
--- /dev/null
+++ b/.claude/skills/system-createcli/framework-comparison.md
@@ -0,0 +1,477 @@
+# CLI Framework Comparison
+
+**Comprehensive analysis of TypeScript CLI frameworks for informed tier selection**
+
+---
+
+## 🎯 Quick Recommendation Matrix
+
+| Use Case | Framework | Why |
+|----------|-----------|-----|
+| **API Client** (2-10 commands) | Manual Parsing (Tier 1) | Zero deps, 300 lines, production-ready |
+| **File Processor** (simple args) | Manual Parsing (Tier 1) | Fast development, type-safe, composable |
+| **Multi-Tool** (10+ commands) | Commander.js (Tier 2) | Subcommands, auto-help, proven |
+| **Plugin System** (extensible) | oclif (Tier 3) | Enterprise-grade, reference only |
+
+**Rule:** Default to Manual → escalate to Commander → reference oclif only
+
+---
+
+## 📊 Framework Comparison Table
+
+| Framework | Stars | Bundle Size | TypeScript | Best For | PAI Tier |
+|-----------|-------|-------------|------------|----------|----------|
+| **Manual Parsing** | N/A | 0 KB | Native | Simple CLIs (llcli) | Tier 1 ⭐ DEFAULT |
+| **Commander.js** | 25K+ | ~100 KB | Built-in | General CLIs | Tier 2 |
+| **oclif** | 12K+ | 22+ MB | First-class | Enterprise plugins | Tier 3 (ref only) |
+| **cleye** | N/A | Small | Schema inference | Modern TS CLIs | Alternative |
+| **citty** | N/A | Moderate | Discriminated unions | Complex type safety | Alternative |
+| **Yargs** | 30K+ | Larger | @types | Config-heavy | Not recommended |
+
+---
+
+## 1️⃣ TIER 1: Manual Parsing (llcli Pattern)
+
+### Pattern
+
+```typescript
+#!/usr/bin/env bun
+
+async function main() {
+ const args = process.argv.slice(2);
+
+ if (args.length === 0 || args[0] === '--help') {
+ showHelp();
+ return;
+ }
+
+ const command = args[0];
+
+ switch (command) {
+ case 'today':
+ await fetchToday();
+ break;
+ case 'date':
+ if (!args[1]) {
+ console.error('Error: date requires YYYY-MM-DD argument');
+ process.exit(1);
+ }
+ await fetchDate(args[1]);
+ break;
+ case 'search':
+ const keyword = args[1];
+ const limitIdx = args.indexOf('--limit');
+ const limit = limitIdx !== -1 ? parseInt(args[limitIdx + 1]) : 20;
+ await fetchSearch(keyword, limit);
+ break;
+ default:
+ console.error(`Unknown command: ${command}`);
+ process.exit(1);
+ }
+}
+
+main().catch(error => {
+ console.error('Fatal:', error);
+ process.exit(1);
+});
+```
+
+### Pros
+- ✅ Zero dependencies (no node_modules bloat)
+- ✅ Complete control over parsing logic
+- ✅ Type-safe with TypeScript interfaces
+- ✅ 300-400 lines total (easy to understand)
+- ✅ Fast development (no framework learning curve)
+- ✅ Proven pattern (llcli is production-ready)
+- ✅ Perfect for Bun runtime
+- ✅ Deterministic behavior
+
+### Cons
+- ❌ Manual help text (but this ensures quality)
+- ❌ Manual argument parsing (but simple)
+- ❌ No built-in subcommand routing (use Tier 2 if needed)
+- ❌ Repetitive for 20+ commands (escalate at that point)
+
+### When to Use (DEFAULT)
+- ✅ 2-10 commands
+- ✅ API client wrappers
+- ✅ Data transformers
+- ✅ File processors
+- ✅ Simple automation tools
+- ✅ JSON output only
+- ✅ Fast development priority
+
+### Reference Implementation
+**Location:** `~/.claude/bin/llcli/llcli.ts` (327 lines)
+**Commands:** today, date, search
+**Pattern:** Exactly what this tier generates
+
+---
+
+## 2️⃣ TIER 2: Commander.js
+
+### Pattern
+
+```typescript
+#!/usr/bin/env bun
+
+import { Command } from 'commander';
+
+const program = new Command();
+
+program
+ .name('mycli')
+ .description('Production CLI tool')
+ .version('1.0.0');
+
+program
+ .command('convert <format> <input>')
+ .option('-o, --output <file>', 'output file')
+ .option('--verbose', 'verbose logging')
+ .action((format: string, input: string, options) => {
+ console.log(`Converting ${input} to ${format}`);
+ if (options.output) {
+ console.log(`Output: ${options.output}`);
+ }
+ });
+
+program
+ .command('validate')
+ .argument('<file>', 'file to validate')
+ .option('--strict', 'strict mode')
+ .action((file: string, options) => {
+ console.log(`Validating ${file}`);
+ });
+
+program.parse();
+```
+
+### Pros
+- ✅ Auto-generated help (from command definitions)
+- ✅ Subcommand routing built-in
+- ✅ Fluent API (readable, chainable)
+- ✅ TypeScript definitions included
+- ✅ Large community (25K+ stars)
+- ✅ Well-documented
+- ✅ Option parsing automatic
+- ✅ Lightweight (~100 KB, zero sub-dependencies)
+
+### Cons
+- ❌ Framework dependency (not zero-dep like Tier 1)
+- ❌ Learning curve (need to understand API)
+- ❌ Opinionated structure
+- ❌ Overkill for simple CLIs (use Tier 1 instead)
+- ❌ Bun may prefer zero-dep approach
+
+### When to Use (ESCALATION)
+- ❌ 10+ commands needing organization
+- ❌ Subcommands (e.g., `cli convert json csv` vs `cli convert csv json`)
+- ❌ Plugin architecture needed
+- ❌ Complex option combinations
+- ❌ Multiple output format engines
+- ❌ Git-style command groups
+
+### Example Use Case
+```bash
+# Data transformation CLI with subcommands
+data-cli convert json csv input.json --output data.csv
+data-cli convert csv json input.csv
+data-cli validate schema data.json --strict
+data-cli analyze stats data.csv
+data-cli analyze trends data.csv --window 7d
+```
+
+**Pattern:** Commands naturally group into categories (convert, validate, analyze)
+
+---
+
+## 3️⃣ TIER 3: oclif (Reference Only)
+
+### Pattern
+
+```typescript
+import { Command, Flags, Args } from '@oclif/core';
+
+export default class Hello extends Command {
+ static description = 'Say hello';
+
+ static examples = [
+ '<%= config.bin %> <%= command.id %> --name World',
+ ];
+
+ static flags = {
+ name: Flags.string({
+ char: 'n',
+ description: 'name to greet',
+ required: true,
+ }),
+ verbose: Flags.boolean({ char: 'v' }),
+ };
+
+ static args = {
+ file: Args.string({ description: 'file to process' }),
+ };
+
+ async run() {
+ const { flags, args } = await this.parse(Hello);
+ this.log(`Hello ${flags.name}!`);
+ }
+}
+```
+
+### Pros
+- ✅ Enterprise-grade plugin system
+- ✅ Code generation (`oclif generate command`)
+- ✅ Topics for hierarchical commands
+- ✅ Auto-updates mechanism
+- ✅ Multi-command CLIs (Heroku, Salesforce scale)
+- ✅ Class-based commands (OOP style)
+- ✅ ES modules + CommonJS compatible
+
+### Cons
+- ❌ Heavy bundle size (22+ MB)
+- ❌ Steep learning curve
+- ❌ Complex setup
+- ❌ Overkill for 99% of CLIs
+- ❌ Not aligned with PAI's minimal approach
+
+### When to Reference (RARE)
+- Enterprise plugin systems (Heroku CLI scale)
+- 50+ commands with complex organization
+- Auto-update mechanisms critical
+- Multi-tenant CLI platforms
+
+**Note:** This skill does NOT generate oclif CLIs. Documentation only for reference.
+
+---
+
+## 🔬 RESEARCH FINDINGS: Type-Safe Frameworks
+
+### cleye (Schema-Driven Inference)
+
+**Pattern:**
+```typescript
+import { cli } from 'cleye';
+
+const argv = cli({
+ name: 'mycli',
+ flags: {
+ noCache: {
+ type: Boolean,
+ description: 'Disable cache',
+ },
+ tsconfig: {
+ type: String,
+ description: 'Path to tsconfig',
+ },
+ },
+ parameters: ['<script path>'],
+});
+
+// argv.flags.noCache → boolean
+// argv.flags.tsconfig → string | undefined
+// argv._.scriptPath → string | undefined
+```
+
+**Key Insight:** TypeScript infers full shape from flag definitions (zero manual typing)
+
+**Use When:**
+- Zero boilerplate preference
+- Modern TypeScript CLI
+- Full type inference needed
+
+**Trade-off vs Tier 1:**
+- + Type inference automatic
+- - Framework dependency
+- - Less control over parsing
+
+---
+
+### citty (Discriminated Unions)
+
+**Pattern:**
+```typescript
+import { defineCommand, runMain } from 'citty';
+
+const convert = defineCommand({
+ meta: {
+ name: 'convert',
+ description: 'Convert files',
+ },
+ args: {
+ format: {
+ type: 'positional',
+ description: 'Output format',
+ required: true,
+ },
+ strict: {
+ type: 'boolean',
+ description: 'Strict mode',
+ },
+ },
+ async run({ args }) {
+ // args.format → string (required)
+ // args.strict → boolean | undefined
+ console.log(`Converting to ${args.format}`);
+ },
+});
+
+runMain(convert);
+```
+
+**Key Insight:** Discriminated unions provide exhaustive type checking
+
+**Use When:**
+- Complex command trees
+- Type safety critical
+- Argument validation needed
+
+**Trade-off vs Tier 1:**
+- + Advanced type safety
+- - Framework abstraction
+- - Additional dependency
+
+---
+
+## 📈 DECISION CRITERIA
+
+### Choose Manual Parsing (Tier 1) If:
+- [ ] CLI has 2-10 simple commands
+- [ ] Commands take basic arguments (strings, numbers, flags)
+- [ ] Output is JSON only
+- [ ] No subcommand grouping needed
+- [ ] Zero dependencies preferred
+- [ ] Fast development critical
+- [ ] Following llcli pattern
+
+**→ 80% of CLIs should use Tier 1**
+
+---
+
+### Choose Commander.js (Tier 2) If:
+- [ ] CLI has 10+ commands needing organization
+- [ ] Subcommands required (git-style: `cli category command`)
+- [ ] Complex nested options
+- [ ] Plugin architecture planned
+- [ ] Multiple output formats (JSON, table, CSV)
+- [ ] Auto-generated help essential
+
+**→ 15% of CLIs need Tier 2**
+
+---
+
+### Reference oclif (Tier 3) If:
+- [ ] Enterprise plugin system (Heroku/Salesforce scale)
+- [ ] 50+ commands with topics
+- [ ] Auto-update mechanism
+- [ ] Multi-tenant platform
+
+**→ 5% of CLIs (NOT generated by this skill)**
+
+---
+
+## 🎯 llcli Pattern Analysis
+
+### Why Manual Parsing Works
+
+**llcli demonstrates:**
+1. **327 lines total** - Complete CLI with docs
+2. **Zero dependencies** - No node_modules needed
+3. **Type-safe** - Full TypeScript interfaces
+4. **Production-ready** - Error handling, help, validation
+5. **Composable** - JSON output pipes everywhere
+6. **Documented** - README explains philosophy
+
+**Key Insight:** For API wrappers and simple tools, manual parsing is SUPERIOR to frameworks because:
+- Complete control over behavior
+- No framework magic to debug
+- Easier to understand and modify
+- Faster to develop (no API to learn)
+- Deterministic (no framework updates breaking things)
+
+### When llcli Pattern Breaks Down
+
+**Indicators to escalate:**
+- 15+ commands making switch statement unwieldy
+- Need for subcommand grouping (convert json csv vs convert csv json)
+- Plugin/extension system required
+- Complex option validation across commands
+
+**At that point → Tier 2 (Commander.js)**
+
+---
+
+## 💡 Best Practices
+
+### 1. **Start Tier 1, Escalate When Proven**
+Don't guess complexity. Build simple first.
+
+### 2. **Frameworks Are Not Free**
+Every dependency is debt. Justify it.
+
+### 3. **Type Safety > Frameworks**
+Manual parsing with TypeScript beats framework without types.
+
+### 4. **Help Text Quality Matters**
+Auto-generated help is convenient but often poor quality. Manual help (like llcli) is better.
+
+### 5. **Composability > Features**
+JSON output + pipes > built-in table rendering.
+
+### 6. **Test Immediately**
+Run `--help` before declaring framework choice successful.
+
+### 7. **Read Real Code**
+Study llcli, not just framework docs.
+
+### 8. **Benchmark Size**
+Check dist/ folder size. Tier 1 CLIs are <100 KB.
+
+---
+
+## 📚 Additional Research
+
+### Yargs (NOT Recommended for PAI)
+
+**Why not recommended:**
+- Larger bundle size than Commander
+- Less TypeScript-friendly
+- Verbose syntax
+- Async typing issues
+
+**Use Commander.js instead if escalating from Tier 1.**
+
+---
+
+### Ink (NOT Recommended for General CLIs)
+
+**Why not recommended:**
+- React-based (massive overhead)
+- Interactive UIs (not deterministic)
+- Large bundle size
+- Overkill for data processing
+
+**Use for:** Dashboard UIs, dev servers with live updates
+
+**Not for:** API clients, file processors, automation
+
+---
+
+## ✅ Final Recommendation
+
+**For PAI system-createcli skill:**
+
+1. **Default:** Tier 1 (Manual Parsing / llcli pattern)
+2. **Escalation:** Tier 2 (Commander.js) when decision tree indicates
+3. **Reference:** Tier 3 (oclif) for documentation only
+
+**Philosophy:** The best framework is no framework until proven otherwise.
+
+---
+
+**Sources:**
+- llcli production implementation (~/.claude/bin/llcli/)
+- Commander.js 12.x documentation
+- oclif core documentation
+- Perplexity research (32 sub-queries on CLI frameworks)
+- Codex research (tsx, vite, next, bun CLI analysis)
diff --git a/.claude/skills/system-createcli/patterns.md b/.claude/skills/system-createcli/patterns.md
new file mode 100644
index 00000000..81db8d9a
--- /dev/null
+++ b/.claude/skills/system-createcli/patterns.md
@@ -0,0 +1,487 @@
+# Common CLI Patterns
+
+**Reusable patterns for TypeScript CLIs based on llcli and production CLIs.**
+
+---
+
+## 🎯 CORE PATTERNS
+
+### 1. Configuration Loading
+
+**Pattern from llcli:**
+
+```typescript
+interface Config {
+ apiKey: string;
+ baseUrl: string;
+}
+
+const DEFAULTS = {
+ baseUrl: 'https://api.example.com',
+ timeout: 30000,
+ limit: 20,
+} as const;
+
+function loadConfig(): Config {
+ const envPath = join(homedir(), '.claude', '.env');
+
+ try {
+ const envContent = readFileSync(envPath, 'utf-8');
+ const apiKey = envContent
+ .split('\n')
+ .find(line => line.startsWith('API_KEY='))
+ ?.split('=')[1]
+ ?.trim();
+
+ if (!apiKey) {
+ console.error('Error: API_KEY not found in ~/.claude/.env');
+ console.error('Add: API_KEY=your_key_here');
+ process.exit(1);
+ }
+
+ return {
+ apiKey,
+ baseUrl: process.env.API_BASE_URL || DEFAULTS.baseUrl,
+ };
+ } catch (error) {
+ console.error('Error: Cannot read ~/.claude/.env');
+ console.error('Create file: touch ~/.claude/.env');
+ process.exit(1);
+ }
+}
+```
+
+**Key principles:**
+- Load from ~/.claude/.env (PAI standard)
+- Clear error messages with resolution steps
+- Defaults for optional config
+- Type-safe Config interface
+
+---
+
+### 2. API Client Pattern
+
+**Fetch wrapper with error handling:**
+
+```typescript
+async function apiRequest<T>(
+ config: Config,
+ endpoint: string,
+ params: Record<string, string> = {}
+): Promise<T> {
+ const queryParams = new URLSearchParams(params);
+ const url = `${config.baseUrl}/${endpoint}?${queryParams}`;
+
+ try {
+ const response = await fetch(url, {
+ headers: {
+ 'Authorization': `Bearer ${config.apiKey}`,
+ 'Content-Type': 'application/json',
+ },
+ });
+
+ if (!response.ok) {
+ throw new Error(`API error: ${response.status} ${response.statusText}`);
+ }
+
+ return await response.json() as T;
+ } catch (error) {
+ if (error instanceof Error) {
+ console.error('Request failed:', error.message);
+ } else {
+ console.error('Unknown error:', error);
+ }
+ process.exit(1);
+ }
+}
+
+// Usage
+const data = await apiRequest<ResponseType>(config, 'endpoint', {
+ param: 'value',
+});
+```
+
+---
+
+### 3. Command Function Pattern
+
+**One function per command:**
+
+```typescript
+/**
+ * Fetch items by date
+ *
+ * @param date - Date in YYYY-MM-DD format
+ * @param options - Command options
+ */
+async function fetchByDate(
+ date: string,
+ options: { limit?: number } = {}
+): Promise<void> {
+ const config = loadConfig();
+
+ // Validate input
+ if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
+ console.error('Error: Date must be YYYY-MM-DD format');
+ console.error('Example: 2025-11-17');
+ process.exit(1);
+ }
+
+ // Build params
+ const params = {
+ date,
+ limit: (options.limit || DEFAULTS.limit).toString(),
+ };
+
+ // Make request
+ const data = await apiRequest<ApiResponse>(config, 'items', params);
+
+ // Output JSON
+ console.log(JSON.stringify(data, null, 2));
+}
+```
+
+**Principles:**
+- Clear function signature
+- Input validation with helpful errors
+- Use loadConfig() inside function
+- JSON output to stdout
+- Errors to stderr
+
+---
+
+### 4. Argument Parsing Pattern
+
+**Manual parsing with validation:**
+
+```typescript
+function parseArguments(args: string[]): {
+ command: string;
+ args: string[];
+ options: Record<string, string | boolean>;
+} {
+ if (args.length === 0) {
+ return { command: 'help', args: [], options: {} };
+ }
+
+ const command = args[0];
+ const options: Record<string, string | boolean> = {};
+ const commandArgs: string[] = [];
+
+ for (let i = 1; i < args.length; i++) {
+ const arg = args[i];
+
+ if (arg.startsWith('--')) {
+ // Long option
+ const key = arg.slice(2);
+ const next = args[i + 1];
+
+ if (next && !next.startsWith('-')) {
+ options[key] = next;
+ i++; // Skip next
+ } else {
+ options[key] = true;
+ }
+ } else if (arg.startsWith('-')) {
+ // Short option
+ const key = arg.slice(1);
+ options[key] = true;
+ } else {
+ // Positional argument
+ commandArgs.push(arg);
+ }
+ }
+
+ return { command, args: commandArgs, options };
+}
+```
+
+---
+
+### 5. Help Text Pattern
+
+**Comprehensive, actionable help:**
+
+```typescript
+function showHelp(): void {
+ console.log(`
+${CLI_NAME} - ${DESCRIPTION}
+${'='.repeat(CLI_NAME.length + DESCRIPTION.length + 3)}
+
+USAGE:
+ ${CLI_NAME} <command> [arguments] [options]
+
+COMMANDS:
+ command1 <arg> Description of command1
+ command2 [optional] Description of command2
+ help, --help, -h Show this help
+ version, --version, -v Show version
+
+OPTIONS:
+ --limit <n> Max results (default: 20)
+ --format <type> Output format (json, csv)
+ --verbose Verbose logging
+
+EXAMPLES:
+ # Common use case 1
+ $ ${CLI_NAME} command1 value
+
+ # Common use case 2
+ $ ${CLI_NAME} command2 --limit 50
+
+ # Piping to jq
+ $ ${CLI_NAME} command1 value | jq '.data[]'
+
+OUTPUT:
+ JSON to stdout (deterministic)
+ Errors to stderr
+ Exit code: 0 = success, 1 = error
+
+CONFIGURATION:
+ API Key: ~/.claude/.env (API_KEY=your_key)
+ Base URL: ${DEFAULTS.baseUrl}
+
+PHILOSOPHY:
+ ${CLI_NAME} follows PAI's CLI-First Architecture:
+ - Deterministic: Same input → Same output
+ - Clean: Single responsibility
+ - Composable: Pipes to jq, grep, etc.
+ - Documented: This help + README
+ - Testable: Predictable behavior
+
+For full documentation: ~/.claude/bin/${CLI_NAME}/README.md
+Version: ${VERSION}
+`);
+}
+```
+
+---
+
+### 6. Error Handling Pattern
+
+**Type-safe custom errors:**
+
+```typescript
+class CLIError extends Error {
+ constructor(
+ message: string,
+ public readonly code: string,
+ public readonly hint?: string,
+ public readonly exitCode: number = 1
+ ) {
+ super(message);
+ this.name = 'CLIError';
+ }
+}
+
+function handleError(error: unknown): never {
+ if (error instanceof CLIError) {
+ console.error(`Error [${error.code}]: ${error.message}`);
+ if (error.hint) {
+ console.error(`Hint: ${error.hint}`);
+ }
+ process.exit(error.exitCode);
+ }
+
+ if (error instanceof Error) {
+ console.error('Unexpected error:', error.message);
+ if (program.opts().debug) {
+ console.error(error.stack);
+ }
+ } else {
+ console.error('Unknown error:', error);
+ }
+
+ process.exit(1);
+}
+
+// Usage
+throw new CLIError(
+ 'Configuration file not found',
+ 'ERR_NO_CONFIG',
+ 'Run: mycli init'
+);
+
+// Global handler
+process.on('uncaughtException', handleError);
+process.on('unhandledRejection', handleError);
+```
+
+---
+
+### 7. Main Entry Pattern
+
+**Structured main with routing:**
+
+```typescript
+async function main(): Promise<void> {
+ const args = process.argv.slice(2);
+
+ // Help/version shortcuts
+ if (!args.length || args[0] === 'help' || args[0] === '--help') {
+ showHelp();
+ return;
+ }
+
+ if (args[0] === 'version' || args[0] === '--version') {
+ console.log(`${CLI_NAME} version ${VERSION}`);
+ return;
+ }
+
+ // Parse arguments
+ const { command, args: cmdArgs, options } = parseArguments(args);
+
+ // Route to command
+ switch (command) {
+ case 'command1':
+ await command1(cmdArgs[0], options);
+ break;
+
+ case 'command2':
+ await command2(cmdArgs, options);
+ break;
+
+ default:
+ throw new CLIError(
+ `Unknown command: ${command}`,
+ 'ERR_UNKNOWN_COMMAND',
+ `Run "${CLI_NAME} --help" for usage`
+ );
+ }
+}
+
+// Execute
+main().catch(handleError);
+```
+
+---
+
+### 8. File I/O Pattern
+
+**Safe file operations:**
+
+```typescript
+import { readFile, writeFile, access } from 'fs/promises';
+import { constants } from 'fs';
+
+async function readJsonFile<T>(path: string): Promise<T> {
+ try {
+ // Check file exists and is readable
+ await access(path, constants.R_OK);
+
+ const content = await readFile(path, 'utf-8');
+ return JSON.parse(content) as T;
+ } catch (error) {
+ if ((error as NodeJS.ErrnoException).code === 'ENOENT') {
+ throw new CLIError(
+ `File not found: ${path}`,
+ 'ERR_FILE_NOT_FOUND',
+ 'Check the file path'
+ );
+ }
+
+ throw new CLIError(
+ `Cannot read file: ${path}`,
+ 'ERR_FILE_READ',
+ error instanceof Error ? error.message : 'Unknown error'
+ );
+ }
+}
+
+async function writeJsonFile<T>(path: string, data: T): Promise<void> {
+ try {
+ const json = JSON.stringify(data, null, 2);
+ await writeFile(path, json, 'utf-8');
+ } catch (error) {
+ throw new CLIError(
+ `Cannot write file: ${path}`,
+ 'ERR_FILE_WRITE',
+ error instanceof Error ? error.message : 'Unknown error'
+ );
+ }
+}
+```
+
+---
+
+### 9. Progress Indicator Pattern
+
+**For long operations:**
+
+```typescript
+import ora from 'ora';
+
+async function processMany(items: string[]): Promise<void> {
+ const spinner = ora({
+ text: `Processing ${items.length} items...`,
+ spinner: 'dots',
+ }).start();
+
+ try {
+ for (let i = 0; i < items.length; i++) {
+ spinner.text = `Processing ${i + 1}/${items.length}: ${items[i]}`;
+ await processItem(items[i]);
+ }
+
+ spinner.succeed(`Processed ${items.length} items`);
+ } catch (error) {
+ spinner.fail('Processing failed');
+ throw error;
+ }
+}
+```
+
+---
+
+### 10. Testing Pattern
+
+**Vitest for CLIs:**
+
+```typescript
+import { describe, it, expect } from 'vitest';
+import { exec } from 'child_process';
+import { promisify } from 'util';
+
+const execAsync = promisify(exec);
+
+describe('CLI', () => {
+ it('shows help', async () => {
+ const { stdout } = await execAsync('./cli.ts --help');
+ expect(stdout).toContain('USAGE:');
+ expect(stdout).toContain('COMMANDS:');
+ });
+
+ it('handles errors gracefully', async () => {
+ await expect(
+ execAsync('./cli.ts invalid-command')
+ ).rejects.toThrow();
+ });
+
+ it('outputs valid JSON', async () => {
+ const { stdout } = await execAsync('./cli.ts command test');
+ const data = JSON.parse(stdout);
+ expect(data).toHaveProperty('result');
+ });
+});
+```
+
+---
+
+## ✅ PATTERN CHECKLIST
+
+When building a CLI, use these patterns:
+
+- [ ] Configuration loading (from ~/.claude/.env)
+- [ ] API client with error handling
+- [ ] One function per command
+- [ ] Manual argument parsing (Tier 1) or Commander (Tier 2)
+- [ ] Comprehensive help text
+- [ ] Custom CLIError class
+- [ ] Main entry with routing
+- [ ] Safe file I/O (if needed)
+- [ ] Progress indicators (if long operations)
+- [ ] Tests (Vitest integration)
+
+---
+
+**All patterns battle-tested in llcli and production CLIs.**
diff --git a/.claude/skills/system-createcli/typescript-patterns.md b/.claude/skills/system-createcli/typescript-patterns.md
new file mode 100644
index 00000000..1479c644
--- /dev/null
+++ b/.claude/skills/system-createcli/typescript-patterns.md
@@ -0,0 +1,786 @@
+# TypeScript Patterns for CLI Development
+
+**Production patterns from tsx, vite, turbo, bun, and other modern TypeScript CLIs**
+
+---
+
+## 🎯 Overview
+
+This document captures type safety patterns, modern TypeScript features, and error handling strategies from real-world production CLIs.
+
+**Research Sources:**
+- tsx (privatenumber/tsx)
+- Vite (vitejs/vite)
+- Next.js (vercel/next)
+- Turbo (vercel/turbo)
+- Bun installer (oven-sh/bun)
+- pnpm (pnpm/pnpm)
+- Shopify CLI (Shopify/cli)
+
+---
+
+## 1️⃣ TYPE-SAFE ARGUMENT PARSING
+
+### Pattern 1: Schema-Driven Inference (cleye library - used by tsx)
+
+```typescript
+import { cli } from 'cleye';
+
+const argv = cli({
+ name: 'tsx',
+ flags: {
+ noCache: {
+ type: Boolean,
+ description: 'Disable cache',
+ default: false,
+ },
+ tsconfig: {
+ type: String,
+ description: 'Path to tsconfig.json',
+ },
+ },
+ parameters: ['<script path>'],
+});
+
+// TypeScript infers:
+// argv.flags.noCache → boolean
+// argv.flags.tsconfig → string | undefined
+// argv._.scriptPath → string | undefined
+```
+
+**Key Insight:** Flags defined as `const` objects enable full type inference.
+
+---
+
+### Pattern 2: Manual Type Annotations (Vite - cac library)
+
+```typescript
+interface GlobalCLIOptions {
+ '--'?: string[];
+ debug?: boolean | string;
+ filter?: string;
+ config?: string;
+}
+
+interface ServerOptions extends GlobalCLIOptions {
+ host?: string;
+ port?: number;
+ open?: boolean | string;
+ cors?: boolean;
+ strictPort?: boolean;
+}
+
+cli
+ .command('[root]', 'start dev server')
+ .option('--host <host>', 'specify hostname')
+ .option('--port <port>', 'specify port', { type: [Number] })
+ .option('--open [path]', 'open browser on startup')
+ .action(async (root: string, options: ServerOptions) => {
+ // options fully typed here
+ const server = await createServer({ ...options });
+ });
+```
+
+**Key Insight:** Explicit interfaces + intersections for type narrowing.
+
+---
+
+### Pattern 3: Discriminated Unions (citty library)
+
+```typescript
+type ArgDef =
+ | { type: 'boolean'; default?: boolean }
+ | { type: 'string'; default?: string }
+ | { type: 'number'; default?: number };
+
+type ParsedArgs<T> = {
+ [K in keyof T]: T[K] extends { type: 'boolean' }
+ ? boolean
+ : T[K] extends { type: 'number' }
+ ? number
+ : string;
+};
+
+// Command discriminants for exhaustive switching
+type ParsedCLI<Commands> = {
+ command: Commands; // literal union type
+ flags: Record<string, unknown>;
+};
+
+const argv = parse() as ParsedCLI<'build' | 'dev' | 'test'>;
+
+switch (argv.command) {
+ case 'build': /* ... */; break;
+ case 'dev': /* ... */; break;
+ case 'test': /* ... */; break;
+ default:
+ argv.command satisfies never; // exhaustiveness check
+}
+```
+
+**Key Insight:** Discriminated unions enable exhaustive compile-time checking.
+
+---
+
+## 2️⃣ MODERN TYPESCRIPT FEATURES (5.x)
+
+### Pattern 1: `satisfies` Operator (Vite/Turbo)
+
+**Exhaustive switch validation (Vite build.ts:1037):**
+
+```typescript
+type LogLevel = 'info' | 'warn' | 'error' | 'debug';
+
+function handleLog(level: LogLevel) {
+ switch (level) {
+ case 'info': /* ... */; break;
+ case 'warn': /* ... */; break;
+ case 'error': /* ... */; break;
+ case 'debug': /* ... */; break;
+ default:
+ level satisfies never; // new levels = compile error
+ throw new Error(`Unknown log level: ${level}`);
+ }
+}
+```
+
+**Typed URL mechanisms (Vite build.ts:1356-1362):**
+
+```typescript
+const urlMechanisms = {
+ es: (path: string) => `import.meta.url + '${path}'`,
+ iife: (path: string) => `document.baseURI + '${path}'`,
+ system: (path: string) => `module.meta.url + '${path}'`,
+} as const satisfies Record<string, (path: string) => string>;
+
+type Format = keyof typeof urlMechanisms; // 'es' | 'iife' | 'system'
+```
+
+**Config typing (Turbo jest.config.ts):**
+
+```typescript
+import type { Config } from '@jest/types';
+
+const config = {
+ preset: 'ts-jest/presets/js-with-ts',
+ testEnvironment: 'node',
+ verbose: process.env.RUNNER_DEBUG === '1',
+} as const satisfies Config;
+
+export default config;
+```
+
+**Benefits:**
+- ✅ Literal types preserved
+- ✅ Type-checked against interface
+- ✅ IntelliSense on config object
+- ✅ Compile error on typos
+
+---
+
+### Pattern 2: Template Literal Types (Vite)
+
+**Debug scope validation (Vite utils.ts:181-207):**
+
+```typescript
+export type ViteDebugScope = `vite:${string}`;
+
+function createDebugger(namespace: ViteDebugScope): void {
+ const log = debug(namespace);
+ // ...
+}
+
+createDebugger('vite:server'); // ✅ Valid
+createDebugger('vite:config'); // ✅ Valid
+createDebugger('app:server'); // ❌ Type error
+```
+
+**CLI command validation:**
+
+```typescript
+type CommandName = `${'build' | 'dev' | 'test'}:${string}`;
+
+function runCommand<const T extends CommandName>(name: T) {
+ // T preserves literal type
+ console.log(`Running: ${name}`);
+}
+
+runCommand('build:production'); // ✅
+runCommand('dev:local'); // ✅
+runCommand('deploy:prod'); // ❌ Type error
+```
+
+---
+
+### Pattern 3: Const Type Parameters (TS 5.0)
+
+**Preserve literal types in flag definitions:**
+
+```typescript
+function defineFlags<const T extends Record<string, string | boolean>>(
+ flags: T
+): T {
+ return flags;
+}
+
+const flags = defineFlags({
+ env: 'production',
+ watch: false,
+ verbose: true,
+});
+
+// T is inferred as:
+// {
+// readonly env: "production";
+// readonly watch: false;
+// readonly verbose: true;
+// }
+
+// Not widened to:
+// { env: string; watch: boolean; verbose: boolean }
+```
+
+---
+
+## 3️⃣ ERROR HANDLING PATTERNS
+
+### Pattern 1: Custom Error Classes (pnpm)
+
+**Structured errors with metadata (pnpm error/index.ts:3-44):**
+
+```typescript
+export class PnpmError extends Error {
+ public readonly code: string;
+ public readonly hint?: string;
+ public attempts?: number;
+ public prefix?: string;
+ public pkgsStack?: Array<{
+ id: string;
+ name: string;
+ version: string;
+ }>;
+
+ constructor(
+ code: string,
+ message: string,
+ opts?: { hint?: string; attempts?: number }
+ ) {
+ super(message);
+ this.code = code.startsWith('ERR_PNPM_') ? code : `ERR_PNPM_${code}`;
+ this.hint = opts?.hint;
+ this.attempts = opts?.attempts;
+ this.name = 'PnpmError';
+ }
+}
+
+// Usage with typed error codes
+throw new PnpmError('NO_LOCKFILE', 'Missing pnpm-lock.yaml', {
+ hint: 'Run `pnpm install` to generate lockfile'
+});
+```
+
+**Benefits:**
+- Machine-readable error codes
+- Actionable hints for users
+- Structured metadata (attempts, stack)
+- Type-safe error construction
+
+---
+
+### Pattern 2: Discriminated Fatal Errors (Shopify CLI)
+
+**Fatal error types (Shopify cli-kit/error.ts:9-92):**
+
+```typescript
+export enum FatalErrorType {
+ Abort, // User-facing error (bad input)
+ AbortSilent, // Abort without output
+ Bug, // Unexpected error (our fault)
+}
+
+export class FatalError extends ExtendableError {
+ public type: FatalErrorType;
+ public tryMessage?: TokenizedString;
+}
+
+export class AbortError extends FatalError {
+ constructor(message: string, tryMessage?: string) {
+ super(message);
+ this.type = FatalErrorType.Abort;
+ this.tryMessage = tryMessage;
+ }
+}
+
+export class BugError extends FatalError {
+ constructor(message: string) {
+ super(message);
+ this.type = FatalErrorType.Bug;
+ }
+}
+
+// Global error mapper
+export function errorMapper(error: unknown): FatalError {
+ if (error instanceof FatalError) return error;
+ if (error instanceof Error) return new BugError(error.message);
+ return new BugError(String(error));
+}
+
+// Central handler
+export function handler(error: unknown): void {
+ const fatalError = errorMapper(error);
+ renderFatalError(fatalError);
+ process.exitCode = fatalError.type === FatalErrorType.Bug ? 2 : 1;
+}
+```
+
+**Benefits:**
+- Distinguish user errors from bugs
+- Different exit codes (1 = user, 2 = bug)
+- Centralized error handling
+- Type-safe error classification
+
+---
+
+### Pattern 3: Result Type (Shopify CLI)
+
+**Result/Either monad pattern (Shopify cli-kit/result.ts:3-113):**
+
+```typescript
+export type Result<TValue, TError> = Ok<TValue, TError> | Err<TValue, TError>;
+
+export const ok = <TValue>(value: TValue) => new Ok(value);
+export const err = <TError>(error: TError) => new Err(error);
+
+class Ok<TValue, TError> {
+ constructor(readonly value: TValue) {}
+
+ isOk(): this is Ok<TValue, TError> { return true; }
+ isErr(): this is Err<TValue, TError> { return false; }
+
+ map<U>(fn: (value: TValue) => U): Result<U, TError> {
+ return ok(fn(this.value));
+ }
+
+ mapError<E>(_fn: (error: TError) => E): Result<TValue, E> {
+ return ok(this.value);
+ }
+
+ valueOrAbort(): TValue {
+ return this.value;
+ }
+}
+
+class Err<TValue, TError> {
+ constructor(readonly error: TError) {}
+
+ isOk(): this is Ok<TValue, TError> { return false; }
+ isErr(): this is Err<TValue, TError> { return true; }
+
+ map<U>(_fn: (value: TValue) => U): Result<U, TError> {
+ return err(this.error);
+ }
+
+ mapError<E>(fn: (error: TError) => E): Result<TValue, E> {
+ return err(fn(this.error));
+ }
+
+ valueOrAbort(): never {
+ throw new AbortError(String(this.error));
+ }
+}
+
+// Usage
+async function loadConfig(): Promise<Result<Config, string>> {
+ try {
+ const raw = await readFile('config.json', 'utf-8');
+ const config = JSON.parse(raw);
+ return ok(config);
+ } catch (e) {
+ return err('Failed to load config');
+ }
+}
+
+// Expression-oriented error handling
+const config = (await loadConfig())
+ .mapError(e => `Config error: ${e}`)
+ .valueOrAbort();
+```
+
+**Benefits:**
+- No try/catch needed
+- Explicit error handling in types
+- Composable with map/mapError
+- Railway-oriented programming
+
+---
+
+### Pattern 4: Signal Handling (tsx)
+
+**Relay signals to child process (tsx cli.ts:24-120):**
+
+```typescript
+let waitForSignal: Promise<void> | undefined;
+
+const relaySignalToChild = async (signal: NodeJS.Signals) => {
+ if (waitForSignal) {
+ return waitForSignal;
+ }
+
+ childProcess.kill(signal);
+
+ waitForSignal = new Promise((resolve) => {
+ setTimeout(() => {
+ const exitCode = osConstants.signals[signal];
+ process.exit(128 + exitCode); // POSIX-compliant
+ }, 5000); // 5s grace period
+
+ childProcess.on('exit', () => {
+ resolve();
+ });
+ });
+
+ // Force kill after grace period
+ setTimeout(() => {
+ childProcess.kill('SIGKILL');
+ }, 5000);
+};
+
+process.on('SIGINT', relaySignalToChild);
+process.on('SIGTERM', relaySignalToChild);
+```
+
+**Exit code mapping (tsx cli.ts:254):**
+
+```typescript
+childProcess.on('close', (code, signal) => {
+ if (code !== null) {
+ process.exit(code);
+ } else if (signal) {
+ const exitCode = osConstants.signals[signal];
+ process.exit(128 + exitCode); // 130 for SIGINT, 143 for SIGTERM
+ }
+});
+```
+
+**Benefits:**
+- Graceful shutdown
+- Proper signal propagation
+- POSIX-compliant exit codes
+- Timeout for hung processes
+
+---
+
+## 4️⃣ TYPE-SAFE CONFIGURATION
+
+### Pattern 1: Zod Validation with Transform
+
+**Parse → Transform → Enrich pattern:**
+
+```typescript
+import { z } from 'zod';
+import path from 'node:path';
+
+const RawConfigSchema = z.object({
+ root: z.string().default('.'),
+ mode: z.enum(['dev', 'prod']).default('dev'),
+ targets: z.array(z.string()).nonempty(),
+ deploy: z.discriminatedUnion('provider', [
+ z.object({
+ provider: z.literal('s3'),
+ bucket: z.string(),
+ region: z.string().default('us-east-1'),
+ }),
+ z.object({
+ provider: z.literal('gcs'),
+ bucket: z.string(),
+ projectId: z.string(),
+ }),
+ ]),
+});
+
+const ConfigSchema = RawConfigSchema.transform((cfg) => ({
+ ...cfg,
+ root: path.resolve(cfg.root),
+ isProd: cfg.mode === 'prod',
+ timestamp: Date.now(),
+}));
+
+type Config = z.infer<typeof ConfigSchema>;
+
+// Safe parsing with formatted errors
+const res = ConfigSchema.safeParse(rawInput);
+if (!res.success) {
+ const formatted = res.error.issues
+ .map(issue => `${issue.path.join('.')}: ${issue.message}`)
+ .join('\n');
+ throw new Error(`Invalid config:\n${formatted}`);
+}
+
+const config = res.data;
+```
+
+---
+
+### Pattern 2: Environment Variable Validation
+
+```typescript
+import { z } from 'zod';
+import dotenv from 'dotenv';
+
+dotenv.config();
+
+const EnvSchema = z.object({
+ PORT: z.coerce.number().int().min(1).max(65535).default(3000),
+ NODE_ENV: z.enum(['development', 'test', 'production']).default('development'),
+ DATABASE_URL: z.string().url(),
+ DEBUG: z.preprocess(
+ (v) => (typeof v === 'string' ? v === 'true' : v),
+ z.boolean().default(false)
+ ),
+ API_KEY: z.string().min(10),
+});
+
+export const env = EnvSchema.parse(process.env);
+export type Env = typeof env;
+
+// Usage: env.PORT is guaranteed to be number 1-65535
+```
+
+---
+
+## 5️⃣ ASYNC/AWAIT BEST PRACTICES
+
+### Pattern 1: Top-Level Await (Prisma Style)
+
+```typescript
+async function main() {
+ const args = process.argv.slice(2);
+ const result = await runCommand(args);
+ return result;
+}
+
+void main().catch((err) => {
+ console.error('❌', err instanceof Error ? err.message : err);
+ process.exitCode = 1;
+});
+```
+
+**Pure ESM (tsx/bun-friendly):**
+
+```typescript
+const args = process.argv.slice(2);
+const code = await runCommand(args);
+process.exit(code ?? 0);
+```
+
+---
+
+### Pattern 2: Parallel Operations
+
+**Fail-fast (Promise.all):**
+
+```typescript
+const [config, user, data] = await Promise.all([
+ loadConfig(),
+ fetchUser(),
+ fetchData(),
+]);
+```
+
+**Best effort (Promise.allSettled):**
+
+```typescript
+const results = await Promise.allSettled(
+ tasks.map(task => processTask(task))
+);
+
+const failures = results.filter(r => r.status === 'rejected');
+if (failures.length > 0) {
+ failures.forEach(f => console.error(f.reason));
+ process.exitCode = 1;
+}
+```
+
+**Concurrency limiting (p-limit):**
+
+```typescript
+import pLimit from 'p-limit';
+
+const limit = pLimit(4); // max 4 concurrent
+await Promise.all(
+ items.map(item => limit(() => processItem(item)))
+);
+```
+
+---
+
+### Pattern 3: Cleanup (Prisma Pattern)
+
+```typescript
+async function main() {
+ const client = await createClient();
+ try {
+ await client.connect();
+ await doWork(client);
+ } finally {
+ await client.close().catch(() => {}); // swallow close errors
+ }
+}
+```
+
+**Signal-aware teardown (Vercel pattern):**
+
+```typescript
+import { onExit } from 'signal-exit';
+
+const cleanup = async () => {
+ spinner?.stop();
+ await client?.close();
+};
+
+onExit(() => { void cleanup(); });
+
+await main().catch(async (err) => {
+ await cleanup();
+ console.error(err);
+ process.exit(1);
+});
+```
+
+---
+
+## 6️⃣ RECOMMENDED PATTERNS FOR KAI CLIS
+
+### For Tier 1 (llcli-style):
+
+```typescript
+#!/usr/bin/env bun
+
+interface Config {
+ apiKey: string;
+ baseUrl: string;
+}
+
+const DEFAULTS = {
+ baseUrl: 'https://api.example.com',
+ limit: 20,
+} as const;
+
+class CLIError extends Error {
+ constructor(
+ message: string,
+ public code: string,
+ public exitCode: number = 1
+ ) {
+ super(message);
+ this.name = 'CLIError';
+ }
+}
+
+function loadConfig(): Config {
+ // ... load from ~/.claude/.env
+ throw new CLIError('API_KEY not found', 'ERR_NO_API_KEY');
+}
+
+async function main() {
+ const args = process.argv.slice(2);
+
+ if (!args.length || args[0] === '--help') {
+ showHelp();
+ return;
+ }
+
+ const command = args[0];
+
+ switch (command) {
+ case 'fetch':
+ await fetchData(args[1]);
+ break;
+ default:
+ throw new CLIError(`Unknown command: ${command}`, 'ERR_UNKNOWN_CMD');
+ }
+}
+
+main().catch(error => {
+ if (error instanceof CLIError) {
+ console.error(`Error [${error.code}]: ${error.message}`);
+ process.exit(error.exitCode);
+ }
+ console.error('Fatal error:', error);
+ process.exit(1);
+});
+```
+
+---
+
+### For Tier 2 (Commander.js):
+
+```typescript
+#!/usr/bin/env bun
+
+import { Command } from 'commander';
+
+const program = new Command();
+
+program
+ .name('mycli')
+ .description('My CLI tool')
+ .version('1.0.0');
+
+program
+ .command('process <file>')
+ .option('-o, --output <path>', 'output path')
+ .option('--format <type>', 'output format', 'json')
+ .action(async (file: string, options) => {
+ try {
+ await processFile(file, options);
+ } catch (error) {
+ console.error('Processing failed:', error);
+ process.exit(1);
+ }
+ });
+
+program.parse();
+```
+
+---
+
+## ✅ QUICK REFERENCE CHECKLIST
+
+**Type Safety:**
+- [ ] Use strict mode in tsconfig.json
+- [ ] Define interfaces for all data structures
+- [ ] Avoid `any` types (use `unknown` if needed)
+- [ ] Use template literal types for string patterns
+- [ ] Use discriminated unions for commands
+- [ ] Prefer `as const satisfies` for configs
+
+**Error Handling:**
+- [ ] Custom error class with `code` field
+- [ ] Actionable error messages with hints
+- [ ] Exit code 0 = success, 1 = error, 2 = bug
+- [ ] Catch at top level (main().catch())
+- [ ] Handle signals (SIGINT, SIGTERM)
+
+**Modern TypeScript:**
+- [ ] Use `satisfies` for exhaustiveness checks
+- [ ] Use template literals for validation
+- [ ] Use const type parameters for literals
+- [ ] Prefer `as const` for config objects
+
+**Async/Await:**
+- [ ] Top-level await in ESM or void main().catch()
+- [ ] Use Promise.allSettled for best-effort parallel
+- [ ] Cleanup in finally blocks
+- [ ] Set process.exitCode instead of process.exit
+
+---
+
+**Sources:**
+- tsx (privatenumber/tsx) - Type safety, signal handling
+- Vite (vitejs/vite) - Modern TS features, validation
+- Turbo (vercel/turbo) - Config patterns
+- Bun (oven-sh/bun) - Async patterns
+- pnpm (pnpm/pnpm) - Custom errors
+- Shopify CLI (Shopify/cli) - Result types, fatal errors
+- Codex research (actual repository analysis)
diff --git a/.claude/skills/system-createcli/workflows/add-command.md b/.claude/skills/system-createcli/workflows/add-command.md
new file mode 100644
index 00000000..fb66d97f
--- /dev/null
+++ b/.claude/skills/system-createcli/workflows/add-command.md
@@ -0,0 +1,150 @@
+---
+workflow: add-command
+purpose: Add new command to existing CLI
+---
+
+# Add Command Workflow
+
+**Extend existing CLI with new commands while maintaining code quality and consistency.**
+
+---
+
+## 🎯 PURPOSE
+
+Add one or more commands to an existing CLI without breaking existing functionality.
+
+---
+
+## 📍 WHEN TO USE
+
+- User requests: "Add [command] to [CLI]"
+- "Extend [CLI] with [feature]"
+- "My CLI needs to do [X] too"
+
+---
+
+## 📋 STEPS
+
+### 1. Locate Existing CLI
+
+```bash
+# Find CLI location
+ls -la ~/.claude/bin/[cli-name]/
+# or
+ls -la ~/Projects/[project]/
+```
+
+### 2. Read Current Structure
+
+```typescript
+// Identify:
+// - Existing commands (in switch statement)
+// - Interface definitions
+// - Help text structure
+```
+
+### 3. Add Interface (if needed)
+
+```typescript
+// Add response interface
+interface NewCommandResponse {
+ // ... based on API/data
+}
+```
+
+### 4. Implement Command Function
+
+```typescript
+/**
+ * [Command description]
+ */
+async function newCommand(
+ arg: string,
+ options: { flag?: boolean } = {}
+): Promise<void> {
+ const config = loadConfig();
+
+ // Validation
+ if (!arg) {
+ console.error('Error: argument required');
+ process.exit(1);
+ }
+
+ // Implementation
+ const result = await fetchData(config, arg);
+
+ // Output
+ console.log(JSON.stringify(result, null, 2));
+}
+```
+
+### 5. Add to Switch Statement
+
+```typescript
+switch (command) {
+ // ... existing cases
+
+ case 'newcommand':
+ await newCommand(args[1], options);
+ break;
+
+ default:
+ console.error(`Unknown command: ${command}`);
+ process.exit(1);
+}
+```
+
+### 6. Update Help Text
+
+```typescript
+COMMANDS:
+ existing-cmd Description
+ newcommand <arg> New command description // ← Add
+ help, --help, -h Show help
+
+EXAMPLES:
+ # New command examples // ← Add
+ $ mycli newcommand value
+ $ mycli newcommand value --flag
+```
+
+### 7. Update README
+
+Add to command list and examples section.
+
+### 8. Test
+
+```bash
+./cli.ts newcommand test-value
+./cli.ts --help # Verify new command listed
+```
+
+---
+
+## ✅ QUALITY CHECKLIST
+
+- [ ] Command function implemented
+- [ ] Added to switch statement
+- [ ] Help text updated
+- [ ] README updated
+- [ ] Tested and working
+- [ ] Error handling added
+- [ ] TypeScript compiles
+
+---
+
+**Example: Adding "search" to existing "list/create" CLI**
+
+```typescript
+// Before: list, create
+// After: list, create, search ← new
+
+async function search(keyword: string, limit: number = 20): Promise<void> {
+ // Implementation
+}
+
+// Add to switch
+case 'search':
+ await search(args[1], parseLimit(args));
+ break;
+```
diff --git a/.claude/skills/system-createcli/workflows/create-cli.md b/.claude/skills/system-createcli/workflows/create-cli.md
new file mode 100644
index 00000000..e83700eb
--- /dev/null
+++ b/.claude/skills/system-createcli/workflows/create-cli.md
@@ -0,0 +1,740 @@
+---
+workflow: create-cli
+purpose: Generate complete, production-ready TypeScript CLI from requirements
+---
+
+# Create CLI Workflow
+
+**Generate production-quality TypeScript command-line interfaces following llcli pattern and PAI's CLI-First Architecture.**
+
+---
+
+## 🎯 PURPOSE
+
+This workflow generates a complete, immediately usable TypeScript CLI tool with:
+- Full type safety and error handling
+- Comprehensive documentation (README + QUICKSTART)
+- Clean architecture (following llcli pattern)
+- Production-ready code
+- Quality validation gates
+
+---
+
+## 📍 WHEN TO USE
+
+Activate this workflow when user requests:
+- "Create a CLI for [API/service/tool]"
+- "Build a command-line interface"
+- "Make a CLI that does X"
+- "Generate a CLI tool"
+- "I need something like llcli but for Y"
+
+---
+
+## 🔀 TIER DECISION TREE
+
+**Use this deterministic decision tree to select complexity tier:**
+
+```
+START: User describes CLI requirements
+│
+├─ Does it need 10+ commands with grouping? ─ YES → Tier 2 (Commander.js)
+│ NO ↓
+│
+├─ Does it need plugin architecture? ──────── YES → Tier 2 (Commander.js)
+│ NO ↓
+│
+├─ Does it need subcommands (git-style)? ──── YES → Tier 2 (Commander.js)
+│ NO ↓
+│
+├─ Does it need complex nested options? ────── YES → Tier 2 (Commander.js)
+│ NO ↓
+│
+└─ Use Tier 1 (llcli-style) ← DEFAULT
+ ↑
+ └─ 80% of CLIs end up here
+```
+
+**Tier 1 Indicators (DEFAULT):**
+- ✅ 2-10 simple commands
+- ✅ API client wrapper
+- ✅ Data transformer
+- ✅ File processor
+- ✅ Simple automation
+- ✅ JSON output
+- ✅ Fast development needed
+
+**Tier 2 Indicators (ESCALATION):**
+- ❌ 10+ commands needing organization
+- ❌ Plugin/extension system
+- ❌ Subcommands (convert json csv, convert csv json)
+- ❌ Multiple output format engines
+- ❌ Complex option combinations
+
+**Rule of Thumb:** If user doesn't explicitly need Tier 2 features, use Tier 1.
+
+---
+
+## 📋 WORKFLOW STEPS
+
+### Step 1: Gather Requirements
+
+**Extract from user request:**
+- CLI name (kebab-case, e.g., `ghcli`, `md2html`)
+- Purpose (one-sentence description)
+- Commands needed (list each command with arguments)
+- API/service being wrapped (if applicable)
+- Authentication method (API key, Bearer token, OAuth)
+- Environment variables needed
+- Output format (usually JSON)
+
+**Questions to ask user if unclear:**
+- "What API or service does this wrap?"
+- "What are the main commands you need?"
+- "How should it authenticate?"
+- "Where should the CLI be installed?" (personal bin, project-specific, etc.)
+
+**Example extraction:**
+```
+User: "Create a CLI for the GitHub API"
+
+Extracted:
+- Name: ghcli
+- Purpose: GitHub API Command-Line Interface
+- Commands: repos (list), issues (create, list), search
+- API: api.github.com
+- Auth: Bearer token (GITHUB_TOKEN)
+- Env vars: GITHUB_TOKEN
+- Output: JSON
+```
+
+---
+
+### Step 2: Determine Complexity Tier
+
+**Apply decision tree from above.**
+
+**For most requests → Tier 1**
+
+Example decision:
+```
+User: "CLI for GitHub API with repos, issues, search commands"
+→ 3 commands (< 10) ✓
+→ No subcommands ✓
+→ Simple arguments ✓
+→ API wrapper ✓
+= TIER 1
+```
+
+---
+
+### Step 3: Generate TypeScript Interface Definitions
+
+**Based on API responses/data structures:**
+
+```typescript
+// For API client CLIs
+interface ApiResponse {
+ data: {
+ items: Item[];
+ };
+}
+
+interface Item {
+ id: string;
+ name: string;
+ created_at: string;
+ // ... fields from API docs
+}
+
+interface Config {
+ apiKey: string;
+ baseUrl: string;
+ // ... configuration fields
+}
+```
+
+**For file processing CLIs:**
+```typescript
+interface ProcessResult {
+ input: string;
+ output: string;
+ status: 'success' | 'error';
+ error?: string;
+}
+
+interface Config {
+ outputDir: string;
+ format: string;
+}
+```
+
+---
+
+### Step 4: Generate Configuration Section
+
+**Pattern from llcli:**
+
+```typescript
+// ============================================================================
+// Configuration
+// ============================================================================
+
+const DEFAULTS = {
+ baseUrl: '{{API_BASE_URL}}',
+ limit: 20,
+ {{ADDITIONAL_DEFAULTS}}
+} as const;
+
+/**
+ * Load configuration from environment
+ */
+function loadConfig(): Config {
+ const envPath = join(homedir(), '.claude', '.env');
+
+ try {
+ const envContent = readFileSync(envPath, 'utf-8');
+ const apiKey = envContent
+ .split('\n')
+ .find(line => line.startsWith('{{ENV_VAR_NAME}}='))
+ ?.split('=')[1]
+ ?.trim();
+
+ if (!apiKey) {
+ console.error('Error: {{ENV_VAR_NAME}} not found in ~/.claude/.env');
+ process.exit(1);
+ }
+
+ return {
+ apiKey,
+ baseUrl: DEFAULTS.baseUrl,
+ {{ADDITIONAL_CONFIG}}
+ };
+ } catch (error) {
+ console.error(`Error: Cannot read ~/.claude/.env file`);
+ console.error('Make sure {{ENV_VAR_NAME}} is set in ~/.claude/.env');
+ process.exit(1);
+ }
+}
+```
+
+---
+
+### Step 5: Generate Command Functions
+
+**One function per command:**
+
+```typescript
+// ============================================================================
+// CLI Commands
+// ============================================================================
+
+/**
+ * {{COMMAND_DESCRIPTION}}
+ */
+async function {{commandName}}(
+ {{ARGUMENTS}}: string,
+ options: { limit?: number } = {}
+): Promise<void> {
+ const config = loadConfig();
+
+ // Validate inputs
+ if (!{{ARGUMENTS}} || {{ARGUMENTS}}.trim() === '') {
+ console.error('Error: {{ARGUMENT_NAME}} is required');
+ process.exit(1);
+ }
+
+ // Build request
+ const params = {
+ {{PARAM_MAPPING}},
+ limit: options.limit?.toString() ?? DEFAULTS.limit.toString(),
+ };
+
+ // Make API call
+ const data = await {{fetchFunction}}(config, params);
+
+ // Output JSON
+ console.log(JSON.stringify(data, null, 2));
+}
+```
+
+**Repeat for each command.**
+
+---
+
+### Step 6: Generate Help Documentation
+
+**Comprehensive help text following llcli pattern:**
+
+```typescript
+// ============================================================================
+// Help Documentation
+// ============================================================================
+
+function showHelp(): void {
+ console.log(`
+{{CLI_NAME}} - {{CLI_DESCRIPTION}}
+${'='.repeat(CLI_NAME.length + CLI_DESCRIPTION.length + 3)}
+
+A clean, deterministic CLI for {{PURPOSE}}.
+
+USAGE:
+ {{CLI_NAME}} <command> [options]
+
+COMMANDS:
+ {{COMMAND_LIST}}
+ help, --help, -h Show this help message
+ version, --version, -v Show version information
+
+OPTIONS:
+ {{OPTIONS_LIST}}
+
+EXAMPLES:
+ {{EXAMPLE_LIST}}
+
+OUTPUT:
+ All commands return JSON to stdout
+ Errors and messages go to stderr
+ Exit code 0 on success, 1 on error
+
+CONFIGURATION:
+ {{CONFIGURATION_DETAILS}}
+
+RESPONSE FORMAT:
+ {{JSON_STRUCTURE_EXAMPLE}}
+
+PHILOSOPHY:
+ {{CLI_NAME}} follows PAI's CLI-First Architecture:
+ - Deterministic: Same input → Same output
+ - Clean: Single responsibility ({{PURPOSE}} only)
+ - Composable: JSON output pipes to jq, grep, etc.
+ - Documented: Full help and examples
+ - Testable: Predictable behavior
+
+For more information, see ~/.claude/bin/{{CLI_NAME}}/README.md
+
+Version: 1.0.0
+Author: Daniel Miessler
+`);
+}
+
+function showVersion(): void {
+ console.log('{{CLI_NAME}} version 1.0.0');
+}
+```
+
+---
+
+### Step 7: Generate Main Entry Point
+
+**Argument parsing and command routing:**
+
+```typescript
+// ============================================================================
+// Main CLI Entry Point
+// ============================================================================
+
+async function main() {
+ const args = process.argv.slice(2);
+
+ // Handle help/version
+ if (args.length === 0 || args[0] === 'help' || args[0] === '--help' || args[0] === '-h') {
+ showHelp();
+ return;
+ }
+
+ if (args[0] === 'version' || args[0] === '--version' || args[0] === '-v') {
+ showVersion();
+ return;
+ }
+
+ const command = args[0];
+
+ // Parse common options (e.g., --limit)
+ const limitIndex = args.indexOf('--limit');
+ const limit = limitIndex !== -1 && args[limitIndex + 1]
+ ? parseInt(args[limitIndex + 1], 10)
+ : undefined;
+
+ if (limitIndex !== -1 && (isNaN(limit!) || limit! <= 0)) {
+ console.error('Error: --limit must be a positive number');
+ process.exit(1);
+ }
+
+ // Route to commands
+ switch (command) {
+ {{COMMAND_CASES}}
+
+ default:
+ console.error(`Error: Unknown command '${command}'`);
+ console.error('Run "{{CLI_NAME}} --help" for usage information');
+ process.exit(1);
+ }
+}
+
+// Run CLI
+main().catch((error) => {
+ console.error('Fatal error:', error);
+ process.exit(1);
+});
+```
+
+---
+
+### Step 8: Generate Documentation Files
+
+**README.md structure (following llcli):**
+
+```markdown
+# {{CLI_NAME}} - {{CLI_DESCRIPTION}}
+
+**Version:** 1.0.0
+**Author:** Daniel Miessler
+**Last Updated:** {{TODAY_DATE}}
+
+---
+
+## Overview
+
+{{CLI_NAME}} is a clean, deterministic command-line interface for {{PURPOSE}}. It provides simple access to {{SERVICE}} with a focus on reliability, composability, and documentation.
+
+### Philosophy
+
+{{CLI_NAME}} follows PAI's **CLI-First Architecture**:
+
+1. **Deterministic** - Same input always produces same output
+2. **Clean** - Single responsibility
+3. **Composable** - JSON output pipes to jq, grep, other tools
+4. **Documented** - Comprehensive help and examples
+5. **Testable** - Predictable, verifiable behavior
+
+---
+
+## Installation
+
+[Setup instructions]
+
+---
+
+## Usage
+
+[Command documentation]
+
+---
+
+## Examples
+
+[Real-world examples with jq, grep, etc.]
+
+---
+
+## Configuration
+
+[Environment variables, defaults]
+
+---
+
+## API Reference
+
+[API endpoint documentation]
+
+---
+
+## Philosophy
+
+### Why This CLI Exists
+
+[Explain the problem it solves]
+
+### Design Principles
+
+[Key decisions and why]
+
+---
+
+[Additional sections: Troubleshooting, Integration, Best Practices]
+```
+
+**QUICKSTART.md:**
+```markdown
+# {{CLI_NAME}} Quick Start
+
+**The 30-second guide to using {{CLI_NAME}}**
+
+## Installation
+
+[Quick setup]
+
+## Usage
+
+[3-5 most common commands]
+
+## Piping to jq
+
+[Common jq patterns]
+
+## Configuration
+
+[Minimal config info]
+
+## Full Documentation
+
+See: ~/.claude/bin/{{CLI_NAME}}/README.md
+```
+
+---
+
+### Step 9: Generate Supporting Files
+
+**package.json:**
+```json
+{
+ "name": "{{CLI_NAME}}",
+ "version": "1.0.0",
+ "description": "{{CLI_DESCRIPTION}}",
+ "type": "module",
+ "bin": {
+ "{{CLI_NAME}}": "./{{CLI_NAME}}.ts"
+ },
+ "scripts": {
+ "help": "bun run {{CLI_NAME}}.ts --help"
+ },
+ "keywords": [{{KEYWORDS}}],
+ "author": "Daniel Miessler",
+ "license": "MIT",
+ "dependencies": {}
+}
+```
+
+**tsconfig.json:**
+```json
+{
+ "compilerOptions": {
+ "target": "ES2022",
+ "module": "ESNext",
+ "lib": ["ES2022"],
+ "moduleResolution": "bundler",
+ "strict": true,
+ "esModuleInterop": true,
+ "skipLibCheck": true,
+ "forceConsistentCasingInFileNames": true,
+ "resolveJsonModule": true,
+ "allowSyntheticDefaultImports": true
+ },
+ "include": ["*.ts"],
+ "exclude": ["node_modules"]
+}
+```
+
+**.env.example:**
+```bash
+# {{CLI_NAME}} Configuration
+{{ENV_VAR_NAME}}=your_{{TOKEN_TYPE}}_here
+```
+
+---
+
+### Step 10: Validate and Report
+
+**Quality Gates:**
+1. ✅ TypeScript compiles without errors
+2. ✅ All commands work with test inputs
+3. ✅ Help text displays correctly
+4. ✅ README is comprehensive
+5. ✅ File permissions set (chmod +x)
+
+**Validation Commands:**
+```bash
+cd ~/.claude/bin/{{CLI_NAME}}/
+chmod +x {{CLI_NAME}}.ts
+./{{CLI_NAME}}.ts --help
+./{{CLI_NAME}}.ts --version
+```
+
+**Report to user:**
+```
+✅ CLI Created: ~/.claude/bin/{{CLI_NAME}}/
+
+Files generated:
+- {{CLI_NAME}}.ts ({{LINE_COUNT}} lines)
+- package.json
+- tsconfig.json
+- .env.example
+- README.md
+- QUICKSTART.md
+
+Next steps:
+1. Configure: Add {{ENV_VAR_NAME}} to ~/.claude/.env
+2. Test: ./{{CLI_NAME}}.ts --help
+3. Use: ./{{CLI_NAME}}.ts {{EXAMPLE_COMMAND}}
+
+Documentation: ~/.claude/bin/{{CLI_NAME}}/README.md
+```
+
+---
+
+## 📤 OUTPUT EXAMPLE
+
+**User Request:**
+"Create a CLI for the Notion API to list databases and create pages"
+
+**Generated Output:**
+```
+✅ CLI Created: ~/.claude/bin/notioncli/
+
+Files generated:
+- notioncli.ts (342 lines)
+- package.json
+- tsconfig.json
+- .env.example (NOTION_API_KEY)
+- README.md (with philosophy and examples)
+- QUICKSTART.md
+
+Commands available:
+- notioncli databases # List all databases
+- notioncli pages create <db-id> # Create page in database
+- notioncli search <query> # Search workspace
+- notioncli --help # Show full help
+
+Next steps:
+1. Add NOTION_API_KEY=your_key to ~/.claude/.env
+2. Test: notioncli databases
+3. Read: ~/.claude/bin/notioncli/README.md
+
+The CLI follows llcli pattern with type safety, error handling,
+and comprehensive documentation.
+```
+
+---
+
+## 🔗 RELATED WORKFLOWS
+
+**After creating CLI:**
+- `add-command.md` - Add more commands to existing CLI
+- `add-testing.md` - Generate test suite
+- `setup-distribution.md` - Setup npm publishing or binary distribution
+
+**Escalation:**
+- `upgrade-tier.md` - Migrate from Tier 1 → Tier 2 if CLI grows complex
+
+---
+
+## 📖 REAL-WORLD EXAMPLES
+
+### Example 1: API Client
+
+**Request:** "CLI for Stripe API"
+
+**Decision:** Tier 1 (API wrapper, simple commands)
+
+**Generated Commands:**
+```bash
+stripecli customers list
+stripecli customers create --email [email protected]
+stripecli payments list --customer cus_123
+stripecli balance
+```
+
+---
+
+### Example 2: File Processor
+
+**Request:** "CLI to convert markdown to various formats"
+
+**Decision:** Tier 1 (file I/O, simple transformations)
+
+**Generated Commands:**
+```bash
+md-convert html input.md output.html
+md-convert pdf input.md output.pdf
+md-convert extract-links input.md
+md-convert stats input.md
+```
+
+---
+
+### Example 3: Database Tool
+
+**Request:** "CLI for database migrations with rollback, status, and generate commands"
+
+**Decision:** Tier 2 (complex workflow, subcommands)
+
+**Generated Commands:**
+```bash
+db-migrate up # Run pending migrations
+db-migrate down --steps 1 # Rollback
+db-migrate status # Show migration status
+db-migrate create --name users # Generate new migration
+```
+
+---
+
+## ✅ BEST PRACTICES
+
+### 1. **Default to Tier 1**
+Start simple. 80% of CLIs don't need a framework.
+
+### 2. **Complete Documentation**
+README explains "why" not just "how". Include philosophy section.
+
+### 3. **Type Safety First**
+All interfaces, strict mode, no `any` types.
+
+### 4. **Deterministic Output**
+JSON to stdout, errors to stderr. Consistent every time.
+
+### 5. **Error Context**
+Don't just say "Error". Explain what failed and how to fix it.
+
+### 6. **Examples in Help**
+Show real usage examples, not just flag descriptions.
+
+### 7. **Test Immediately**
+Run `--help` and version command before reporting success.
+
+### 8. **Follow llcli Pattern**
+Use proven structure from ~/.claude/bin/llcli/ as reference.
+
+---
+
+## 🐛 TROUBLESHOOTING
+
+**"Should I use Tier 1 or Tier 2?"**
+→ Follow decision tree. If uncertain, use Tier 1. You can upgrade later.
+
+**"User wants 15 commands"**
+→ Tier 1 can handle this if commands are simple. Use Tier 2 only if they need grouping/subcommands.
+
+**"CLI needs both JSON and table output"**
+→ Tier 2 (multiple output engines). Tier 1 is JSON-only.
+
+**"User didn't specify commands"**
+→ Ask: "What are the main commands you need?"
+
+**"Don't know API structure"**
+→ Ask: "Do you have API documentation? What does a typical response look like?"
+
+---
+
+## 📊 QUALITY CHECKLIST
+
+Before reporting CLI as complete, verify:
+
+- [ ] TypeScript compiles (run bun check)
+- [ ] File permissions set (chmod +x)
+- [ ] --help displays correctly
+- [ ] --version shows version
+- [ ] All commands in help are implemented
+- [ ] README has philosophy section
+- [ ] QUICKSTART has common examples
+- [ ] .env.example lists all required vars
+- [ ] Error messages are actionable
+- [ ] Exit codes correct (0 = success, 1 = error)
+- [ ] JSON output valid (test with `| jq empty`)
+- [ ] Configuration loaded from expected location
+- [ ] CLI name is kebab-case
+- [ ] Follows llcli structure pattern
+
+---
+
+**This workflow generates production-ready CLIs that work immediately, following the proven llcli pattern and PAI's CLI-First Architecture principles.**
diff --git a/.claude/skills/system-createcli/workflows/upgrade-tier.md b/.claude/skills/system-createcli/workflows/upgrade-tier.md
new file mode 100644
index 00000000..5da2f2bb
--- /dev/null
+++ b/.claude/skills/system-createcli/workflows/upgrade-tier.md
@@ -0,0 +1,166 @@
+---
+workflow: upgrade-tier
+purpose: Migrate CLI from Tier 1 (manual) to Tier 2 (Commander.js)
+---
+
+# Upgrade Tier Workflow
+
+**Migrate from manual parsing to Commander.js when CLI grows complex.**
+
+---
+
+## 🎯 PURPOSE
+
+Convert Tier 1 CLI (llcli-style) to Tier 2 (Commander.js) when complexity demands it.
+
+---
+
+## 📍 WHEN TO USE
+
+**Indicators to upgrade:**
+- 15+ commands (switch statement unwieldy)
+- Need subcommands (git-style: `cli convert json csv`)
+- Plugin architecture needed
+- Complex option combinations
+- Multiple output formats
+
+**Rule:** Don't upgrade prematurely. Tier 1 handles 10-15 commands fine.
+
+---
+
+## 📋 MIGRATION STEPS
+
+### 1. Install Commander.js
+
+```bash
+cd ~/.claude/bin/[cli-name]/
+bun add commander
+```
+
+### 2. Create Commander Structure
+
+```typescript
+#!/usr/bin/env bun
+
+import { Command } from 'commander';
+
+const program = new Command();
+
+program
+ .name('[cli-name]')
+ .description('[description from old CLI]')
+ .version('2.0.0'); // Bump major version
+```
+
+### 3. Convert Commands
+
+**Before (Tier 1):**
+```typescript
+async function fetchData(arg: string, limit: number): Promise<void> {
+ // ...
+}
+
+switch (command) {
+ case 'fetch':
+ await fetchData(args[1], limit);
+ break;
+}
+```
+
+**After (Tier 2):**
+```typescript
+program
+ .command('fetch <arg>')
+ .option('-l, --limit <number>', 'limit results', '20')
+ .description('Fetch data')
+ .action(async (arg: string, options) => {
+ const limit = parseInt(options.limit, 10);
+ await fetchData(arg, limit);
+ });
+```
+
+### 4. Preserve Help Quality
+
+Don't let auto-generated help be worse than manual help.
+
+```typescript
+program
+ .command('fetch <query>')
+ .description('Search and fetch data')
+ .option('-l, --limit <n>', 'max results', '20')
+ .addHelpText('after', `
+Examples:
+ $ ${program.name()} fetch "keyword" --limit 50
+ $ ${program.name()} fetch "api query"
+
+Output: JSON to stdout
+`);
+```
+
+### 5. Test All Commands
+
+```bash
+./cli.ts --help
+./cli.ts fetch test
+./cli.ts [each-command]
+```
+
+### 6. Update Documentation
+
+```markdown
+# Breaking Changes (v2.0.0)
+
+Now uses Commander.js for better command organization.
+
+**Migration:**
+- All commands work the same
+- Help text improved
+- Added subcommand support
+
+No API changes - drop-in replacement.
+```
+
+---
+
+## 🔄 BEFORE/AFTER COMPARISON
+
+### Before (Tier 1)
+```typescript
+// Manual parsing, ~350 lines
+async function main() {
+ const args = process.argv.slice(2);
+ const command = args[0];
+ switch (command) {
+ case 'fetch': /* ... */
+ case 'create': /* ... */
+ // ... 15 more cases
+ }
+}
+```
+
+### After (Tier 2)
+```typescript
+// Commander.js, ~250 lines (cleaner)
+program
+ .command('fetch <query>').action(fetchCommand)
+ .command('create <name>').action(createCommand);
+ // ... 15 more commands
+
+program.parse();
+```
+
+---
+
+## ✅ CHECKLIST
+
+- [ ] Commander.js installed
+- [ ] All commands converted
+- [ ] Help text quality maintained
+- [ ] All tests pass
+- [ ] README updated (breaking changes)
+- [ ] Version bumped to 2.0.0
+- [ ] Users notified if published
+
+---
+
+**Note:** Most CLIs NEVER need this upgrade. Tier 1 is production-ready indefinitely.
diff --git a/.claude/skills/system-createskill/SKILL.md b/.claude/skills/system-createskill/SKILL.md
new file mode 100644
index 00000000..354e2202
--- /dev/null
+++ b/.claude/skills/system-createskill/SKILL.md
@@ -0,0 +1,542 @@
+---
+name: system-createskill
+description: |
+ Skill creation and validation framework ensuring compliance with PAI architectural standards.
+
+ USE WHEN user says "create skill", "create a skill", "new skill", "build skill",
+ "make skill", "skill for X", "Create-A-Skill", or any request to create new PAI skills.
+---
+
+## Workflow Routing (SYSTEM PROMPT)
+
+**CRITICAL: Every skill creation request MUST follow architectural compliance validation.**
+
+**When user requests creating a new skill:**
+Examples: "create skill", "create a skill", "new skill", "build skill", "make skill", "skill for X", "Create-A-Skill"
+→ **READ:** ~/.claude/skills/CORE/SKILL-STRUCTURE-AND-ROUTING.md
+→ **READ:** ~/.claude/skills/system-createskill/workflows/create-skill.md
+→ **EXECUTE:** Complete skill creation workflow with architectural validation
+
+**When user requests validating existing skill:**
+Examples: "validate skill", "check skill compliance", "audit skill", "verify skill structure"
+→ **READ:** ~/.claude/skills/CORE/SKILL-STRUCTURE-AND-ROUTING.md
+→ **READ:** ~/.claude/skills/system-createskill/workflows/validate-skill.md
+→ **EXECUTE:** Skill compliance audit workflow
+
+**When user requests updating existing skill:**
+Examples: "update skill", "refactor skill", "fix skill routing", "add workflow to skill"
+→ **READ:** ~/.claude/skills/CORE/SKILL-STRUCTURE-AND-ROUTING.md
+→ **READ:** ~/.claude/skills/system-createskill/workflows/update-skill.md
+→ **EXECUTE:** Skill update workflow with compliance checking
+
+**When user requests canonicalizing a skill:**
+Examples: "canonicalize skill", "canonicalize this skill", "canonicalize [skill-name]", "rebuild skill to standards", "refactor skill to canonical structure"
+→ **READ:** ~/.claude/skills/CORE/SKILL-STRUCTURE-AND-ROUTING.md
+→ **READ:** ~/.claude/skills/system-createskill/workflows/canonicalize-skill.md
+→ **EXECUTE:** Complete skill canonicalization workflow - analyze current skill structure and rebuild according to canonical architecture while preserving functionality
+
+---
+
+## When to Activate This Skill
+
+### Direct Skill Creation Requests
+- "create skill", "create a skill", "new skill for X"
+- "build skill", "make skill", "add skill"
+- "Create-A-Skill" (canonical name)
+- "skill for [purpose]" or "need a skill that does X"
+
+### Skill Validation Requests
+- "validate skill", "check skill compliance", "audit skill structure"
+- "verify skill follows standards", "is this skill compliant"
+- "review skill architecture", "skill quality check"
+
+### Skill Update Requests
+- "update skill", "refactor skill", "fix skill routing"
+- "add workflow to skill", "extend skill"
+- "reorganize skill structure", "migrate skill"
+
+### Skill Canonicalization Requests
+- "canonicalize skill", "canonicalize this skill", "canonicalize [skill-name]"
+- "rebuild skill to standards", "refactor skill to canonical structure"
+- "fix skill compliance", "bring skill to canonical form"
+- "standardize skill structure", "make skill compliant"
+
+### Quality & Compliance Indicators
+- User mentions "architectural standards" or "compliance"
+- User references "SKILL-STRUCTURE-AND-ROUTING.md"
+- User asks about "skill best practices" or "skill patterns"
+- User needs to ensure skill follows "template" or "philosophy"
+
+---
+
+## Core Principles
+
+### Architectural Compliance
+
+**MANDATORY: Every skill MUST comply with the canonical architecture defined in:**
+`~/.claude/skills/CORE/SKILL-STRUCTURE-AND-ROUTING.md`
+
+This document defines:
+- The 3 skill archetypes (Minimal, Standard, Complex)
+- The 4-level routing hierarchy
+- Mandatory structural requirements
+- Workflow organization patterns
+- Naming conventions
+- Routing patterns
+
+**NON-NEGOTIABLE Requirements:**
+
+1. **Workflow Routing Section FIRST** - Immediately after YAML frontmatter
+2. **Every Workflow Must Be Routed** - No orphaned workflow files
+3. **Every Secondary File Must Be Linked** - From main SKILL.md body
+4. **Canonical Structure Template** - Follow the exact structure
+5. **Progressive Disclosure** - SKILL.md → workflows → documentation → references
+
+### Template-Driven Philosophy
+
+**Consistency over creativity** when it comes to structure:
+- Use established archetypes (Minimal/Standard/Complex)
+- Follow canonical naming conventions
+- Implement proven routing patterns
+- Maintain predictable organization
+
+**Creativity where it matters:**
+- Domain-specific workflows
+- Custom capabilities
+- Unique integrations
+- Innovative approaches to problems
+
+### Quality Gates
+
+Every created/updated skill must pass:
+
+1. **Structural Validation**
+ - Correct archetype directory structure
+ - Proper file naming conventions
+ - Required files present
+
+2. **Routing Validation**
+ - Workflow Routing section present and FIRST
+ - All workflows explicitly routed
+ - Activation triggers comprehensive (8-category pattern)
+
+3. **Documentation Validation**
+ - All files referenced in SKILL.md
+ - Clear purpose and when-to-use guidance
+ - Examples provided
+
+4. **Integration Validation**
+ - Registered in mcp_settings.json
+ - No duplication of CORE context
+ - Compatible with agent workflows
+
+---
+
+## Skill Creation Process
+
+### Step 1: Define Skill Purpose
+
+Ask user to clarify:
+- **What does this skill do?** (Core capability)
+- **When should it activate?** (Trigger patterns)
+- **What workflows does it need?** (Count and categories)
+- **What integrations?** (MCPs, agents, external services)
+
+### Step 2: Choose Archetype
+
+Based on workflow count and complexity:
+
+**Minimal Skill (1-3 workflows)**
+```
+skill-name/
+├── SKILL.md
+└── workflows/ OR assets/
+ └── *.md
+```
+
+**Standard Skill (3-15 workflows)**
+```
+skill-name/
+├── SKILL.md
+├── workflows/
+│ └── *.md (flat or nested)
+└── [optional: documentation/, tools/, references/]
+```
+
+**Complex Skill (15+ workflows)**
+```
+skill-name/
+├── SKILL.md
+├── CONSTITUTION.md (optional)
+├── METHODOLOGY.md (optional)
+├── documentation/
+├── workflows/ (nested)
+├── references/
+├── state/
+└── tools/
+```
+
+### Step 3: Read Architecture Document
+
+**ALWAYS read the canonical architecture before creating:**
+```bash
+~/.claude/skills/CORE/SKILL-STRUCTURE-AND-ROUTING.md
+```
+
+This ensures:
+- Latest architectural requirements
+- Current best practices
+- Proven routing patterns
+- Quality standards
+
+### Step 4: Create Skill Structure
+
+Use the canonical template from SKILL-STRUCTURE-AND-ROUTING.md:
+
+```markdown
+---
+name: skill-name
+description: |
+ What this skill does and when to use it.
+
+ USE WHEN: user says "trigger phrase", "another trigger", or any related request.
+---
+
+## Workflow Routing (SYSTEM PROMPT)
+
+**When user requests [action 1]:**
+Examples: "actual user phrases", "variations", "synonyms"
+→ **READ:** ~/.claude/skills/skill-name/workflows/workflow1.md
+→ **EXECUTE:** What to do with this workflow
+
+[Route EVERY workflow file]
+
+---
+
+## When to Activate This Skill
+
+[Comprehensive activation triggers using 8-category pattern]
+
+---
+
+## Extended Context / Main Body
+
+[Detailed information, file links, examples]
+```
+
+### Step 5: Validate Compliance
+
+Run through quality gates:
+- ✅ Workflow Routing section present and FIRST?
+- ✅ All workflows explicitly routed?
+- ✅ All files referenced in main body?
+- ✅ Activation triggers comprehensive?
+- ✅ Examples provided?
+- ✅ Naming conventions followed?
+
+### Step 6: Register Skill
+
+Add to `~/.claude/mcp_settings.json`:
+
+```json
+{
+ "skills": {
+ "skill-name": {
+ "description": "Brief description. USE WHEN user says 'trigger', 'pattern', or requests 'task type'.",
+ "location": "user"
+ }
+ }
+}
+```
+
+### Step 7: Test Activation
+
+Verify skill activates with natural language triggers from description.
+
+---
+
+## The 8-Category Routing Pattern
+
+**For comprehensive activation triggers, cover these categories:**
+
+1. **Core Skill Name (Noun)** - "OSINT", "research", "skill name"
+2. **Action Verbs** - "do [skill]", "run [skill]", "perform [skill]", "execute [skill]"
+3. **Modifiers** - "basic [skill]", "quick [skill]", "comprehensive [skill]", "deep [skill]"
+4. **Prepositions** - "[skill] on [target]", "[skill] for [target]", "[skill] about [target]"
+5. **Synonyms** - Industry jargon, casual vs formal phrasings
+6. **Use Case Oriented** - Why would someone use this? What problem does it solve?
+7. **Result-Oriented** - "find [thing]", "discover [thing]", "get [information]"
+8. **Tool/Method Specific** - Specific tools or techniques within the skill
+
+**Example from security-OSINT skill:**
+```markdown
+## When to Activate This Skill
+
+### Direct OSINT Requests (Categories 1-4)
+- "do OSINT on [target]" or "do some OSINT"
+- "run OSINT", "perform OSINT", "conduct OSINT"
+- "basic OSINT", "quick OSINT", "comprehensive OSINT"
+- "OSINT [target]", "OSINT on [target]", "OSINT for [target]"
+
+### Investigation & Research (Categories 5-7)
+- "investigate [person/company]", "research [target]"
+- "background check", "due diligence", "find information"
+- "who is [person]", "what can you find about [target]"
+```
+
+---
+
+## Routing Patterns Reference
+
+### Pattern 1: Semantic Routing
+**Use when:** Distinct capabilities map to different user intents
+
+```markdown
+**When user requests [specific intent]:**
+Examples: "phrase 1", "phrase 2", "phrase 3"
+→ **READ:** ~/.claude/skills/skill-name/workflows/workflow1.md
+→ **EXECUTE:** Brief description
+```
+
+### Pattern 2: State-Based Routing
+**Use when:** Routing depends on current task state or phase
+
+```markdown
+### Phase 1: [State Name]
+**Current State:** No spec exists
+**Use:** workflow1.md to create spec
+```
+
+### Pattern 3: Agent-Delegated Routing
+**Use when:** Complex context requires agent decision
+
+```markdown
+## Available Capabilities
+
+### Category 1
+- workflow1.md - Description of capability
+- workflow2.md - Description of capability
+```
+
+### Pattern 4: Cross-Skill Delegation
+**Use when:** Another skill has specialized methodology
+
+```markdown
+**CRITICAL: Check if request should be delegated to specialized skills FIRST**
+
+**When user requests [use case needing delegation]:**
+Examples: "phrase 1", "phrase 2"
+→ **INVOKE SKILL:** specialized-skill-name
+→ **REASON:** Why delegation is required
+```
+
+---
+
+## Common Anti-Patterns to Avoid
+
+### ❌ Missing Workflow Routing Section
+**Problem:** Workflows never get invoked
+**Solution:** Add "Workflow Routing (SYSTEM PROMPT)" section FIRST
+
+### ❌ Workflows Not Explicitly Routed
+**Problem:** Orphaned workflow files that are never used
+**Solution:** Route EVERY workflow with examples and file paths
+
+### ❌ Files Not Linked from Main Body
+**Problem:** Files are invisible and undiscoverable
+**Solution:** Reference every .md file in appropriate section
+
+### ❌ Vague Activation Triggers
+**Problem:** "Any security testing request" - too broad
+**Solution:** Use 8-category pattern with specific examples
+
+### ❌ Wrong Section Order
+**Problem:** Workflow routing buried in middle of file
+**Solution:** Workflow Routing section immediately after YAML
+
+### ❌ Duplication of CORE Context
+**Problem:** Skill repeats information already in CORE
+**Solution:** Reference CORE docs, don't duplicate
+
+### ❌ No Examples
+**Problem:** Users don't understand when to use skill
+**Solution:** Provide clear example requests and outcomes
+
+---
+
+## Quality Checklist
+
+Before considering a skill complete, verify:
+
+**Structure:**
+- [ ] Correct archetype directory structure
+- [ ] SKILL.md present and properly formatted
+- [ ] YAML frontmatter with name and description
+- [ ] workflows/ directory (if Standard or Complex)
+
+**Routing:**
+- [ ] Workflow Routing section present
+- [ ] Workflow Routing section is FIRST (after YAML)
+- [ ] Every workflow explicitly routed with examples
+- [ ] File paths are absolute and correct
+
+**Activation:**
+- [ ] Comprehensive trigger patterns (8-category coverage)
+- [ ] "When to Activate This Skill" section detailed
+- [ ] USE WHEN in YAML description
+- [ ] Natural language variations covered
+
+**Documentation:**
+- [ ] All files referenced in SKILL.md main body
+- [ ] Clear purpose and when-to-use for each file
+- [ ] Examples provided
+- [ ] Related workflows linked
+
+**Integration:**
+- [ ] Registered in mcp_settings.json
+- [ ] No duplication of CORE context
+- [ ] Compatible with existing skills
+- [ ] Tested activation with natural language
+
+**Quality:**
+- [ ] Follows naming conventions
+- [ ] Progressive disclosure pattern
+- [ ] Self-contained but inherits CORE
+- [ ] Validated against SKILL-STRUCTURE-AND-ROUTING.md
+
+---
+
+## Extended Context
+
+### Primary Reference Document
+
+**~/.claude/skills/CORE/SKILL-STRUCTURE-AND-ROUTING.md**
+- Canonical guide for all skill structure and routing
+- Defines the 3 archetypes (Minimal, Standard, Complex)
+- The 4-level routing hierarchy
+- All structural requirements and naming conventions
+- Routing pattern examples
+- Complete skill ecosystem reference
+- **ALWAYS read this before creating or updating skills**
+
+### Workflow Files
+
+**~/.claude/skills/system-createskill/workflows/create-skill.md**
+- Complete skill creation workflow
+- Step-by-step process with validation gates
+- Template generation
+- Quality assurance checks
+
+**~/.claude/skills/system-createskill/workflows/validate-skill.md**
+- Skill compliance audit workflow
+- Structural validation
+- Routing validation
+- Documentation validation
+- Integration validation
+
+**~/.claude/skills/system-createskill/workflows/update-skill.md**
+- Skill update and refactoring workflow
+- Adding workflows to existing skills
+- Reorganizing skill structure
+- Migration patterns
+
+---
+
+## Examples
+
+### Example 1: Creating a Minimal Skill
+
+**User:** "Create a skill for generating API documentation"
+
+**System-CreateSkill Response:**
+1. Read SKILL-STRUCTURE-AND-ROUTING.md
+2. Determine archetype: Minimal (single workflow)
+3. Create structure:
+ ```
+ api-docs/
+ ├── SKILL.md
+ └── workflows/
+ └── generate-docs.md
+ ```
+4. Write SKILL.md with:
+ - YAML: name, description with USE WHEN triggers
+ - Workflow Routing section (FIRST)
+ - When to Activate section (8-category pattern)
+ - Main body with workflow description
+5. Validate against quality checklist
+6. Register in mcp_settings.json
+7. Test activation: "generate API docs for my service"
+
+### Example 2: Creating a Standard Skill
+
+**User:** "Create a skill for database operations - migrations, backups, queries, optimization"
+
+**System-CreateSkill Response:**
+1. Read SKILL-STRUCTURE-AND-ROUTING.md
+2. Determine archetype: Standard (4 workflows)
+3. Create structure:
+ ```
+ database/
+ ├── SKILL.md
+ └── workflows/
+ ├── run-migration.md
+ ├── backup-database.md
+ ├── optimize-queries.md
+ └── execute-query.md
+ ```
+4. Write SKILL.md with semantic routing:
+ - Route "run migration" → run-migration.md
+ - Route "backup database" → backup-database.md
+ - Route "optimize" → optimize-queries.md
+ - Route "query" → execute-query.md
+5. Comprehensive activation triggers covering all 4 workflows
+6. Validate and register
+7. Test each workflow activation
+
+### Example 3: Validating Existing Skill
+
+**User:** "Validate the research skill for compliance"
+
+**System-CreateSkill Response:**
+1. Read SKILL-STRUCTURE-AND-ROUTING.md
+2. Read ~/.claude/skills/research/SKILL.md
+3. Run validation:
+ - ✅ Workflow Routing section present and FIRST
+ - ✅ All 12 workflows explicitly routed
+ - ✅ Activation triggers comprehensive
+ - ✅ All files referenced
+ - ✅ Standard archetype structure correct
+4. Report: "research skill is COMPLIANT - no issues found"
+
+---
+
+## Summary
+
+**system-createskill ensures:**
+- Every created skill follows architectural standards
+- Compliance is validated automatically
+- Templates drive consistency
+- Quality gates prevent non-compliant skills
+- Philosophy is embedded in process
+
+**Three core operations:**
+1. **Create** - New skills with architectural compliance
+2. **Validate** - Existing skills against standards
+3. **Update** - Modify skills while maintaining compliance
+
+**One source of truth:**
+`~/.claude/skills/CORE/SKILL-STRUCTURE-AND-ROUTING.md`
+
+**Zero tolerance for:**
+- Orphaned workflows (not routed)
+- Invisible files (not linked)
+- Vague triggers (not comprehensive)
+- Structural violations (wrong archetype)
+
+---
+
+**Related Documentation:**
+- `~/.claude/skills/CORE/SKILL-STRUCTURE-AND-ROUTING.md` - Canonical architecture guide (PRIMARY)
+- `~/.claude/skills/CORE/CONSTITUTION.md` - Overall PAI philosophy
+
+**Last Updated:** 2025-11-17
diff --git a/.claude/skills/system-createskill/workflows/canonicalize-skill.md b/.claude/skills/system-createskill/workflows/canonicalize-skill.md
new file mode 100644
index 00000000..4e752d86
--- /dev/null
+++ b/.claude/skills/system-createskill/workflows/canonicalize-skill.md
@@ -0,0 +1,543 @@
+# Canonicalize Skill Workflow
+
+**Purpose:** Analyze existing skill and rebuild it according to canonical PAI architectural standards while preserving functionality
+
+**When to Use:**
+- User says "canonicalize skill", "canonicalize this skill", "canonicalize [skill-name]"
+- Existing skill doesn't follow current architectural standards
+- Need to refactor skill to comply with SKILL-STRUCTURE-AND-ROUTING.md
+- Skill structure is inconsistent or non-compliant
+
+**Prerequisites:**
+- Target skill exists in ~/.claude/skills/
+- Access to SKILL-STRUCTURE-AND-ROUTING.md
+- Understanding of current skill functionality
+
+---
+
+## Workflow Steps
+
+### Step 1: Identify Target Skill
+
+**If user says "canonicalize this skill":**
+- Determine current working directory
+- If in a skill directory (contains SKILL.md), use that skill
+- Otherwise, ask user to specify skill name or navigate to skill directory
+
+**If user specifies skill name:**
+- Verify skill exists at ~/.claude/skills/[skill-name]/
+- Read SKILL.md to understand current structure
+
+**Output:** Target skill path identified
+
+---
+
+### Step 2: Read Canonical Architecture
+
+**REQUIRED:** Read the source of truth before any analysis:
+```bash
+~/.claude/skills/CORE/SKILL-STRUCTURE-AND-ROUTING.md
+```
+
+**What to extract:**
+- The 3 archetypes (Minimal, Standard, Complex)
+- Mandatory structural requirements
+- Workflow routing rules (FIRST section requirement)
+- Naming conventions
+- Routing patterns
+- Quality checklist
+- 8-category activation pattern
+
+**Output:** Canonical architecture loaded into context
+
+---
+
+### Step 3: Analyze Current Skill Structure
+
+**Read all skill files:**
+```bash
+# Read SKILL.md
+~/.claude/skills/[skill-name]/SKILL.md
+
+# List all files in skill directory
+ls -R ~/.claude/skills/[skill-name]/
+
+# Identify all workflow files
+find ~/.claude/skills/[skill-name]/workflows/ -name "*.md"
+
+# Identify all documentation files
+find ~/.claude/skills/[skill-name]/ -name "*.md" ! -path "*/workflows/*"
+```
+
+**Analyze structure:**
+- Current directory structure
+- File count and organization
+- YAML frontmatter content
+- Presence/absence of Workflow Routing section
+- Location of Workflow Routing section (is it FIRST?)
+- Workflow files and their routing status
+- Documentation files and their linkage
+- Activation trigger comprehensiveness
+- Naming convention compliance
+
+**Output:** Complete structural assessment
+
+---
+
+### Step 4: Identify Compliance Gaps
+
+**Run through mandatory requirements:**
+
+1. **Workflow Routing Section**
+ - ❓ Present? (yes/no)
+ - ❓ Is it FIRST after YAML? (yes/no)
+ - ❓ Are ALL workflows routed? (yes/no)
+ - ❓ Are file paths absolute? (yes/no)
+ - ❓ Are examples provided? (yes/no)
+
+2. **File Linkage**
+ - ❓ Are all secondary files referenced in SKILL.md main body? (yes/no)
+ - ❓ Are all workflow files linked? (yes/no)
+ - ❓ Are all documentation files linked? (yes/no)
+
+3. **Activation Triggers**
+ - ❓ USE WHEN in YAML description? (yes/no)
+ - ❓ "When to Activate This Skill" section present? (yes/no)
+ - ❓ 8-category pattern coverage? (score 0-8)
+
+4. **Archetype Compliance**
+ - Current archetype: [Minimal/Standard/Complex/Unknown]
+ - Workflow count: [N]
+ - Should be archetype: [Minimal/Standard/Complex]
+ - ❓ Directory structure matches archetype? (yes/no)
+
+5. **Naming Conventions**
+ - ❓ SKILL.md uppercase? (yes/no)
+ - ❓ Workflows kebab-case? (yes/no)
+ - ❓ Directories proper naming? (yes/no)
+
+**Output:** Gap analysis report with specific violations
+
+---
+
+### Step 5: Preserve Functionality
+
+**Critical: Do NOT lose functionality during canonicalization**
+
+**Extract and preserve:**
+- All workflow content (steps, tools, commands)
+- All domain knowledge and context
+- All integration points (MCPs, agents, external services)
+- All examples and use cases
+- All reference documentation
+- Special configurations or state
+
+**Create backup:**
+```bash
+# Create backup before modifying
+cp -r ~/.claude/skills/[skill-name]/ ~/.claude/skills/[skill-name]/.backup-$(date +%Y%m%d-%H%M%S)/
+```
+
+**Output:** Functionality inventory and backup created
+
+---
+
+### Step 6: Determine Target Structure
+
+**Based on workflow count:**
+- 0-3 workflows → Minimal archetype
+- 3-15 workflows → Standard archetype
+- 15+ workflows → Complex archetype
+
+**Plan directory structure:**
+
+**Minimal:**
+```
+skill-name/
+├── SKILL.md
+└── workflows/ OR assets/
+ └── *.md
+```
+
+**Standard:**
+```
+skill-name/
+├── SKILL.md
+├── workflows/
+│ └── *.md (flat if <10, nested if 10+)
+└── [optional: documentation/, references/]
+```
+
+**Complex:**
+```
+skill-name/
+├── SKILL.md
+├── [CONSTITUTION.md, METHODOLOGY.md]
+├── documentation/
+├── workflows/ (nested)
+├── references/
+└── [optional: state/, tools/, testing/]
+```
+
+**Output:** Target canonical structure plan
+
+---
+
+### Step 7: Rebuild SKILL.md
+
+**Create new SKILL.md following canonical template:**
+
+```markdown
+---
+name: skill-name
+description: |
+ What this skill does and when to use it.
+
+ USE WHEN: user says "trigger phrase", "another trigger", or any related request.
+---
+
+## Workflow Routing (SYSTEM PROMPT)
+
+**When user requests [action 1]:**
+Examples: "actual user phrases", "variations", "synonyms"
+→ **READ:** ~/.claude/skills/skill-name/workflows/workflow1.md
+→ **EXECUTE:** What to do with this workflow
+
+[Route EVERY workflow file - NO EXCEPTIONS]
+
+---
+
+## When to Activate This Skill
+
+[Use 8-category pattern for comprehensive coverage]
+
+### Direct [Skill Name] Requests
+- [Category 1-4: Core name, verbs, modifiers, prepositions]
+
+### [Use Case Category 1]
+- [Category 5-7: Synonyms, use cases, results]
+
+### [Use Case Category 2]
+- [Category 8: Tool-specific if applicable]
+
+---
+
+## [Extended Context Sections]
+
+[Main body with detailed information]
+[Links to all secondary files]
+[Examples and usage guidance]
+```
+
+**Key fixes:**
+1. ✅ Workflow Routing section FIRST
+2. ✅ ALL workflows explicitly routed
+3. ✅ Absolute file paths
+4. ✅ Comprehensive examples
+5. ✅ 8-category activation pattern
+6. ✅ All files linked in main body
+
+**Output:** Compliant SKILL.md file
+
+---
+
+### Step 8: Reorganize Files
+
+**Move/rename files to match target structure:**
+
+```bash
+# Example: Reorganizing workflows from flat to nested
+mkdir -p ~/.claude/skills/skill-name/workflows/category1
+mkdir -p ~/.claude/skills/skill-name/workflows/category2
+
+mv ~/.claude/skills/skill-name/workflows/category1-*.md \
+ ~/.claude/skills/skill-name/workflows/category1/
+
+mv ~/.claude/skills/skill-name/workflows/category2-*.md \
+ ~/.claude/skills/skill-name/workflows/category2/
+```
+
+**Naming convention fixes:**
+- Rename files to kebab-case if needed
+- Fix directory names (plural containers, singular content)
+- Ensure UPPERCASE for root docs
+
+**Output:** Files organized according to canonical structure
+
+---
+
+### Step 9: Validate Canonicalized Skill
+
+**Run complete validation (use validate-skill workflow):**
+
+**Structural Validation:**
+- ✅ Correct archetype directory structure
+- ✅ All required files present
+- ✅ Naming conventions followed
+
+**Routing Validation:**
+- ✅ Workflow Routing section present and FIRST
+- ✅ All workflows explicitly routed
+- ✅ Examples provided for each route
+
+**Documentation Validation:**
+- ✅ All files referenced in SKILL.md
+- ✅ Clear purpose and when-to-use guidance
+- ✅ Examples provided
+
+**Integration Validation:**
+- ✅ No duplication of CORE context
+- ✅ Compatible with agent workflows
+
+**Quality Validation:**
+- ✅ 8-category activation pattern coverage
+- ✅ Progressive disclosure maintained
+- ✅ Self-contained but inherits CORE
+
+**Output:** Validation report (PASS/FAIL with details)
+
+---
+
+### Step 10: Generate Migration Report
+
+**Create canonicalization report:**
+
+```markdown
+# Skill Canonicalization Report: [skill-name]
+
+**Date:** [YYYY-MM-DD]
+**Original Structure:** [archetype or non-compliant]
+**Target Structure:** [archetype]
+
+## Changes Made
+
+### Structure Changes
+- [List directory reorganization]
+- [List file moves/renames]
+- [List archetype transition]
+
+### SKILL.md Changes
+- Added Workflow Routing section (now FIRST)
+- Routed [N] previously unrouted workflows
+- Enhanced activation triggers ([N] categories covered)
+- Linked [N] previously unlinked files
+
+### Compliance Fixes
+- ✅ Fixed: [specific violation 1]
+- ✅ Fixed: [specific violation 2]
+- ✅ Fixed: [specific violation 3]
+
+### Files Modified
+- [List all modified files]
+
+### Files Created
+- [List any new files]
+
+### Files Deleted
+- [List any removed files]
+- Note: Originals preserved in .backup-[timestamp]/
+
+## Functionality Preserved
+
+✅ All [N] workflows maintained
+✅ All domain knowledge preserved
+✅ All integrations functional
+✅ All examples retained
+
+## Validation Results
+
+✅ Structural: PASS
+✅ Routing: PASS
+✅ Documentation: PASS
+✅ Integration: PASS
+✅ Quality: PASS
+
+## Before vs After
+
+### Before:
+[Description of non-compliant structure]
+
+### After:
+[Description of canonical structure]
+
+## Next Steps
+
+1. Test skill activation with natural language triggers
+2. Verify all workflows execute correctly
+3. Update any external references to this skill
+4. Delete backup after confirming functionality
+
+## Backup Location
+
+Original skill backed up to:
+~/.claude/skills/[skill-name]/.backup-[timestamp]/
+```
+
+**Output:** Complete migration report
+
+---
+
+### Step 11: User Review
+
+**Present to user:**
+1. Gap analysis (what was wrong)
+2. Changes made (what was fixed)
+3. Validation results (compliance status)
+4. Migration report (complete documentation)
+5. Backup location (safety net)
+
+**Ask user:**
+- "Review the changes - does the canonicalized skill meet expectations?"
+- "Test the skill with natural language triggers to verify functionality"
+- "Once confirmed working, you can delete the backup"
+
+**Output:** User approval obtained
+
+---
+
+## Success Criteria
+
+**Canonicalization is complete when:**
+- ✅ Skill follows canonical archetype structure
+- ✅ Workflow Routing section present and FIRST
+- ✅ ALL workflows explicitly routed
+- ✅ ALL files referenced in main body
+- ✅ Activation triggers comprehensive (8-category pattern)
+- ✅ Naming conventions followed
+- ✅ Passes complete validation
+- ✅ Functionality preserved (all workflows work)
+- ✅ Migration report generated
+- ✅ Backup created
+- ✅ User has reviewed and approved
+
+---
+
+## Related Workflows
+
+- **validate-skill.md** - Run after canonicalization to verify compliance
+- **update-skill.md** - For incremental changes after canonicalization
+- **create-skill.md** - For creating new skills from scratch (not refactoring)
+
+---
+
+## Common Canonicalization Patterns
+
+### Pattern 1: Missing Workflow Routing Section
+
+**Before:**
+```markdown
+---
+name: skill-name
+description: Some skill
+---
+
+## When to Use
+...
+
+## Workflows
+- workflow1.md
+- workflow2.md
+```
+
+**After:**
+```markdown
+---
+name: skill-name
+description: |
+ Some skill.
+
+ USE WHEN user says "trigger phrases"
+---
+
+## Workflow Routing (SYSTEM PROMPT)
+
+**When user requests [action 1]:**
+Examples: "phrase 1", "phrase 2"
+→ **READ:** ~/.claude/skills/skill-name/workflows/workflow1.md
+→ **EXECUTE:** Description
+
+**When user requests [action 2]:**
+Examples: "phrase 3", "phrase 4"
+→ **READ:** ~/.claude/skills/skill-name/workflows/workflow2.md
+→ **EXECUTE:** Description
+
+---
+
+## When to Activate This Skill
+[8-category pattern]
+```
+
+### Pattern 2: Flat to Nested Workflow Migration
+
+**When:** >10 workflows in flat structure
+
+**Before:**
+```
+skill/
+└── workflows/
+ ├── category1-action1.md
+ ├── category1-action2.md
+ ├── category2-action1.md
+ └── category2-action2.md
+```
+
+**After:**
+```
+skill/
+└── workflows/
+ ├── category1/
+ │ ├── action1.md
+ │ └── action2.md
+ └── category2/
+ ├── action1.md
+ └── action2.md
+```
+
+### Pattern 3: Adding 8-Category Activation Triggers
+
+**Before:**
+```markdown
+## When to Use
+- User asks for OSINT
+- User needs research
+```
+
+**After:**
+```markdown
+## When to Activate This Skill
+
+### Direct OSINT Requests
+- "do OSINT on [target]" or "do some OSINT"
+- "run OSINT", "perform OSINT", "conduct OSINT"
+- "basic OSINT", "quick OSINT", "comprehensive OSINT"
+- "OSINT [target]", "OSINT on [target]", "OSINT for [target]"
+
+### Investigation & Research
+- "investigate [person/company]", "research [target]"
+- "background check", "due diligence", "find information"
+- "who is [person]", "what can you find about [target]"
+```
+
+---
+
+## Notes
+
+**Philosophy:** Canonicalization is about **compliance**, not **creativity**
+- Structure follows templates
+- Routing is explicit and comprehensive
+- Functionality is preserved
+- Quality is validated
+
+**Safety First:**
+- ALWAYS create backup before modifying
+- ALWAYS preserve functionality
+- ALWAYS validate after changes
+- ALWAYS get user approval
+
+**One Source of Truth:**
+Everything must align with:
+`~/.claude/skills/CORE/SKILL-STRUCTURE-AND-ROUTING.md`
+
+---
+
+**Last Updated:** 2025-11-17
diff --git a/.claude/skills/system-createskill/workflows/create-skill.md b/.claude/skills/system-createskill/workflows/create-skill.md
new file mode 100644
index 00000000..607e8d58
--- /dev/null
+++ b/.claude/skills/system-createskill/workflows/create-skill.md
@@ -0,0 +1,638 @@
+# Create Skill Workflow
+
+**Purpose:** Create a brand new PAI skill following canonical architectural standards
+
+**When to Use:**
+- User says "create skill", "create a skill", "new skill", "build skill", "make skill"
+- User wants to add new capability domain to PAI
+- User requests "skill for [purpose]"
+
+**Prerequisites:**
+- Access to SKILL-STRUCTURE-AND-ROUTING.md
+- Understanding of skill purpose and requirements
+- Target skill name determined
+
+---
+
+## Workflow Steps
+
+### Step 1: Read Canonical Architecture
+
+**REQUIRED FIRST STEP:** Read the source of truth before creating:
+```bash
+~/.claude/skills/CORE/SKILL-STRUCTURE-AND-ROUTING.md
+```
+
+**What to extract:**
+- The 3 archetypes (Minimal, Standard, Complex)
+- Canonical SKILL.md structure template
+- Mandatory structural requirements
+- Workflow routing rules
+- Naming conventions
+- The 8-category activation pattern
+- Quality checklist
+
+**Output:** Canonical architecture loaded into context
+
+---
+
+### Step 2: Define Skill Requirements
+
+**Ask user to clarify:**
+
+1. **What does this skill do?** (Core capability)
+ - What problem does it solve?
+ - What domain does it cover?
+ - What are the main capabilities?
+
+2. **When should it activate?** (Trigger patterns)
+ - What phrases will users say?
+ - What tasks trigger this skill?
+ - What synonyms and variations?
+
+3. **What workflows does it need?** (Count and types)
+ - How many distinct workflows?
+ - What are the workflow categories?
+ - Are workflows sequential or independent?
+
+4. **What integrations?** (Dependencies)
+ - MCPs needed?
+ - Agents required?
+ - External services?
+ - Tools or scripts?
+
+5. **Skill name?** (Naming)
+ - Kebab-case format: "skill-name"
+ - Descriptive and clear
+ - Follows naming conventions
+
+**Output:** Complete skill requirements specification
+
+---
+
+### Step 3: Choose Archetype
+
+**Based on workflow count and complexity:**
+
+**Minimal Skill (0-3 workflows)**
+- **Use when:** Single purpose, few workflows, no complex state
+- **Structure:** SKILL.md + workflows/ OR assets/
+- **Example:** be-creative, social-xpost
+
+**Standard Skill (3-15 workflows)**
+- **Use when:** Multi-workflow, clear domain, some documentation
+- **Structure:** SKILL.md + workflows/ + optional (documentation/, references/, tools/)
+- **Example:** research, blogging, media
+
+**Complex Skill (15+ workflows)**
+- **Use when:** Many workflows, extensive docs, state management, embedded apps
+- **Structure:** SKILL.md + full directory tree
+- **Example:** development, business, CORE
+
+**Decision criteria:**
+```
+Workflow count:
+├─ 0-3 → MINIMAL
+├─ 3-15 → STANDARD
+└─ 15+ → COMPLEX
+
+Additional factors:
+- State management needed? → Bump up one level
+- Embedded applications? → COMPLEX
+- Extensive documentation? → Bump up one level
+```
+
+**Output:** Archetype selected with rationale
+
+---
+
+### Step 4: Create Directory Structure
+
+**For Minimal Skill:**
+```bash
+mkdir -p ~/.claude/skills/[skill-name]/workflows
+touch ~/.claude/skills/[skill-name]/SKILL.md
+```
+
+**For Standard Skill:**
+```bash
+mkdir -p ~/.claude/skills/[skill-name]/{workflows,documentation}
+touch ~/.claude/skills/[skill-name]/SKILL.md
+```
+
+**For Complex Skill:**
+```bash
+mkdir -p ~/.claude/skills/[skill-name]/{workflows,documentation,references,state,tools,testing}
+touch ~/.claude/skills/[skill-name]/{SKILL.md,CONSTITUTION.md,METHODOLOGY.md}
+```
+
+**Verify creation:**
+```bash
+ls -la ~/.claude/skills/[skill-name]/
+```
+
+**Output:** Directory structure created
+
+---
+
+### Step 5: Create SKILL.md
+
+**Use the canonical template from SKILL-STRUCTURE-AND-ROUTING.md:**
+
+```markdown
+---
+name: skill-name
+description: |
+ Brief description of what this skill does and its core capabilities.
+
+ USE WHEN user says "trigger phrase 1", "trigger phrase 2", "trigger phrase 3",
+ "another variation", or any request related to [domain/purpose].
+---
+
+## Workflow Routing (SYSTEM PROMPT)
+
+**CRITICAL: This section MUST be FIRST and route EVERY workflow.**
+
+**When user requests [action 1]:**
+Examples: "actual user phrase 1", "variation 1", "variation 2", "variation 3", "casual phrasing"
+→ **READ:** ~/.claude/skills/skill-name/workflows/workflow1.md
+→ **EXECUTE:** Brief description of what this workflow does
+
+**When user requests [action 2]:**
+Examples: "actual user phrase 1", "variation 1", "variation 2", "variation 3", "result-oriented phrasing"
+→ **READ:** ~/.claude/skills/skill-name/workflows/workflow2.md
+→ **EXECUTE:** Brief description of what this workflow does
+
+[Continue for EVERY workflow - NO EXCEPTIONS]
+
+---
+
+## When to Activate This Skill
+
+**Use the 8-category pattern for comprehensive coverage:**
+
+### Direct [Skill Name] Requests (Categories 1-4)
+- Core skill name and all variations
+- "do [skill]", "run [skill]", "perform [skill]", "execute [skill]", "conduct [skill]"
+- "basic [skill]", "quick [skill]", "simple [skill]", "comprehensive [skill]", "deep [skill]", "full [skill]"
+- "[skill] on [target]", "[skill] for [target]", "[skill] about [target]"
+
+### [Primary Use Case Category] (Categories 5-7)
+- Synonyms and alternative phrasings
+- Use case oriented: why would someone use this?
+- Result-oriented: "find [thing]", "discover [thing]", "get [information]"
+
+### [Secondary Use Case Category] (Category 8)
+- Tool/method specific triggers if applicable
+- Specialized scenarios
+
+### [Additional Categories as Needed]
+- Cover all major use cases
+- Natural language variations
+
+---
+
+## Core Capabilities
+
+**What this skill provides:**
+- Capability 1: Description
+- Capability 2: Description
+- Capability 3: Description
+
+---
+
+## Workflow Overview
+
+**[Category 1 - if applicable]**
+- **workflow1.md** - Description and when to use
+- **workflow2.md** - Description and when to use
+
+**[Category 2 - if applicable]**
+- **workflow3.md** - Description and when to use
+- **workflow4.md** - Description and when to use
+
+---
+
+## Extended Context
+
+[Additional information, configuration, integration details]
+
+**Related Documentation:**
+[Link any supporting docs]
+
+**Integration Points:**
+[MCPs, agents, external services]
+
+**Configuration:**
+[Any required setup or configuration]
+
+---
+
+## Examples
+
+**Example 1: [Use Case Name]**
+
+User: "example request"
+
+Skill Response:
+1. Routes to [workflow-name].md
+2. Executes steps: [brief description]
+3. Outcome: [what happens]
+
+**Example 2: [Use Case Name]**
+
+User: "another example request"
+
+Skill Response:
+1. Routes to [workflow-name].md
+2. Executes steps: [brief description]
+3. Outcome: [what happens]
+
+---
+
+**Related Documentation:**
+- `~/.claude/skills/CORE/SKILL-STRUCTURE-AND-ROUTING.md` - Canonical structure guide
+- `~/.claude/skills/CORE/CONSTITUTION.md` - Overall PAI philosophy
+
+**Last Updated:** [YYYY-MM-DD]
+```
+
+**Critical elements to include:**
+1. ✅ YAML frontmatter with name and comprehensive description
+2. ✅ USE WHEN triggers in description (5-10 variations)
+3. ✅ Workflow Routing section FIRST (after YAML)
+4. ✅ Every workflow explicitly routed with examples
+5. ✅ 8-category activation pattern in "When to Activate"
+6. ✅ Clear capability descriptions
+7. ✅ Workflow overview linking all files
+8. ✅ Concrete examples
+
+**Output:** SKILL.md file created and compliant
+
+---
+
+### Step 6: Create Workflow Files
+
+**For each workflow identified in Step 2:**
+
+```bash
+touch ~/.claude/skills/[skill-name]/workflows/[workflow-name].md
+```
+
+**Use standard workflow template:**
+
+```markdown
+# [Workflow Name]
+
+**Purpose:** One-line description of what this workflow does
+
+**When to Use:**
+- Specific trigger condition 1
+- Specific trigger condition 2
+- When user needs to [specific outcome]
+
+**Prerequisites:**
+- Required tool or configuration
+- Required state or artifact
+- Any dependencies
+
+---
+
+## Workflow Steps
+
+### Step 1: [Action Name]
+
+**Description:** What this step accomplishes
+
+**Actions:**
+```bash
+# Commands if applicable
+command-to-run
+```
+
+**Expected Outcome:** What should happen
+
+---
+
+### Step 2: [Action Name]
+
+**Description:** What this step accomplishes
+
+**Actions:**
+- Bullet point action 1
+- Bullet point action 2
+
+**Expected Outcome:** What should happen
+
+---
+
+### Step 3: [Final Action]
+
+**Description:** Wrap up and verification
+
+**Verification:**
+- Success criteria 1
+- Success criteria 2
+
+---
+
+## Outputs
+
+**What this workflow produces:**
+- Output 1: Description and location
+- Output 2: Description and location
+
+**Where outputs are stored:**
+- Path or location
+
+---
+
+## Related Workflows
+
+- **next-workflow.md** - What to do after this (if sequential)
+- **alternative-workflow.md** - Alternative approach (if applicable)
+- **parent-workflow.md** - Broader workflow this belongs to (if nested)
+
+---
+
+## Examples
+
+**Example 1:**
+Input: [Example input]
+Process: [What happens]
+Output: [Example output]
+
+**Example 2:**
+Input: [Example input]
+Process: [What happens]
+Output: [Example output]
+
+---
+
+**Last Updated:** [YYYY-MM-DD]
+```
+
+**Output:** All workflow files created
+
+---
+
+### Step 7: Validate Skill Structure
+
+**Run structural validation:**
+
+```bash
+# Verify SKILL.md exists
+test -f ~/.claude/skills/[skill-name]/SKILL.md && echo "✅ SKILL.md present" || echo "❌ SKILL.md missing"
+
+# Verify workflows directory
+test -d ~/.claude/skills/[skill-name]/workflows && echo "✅ workflows/ present" || echo "❌ workflows/ missing"
+
+# Count workflow files
+echo "Workflow count: $(find ~/.claude/skills/[skill-name]/workflows/ -name "*.md" | wc -l)"
+
+# Verify archetype compliance
+# Check against archetype rules
+```
+
+**Manual validation checklist:**
+- [ ] YAML frontmatter present
+- [ ] Workflow Routing section present and FIRST
+- [ ] All workflows routed in Workflow Routing section
+- [ ] "When to Activate This Skill" section present
+- [ ] 8-category activation pattern used
+- [ ] All workflow files exist
+- [ ] All workflow files linked in SKILL.md
+- [ ] Directory structure matches archetype
+- [ ] Naming conventions followed
+- [ ] Examples provided
+
+**Output:** Validation results
+
+---
+
+### Step 8: Register Skill
+
+**Add to `~/.claude/mcp_settings.json`:**
+
+```json
+{
+ "skills": {
+ "skill-name": {
+ "description": "Brief description of skill. USE WHEN user says 'trigger 1', 'trigger 2', 'trigger 3', or requests [domain/task].",
+ "location": "user"
+ }
+ }
+}
+```
+
+**Important:**
+- Description should be 1-2 sentences max
+- Include 3-10 trigger phrases
+- Include USE WHEN for clarity
+- Location is "user" for user skills
+
+**Verify registration:**
+```bash
+grep -A 3 '"skill-name"' ~/.claude/mcp_settings.json
+```
+
+**Output:** Skill registered in system
+
+---
+
+### Step 9: Test Skill Activation
+
+**Test natural language triggers:**
+
+1. **Start fresh conversation** (to load new skill)
+2. **Try primary trigger:** "do [skill-name] for [target]"
+3. **Try casual trigger:** "quick [skill-name]"
+4. **Try result-oriented:** "find [result using skill]"
+5. **Try use-case oriented:** "[problem that skill solves]"
+
+**Expected:**
+- Skill loads SKILL.md
+- Routes to correct workflow
+- Executes workflow steps
+
+**If skill doesn't activate:**
+- Check mcp_settings.json registration
+- Verify trigger phrases in description
+- Test with more explicit phrasing
+- Review system prompt skill loading
+
+**Output:** Skill activation confirmed
+
+---
+
+### Step 10: Document Creation
+
+**Create skill creation record:**
+
+```markdown
+# Skill Creation: [skill-name]
+
+**Created:** [YYYY-MM-DD]
+**Archetype:** [Minimal/Standard/Complex]
+**Workflow Count:** [N]
+
+## Purpose
+[Brief description of what this skill does]
+
+## Capabilities
+- Capability 1
+- Capability 2
+- Capability 3
+
+## Workflows
+1. workflow1.md - Purpose
+2. workflow2.md - Purpose
+[...]
+
+## Integration Points
+- MCP: [if applicable]
+- Agents: [if applicable]
+- External Services: [if applicable]
+
+## Activation Triggers
+- "trigger 1"
+- "trigger 2"
+- "trigger 3"
+
+## Quality Validation
+✅ Structural compliance
+✅ Routing compliance
+✅ Documentation complete
+✅ Registered in mcp_settings.json
+✅ Tested and functional
+
+## Notes
+[Any special considerations or future enhancements]
+```
+
+**Optional:** Add to skill inventory or changelog
+
+**Output:** Creation documented
+
+---
+
+## Success Criteria
+
+**Skill creation is complete when:**
+- ✅ Archetype chosen and implemented
+- ✅ Directory structure created
+- ✅ SKILL.md written using canonical template
+- ✅ Workflow Routing section present and FIRST
+- ✅ ALL workflows routed explicitly
+- ✅ 8-category activation pattern used
+- ✅ All workflow files created
+- ✅ All files referenced in SKILL.md
+- ✅ Naming conventions followed
+- ✅ Registered in mcp_settings.json
+- ✅ Tested with natural language triggers
+- ✅ Validated against quality checklist
+- ✅ Documentation complete
+
+---
+
+## Common Patterns
+
+### Pattern 1: Simple Utility Skill (Minimal)
+
+**Example:** Generate API documentation
+
+**Structure:**
+```
+api-docs/
+├── SKILL.md
+└── workflows/
+ └── generate-docs.md
+```
+
+**Characteristics:**
+- Single workflow
+- No state
+- Clear input/output
+- Minimal configuration
+
+### Pattern 2: Multi-Workflow Domain Skill (Standard)
+
+**Example:** Database operations
+
+**Structure:**
+```
+database/
+├── SKILL.md
+└── workflows/
+ ├── run-migration.md
+ ├── backup-database.md
+ ├── optimize-queries.md
+ └── execute-query.md
+```
+
+**Characteristics:**
+- 4 distinct workflows
+- Related capabilities
+- Semantic routing
+- Category-based organization
+
+### Pattern 3: Comprehensive Framework Skill (Complex)
+
+**Example:** Security testing framework
+
+**Structure:**
+```
+security-testing/
+├── SKILL.md
+├── METHODOLOGY.md
+├── documentation/
+│ └── tools.md
+├── workflows/
+│ ├── recon/
+│ ├── exploitation/
+│ └── reporting/
+├── tools/
+│ └── automation/
+└── references/
+ └── checklists/
+```
+
+**Characteristics:**
+- 15+ workflows
+- Methodology document
+- Nested organization
+- State management
+- Tool integration
+
+---
+
+## Related Workflows
+
+- **validate-skill.md** - Validate created skill for compliance
+- **canonicalize-skill.md** - Fix non-compliant existing skill
+- **update-skill.md** - Add workflows or extend existing skill
+
+---
+
+## Notes
+
+**Critical Success Factors:**
+1. **ALWAYS read SKILL-STRUCTURE-AND-ROUTING.md FIRST**
+2. **Workflow Routing section MUST be FIRST**
+3. **Every workflow MUST be routed**
+4. **8-category activation pattern is NOT optional**
+5. **Test activation before declaring complete**
+
+**One Source of Truth:**
+Everything must align with:
+`~/.claude/skills/CORE/SKILL-STRUCTURE-AND-ROUTING.md`
+
+**Progressive Disclosure:**
+- SKILL.md is the hub (routing + overview)
+- Workflows contain detailed steps
+- Documentation provides deep context
+- References provide supporting material
+
+---
+
+**Last Updated:** 2025-11-17
diff --git a/.claude/skills/system-createskill/workflows/update-skill.md b/.claude/skills/system-createskill/workflows/update-skill.md
new file mode 100644
index 00000000..e699ab15
--- /dev/null
+++ b/.claude/skills/system-createskill/workflows/update-skill.md
@@ -0,0 +1,548 @@
+# Update Skill Workflow
+
+**Purpose:** Update existing skill with new workflows, documentation, or features while maintaining architectural compliance
+
+**When to Use:**
+- User says "update skill", "add workflow to skill", "extend skill"
+- Need to add new workflow to existing skill
+- Need to refactor workflow organization (flat → nested)
+- Need to add documentation or references
+- Need to add state management or tools
+- Skill needs incremental enhancement
+
+**Prerequisites:**
+- Target skill exists and is functional
+- Access to SKILL-STRUCTURE-AND-ROUTING.md
+- Understanding of changes needed
+- Backup created (recommended)
+
+---
+
+## Workflow Steps
+
+### Step 1: Read Canonical Architecture
+
+**REQUIRED:** Read the source of truth before updating:
+```bash
+~/.claude/skills/CORE/SKILL-STRUCTURE-AND-ROUTING.md
+```
+
+**What to extract:**
+- Current archetype requirements
+- Workflow routing rules
+- File organization patterns
+- Naming conventions
+- Quality standards
+
+**Output:** Architecture standards loaded
+
+---
+
+### Step 2: Identify Update Scope
+
+**Ask user to clarify what needs updating:**
+
+**Type 1: Add New Workflow**
+- What does the new workflow do?
+- What triggers it?
+- Where should it fit in existing structure?
+
+**Type 2: Reorganize Workflows**
+- Current organization (flat/nested)?
+- Target organization?
+- Reason for change (too many flat files, clearer categories)?
+
+**Type 3: Add Documentation**
+- What documentation is needed?
+- Where should it go (documentation/, references/)?
+- What does it document?
+
+**Type 4: Add Features**
+- State management?
+- Tool integration?
+- Agent integration?
+- MCP integration?
+
+**Type 5: Fix Compliance Issues**
+- What issues identified (from validate-skill)?
+- What needs fixing?
+
+**Output:** Update scope defined
+
+---
+
+### Step 3: Assess Current State
+
+**Read current SKILL.md:**
+```bash
+~/.claude/skills/[skill-name]/SKILL.md
+```
+
+**Analyze:**
+- Current archetype (Minimal/Standard/Complex)
+- Current workflow count
+- Current directory structure
+- Current routing patterns
+
+**Check for upgrade triggers:**
+- Adding workflow to Minimal → Should become Standard?
+- Adding 5+ workflows to Standard → Should become Complex?
+- Adding state management → Bump up archetype?
+
+**Determine if archetype change needed:**
+```
+Current: Minimal (2 workflows) + Adding 3 new → Standard (5 total)
+Current: Standard (12 workflows) + Adding 8 new → Complex (20 total)
+Current: Standard (no state) + Adding state → Consider Complex
+```
+
+**Output:** Current state assessment + archetype decision
+
+---
+
+### Step 4: Create Backup
+
+**ALWAYS backup before modifying:**
+```bash
+# Create timestamped backup
+cp -r ~/.claude/skills/[skill-name]/ \
+ ~/.claude/skills/[skill-name]/.backup-$(date +%Y%m%d-%H%M%S)/
+
+# Verify backup
+ls -la ~/.claude/skills/[skill-name]/.backup-*/
+```
+
+**Output:** Backup created
+
+---
+
+### Step 5: Implement Changes
+
+**For Type 1: Add New Workflow**
+
+**Create workflow file:**
+```bash
+touch ~/.claude/skills/[skill-name]/workflows/[new-workflow].md
+```
+
+**Write workflow content** (use standard template from create-skill.md)
+
+**Update SKILL.md Workflow Routing section:**
+```markdown
+**When user requests [new action]:**
+Examples: "phrase 1", "phrase 2", "phrase 3", "phrase 4", "phrase 5"
+→ **READ:** ~/.claude/skills/[skill-name]/workflows/[new-workflow].md
+→ **EXECUTE:** Description of what this workflow does
+```
+
+**Update "When to Activate This Skill" section:**
+- Add triggers for new workflow
+- Expand category coverage if needed
+
+**Update Workflow Overview section:**
+- Add new workflow to appropriate category
+- Provide description and when-to-use
+
+**Output:** New workflow added and routed
+
+---
+
+**For Type 2: Reorganize Workflows (Flat → Nested)**
+
+**When:** 10+ workflows in flat structure
+
+**Create category directories:**
+```bash
+mkdir -p ~/.claude/skills/[skill-name]/workflows/{category1,category2,category3}
+```
+
+**Move workflows to categories:**
+```bash
+# Move workflows by category
+mv ~/.claude/skills/[skill-name]/workflows/category1-*.md \
+ ~/.claude/skills/[skill-name]/workflows/category1/
+
+mv ~/.claude/skills/[skill-name]/workflows/category2-*.md \
+ ~/.claude/skills/[skill-name]/workflows/category2/
+```
+
+**Update SKILL.md Workflow Routing paths:**
+```markdown
+OLD: → **READ:** ~/.claude/skills/[skill-name]/workflows/workflow1.md
+NEW: → **READ:** ~/.claude/skills/[skill-name]/workflows/category1/workflow1.md
+```
+
+**Update Workflow Overview with nested structure:**
+```markdown
+## Workflow Overview
+
+**Category 1**
+- **category1/workflow1.md** - Description
+- **category1/workflow2.md** - Description
+
+**Category 2**
+- **category2/workflow1.md** - Description
+```
+
+**Output:** Workflows reorganized into nested structure
+
+---
+
+**For Type 3: Add Documentation**
+
+**Create documentation directory if needed:**
+```bash
+mkdir -p ~/.claude/skills/[skill-name]/documentation
+```
+
+**Create documentation file:**
+```bash
+touch ~/.claude/skills/[skill-name]/documentation/[topic].md
+```
+
+**Write documentation content**
+
+**Link from SKILL.md Extended Context section:**
+```markdown
+## Extended Context
+
+### [Topic Name]
+
+For detailed information about [topic], see:
+`~/.claude/skills/[skill-name]/documentation/[topic].md`
+
+[Brief summary of what this doc contains]
+[When to use this documentation]
+```
+
+**Output:** Documentation added and linked
+
+---
+
+**For Type 4: Add Features**
+
+**Add State Management:**
+```bash
+mkdir -p ~/.claude/skills/[skill-name]/state
+touch ~/.claude/skills/[skill-name]/.gitignore
+
+# Add to .gitignore
+echo "state/*.json" >> ~/.claude/skills/[skill-name]/.gitignore
+echo "state/*.cache" >> ~/.claude/skills/[skill-name]/.gitignore
+```
+
+**Add Tools:**
+```bash
+mkdir -p ~/.claude/skills/[skill-name]/tools
+touch ~/.claude/skills/[skill-name]/tools/[tool-name].ts
+```
+
+**Add Testing:**
+```bash
+mkdir -p ~/.claude/skills/[skill-name]/testing
+touch ~/.claude/skills/[skill-name]/testing/test-[feature].md
+```
+
+**Document in SKILL.md:**
+- Explain state management approach
+- Document tool usage
+- Link testing procedures
+
+**Output:** Features added and documented
+
+---
+
+**For Type 5: Fix Compliance Issues**
+
+**Use issues from validate-skill report:**
+- Fix Workflow Routing section placement
+- Add missing workflow routes
+- Expand activation triggers
+- Link orphan files
+- Fix naming conventions
+
+**Run validation after each fix:**
+- Verify issue resolved
+- Check no new issues introduced
+
+**Output:** Compliance issues fixed
+
+---
+
+### Step 6: Update Archetype (If Needed)
+
+**If workflow count or complexity changed archetype:**
+
+**Minimal → Standard:**
+```bash
+# Add optional directories
+mkdir -p ~/.claude/skills/[skill-name]/documentation
+mkdir -p ~/.claude/skills/[skill-name]/references
+```
+
+**Standard → Complex:**
+```bash
+# Add full directory tree
+mkdir -p ~/.claude/skills/[skill-name]/{documentation,references,state,tools,testing}
+
+# Optionally add methodology docs
+touch ~/.claude/skills/[skill-name]/METHODOLOGY.md
+```
+
+**Update SKILL.md to reflect complexity:**
+- Expand Extended Context sections
+- Add methodology references if applicable
+- Document new capabilities
+
+**Output:** Archetype upgraded if needed
+
+---
+
+### Step 7: Validate Changes
+
+**Run validate-skill workflow:**
+```bash
+# Use validate-skill.md to check compliance
+```
+
+**Check:**
+- ✅ Structural validation (archetype correct)
+- ✅ Routing validation (new workflows routed)
+- ✅ Activation triggers (expanded if needed)
+- ✅ Documentation (new files linked)
+- ✅ Integration (no regressions)
+- ✅ Quality (standards maintained)
+
+**Fix any issues found**
+
+**Output:** Validation passed
+
+---
+
+### Step 8: Test Updated Skill
+
+**Test new workflows:**
+```bash
+# Test activation with natural language
+"do [new-workflow-action]"
+"quick [new-workflow-action]"
+"[result from new workflow]"
+```
+
+**Test existing workflows:**
+```bash
+# Ensure no regressions
+"do [existing-workflow-action]"
+```
+
+**Test reorganized paths (if applicable):**
+- Verify routed paths correct
+- Check no broken links
+
+**Output:** All workflows functional
+
+---
+
+### Step 9: Document Changes
+
+**Create update record:**
+
+```markdown
+# Skill Update: [skill-name]
+
+**Date:** [YYYY-MM-DD]
+**Update Type:** [Add Workflow / Reorganize / Add Documentation / Add Features / Fix Compliance]
+**Previous Archetype:** [archetype]
+**New Archetype:** [archetype if changed]
+
+## Changes Made
+
+### New Workflows
+- [new-workflow-1].md - Purpose and triggers
+- [new-workflow-2].md - Purpose and triggers
+
+### Reorganization
+- Moved workflows from flat to nested structure
+- Categories: [list categories]
+
+### New Documentation
+- documentation/[topic].md - What it covers
+
+### New Features
+- State management added
+- Tool integration: [tool name]
+
+### Compliance Fixes
+- Fixed: [issue 1]
+- Fixed: [issue 2]
+
+## Updated Activation Triggers
+
+**New triggers added:**
+- "phrase 1"
+- "phrase 2"
+- "phrase 3"
+
+## Validation Results
+
+✅ Structural: PASS
+✅ Routing: PASS
+✅ Activation: PASS
+✅ Documentation: PASS
+✅ Integration: PASS
+✅ Quality: PASS
+
+## Testing Performed
+
+- Tested new workflow activations
+- Tested existing workflows (no regressions)
+- Verified reorganized paths work
+- Confirmed all features functional
+
+## Backup Location
+
+Original skill backed up to:
+~/.claude/skills/[skill-name]/.backup-[timestamp]/
+
+## Next Steps
+
+[Any follow-up work needed]
+```
+
+**Optional:** Add to MIGRATION-YYYY-MM-DD.md if major update
+
+**Output:** Changes documented
+
+---
+
+### Step 10: User Review
+
+**Present to user:**
+- Summary of changes made
+- New capabilities available
+- Updated activation triggers
+- Validation results
+- Testing confirmation
+
+**Confirm:**
+- "Changes meet expectations?"
+- "Ready to use updated skill?"
+- "Delete backup after confirming functionality?"
+
+**Output:** User approval obtained
+
+---
+
+## Success Criteria
+
+**Update is complete when:**
+- ✅ Changes implemented as specified
+- ✅ SKILL.md updated (routing, triggers, documentation)
+- ✅ New files created in correct locations
+- ✅ All new files linked from SKILL.md
+- ✅ Archetype updated if needed
+- ✅ Validation passed
+- ✅ Functionality tested (new + existing)
+- ✅ Changes documented
+- ✅ Backup created
+- ✅ User approval obtained
+
+---
+
+## Common Update Patterns
+
+### Pattern 1: Adding Single Workflow
+
+**Scenario:** Add "export data" workflow to existing skill
+
+**Steps:**
+1. Create workflows/export-data.md
+2. Add routing in SKILL.md Workflow Routing section
+3. Add triggers to "When to Activate" section
+4. Add to Workflow Overview
+5. Validate and test
+
+**Time:** 10-15 minutes
+
+---
+
+### Pattern 2: Reorganizing Workflows (Flat → Nested)
+
+**Scenario:** Skill has 15 workflows, moving from flat to nested
+
+**Steps:**
+1. Create category directories
+2. Move workflows to categories
+3. Update all routing paths in SKILL.md
+4. Update Workflow Overview to show nested structure
+5. Test all workflow activations
+6. Validate
+
+**Time:** 20-30 minutes
+
+---
+
+### Pattern 3: Archetype Upgrade (Minimal → Standard)
+
+**Scenario:** Minimal skill growing to 5 workflows
+
+**Steps:**
+1. Add documentation/ directory
+2. Move extended docs from SKILL.md to documentation/
+3. Link docs from SKILL.md
+4. Update SKILL.md to be routing hub
+5. Validate archetype compliance
+
+**Time:** 30-45 minutes
+
+---
+
+### Pattern 4: Adding Integration (MCP/Agent)
+
+**Scenario:** Add MCP integration to existing skill
+
+**Steps:**
+1. Document integration in SKILL.md Extended Context
+2. Create tools/ directory if needed
+3. Add integration scripts
+4. Update workflows to use integration
+5. Test integration functionality
+6. Document configuration
+
+**Time:** 30-60 minutes
+
+---
+
+## Related Workflows
+
+- **create-skill.md** - Create new skill from scratch
+- **validate-skill.md** - Validate updated skill compliance
+- **canonicalize-skill.md** - Major refactoring for compliance
+
+---
+
+## Notes
+
+**Incremental vs Major Updates:**
+- **Incremental:** Add 1-3 workflows, minor features → Use update-skill
+- **Major:** 10+ workflow additions, archetype change, complete refactor → Consider canonicalize-skill
+
+**Safety First:**
+- ALWAYS create backup
+- ALWAYS validate after changes
+- ALWAYS test existing functionality
+- Get user approval before finalizing
+
+**Maintain Quality:**
+- Follow canonical architecture
+- Keep activation triggers comprehensive
+- Route all new workflows
+- Link all new files
+- Update documentation
+
+**One Source of Truth:**
+`~/.claude/skills/CORE/SKILL-STRUCTURE-AND-ROUTING.md`
+
+---
+
+**Last Updated:** 2025-11-17
diff --git a/.claude/skills/system-createskill/workflows/validate-skill.md b/.claude/skills/system-createskill/workflows/validate-skill.md
new file mode 100644
index 00000000..cedb404a
--- /dev/null
+++ b/.claude/skills/system-createskill/workflows/validate-skill.md
@@ -0,0 +1,612 @@
+# Validate Skill Workflow
+
+**Purpose:** Audit existing skill for compliance with canonical PAI architectural standards
+
+**When to Use:**
+- User says "validate skill", "check skill compliance", "audit skill structure"
+- Before deploying a skill to production
+- After creating or updating a skill
+- When reviewing skill quality
+- As part of skill maintenance
+
+**Prerequisites:**
+- Target skill exists in ~/.claude/skills/
+- Access to SKILL-STRUCTURE-AND-ROUTING.md
+- Understanding of validation criteria
+
+---
+
+## Workflow Steps
+
+### Step 1: Read Canonical Architecture
+
+**REQUIRED FIRST STEP:** Read the source of truth:
+```bash
+~/.claude/skills/CORE/SKILL-STRUCTURE-AND-ROUTING.md
+```
+
+**What to extract:**
+- The 3 archetypes (Minimal, Standard, Complex)
+- Mandatory structural requirements
+- Workflow routing rules
+- Naming conventions
+- Quality checklist
+
+**Output:** Validation criteria loaded
+
+---
+
+### Step 2: Identify Target Skill
+
+**If user specifies skill name:**
+```bash
+~/.claude/skills/[skill-name]/
+```
+
+**If user says "validate this skill":**
+- Check current working directory
+- If in skill directory (contains SKILL.md), use that
+- Otherwise ask user to specify
+
+**Verify skill exists:**
+```bash
+test -f ~/.claude/skills/[skill-name]/SKILL.md && echo "✅ Skill found" || echo "❌ Skill not found"
+```
+
+**Output:** Target skill identified
+
+---
+
+### Step 3: Structural Validation
+
+**Check directory structure:**
+
+```bash
+# List all files
+tree ~/.claude/skills/[skill-name]/
+
+# Or if tree not available:
+find ~/.claude/skills/[skill-name]/ -type f -o -type d
+```
+
+**Validate archetype compliance:**
+
+**For Minimal Skill (0-3 workflows):**
+- [ ] SKILL.md present
+- [ ] workflows/ OR assets/ directory present
+- [ ] No unnecessary directories
+
+**For Standard Skill (3-15 workflows):**
+- [ ] SKILL.md present
+- [ ] workflows/ directory present
+- [ ] Optional: documentation/, references/, tools/
+- [ ] No unnecessary complexity
+
+**For Complex Skill (15+ workflows):**
+- [ ] SKILL.md present
+- [ ] workflows/ directory (nested structure)
+- [ ] documentation/ directory (CORE is flat exception)
+- [ ] Optional: CONSTITUTION.md, METHODOLOGY.md
+- [ ] Optional: references/, state/, tools/, testing/
+
+**Count workflows:**
+```bash
+find ~/.claude/skills/[skill-name]/workflows/ -name "*.md" -type f | wc -l
+```
+
+**Determine expected archetype:**
+- 0-3 workflows → Should be Minimal
+- 3-15 workflows → Should be Standard
+- 15+ workflows → Should be Complex
+
+**Check archetype match:**
+- ❓ Does structure match workflow count?
+- ❓ Is skill over-engineered (Complex structure with 5 workflows)?
+- ❓ Is skill under-engineered (Minimal structure with 20 workflows)?
+
+**Naming conventions:**
+```bash
+# Check SKILL.md is uppercase
+test -f ~/.claude/skills/[skill-name]/SKILL.md && echo "✅ SKILL.md correct" || echo "❌ Should be SKILL.md"
+
+# Check workflow naming (should be kebab-case)
+find ~/.claude/skills/[skill-name]/workflows/ -name "*.md" -exec basename {} \; | grep -v '^[a-z][a-z0-9-]*\.md$' && echo "❌ Non-kebab-case workflows found" || echo "✅ Workflows kebab-case"
+```
+
+**Score: [X/10]**
+
+**Output:** Structural validation results
+
+---
+
+### Step 4: Routing Validation
+
+**Read SKILL.md:**
+```bash
+~/.claude/skills/[skill-name]/SKILL.md
+```
+
+**Check YAML frontmatter:**
+- [ ] `name:` field present
+- [ ] `description:` field present
+- [ ] Description includes USE WHEN triggers
+- [ ] Description has 5-10 trigger phrases
+
+**Check Workflow Routing section:**
+- [ ] "Workflow Routing (SYSTEM PROMPT)" section present
+- [ ] Section is FIRST (immediately after YAML frontmatter)
+- [ ] NOT buried in middle or end of file
+
+**Count routed workflows:**
+```bash
+# Manual inspection - count "When user requests" blocks
+grep -c "When user requests" ~/.claude/skills/[skill-name]/SKILL.md
+```
+
+**Compare to actual workflows:**
+```bash
+# Count actual workflow files
+find ~/.claude/skills/[skill-name]/workflows/ -name "*.md" -type f | wc -l
+```
+
+**Validation:**
+- ❓ Are all workflows routed? (route count = file count)
+- ❓ Are orphan workflows present? (files not routed)
+- ❓ Are dead routes present? (routes to non-existent files)
+
+**Check routing quality:**
+For each route:
+- [ ] Examples provided (3-5 user phrases)
+- [ ] File path is absolute (`~/.claude/skills/...`)
+- [ ] EXECUTE description provided
+- [ ] Examples are semantic (natural language), not formulaic
+
+**Example of GOOD routing:**
+```markdown
+**When user requests person research:**
+Examples: "do OSINT on [person]", "research [person]", "background check on [person]", "who is [person]", "investigate this person"
+→ **READ:** ~/.claude/skills/security-OSINT/workflows/people/lookup.md
+→ **EXECUTE:** Complete person OSINT workflow
+```
+
+**Example of BAD routing:**
+```markdown
+**When user requests person research:**
+→ READ: workflows/people/lookup.md
+→ EXECUTE: Person OSINT
+```
+
+**Score: [X/10]**
+
+**Output:** Routing validation results
+
+---
+
+### Step 5: Activation Triggers Validation
+
+**Check "When to Activate This Skill" section:**
+- [ ] Section present
+- [ ] Located after Workflow Routing section
+
+**8-Category Pattern Coverage:**
+
+Check if skill covers these categories:
+
+1. **Core Skill Name (Noun)** - ❓ Present?
+ - Skill name variations
+ - Abbreviations
+
+2. **Action Verbs** - ❓ Present?
+ - "do [skill]", "run [skill]", "perform [skill]", etc.
+
+3. **Modifiers (Scope/Intensity)** - ❓ Present?
+ - "basic [skill]", "quick [skill]", "comprehensive [skill]", etc.
+
+4. **Prepositions (Target Connection)** - ❓ Present?
+ - "[skill] on [target]", "[skill] for [target]", etc.
+
+5. **Synonyms & Alternative Phrasings** - ❓ Present?
+ - Industry jargon, casual vs formal
+
+6. **Use Case Oriented** - ❓ Present?
+ - Why would someone use this?
+ - What problem does it solve?
+
+7. **Result-Oriented Phrasing** - ❓ Present?
+ - "find [thing]", "discover [thing]", "get [information]"
+
+8. **Tool/Method Specific** - ❓ Present if applicable?
+ - Specific tools or techniques
+
+**Category Coverage Score: [X/8]**
+
+**Comprehensiveness check:**
+- [ ] Covers at least 5/8 categories
+- [ ] Includes casual phrasing ("just do X", "super basic X")
+- [ ] Includes natural variations (not just formulaic)
+- [ ] Passes "read aloud" test (sounds like real requests)
+
+**Score: [X/10]**
+
+**Output:** Activation trigger validation results
+
+---
+
+### Step 6: Documentation Validation
+
+**Check file linkage:**
+
+**List all .md files in skill:**
+```bash
+find ~/.claude/skills/[skill-name]/ -name "*.md" -type f
+```
+
+**For each file (excluding SKILL.md):**
+- ❓ Is it referenced in SKILL.md main body?
+- ❓ Is purpose explained?
+- ❓ Is when-to-use guidance provided?
+
+**Check for orphan files:**
+- Files in skill directory not linked from SKILL.md
+
+**Check for broken links:**
+- SKILL.md references non-existent files
+
+**Documentation quality:**
+- [ ] Each workflow has clear purpose
+- [ ] Each workflow has when-to-use guidance
+- [ ] Examples provided
+- [ ] Related workflows linked
+
+**Extended context sections:**
+- [ ] Core capabilities explained
+- [ ] Integration points documented
+- [ ] Configuration documented (if applicable)
+- [ ] Examples provided
+
+**Score: [X/10]**
+
+**Output:** Documentation validation results
+
+---
+
+### Step 7: Integration Validation
+
+**Check mcp_settings.json registration:**
+```bash
+grep -A 3 '"[skill-name]"' ~/.claude/mcp_settings.json
+```
+
+**Validation:**
+- [ ] Skill registered in mcp_settings.json
+- [ ] Description field present
+- [ ] USE WHEN triggers in description
+- [ ] Location set to "user"
+
+**Check for CORE duplication:**
+- [ ] Skill doesn't duplicate CORE context
+- [ ] References CORE instead of copying
+- [ ] Self-contained but inherits CORE
+
+**Check agent compatibility:**
+- [ ] Can be invoked via Skill tool
+- [ ] Compatible with agent workflows
+- [ ] No blocking dependencies
+
+**Score: [X/10]**
+
+**Output:** Integration validation results
+
+---
+
+### Step 8: Quality Validation
+
+**Progressive disclosure check:**
+- [ ] SKILL.md is the hub (routing + overview)
+- [ ] Workflows contain detailed steps
+- [ ] Documentation provides deep context
+- [ ] Not all info crammed in SKILL.md
+
+**Naming convention compliance:**
+- [ ] SKILL.md is UPPERCASE
+- [ ] Root docs are UPPERCASE (METHODOLOGY, CONSTITUTION)
+- [ ] Workflows are kebab-case
+- [ ] Directories follow conventions (workflows, tools, documentation)
+
+**Template compliance:**
+- [ ] Follows canonical SKILL.md template
+- [ ] Workflow files follow standard template
+- [ ] Consistent structure across files
+
+**Examples present:**
+- [ ] SKILL.md has usage examples
+- [ ] Workflows have input/output examples
+- [ ] Clear demonstration of capabilities
+
+**Score: [X/10]**
+
+**Output:** Quality validation results
+
+---
+
+### Step 9: Generate Validation Report
+
+**Compile all results:**
+
+```markdown
+# Skill Validation Report: [skill-name]
+
+**Date:** [YYYY-MM-DD]
+**Validator:** system-createskill
+**Overall Status:** [PASS / FAIL / NEEDS IMPROVEMENT]
+
+---
+
+## Executive Summary
+
+**Overall Score:** [X/70] ([percentage]%)
+**Archetype:** [Minimal/Standard/Complex]
+**Compliance Status:** [Compliant/Non-Compliant]
+
+**Critical Issues:** [N]
+**Major Issues:** [N]
+**Minor Issues:** [N]
+
+---
+
+## Validation Results
+
+### 1. Structural Validation: [X/10]
+
+**Archetype Compliance:**
+- Expected: [archetype based on workflow count]
+- Actual: [archetype based on structure]
+- Match: [Yes/No]
+
+**Directory Structure:**
+✅ [Compliant elements]
+❌ [Non-compliant elements]
+⚠️ [Issues needing attention]
+
+**Naming Conventions:**
+✅ [Correct naming]
+❌ [Incorrect naming]
+
+---
+
+### 2. Routing Validation: [X/10]
+
+**Workflow Routing Section:**
+- Present: [Yes/No]
+- Location: [First/Middle/End/Missing]
+- ✅/❌ Positioning correct
+
+**Workflow Coverage:**
+- Total workflows: [N]
+- Routed workflows: [N]
+- Orphan workflows: [N]
+- Dead routes: [N]
+
+**Routing Quality:**
+✅ [Good routing examples]
+❌ [Poor routing examples]
+
+---
+
+### 3. Activation Triggers: [X/10]
+
+**8-Category Pattern Coverage: [X/8]**
+1. Core Skill Name: [✅/❌]
+2. Action Verbs: [✅/❌]
+3. Modifiers: [✅/❌]
+4. Prepositions: [✅/❌]
+5. Synonyms: [✅/❌]
+6. Use Case Oriented: [✅/❌]
+7. Result-Oriented: [✅/❌]
+8. Tool/Method Specific: [✅/❌/N/A]
+
+**Quality:**
+✅ [Strengths]
+❌ [Weaknesses]
+
+---
+
+### 4. Documentation: [X/10]
+
+**File Linkage:**
+- Total files: [N]
+- Linked files: [N]
+- Orphan files: [N]
+- Broken links: [N]
+
+**Documentation Quality:**
+✅ [Good documentation]
+❌ [Missing or poor documentation]
+
+---
+
+### 5. Integration: [X/10]
+
+**Registration:**
+- mcp_settings.json: [✅/❌]
+- Description quality: [Good/Needs Improvement]
+
+**CORE Duplication:**
+- [✅ No duplication / ❌ Duplication found]
+
+**Agent Compatibility:**
+- [✅ Compatible / ❌ Issues found]
+
+---
+
+### 6. Quality: [X/10]
+
+**Progressive Disclosure:** [✅/❌]
+**Naming Conventions:** [✅/❌]
+**Template Compliance:** [✅/❌]
+**Examples Present:** [✅/❌]
+
+---
+
+## Issues Identified
+
+### Critical Issues (Must Fix)
+1. [Issue 1 with specific details]
+2. [Issue 2 with specific details]
+
+### Major Issues (Should Fix)
+1. [Issue 1 with specific details]
+2. [Issue 2 with specific details]
+
+### Minor Issues (Nice to Fix)
+1. [Issue 1 with specific details]
+2. [Issue 2 with specific details]
+
+---
+
+## Recommendations
+
+### Immediate Actions
+1. [Action 1 to fix critical issues]
+2. [Action 2 to fix critical issues]
+
+### Short-term Improvements
+1. [Action 1 for major issues]
+2. [Action 2 for major issues]
+
+### Long-term Enhancements
+1. [Suggestion 1 for improvement]
+2. [Suggestion 2 for improvement]
+
+---
+
+## Compliance Status
+
+**This skill is:**
+- [✅ COMPLIANT] - Meets all mandatory requirements
+- [⚠️ PARTIALLY COMPLIANT] - Meets most requirements, minor issues
+- [❌ NON-COMPLIANT] - Fails mandatory requirements
+
+**Next Steps:**
+[What needs to be done to achieve/maintain compliance]
+
+---
+
+## Canonical Reference
+
+All validation based on:
+`~/.claude/skills/CORE/SKILL-STRUCTURE-AND-ROUTING.md`
+
+**Last Updated:** [YYYY-MM-DD]
+```
+
+**Output:** Complete validation report
+
+---
+
+### Step 10: Present Results to User
+
+**Summarize findings:**
+- Overall score and status
+- Critical issues requiring immediate attention
+- Recommendations for improvement
+- Next steps
+
+**If COMPLIANT:**
+"✅ Skill [skill-name] is COMPLIANT with canonical architecture. Score: [X/70] ([percentage]%)"
+
+**If NON-COMPLIANT:**
+"❌ Skill [skill-name] has compliance issues. Score: [X/70] ([percentage]%). [N] critical issues found. Recommend using canonicalize-skill workflow to fix."
+
+**Output:** User informed of validation results
+
+---
+
+## Success Criteria
+
+**Validation is complete when:**
+- ✅ All 6 validation categories checked
+- ✅ Scores calculated for each category
+- ✅ Overall score computed
+- ✅ Issues identified and categorized
+- ✅ Recommendations provided
+- ✅ Compliance status determined
+- ✅ Report generated
+- ✅ User informed
+
+**Skill is COMPLIANT when:**
+- Score ≥ 60/70 (≥85%)
+- No critical issues
+- Workflow Routing section present and FIRST
+- All workflows routed
+- Registered in mcp_settings.json
+
+---
+
+## Common Validation Failures
+
+### Failure 1: Missing Workflow Routing Section
+**Symptom:** No "Workflow Routing" section in SKILL.md
+**Impact:** CRITICAL - Workflows never invoked
+**Fix:** Add Workflow Routing section FIRST, route all workflows
+
+### Failure 2: Orphan Workflows
+**Symptom:** Workflow files exist but not routed in SKILL.md
+**Impact:** CRITICAL - Workflows inaccessible
+**Fix:** Add routing for each orphan workflow
+
+### Failure 3: Workflow Routing Not First
+**Symptom:** Routing section buried in middle/end of SKILL.md
+**Impact:** MAJOR - Workflows may be missed
+**Fix:** Move Workflow Routing section to FIRST position
+
+### Failure 4: Incomplete Activation Triggers
+**Symptom:** Only 2-3 categories covered, missing action verbs or modifiers
+**Impact:** MAJOR - Skill won't activate with common phrasings
+**Fix:** Expand to cover all 8 categories
+
+### Failure 5: Vague Examples
+**Symptom:** Examples like "user asks for [skill]" instead of actual phrases
+**Impact:** MAJOR - Pattern matching fails
+**Fix:** Use real user phrasings, not templates
+
+### Failure 6: Unlinked Files
+**Symptom:** Files in skill directory not referenced in SKILL.md
+**Impact:** MINOR - Files undiscoverable
+**Fix:** Link all files from SKILL.md main body
+
+### Failure 7: Wrong Archetype
+**Symptom:** Complex structure with 5 workflows, or Minimal with 20
+**Impact:** MINOR - Over/under-engineered
+**Fix:** Refactor to appropriate archetype
+
+---
+
+## Related Workflows
+
+- **create-skill.md** - Create new compliant skill
+- **canonicalize-skill.md** - Fix non-compliant existing skill
+- **update-skill.md** - Update skill while maintaining compliance
+
+---
+
+## Notes
+
+**Validation Philosophy:**
+- Objective criteria (not subjective opinion)
+- Based on canonical architecture
+- Actionable recommendations
+- Clear pass/fail for critical items
+
+**Use Cases:**
+- Pre-deployment quality gate
+- Post-creation verification
+- Periodic skill audits
+- Skill maintenance
+
+**One Source of Truth:**
+`~/.claude/skills/CORE/SKILL-STRUCTURE-AND-ROUTING.md`
+
+---
+
+**Last Updated:** 2025-11-17