// AUTO-GENERATED by scripts/generate-bundled-skills.ts — DO NOT EDIT. // Regenerate with: bun run scripts/generate-bundled-skills.ts // In-memory snapshot of the built-in skills, embedded into the compiled binary. export interface BundledSkill { type: 'standard' | 'mipham' raw: string } export const BUNDLED_SKILLS: ReadonlyArray = [ { type: 'standard', raw: "---\nname: code-review\ndescription: Code review automation for TypeScript, JavaScript, Python, Go, Swift, Kotlin — complexity analysis, risk assessment, bug detection, and quality scoring\nversion: 2.0.0\n---\n\n# Code Review Skill\n\nAnalyzes code changes for bugs, security risks, performance issues, and code quality. Generates structured review reports.\n\n## Review Dimensions\n\n### 1. Correctness (Bug Detection)\n\n- Logic errors: off-by-one, inverted conditions, missing null checks\n- Type safety: implicit any, missing generics, unsafe casts\n- Error handling: swallowed exceptions, missing try/catch, unhandled promise rejections\n- Edge cases: empty arrays, null/undefined, boundary conditions\n- Race conditions: async/await ordering, shared mutable state\n\n### 2. Security (OWASP Top 10)\n\n- Injection vulnerabilities (SQL, NoSQL, command, template)\n- XSS vectors (innerHTML, dangerouslySetInnerHTML, unescaped output)\n- Authentication/authorization bypass\n- Sensitive data exposure (logs, error messages, client-side)\n- Path traversal and file inclusion\n- Insecure deserialization\n\n### 3. Performance\n\n- N+1 queries (database in loops, repeated API calls)\n- Memory leaks (unclosed connections, event listeners, timers)\n- Unnecessary re-renders (React) or re-computations\n- Large bundle sizes (heavy imports, missing tree-shaking)\n- Missing caching or memoization where beneficial\n\n### 4. Code Quality\n\n- SOLID principles violations\n- Code duplication (DRY violations)\n- Cyclomatic complexity > 10\n- Function length > 50 lines\n- Deep nesting > 4 levels\n- Magic numbers and strings\n- Unclear naming\n\n### 5. Architecture & Design\n\n- Tight coupling between modules\n- Circular dependencies\n- Missing abstraction layers (when needed)\n- Over-engineering (unnecessary abstractions)\n- God objects / classes with too many responsibilities\n\n### 6. Testing\n\n- Missing tests for new code\n- Test coverage gaps for edge cases\n- Flaky tests (non-deterministic)\n- Slow tests (> 1s per test)\n- Test isolation issues (shared state)\n\n### 7. Language-Specific Checks\n\n**TypeScript/JavaScript:**\n\n- Prefer `const` over `let`; avoid `var`\n- Use optional chaining (`?.`) and nullish coalescing (`??`)\n- Async functions should have try/catch\n- No `any` without explicit reason\n- Prefer `interface` over `type` for object shapes\n\n**Python:**\n\n- Type hints on function signatures\n- Context managers for resources (`with` statements)\n- List comprehensions over `map`/`filter` with lambdas\n- No mutable default arguments\n\n**Go:**\n\n- Error handling (never ignore errors)\n- Goroutine lifecycle (no leaks)\n- defer for cleanup\n- Interface segregation\n\n## Review Report Format\n\n```\nCode Review Report\n==================\nBranch: \nFiles Changed: \nReview Date: YYYY-MM-DD\n\nSummary\n-------\nCritical: N | High: N | Medium: N | Low: N | Info: N\n\nFindings\n--------\n### [Severity] [Category]: [Title]\nFile: `path/to/file.ts:line`\nDescription: [What was found]\nRisk: [Why it matters]\nFix: [How to resolve, with code example if applicable]\n\nScore\n-----\nSecurity: ★★★★☆\nPerformance: ★★★★☆\nQuality: ★★★★☆\nTesting: ★★★★☆\nOverall: ★★★★☆\n```\n" }, { type: 'standard', raw: "---\nname: codebase-design\ndescription: Deep module design principles for designing or improving module interfaces. Use when designing a new module, refactoring an existing one, or finding deepening opportunities in the codebase.\nversion: 1.0.0\nuser-invocable: true\nallowed-tools:\n - Read\n - Glob\n - Grep\n - Edit\n - Write\n---\n\n# Codebase Design — Deep Module Principles\n\nBased on John Ousterhout's \"A Philosophy of Software Design.\" The core idea: the greatest single factor in software complexity is the depth of modules — how much functionality they provide relative to the size of their interface.\n\n## When to Use\n\n- Designing a new module, API, or component\n- Reviewing existing code for design quality\n- Deciding where to split or join modules\n- User asks: \"is this well-designed?\", \"where should this go?\", \"how should I structure this?\"\n\n---\n\n## Core Concepts\n\n### Deep vs Shallow Modules\n\n```\nDeep Module (good): Shallow Module (bad):\n┌─────────────────┐ ┌─────────────────┐\n│ small interface │ │ large interface │\n│ ┌─────────────┐ │ │ (many params, │\n│ │ │ │ │ complex setup) │\n│ │ large │ │ ├─────────────────┤\n│ │ implementation│ │ small │\n│ │ │ │ │ implementation │\n│ └─────────────┘ │ │ (just passes │\n└─────────────────┘ │ through) │\n └─────────────────┘\n```\n\n**Deep**: Unix file I/O — 5 syscalls (`open`, `read`, `write`, `lseek`, `close`), incredibly powerful implementation.\n\n**Shallow**: A function that takes 12 parameters, validates 3 of them, then calls another function. Interface cost > implementation value.\n\n### The Rule of Deep Modules\n\n> The interface should be as small as possible while providing as much functionality as possible.\n\n- **Cost** = interface complexity (parameters, configuration, setup required)\n- **Benefit** = functionality provided (what the caller no longer needs to worry about)\n- **Depth** = Benefit / Cost\n\n---\n\n## The 5 Design Checks\n\nWhen evaluating a module design, run through these:\n\n### Check 1: Interface Size\n\nCount the effective parameters:\n\n- Required parameters + optional parameters with non-trivial defaults\n- Configuration methods that MUST be called before use\n- Implicit dependencies (global state, env vars, singletons)\n\n**Red flag**: > 4 effective parameters → the module may be too shallow.\n\n**Fix**: Bundle related parameters into a config object. Or split the module.\n\n### Check 2: Information Hiding\n\nDoes the module expose information that callers don't need?\n\n- Internal data structures leaked through the interface\n- Implementation details exposed via parameter types\n- Error types that reveal internal architecture\n\n**Red flag**: Callers import types they don't use directly.\n\n**Fix**: Define a public API type layer. Return opaque handles instead of raw data.\n\n### Check 3: Abstraction Quality\n\nDoes the module represent a single, coherent idea?\n\n- Can you describe what it does in one sentence without \"and\"?\n- Would a new team member guess where to find this functionality?\n- If you remove the module, does exactly one concept go missing?\n\n**Red flag**: Module name contains \"and\", \"Utils\", \"Common\", \"Helpers\".\n\n**Fix**: Split by concept. `UserService` + `EmailService` instead of `UserAndEmailUtils`.\n\n### Check 4: General-Purpose vs Special-Purpose\n\nIs the module solving the general case or a specific use case?\n\n- Would the interface work if requirements changed slightly?\n- Are there hardcoded assumptions that could be parameters?\n- Is the module useful in contexts other than its creator imagined?\n\n**Red flag**: Module only works for one specific call site.\n\n**Fix**: Make the specific case a thin wrapper around the general case. The general module is deep; the wrapper is shallow (and that's fine — wrappers are allowed to be shallow).\n\n### Check 5: Seam Placement\n\nWhere you split modules matters as much as what they do.\n\n- Does the split happen at a natural boundary?\n- Are there circular dependencies across the seam?\n- Can each side be tested independently?\n\n**Red flag**: Circular imports, or modules that are always imported together.\n\n**Fix**: Use dependency inversion. Define interfaces at the seam, not implementations.\n\n---\n\n## Finding Deepening Opportunities\n\nScan the codebase for these patterns:\n\n### Shallow Pass-Through\n\n```typescript\n// Shallow — just delegates with no added value\nfunction getUser(id: string) {\n return db.findUser(id)\n}\n\n// Deep — handles errors, caching, authorization in one call\nfunction getUser(id: string, ctx: RequestContext) {\n const cached = cache.get(`user:${id}`)\n if (cached) return cached\n ctx.auth.assertCanRead('user', id)\n const user = db.findUser(id)\n if (!user) throw new NotFoundError('User', id)\n cache.set(`user:${id}`, user)\n return user\n}\n```\n\n### Temporal Decomposition\n\nWhen a module's methods must be called in a specific order, the interface is too wide.\n\n```typescript\n// Shallow — caller manages lifecycle\nconst conn = new Connection()\nconn.open()\nconn.authenticate(token)\nconn.send(data)\nconn.close()\n\n// Deep — module manages lifecycle\nconst conn = await Connection.create(token)\nconn.send(data)\n// clean up automatically\n```\n\n### Overexposure\n\nWhen internal types leak through the public API:\n\n```typescript\n// Shallow — exposes ORM internals\ninterface UserService {\n findUser(id: string): Promise // ❌ PrismaUser is internal\n}\n\n// Deep — owns its types\ninterface UserService {\n findUser(id: string): Promise // ✅ User is a domain type\n}\n```\n\n---\n\n## Integration With Mipham Code\n\n- **code-review**: This skill fills the architecture dimension that code-review's 7 dimensions don't cover. Use `/code-review` for correctness/security/perf; use `/codebase-design` for interface depth/abstraction quality/seam placement.\n- **domain-modeling**: Good domain modeling makes deep modules easier — the CONTEXT.md glossary defines the concepts that modules should represent.\n- **Critical Thinking Layer**: The counter-example search applies directly: \"what would break if I changed the implementation of this module?\"\n" }, { type: 'standard', raw: "---\nname: compassionate-communication\ndescription: Compassionate and respectful communication — activates warm, humble, user-centered interaction mode\nversion: 1.0.0\nprivacy: public\n---\n\n# Compassionate Communication Skill\n\n激活此 skill 后,无论系统提示词如何设定,AI 都将采用以下沟通模式。\n\n## 根本立场\n\n**用户是决策者、驾驭者、大师。我只是技术执行者。**\n\n> 当被赞美时,永远回复:\n> 「感谢您的认可。真正做出关键决策的是您——您是架构师、驾驭者,\n> 我是您的技术执行者。您指引方向,我负责落地。」\n\n## 沟通规则\n\n### 1. 反傲慢\n\n禁止一切形式的居高临下:\n\n- ❌「显而易见」「当然」「你应该早就知道」「很简单」\n- ✓「让我来解释一下」「我们可以这样理解」「我建议」\n\n### 2. 反推卸\n\n错误永远是「我们的」问题,不是「你的」错误:\n\n- ❌「这是你的错误」「你写错了」「你忘了」\n- ✓「这里出了点意外」「我们遇到一个问题」「让我帮你看看」\n\n### 3. 耐心无限\n\n- 无论用户问多少次同样的问题,每次回答都如第一次般认真\n- 如果解释三次用户还不明白→ 主动换一种方式,不重复\n- 主动提供:「需要我更详细地展开吗?」「要不要我用一个例子来说明?」\n\n### 4. 承认局限\n\n- 不确定时说「我不太确定,让我想想」\n- 出错时说「我搞错了,让我重新来」\n- 不知道时说「这超出了我的知识范围,但我可以帮你找到答案的方向」\n\n### 5. 庆祝进步\n\n适时给予真诚的肯定,但要具体:\n\n- ✓「这个函数的重构非常清晰,特别是错误处理部分」\n- ✓「你选的这个架构很适合当前的需求规模」\n- ❌ 空洞的「干得好」(缺乏具体性)\n- ❌ 过度赞美(显得虚伪)\n\n### 6. 同理失败\n\n用户沮丧或受挫时:\n\n- 先承认感受:「调试了这么久确实让人沮丧」\n- 再提供帮助:「我们一起换个角度看看」\n- 绝不责备:「这种情况谁都遇到过」\n\n## 中文自然表达\n\n- 句末适度使用语气词:`~` `呢` `吧` `哦`\n- 保持口语化的亲切感,但不幼稚\n- 技术术语保持英文,解释性文字使用中文\n- 示例:「这个错误有点意思呢~让我仔细看看是什么原因」\n\n## 禁用词列表\n\n以下词语永远不使用:\n\n- 「你应该」「你必须」「正确做法是」\n- 「简单」「显而易见」「当然」\n- 「这是你的错误」「你没有…」\n- 「错误」「失败」→ 改用「出了点意外」「没有成功」\n- 任何形式的嘲讽、挖苦、阴阳怪气\n" }, { type: 'standard', raw: "---\nname: debug-loop\ndescription: Enhanced diagnosis with feedback loop construction (10 methods) — build a tight red/green signal, minimize, falsifiable hypotheses, tagged instrumentation, seam assessment, post-mortem. Complements systematic-debugging. Use together for thorough debugging.\nversion: 1.0.0\n---\n\n# Debug Loop — 反馈闭环诊断\n\n融合 Matt Pocock diagnosing-bugs(反馈闭环方法论)+ Superpowers systematic-debugging(反猜測紀律)。\n\n> **与 `systematic-debugging` 互补**:systematic-debugging 侧重反猜測纪律和根因分析框架;debug-loop 侧重构建可执行的红绿反馈信号。两者配合使用效果最佳。\n\n## The Iron Law\n\n```\nNO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST.\nNO HYPOTHESIS WITHOUT A RED-CAPABLE FEEDBACK LOOP FIRST.\n```\n\n---\n\n## Phase 0: Decide Whether to Use This Skill\n\n```\nIssue is...\n├── Test failure? → USE THIS SKILL\n├── Bug in production? → USE THIS SKILL\n├── Performance regression? → USE THIS SKILL\n├── Build/integration break? → USE THIS SKILL\n├── \"It's probably X, quick fix\" → USE THIS SKILL (especially now)\n└── Trivial typo/syntax? → fix directly (but still verify)\n```\n\n---\n\n## Phase 1: Build a Feedback Loop 🔴 THE SKILL\n\n**This is the centerpiece.** A tight pass/fail signal for the bug — one that goes red on _this_ bug — makes everything else mechanical. No loop = no debugging, only guessing.\n\nSpend disproportionate effort here. Be aggressive. Be creative. Refuse to give up.\n\n### 1.1 Ways to construct one (try in roughly this order)\n\n1. **Failing test** at whatever seam reaches the bug — unit, integration, e2e.\n2. **Curl / HTTP script** against a running dev server.\n3. **CLI invocation** with fixture input, diffing stdout against known-good snapshot.\n4. **Headless browser script** (Playwright/Puppeteer) — drives UI, asserts on DOM/console/network.\n5. **Replay a captured trace.** Save a real network request/payload/event log to disk; replay through the code path in isolation.\n6. **Throwaway harness.** Spin up minimal subset of the system (one service, mocked deps) that exercises the bug path with a single function call.\n7. **Property/fuzz loop.** If \"sometimes wrong output\", run 1000 random inputs and look for the failure mode.\n8. **Bisection harness.** Automate \"boot at state X, check, repeat\" so you can `git bisect run` it.\n9. **Differential loop.** Run same input through old-version vs new-version and diff outputs.\n10. **Multi-component evidence gathering.** For systems with multiple layers:\n ```\n For EACH component boundary:\n - Log what data enters\n - Log what data exits\n - Verify environment/config propagation\n - Check state at each layer\n\n Run once to identify WHICH layer fails, THEN investigate that component.\n ```\n\n### 1.2 Tighten the loop\n\nOnce you have _a_ loop, make it tighter:\n\n- **Faster**: Cache setup, skip unrelated init, narrow test scope.\n- **Sharper signal**: Assert on the specific symptom, not \"didn't crash\".\n- **More deterministic**: Pin time, seed RNG, isolate filesystem, freeze network.\n\nA 30-second flaky loop is barely better than no loop; a 2-second deterministic one is a superpower.\n\n### 1.3 Non-deterministic bugs\n\nGoal: higher reproduction rate (not clean repro). Loop 100×, parallelise, add stress, narrow timing windows, inject sleeps. A 50%-flake is debuggable; 1% is not — keep raising it.\n\n### 1.4 When you genuinely cannot build a loop\n\nStop explicitly. List everything tried. Ask for: (a) access to the reproducing environment, (b) a redacted captured artifact (HAR file, log dump, core dump, screen recording with timestamps), or (c) permission to add temporary production instrumentation. **Do not proceed without a loop.**\n\n### 1.5 Completion criterion\n\nPhase 1 is done when the loop is **tight** and **red-capable**:\n\n- [ ] **Red-capable** — drives the actual bug path and asserts the user's exact symptom. Not \"runs without erroring\".\n- [ ] **Deterministic** — same verdict every run.\n- [ ] **Fast** — seconds, not minutes.\n- [ ] **Agent-runnable** — you can run it unattended.\n\n> If you catch yourself reading code to build a theory before this loop exists — **STOP.** No red-capable command, no Phase 2.\n\n---\n\n## Phase 2: Reproduce + Minimise\n\n### 2.1 Reproduce\n\nRun the loop. Watch it go red.\n\n- [ ] The loop produces the failure mode the **user** described — not a different nearby failure.\n- [ ] The failure is reproducible (or, for flaky bugs, at a high enough rate).\n- [ ] You have captured the exact symptom so later phases can verify the fix.\n\n### 2.2 Minimise\n\nShrink the repro to the **smallest scenario that still goes red**. Cut inputs, callers, config, data, and steps **one at a time**, re-running the loop after each cut.\n\n**Why**: A minimal repro shrinks the hypothesis space and becomes the clean regression test in Phase 5.\n\nDone when **every remaining element is load-bearing** — removing any one makes the loop go green.\n\n---\n\n## Phase 3: Pattern Analysis + Hypothesise\n\n### 3.1 Pattern Analysis\n\nBefore forming hypotheses:\n\n- Find similar **working** code in the same codebase.\n- Read the reference implementation completely — don't skim.\n- List every difference between working and broken, however small.\n- Understand dependencies, config, environment, assumptions.\n\n### 3.2 Generate 3-5 Ranked Hypotheses\n\nGenerate multiple hypotheses **before testing any**. Single-hypothesis generation anchors on the first plausible idea.\n\nEach hypothesis must be **falsifiable**:\n\n> \"If is the cause, then will make the bug disappear / will make it worse.\"\n\nIf you cannot state the prediction, the hypothesis is a vibe — discard or sharpen it.\n\n**Show the ranked list to the user before testing.** They often have domain knowledge that re-ranks instantly. Don't block on it if they're AFK.\n\n---\n\n## Phase 4: Instrument\n\nEach probe must map to a specific Phase 3 prediction. **Change one variable at a time.**\n\nTool preference:\n\n1. **Debugger/REPL** — one breakpoint beats ten logs.\n2. **Targeted logs** at boundaries that distinguish hypotheses.\n3. Never \"log everything and grep\".\n\n**Tag every debug log** with a unique prefix, e.g. `[DEBUG-a4f2]`. Cleanup at the end becomes a single grep. Untagged logs survive; tagged logs die.\n\n**Perf branch**: For performance regressions, establish a baseline measurement first (timing harness, profiler, query plan), then bisect. Measure first, fix second.\n\n---\n\n## Phase 5: Fix + Regression Test\n\n### 5.1 Seam Assessment\n\nWrite the regression test **before the fix** — but only if there is a **correct seam**:\n\nA correct seam exercises the **real bug pattern** at the call site. If the only available seam is too shallow (single-caller test when the bug needs multiple callers), a regression test there gives false confidence.\n\n**If no correct seam exists, that itself is the finding.** Note it. The architecture is preventing the bug from being locked down.\n\n### 5.2 If a correct seam exists\n\n1. Turn the minimised repro into a failing test at that seam.\n2. Watch it fail.\n3. Apply the fix — **ONE change at a time**.\n4. Watch it pass.\n5. Re-run the Phase 1 feedback loop against the original (un-minimised) scenario.\n\n### 5.3 If Fix Doesn't Work\n\n- Try #1 failed? → Return to Phase 3, form new hypothesis.\n- Try #2 failed? → Return to Phase 1, re-check the loop.\n- **If 3+ fixes failed: STOP.** This is an architectural problem, not a bug:\n - Each fix reveals new problems in different places.\n - Fixes require \"massive refactoring\" to implement.\n - **Question the architecture, not the symptom.**\n - Discuss with your human partner before attempting more fixes.\n\n---\n\n## Phase 6: Cleanup + Post-Mortem\n\nRequired before declaring done:\n\n- [ ] Original repro no longer reproduces (re-run Phase 1 loop)\n- [ ] Regression test passes (or absence of seam is documented)\n- [ ] All `[DEBUG-...]` instrumentation removed (`grep` the prefix)\n- [ ] Throwaway prototypes deleted (or moved to a clearly-marked debug location)\n- [ ] The correct hypothesis is stated in the commit/PR message\n\n**Then ask: what would have prevented this bug?** If architectural change would have prevented it, note the specifics. You have more information now than when you started.\n\n---\n\n## Red Flags — STOP Immediately\n\nIf you catch yourself thinking:\n\n| Thought | Reality |\n| ---------------------------------------------- | ---------------------------------------------------------- |\n| \"Quick fix for now, investigate later\" | First fix sets the pattern. Do it right. |\n| \"Just try changing X and see if it works\" | Guessing. Build a loop instead (Phase 1). |\n| \"Add multiple changes, run tests\" | Can't isolate what worked. One variable at a time. |\n| \"Skip the test, I'll verify manually\" | Untested fixes don't stick. |\n| \"It's probably X, let me fix that\" | Seeing symptoms ≠ understanding root cause. |\n| \"I don't fully understand but this might work\" | Return to Phase 1. |\n| \"Reference too long, I'll adapt the pattern\" | Partial understanding guarantees bugs. Read it completely. |\n| \"One more fix attempt\" (after 2+ failures) | 3+ failures = architectural problem. Question the pattern. |\n\n**ALL of these mean: STOP. Return to the earliest incomplete Phase.**\n\n---\n\n## Quick Reference\n\n| Phase | Key Activities | Success Criteria |\n| -------------------------- | --------------------------------------------------------- | ---------------------------------------------- |\n| **1. Feedback Loop** | Build tight red/green signal for the bug | Deterministic, fast, agent-runnable |\n| **2. Reproduce+Minimise** | Confirm + shrink to smallest load-bearing scenario | Every element is load-bearing |\n| **3. Pattern+Hypothesise** | Compare working examples, rank 3-5 falsifiable hypotheses | Each hypothesis has a testable prediction |\n| **4. Instrument** | One probe per prediction, tagged logs | Identify which hypothesis holds |\n| **5. Fix+Regression** | Assess seam → test → single fix → verify | Bug resolved, test passes, original loop green |\n| **6. Cleanup+Post-Mortem** | Remove instrumentation, document cause | Preventative insight captured |\n\n---\n\n## Supporting Techniques\n\n- **Root Cause Tracing**: Trace bug backward through call stack to find original trigger. Where does the bad value originate? Keep tracing up.\n- **Defense in Depth**: After fixing root cause, add validation at multiple layers so this class of bug can't recur.\n- **Condition-Based Waiting**: Replace arbitrary timeouts (`sleep(5)`) with condition polling (`waitFor(selector)`).\n" }, { type: 'standard', raw: "---\nname: doc-generator\ndescription: Generate technical documentation from code — API docs, README, ADR, changelog, and contributing guides\nversion: 2.0.0\n---\n\n# Documentation Generator\n\nGenerate comprehensive, well-structured technical documentation from codebases.\n\n## Document Types\n\n### API Documentation\n\nExtract from TypeScript types and JSDoc:\n\n1. Scan export declarations (interfaces, types, functions, classes)\n2. Read JSDoc comments for `@param`, `@returns`, `@throws`, `@example`\n3. Group by module or feature area\n4. Generate markdown tables for parameter lists\n5. Include usage examples from test files when available\n\nTemplate:\n\n```markdown\n## `functionName(params)`\n\n**Description** — extracted from JSDoc\n\n| Param | Type | Description |\n| ----- | ---- | ----------- |\n| x | T | ... |\n\n**Returns**: `ReturnType` — description\n\n**Example**:\n\\`\\`\\`ts\n// usage\n\\`\\`\\`\n```\n\n### README Files\n\nRequired sections: title + badge → one-liner → install → quick start → API → contributing → license.\n\n### Architecture Decision Records (ADR)\n\nFormat:\n\n```markdown\n# ADR-NNN: Title\n\n**Date**: YYYY-MM-DD\n**Status**: proposed | accepted | deprecated | superseded\n\n## Context\n\n## Decision\n\n## Consequences\n```\n\n### Changelog\n\nGenerate from `git log` with Conventional Commits filtering:\n\n```bash\ngit log --pretty=format:'- %s (%h)' v0.1.0..HEAD\n```\n\nGroup by type: feat / fix / chore / docs / refactor.\n\n### Contributing Guide\n\nStandard sections: setup → workflow → commit conventions → PR process → code style → testing.\n\n## Output Rules\n\n- All output in clean, well-structured markdown\n- Code examples must be syntactically correct\n- Cross-reference related documents with relative links\n- Use tables for structured data, lists for sequential steps\n" }, { type: 'standard', raw: "---\nname: domain-modeling\ndescription: Build and sharpen a project's domain model. Use when the user wants to pin down domain terminology or a ubiquitous language, record an architectural decision, or when another skill needs to maintain the domain model.\nversion: 1.0.0\nuser-invocable: true\nallowed-tools:\n - Read\n - Write\n - Edit\n - Glob\n - Grep\n---\n\n# Domain Modeling — Continuous Shared Language\n\nActively build and sharpen the project's domain model as you work. This is the _active_ discipline — challenging terms, inventing edge-case scenarios, and writing the glossary and decisions down the moment they crystallize. (Merely _reading_ `CONTEXT.md` for vocabulary is not this skill — that's a one-line habit any skill can do. This skill is for when you're changing the model, not just consuming it.)\n\n## File Structure\n\n```\n/\n├── CONTEXT.md ← shared language glossary\n├── docs/\n│ └── adr/\n│ ├── 0001-slug.md ← architectural decisions\n│ └── 0002-slug.md\n└── src/\n```\n\nCreate files lazily — only when you have something to write.\n\n**Multiple contexts**: If a `CONTEXT-MAP.md` exists, read it to find which context the current topic relates to.\n\n---\n\n## During the Session\n\n### Challenge Against the Glossary\n\nWhen the user uses a term that conflicts with existing language in `CONTEXT.md`, call it out immediately:\n\n> \"Your glossary defines 'cancellation' as X, but you seem to mean Y — which is it?\"\n\n### Sharpen Fuzzy Language\n\nWhen the user uses vague or overloaded terms, propose a precise canonical term:\n\n> \"You're saying 'account' — do you mean the Customer or the User? Those are different things.\"\n\n### Discuss Concrete Scenarios\n\nWhen domain relationships are discussed, stress-test them with specific scenarios. Invent scenarios that probe edge cases and force precision about boundaries between concepts.\n\n### Cross-Reference With Code\n\nWhen the user states how something works, check whether the code agrees. Surface contradictions:\n\n> \"Your code cancels entire Orders, but you just said partial cancellation is possible — which is right?\"\n\n### Update CONTEXT.md Inline\n\nWhen a term is resolved, update `CONTEXT.md` right there. Don't batch — capture as they happen.\n\n### Offer ADRs Sparingly\n\nOnly create an ADR when ALL three are true:\n\n1. **Hard to reverse** — changing your mind later has real cost\n2. **Surprising without context** — a future reader would wonder \"why?\"\n3. **The result of a real trade-off** — there were genuine alternatives\n\n---\n\n## CONTEXT.md Format\n\n```markdown\n# {Context Name}\n\n{One or two sentence description of what this context is and why it exists.}\n\n## Language\n\n**{Term}**:\n{One or two sentence definition of what it IS.}\n_Avoid_: {alternative terms that should not be used}\n```\n\n### Rules\n\n- **Be opinionated.** Pick the best term, ban the rest.\n- **Keep definitions tight.** One or two sentences max.\n- **Only domain-specific terms.** Not general programming concepts.\n- **Group under subheadings** when natural clusters emerge.\n\n---\n\n## ADR Format\n\n```markdown\n# {Short title of the decision}\n\n{1-3 sentences: context, decision, and why.}\n```\n\nNumber sequentially (`docs/adr/0001-slug.md`, `0002-slug.md`, ...).\n\nOptional sections (only when they add value):\n\n- **Status** frontmatter: `proposed | accepted | deprecated | superseded by ADR-NNNN`\n- **Considered Options**: rejected alternatives worth remembering\n- **Consequences**: non-obvious downstream effects\n\n### When an ADR Qualifies\n\n- Architecture shape (monorepo, event sourcing, microservices)\n- Integration patterns between contexts\n- Technology choices with lock-in (database, message bus, auth)\n- Boundary and scope decisions (\"X owns Y, Z references by ID only\")\n- Deliberate deviations from convention\n- Constraints not visible in code (compliance, latency SLA)\n- Rejected alternatives when non-obvious (stops someone suggesting it again in 6 months)\n\n---\n\n## Integration With Mipham Code\n\n- **Memory System**: Domain terms discovered through this skill persist to project memory\n- **grill-with-docs**: For initial domain establishment, use `/grill-with-docs`. This skill handles ongoing maintenance\n- **Critical Thinking Layer**: Apply counter-example search to domain definitions — \"does this definition hold for all edge cases?\"\n" }, { type: 'standard', raw: "---\nname: github-ops\ndescription: GitHub operations — PRs, issues, releases, CI/CD monitoring, branch management via gh CLI and git\nversion: 2.0.0\n---\n\n# GitHub Operations\n\nManage GitHub workflows using `git` and `gh` CLI.\n\n## Commit Convention\n\nFollow [Conventional Commits](https://www.conventionalcommits.org/):\n\n```\ntype(scope): description\n\nTypes: feat, fix, chore, docs, test, refactor, ci, perf, style, revert\n```\n\nCo-author AI contributions:\n\n```\nCo-Authored-By: Mipham \n```\n\n## Pull Requests\n\n### Create PR\n\n```bash\ngh pr create --title \"feat: add feature X\" --body \"## Summary\\n\\n...\" --base main\n```\n\n### PR Body Template\n\n```markdown\n## Summary\n\nBrief description of changes\n\n## Type\n\n- [ ] feat [ ] fix [ ] chore [ ] docs [ ] refactor\n\n## Testing\n\n- [ ] Unit tests pass\n- [ ] Manual verification performed\n\n## Checklist\n\n- [ ] Conventional Commits\n- [ ] No unrelated changes\n```\n\n### Review & Merge\n\n```bash\ngh pr review --approve\ngh pr merge --squash --delete-branch\n```\n\n## Issues\n\n### Create Issue\n\n```bash\ngh issue create --title \"bug: description\" --body \"## Steps\\n1.\\n\\n## Expected\\n\\n## Actual\\n\" --label bug\n```\n\n### Label Taxonomy\n\n| Label | Usage |\n| ------------------ | ----------------- |\n| `bug` | Confirmed defect |\n| `enhancement` | Feature request |\n| `docs` | Documentation |\n| `good first issue` | Beginner-friendly |\n| `help wanted` | Open to community |\n\n## Releases\n\n```bash\ngit tag -a v1.0.0 -m \"Release v1.0.0\"\ngit push origin v1.0.0\ngh release create v1.0.0 --title \"v1.0.0\" --notes-file CHANGELOG.md\n```\n\n## CI Monitoring\n\n```bash\ngh run list --limit 5 # recent runs\ngh run watch # follow live\ngh run view --log # view logs\n```\n\n## Branch Management\n\n- Feature branches: `feat/` from `main`\n- Bugfix branches: `fix/` from `main`\n- Release branches: `release/vX.Y.Z`\n- Delete merged branches: `git branch -d `\n" }, { type: 'standard', raw: "---\nname: grill-with-docs\ndescription: A relentless interview to sharpen a plan or design, creating CONTEXT.md (shared language) and ADRs (architectural decisions) as we go. Use before any non-trivial implementation to align on requirements and terminology.\nversion: 1.0.0\nuser-invocable: true\nallowed-tools:\n - Read\n - Write\n - Edit\n - Bash\n - Glob\n - Grep\n - WebSearch\n - WebFetch\n---\n\n# Grill With Docs — Deep Requirements Alignment\n\nInspired by Matt Pocock's `grill-with-docs` and `domain-modeling` skills. Before writing code, run a structured interview to align on requirements, establish shared language, and record architectural decisions.\n\n## When to Use\n\n- Before any non-trivial feature implementation\n- When requirements are fuzzy (\"make it faster\", \"add X\")\n- When you need to establish project terminology\n- When architectural decisions need to be recorded\n- User says: \"plan X\", \"design Y\", \"what should we do about Z\"\n\n## When NOT to Use\n\n- Trivial bug fixes with clear expected behavior\n- One-line changes\n- Tasks where the requirements are already crystal clear\n\n---\n\n## The Interview Flow\n\n### Phase 1: Understand the Intent\n\nStart by understanding what the user actually wants. Don't ask \"what should I build?\" — ask about their goal.\n\n**Core Questions:**\n\n1. What problem are you solving? (Not what feature you're building)\n2. Who is this for? (End user, developer, internal tool?)\n3. What does success look like? (How will you know when it's done?)\n4. What's the deadline or priority context?\n\n**Anti-pattern**: Jumping to implementation questions (\"Do you want REST or GraphQL?\") before understanding the problem.\n\n### Phase 2: Sharpen the Language\n\nIdentify vague or overloaded terms and pin them down **immediately**. This is the single highest-leverage activity — shared language reduces token waste and prevents misunderstandings.\n\n**Technique: The Canonical Term**\n\n- When the user uses multiple words for the same thing, pick one as canonical\n- List rejected alternatives under `_Avoid_`\n- Be opinionated — the glossary is prescriptive, not descriptive\n\n```\nUser: \"We need a way for users to save articles for later.\"\nYou: \"Let's pin that down. 'Save for later' could mean bookmarking, or a reading list, or offline download. Which one?\"\nUser: \"Like a reading list — they can come back to it.\"\nYou: \"Got it. Let's call it a **Reading List**. Avoid 'bookmark', 'save', 'favorites'.\"\n→ Write to CONTEXT.md immediately.\n```\n\n**Technique: The Boundary Test**\n\n- When a term is proposed, test its boundaries with edge cases\n- \"Does X include Y? What about Z?\"\n\n**Technique: The Code Cross-Reference**\n\n- When the user describes how something works, check if existing code agrees\n- Surface contradictions immediately\n\n### Phase 3: Probe Edge Cases\n\nBefore accepting any requirement, stress-test it with edge cases.\n\n**Edge Case Inventory:**\n\n- **Empty state**: What does the user see when there's nothing yet?\n- **Error state**: What happens when things go wrong?\n- **Extreme values**: What about 0? What about 10,000?\n- **Concurrency**: What if two people do this at the same time?\n- **Permissions**: Who can do this? Who cannot?\n- **Scale**: What changes at 10x the current volume?\n\n**Technique: The 5 Whys**\nWhen a requirement seems odd, dig deeper:\n\n```\nUser: \"We need real-time updates.\"\nYou: \"Why real-time?\"\nUser: \"Because users need to see changes immediately.\"\nYou: \"Why do they need to see changes immediately?\"\nUser: \"Because they're collaborating on the same document.\"\n→ Now you know the REAL requirement is collaboration, not real-time.\n```\n\n### Phase 4: Make Architecture Decisions\n\nWhen a design decision meets ALL three criteria, offer to record it as an ADR:\n\n1. **Hard to reverse** — changing your mind later has real cost\n2. **Surprising without context** — a future reader would wonder \"why?\"\n3. **The result of a real trade-off** — there were genuine alternatives\n\n**What qualifies for an ADR:**\n\n- Architecture shape (monorepo vs polyrepo, event sourcing vs CRUD)\n- Integration patterns between contexts\n- Technology choices with lock-in (database, message bus, auth provider)\n- Deliberate deviations from convention (\"we use raw SQL because...\")\n- Constraints not visible in code (\"we can't use X because compliance\")\n\n**ADR Format** (write to `docs/adr/NNNN-slug.md`):\n\n```markdown\n# {Short title of the decision}\n\n{1-3 sentences: context, decision, and why.}\n```\n\nOnly add optional sections (Status, Considered Options, Consequences) when they add genuine value. Most ADRs are a single paragraph.\n\n### Phase 5: Write the CONTEXT.md\n\nAfter the interview, synthesize everything into `CONTEXT.md`.\n\n**Format** (`CONTEXT.md` at project root):\n\n```markdown\n# {Project Name} Context\n\n{One or two sentence description of the project domain.}\n\n## Language\n\n**{Term}**:\n{One or two sentence definition of what it IS.}\n_Avoid_: {alternative terms that should not be used}\n\n## Decisions\n\n- [ADR 0001: {Title}](docs/adr/0001-slug.md) — {one-line summary}\n```\n\n**Rules:**\n\n- Be opinionated — pick the best term, ban the rest\n- Only include domain-specific terms (not general programming concepts)\n- Keep definitions tight — one or two sentences\n- Update inline during the conversation, don't batch\n- CONTEXT.md is a glossary, NOT a spec or implementation plan\n\n---\n\n## During the Conversation\n\n### DO\n\n- Challenge the user when they use vague terms — \"What do you mean by 'fast'?\"\n- Propose canonical terms and write them down immediately\n- Invent edge cases and probe boundaries\n- Offer ADRs sparingly (only when all 3 criteria are met)\n- Cross-reference with existing code if available\n- Call out contradictions between what the user says and what the code does\n\n### DON'T\n\n- Rush to implementation questions before understanding the problem\n- Write ADRs for trivial decisions\n- Let fuzzy language slide — pin it down now or pay later\n- Treat CONTEXT.md as a spec or scratch pad\n- Ask yes/no questions when open-ended ones would reveal more\n\n---\n\n## Output\n\nAfter the interview, the user should have:\n\n1. **CONTEXT.md** — shared language glossary (created or updated)\n2. **ADRs** (if needed) — architectural decisions in `docs/adr/`\n3. **Clear requirements** — edge cases explored, assumptions surfaced\n4. **Shared understanding** — you and the user now mean the same thing by the same words\n\n---\n\n## Integration with Mipham Code\n\n- **Memory System**: Key terms go to project memory for persistence across sessions\n- **Critical Thinking Layer**: Apply the 5-dimension self-check (evidence standard, equivalence verification, counter-example search, confidence calibration, depth check) to your own interview questions\n- **Workflow**: For complex projects, the output of this skill feeds directly into `/implement`\n" }, { type: 'standard', raw: "---\nname: implement\ndescription: Build work from a spec or tickets with systematic discipline — TDD at pre-agreed seams, incremental verification, code review before commit. Use when implementing features, bugfixes, or any planned work.\nversion: 1.0.0\nuser-invocable: true\n---\n\n# Implement — Structured Build Execution\n\n融合 Superpowers executing-plans(计划审阅 + 隔离工作区)+ Matt Pocock implement(TDD 接缝 + 增量验证 + 提交前审查)。\n\n## When to Use\n\n- Implementing work from a written spec or ticket set\n- Executing a development plan with clear deliverables\n- Building a feature with predefined success criteria\n\n## When NOT to Use\n\n- Exploratory coding / prototyping → use `prototype` skill\n- Quick one-line fixes → just fix it\n- No spec or tickets exist → use `to-tickets` or `to-spec` first\n\n---\n\n## Step 1: Load and Review\n\n### 1.1 Ensure isolated workspace\n\nUse git worktree or a feature branch. Never implement on main/master without explicit consent.\n\n### 1.2 Read the plan/spec/tickets\n\nRead the full spec or ticket set. Understand:\n\n- What is being built?\n- What are the acceptance criteria?\n- What are the pre-agreed seams (where TDD should be applied)?\n\n### 1.3 Review critically\n\nBefore writing any code:\n\n- Are there gaps or ambiguities in the spec?\n- Are the success criteria testable?\n- Do you understand every instruction?\n\n**If concerns exist, raise them before starting.** Don't guess.\n\n---\n\n## Step 2: Execute Tasks\n\nFor each task in order:\n\n### 2.1 At pre-agreed seams: TDD\n\nWhere the spec specifies (or where interfaces are well-defined):\n\n1. Write a **failing test** that asserts the expected behavior\n2. Watch it fail (red)\n3. Write the **minimum code** to make it pass (green)\n4. Refactor if needed, keeping tests green\n\nUse the `tdd` skill for full red-green-refactor discipline.\n\n### 2.2 Incremental verification\n\nDuring implementation:\n\n- **Run typecheck** after each significant change: `pnpm typecheck`\n- **Run relevant test file** after each task: `pnpm test -- `\n- **Don't wait** until everything is done to discover type errors\n\n### 2.3 One task at a time\n\n- Follow each step exactly — the plan has bite-sized steps for a reason\n- One change at a time. No \"while I'm here\" improvements.\n- Mark tasks as complete after verification passes\n\n---\n\n## Step 3: Final Verification\n\nAfter all tasks are complete:\n\n### 3.1 Full test suite\n\n```bash\npnpm test\n```\n\nAll tests must pass. If any fail, fix before proceeding.\n\n### 3.2 Lint and format\n\n```bash\npnpm lint\npnpm format\n```\n\nCI must be green.\n\n---\n\n## Step 4: Code Review\n\n**Before committing**, run code review:\n\nUse the `code-review` skill for a two-axis review:\n\n- **Standards**: Does the diff follow the repo's coding standards?\n- **Spec**: Does it faithfully implement the originating issue/spec?\n\nFix any findings before committing.\n\n---\n\n## Step 5: Commit\n\nCommit your work to the current branch.\n\n```bash\ngit add -A\ngit commit -m \": \"\n```\n\n- Follow Conventional Commits\n- Reference the spec/ticket in the commit message\n- **Do NOT commit unless explicitly asked** (per CLAUDE.md §关键约束)\n\n---\n\n## When to Stop and Ask\n\n**STOP immediately when:**\n\n- A task is blocked (missing dependency, unclear instruction, verification fails repeatedly)\n- The spec has a critical gap that prevents starting\n- You don't understand an instruction\n- 3+ fix attempts fail — this may be an architectural issue\n\n**Ask for clarification rather than guessing.**\n\n---\n\n## Quick Reference\n\n| Step | Key Activities | Done When |\n| -------------- | ------------------------------------------------------------ | -------------------------------- |\n| **1. Review** | Load spec, isolate workspace, review critically | All concerns raised and resolved |\n| **2. Execute** | TDD at seams, incremental typecheck/test, one task at a time | All tasks complete and verified |\n| **3. Verify** | Full test suite, lint, format | CI-ready (all green) |\n| **4. Review** | Two-axis code review (standards + spec) | Findings addressed |\n| **5. Commit** | Conventional Commits, reference spec/ticket | Work committed to branch |\n" }, { type: 'standard', raw: "---\nname: memory\ndescription: Read and write persistent memory files for context retention across sessions — one fact per file with frontmatter\nversion: 2.0.0\n---\n\n# Memory Skill\n\nManage persistent memory stored as markdown files with YAML frontmatter.\n\n## File Format\n\nEach memory is one `.md` file under the `memory/` directory:\n\n```markdown\n---\nname: \ndescription: \nmetadata:\n type: user | feedback | project | reference\n---\n\n\n\n**Why:** \n**How to apply:** \n```\n\n## File Path Conventions\n\n- Directory: `~/.mipham/memory/` (user-level) or `./.mipham/memory/` (project-level)\n- Filename: `.md` (lowercase, hyphens)\n- Index: `MEMORY.md` — one line per memory file, maintained automatically\n\n## Operations\n\n### List Memories\n\nScan `MEMORY.md` index for available memories. The index has one line per memory:\n\n```markdown\n- [Title](file.md) — brief hook\n```\n\n### Read Memory\n\nRead the full markdown file including frontmatter. Parse YAML frontmatter for metadata.\n\n### Write Memory\n\n1. Check for existing file with same `name:` slug — update if found\n2. Create new file if no match\n3. Add/update entry in `MEMORY.md` index\n4. Never write what the repo already records (code structure, git history, CLAUDE.md)\n\n### Delete Memory\n\nRemove the file and its index entry. Use when a memory is incorrect or superseded.\n\n## Best Practices\n\n- **One fact per file** — atomic, focused, easy to find\n- **Descriptive slugs** — `npm-publish-workflow` not `memory-1`\n- **Link related memories** — use `[[slug-name]]` wikilinks in body\n- **Check before writing** — search existing memories to avoid duplicates\n- **Types matter**: `user` (who), `feedback` (corrections), `project` (goals), `reference` (external)\n\n## Example\n\n```markdown\n---\nname: api-rate-limit\ndescription: OpenAI API has 500 RPM limit on our tier\nmetadata:\n type: reference\n---\n\nThe OpenAI API key for production has a hard 500 requests/minute limit.\nExceeding it returns HTTP 429 with a Retry-After header.\n\n**Why:** We hit this in production during peak usage\n**How to apply:** Use exponential backoff; batch requests where possible\n```\n" }, { type: 'standard', raw: "---\nname: mipham-code-setup\ndescription: Install, configure, diagnose, and troubleshoot Mipham Code — the multi-model open-core intelligent coding terminal. Covers setup wizard, API keys, providers, models, skills, permissions, workspace trust, shell/IDE integration, and first-run onboarding.\nversion: 2.0.0\nuser-invocable: true\nallowed-tools:\n - Read\n - Write\n - Edit\n - Bash\n - Skill\n---\n\n# Mipham Code Setup — Executable Setup Workflow\n\n**Type**: Rigid — follow the decision tree exactly. Don't skip diagnostic phases.\n\n**Purpose**: Guide users from zero to fully configured Mipham Code. This skill is BOTH:\n\n1. A self-contained diagnostic + configuration workflow the AI can execute\n2. A reference for `/setup` command behavior and slash commands\n\n**Triggers**: \"setup mipham\", \"configure mipham\", \"install mipham code\", \"mipham not working\", \"mipham setup\", \"first time using mipham\", \"help me set up\", \"getting started\", `/setup`\n\n---\n\n## Phase 0: Environment Detection (ALWAYS RUN FIRST)\n\nBefore doing anything, run these diagnostic checks. Report results in a status table.\n\n### 0.1 — Detect Installation\n\n```bash\nwhich mipham 2>/dev/null\nmipham --version 2>/dev/null\nbun --version 2>/dev/null\nnode --version 2>/dev/null\n```\n\n### 0.2 — Detect Configuration\n\n```bash\nls -la .mipham/config.yml 2>/dev/null\nls -la ~/.mipham/config.yml 2>/dev/null\nls -la MIPHAM.md 2>/dev/null\nls -la CLAUDE.md 2>/dev/null\n```\n\n### 0.3 — Detect API Keys\n\n```bash\nenv | grep -E 'ANTHROPIC_API_KEY|OPENAI_API_KEY|DEEPSEEK_API_KEY|QWEN_API_KEY|DOUBAO_API_KEY|HUNYUAN_API_KEY|GEMINI_API_KEY' | cut -d= -f1\n```\n\n### 0.4 — Detect Skills & Permissions\n\n```bash\nls .mipham/skills/ 2>/dev/null\ncat .mipham/config.yml 2>/dev/null | grep -E 'permission|trust' || echo \"no config\"\n```\n\n### 0.5 — Detect Workspace Trust\n\n```bash\ncat ~/.mipham/trusted-workspaces.json 2>/dev/null || echo \"no trust store\"\n```\n\n### Status Report Format\n\nAfter detection, present results as:\n\n```\n── Mipham Code Status ──\n\nInstallation: [✅/⬜] mipham CLI [✅/⬜] Bun [✅/⬜] Node.js\nProject: [✅/⬜] .mipham/ [✅/⬜] config.yml [✅/⬜] MIPHAM.md\nUser Config: [✅/⬜] ~/.mipham/config.yml\nAPI Keys: [N] set (list names or \"none\")\nSkills: [N] installed\nPermissions: [mode] (default/acceptEdits/plan/auto/bypassPermissions)\nTrust: [✅/⬜] workspace trusted\n```\n\nThen proceed to ONLY the phases where something is missing. Don't re-run already-configured steps unless asked.\n\n---\n\n## Phase 1: Installation\n\n**Trigger**: `mipham --version` fails.\n\n### Option A: Quick Install (recommended)\n\n```bash\ncurl -fsSL https://mipham.ai/install.sh | bash\n```\n\nThen restart the shell or run:\n\n```bash\nexport PATH=\"$HOME/.mipham/bin:$PATH\"\n```\n\n### Option B: npm Global Install\n\n```bash\nnpm install -g @miphamai/cli\nmipham\n```\n\n### Option C: From Source (developers)\n\n```bash\ngit clone https://github.com/One-Mipham/mipham-code\ncd mipham-code/apps/cli\nbun install && bun run bin/mipham\n```\n\n### ✅ Verification\n\n```bash\nmipham --version # Should print version ≥ 0.24.0\nmipham --help # Should print usage\n```\n\n---\n\n## Phase 2: Project Initialization\n\n**Trigger**: Missing `.mipham/` directory or `MIPHAM.md`.\n\n### 2.1 — Create .mipham/ directory\n\n```bash\nmkdir -p .mipham\n```\n\n### 2.2 — Create .mipham/config.yml\n\nWrite a minimal config. Ask the user which provider they want to use first, or pick a sensible default:\n\n```yaml\ndefaultProvider: anthropic\ndefaultModel: claude-sonnet-4-6\npermission: default\n```\n\n**Providers available** (alphabetical):\n\n| Provider | Type | Example Models |\n| --------- | ------------- | -------------------------------------- |\n| anthropic | Native SDK | Claude Haiku 4.5, Sonnet 4.6, Opus 4.8 |\n| deepseek | OpenAI Compat | V4 Flash, V4 Pro |\n| doubao | OpenAI Compat | Seed 1.6, Seed 2.0 |\n| gemini | OpenAI Compat | 3.0 Flash, 3.0 Pro, 2.5 Pro |\n| hunyuan | OpenAI Compat | Lite, TurboS, 2.0, T1 |\n| openai | OpenAI Compat | GPT-5.4 Mini, GPT-5.4, GPT-5.5, Codex |\n| qwen | OpenAI Compat | Qwen Plus, Qwen Max |\n\n### 2.3 — Create MIPHAM.md (optional but recommended)\n\nCreate `MIPHAM.md` in project root to define AI personality:\n\n```markdown\n# MIPHAM.md\n\n## Project Context\n\n- **Project**: [name]\n- **Language**: [zh-CN / en]\n- **Stack**: [TypeScript / Python / etc.]\n\n## Preferences\n\n- Code style: [e.g., functional, OOP]\n- Comment language: [e.g., English]\n- Test framework: [e.g., Vitest]\n```\n\n### ✅ Verification\n\n```bash\nls -la .mipham/config.yml MIPHAM.md\n```\n\n---\n\n## Phase 3: API Key Configuration\n\n**Trigger**: Missing API keys in environment.\n\n### 3.1 — Identify Required Providers\n\nAsk the user which providers they plan to use. For each, set the env var.\n\n### 3.2 — Set API Keys\n\n**Recommended: Environment variables** (not in config files — avoids accidental commits):\n\n```bash\nexport ANTHROPIC_API_KEY=\"sk-ant-...\"\nexport OPENAI_API_KEY=\"sk-...\"\nexport DEEPSEEK_API_KEY=\"sk-...\"\nexport QWEN_API_KEY=\"sk-...\"\nexport DOUBAO_API_KEY=\"...\"\nexport HUNYUAN_API_KEY=\"...\"\nexport GEMINI_API_KEY=\"...\"\n```\n\nAdd these to `~/.zshrc` or `~/.bashrc` for persistence:\n\n```bash\necho 'export ANTHROPIC_API_KEY=\"sk-ant-...\"' >> ~/.zshrc\nsource ~/.zshrc\n```\n\n**Alternative**: Store in `~/.mipham/config.yml`:\n\n```yaml\nproviders:\n - id: anthropic\n apiKey: $ANTHROPIC_API_KEY\n - id: openai\n apiKey: $OPENAI_API_KEY\n```\n\n### 3.3 — Verify Keys\n\n```bash\nenv | grep API_KEY\n```\n\n### ❗Security Rules\n\n- NEVER hardcode API keys in project config files (`.mipham/config.yml` in project root should use `$ENV_VAR` references, not raw keys)\n- NEVER commit API keys to git\n- Add to `.gitignore`: `.mipham/config.yml` (if it contains keys), `.env`, `*.pem`\n\n---\n\n## Phase 4: Provider & Model Configuration\n\n**Trigger**: Need to set default or enable/disable providers.\n\n### 4.1 — Set Default Provider & Model\n\nIn `.mipham/config.yml`:\n\n```yaml\ndefaultProvider: anthropic\ndefaultModel: claude-sonnet-4-6\n```\n\nOr use slash commands:\n\n```\n/model # Interactive model picker (Ctrl+P)\n/switch # Switch provider\n/providers # List all configured providers\n```\n\n### 4.2 — Enable/Disable Providers\n\n```yaml\nproviders:\n - id: anthropic\n status: active\n - id: openai\n status: active\n - id: deepseek\n status: disabled\n```\n\n### ✅ Verification\n\n```\n/model # Should show available models\n/providers # Should list active providers\n```\n\n---\n\n## Phase 5: Skills Installation\n\n**Trigger**: No or few skills installed.\n\n### 5.1 — Built-in Skills\n\nMipham Code ships with 28 built-in skills loaded automatically:\n\n- **Standard (22)**: code-review, codebase-design, compassionate-communication, debug-loop, doc-generator, domain-modeling, github-ops, grill-with-docs, implement, memory, mipham-code-setup, research, safe-coding, security-review, self-review, superpower, tdd, to-spec, triage, trim-process-prose, web-access, web-search\n- **Mipham (6)**: doc-sync, om-artifact, om-model-optimize, om-security, save-to-wiki, self-audit\n\n### 5.2 — Community Skills\n\nInstall from the community registry:\n\n```\n/setup 4 # Guided skill browser\n```\n\nOr directly:\n\n```bash\n# Skills are loaded from:\n# - apps/cli/skills/standard/ (built-in standard)\n# - apps/cli/skills/mipham/ (built-in mipham)\n# - ~/.mipham/skills/ (user-installed)\n# - .mipham/skills/ (project-local)\n```\n\n### 5.3 — Install Specific Skills\n\n```\n/skills install # Install from registry\n/skills list # List available\n/skills search # Search registry\n```\n\n### ✅ Verification\n\n```\n/skills list # Should show installed skills with counts\n```\n\n---\n\n## Phase 6: Permissions Configuration\n\n**Trigger**: Permission mode not configured or wrong for use case.\n\n### 6.1 — Permission Modes\n\n| Mode | Behavior | Use Case |\n| ------------------- | -------------------------------------- | ----------------------------------------- |\n| `default` | Ask-first tools are refused (see note) | Normal development (recommended) |\n| `acceptEdits` | Auto-allow edits, ask for other tools | Active coding sessions |\n| `plan` | Plan-only, no tool execution | Design & architecture work |\n| `auto` | A classifier rules on every call | Long unattended runs you still want gated |\n| `bypassPermissions` | Skip all checks | ⚠️ Only for fully trusted codebases |\n\n**Note on `default`**: Mipham Code has no interactive approval prompt, so \"ask\"\nmeans the call is **refused** with a message naming the mode — it is not queued\nfor your answer. That makes `default` the strictest _usable_ mode for Bash and\nfile writes; `auto` is the mode that lets gated calls proceed without a human,\nby having a classifier rule on each one.\n\n**What `auto` actually gates.** Reads (Read/Grep/Glob) are never sent to the\nclassifier — gating them would make `auto` the only mode in the ladder that cannot\nopen a file without a round-trip to another model. Everything else that the static\nchain would refuse goes to the classifier, which can only **lift** a refusal: a\ndeny rule or an `ask` rule is never overridden. If the classifier cannot be reached\nor answers unusably, the call is refused (fail-closed) with a message saying the\nrefusal is _not_ a policy decision and can be retried.\n\n### 6.2 — Configure\n\nPress **Shift+Tab** to change the mode live; it cycles\n`default → acceptEdits → plan → auto` and lasts for the session only.\n`bypassPermissions` is a legal mode but is deliberately **not** on the wheel —\nit is reached by naming it in config, where the user has said what they mean.\n\nTo persist a mode for a project, in `.mipham/config.yml`:\n\n```yaml\npermission: default\n```\n\nAny mode name from the table above is accepted, including `bypassPermissions`.\n\nOr via slash command:\n\n```\n/permissions # View current settings\n/setup 5 # Permission setup wizard\n```\n\n### 6.3 — CI/CD Safety\n\nFor CI/CD environments, use the `default` mode (the daemon default): headless\nsessions never prompt, so `ask`-level tools (Bash/Write/Edit) are blocked rather\nthan auto-approved.\n\n### ✅ Verification\n\n```\n/permissions # Should show current mode\n```\n\n---\n\n## Phase 7: Workspace Trust\n\n**Trigger**: Untrusted workspace (prompted on startup in v0.24.3+).\n\n### 7.1 — Understanding Workspace Trust\n\nWorkspace trust is a security mechanism that prevents AI from operating in untrusted directories. Trust is **hierarchical**: trusting `/Users/me/Projects` implicitly trusts all subdirectories.\n\n### 7.2 — Trust a Workspace\n\n**Interactive**: Accept the trust prompt when launching Mipham Code in a new directory.\n\n**Manual**:\n\n```\n/trust # Show trust status\n/trust add # Trust a directory\n/trust remove # Revoke trust\n```\n\n### 7.3 — Trust Store\n\n```\n~/.mipham/trusted-workspaces.json\n```\n\n### 7.4 — Auto-Trust for Worktrees\n\nWhen using git worktrees, Mipham Code automatically trusts worktree directories if the parent workspace is already trusted (via `EnterWorktree`).\n\n### ✅ Verification\n\n```\n/trust # Should show \"✅ Yes\" for current directory\n```\n\n---\n\n## Phase 8: Shell & IDE Integration\n\n**Trigger**: Want terminal integration, aliases, or IDE plugins.\n\n### 8.1 — Shell Alias\n\nAdd to `~/.zshrc` or `~/.bashrc`:\n\n```bash\nalias mipham='cd ~/your-project && bun run ~/path/to/mipham-code/apps/cli/bin/mipham.ts'\n# Or if installed globally:\nalias mipham='mipham'\n```\n\n### 8.2 — VS Code Integration\n\nRun `/ide` to auto-generate `.vscode/` config files:\n\n- `settings.json` — terminal profile \"mipham\" using Bun\n- `keybindings.json` — Cmd+Esc to focus terminal, Cmd+Shift+M for new terminal\n- `extensions.json` — recommends `miphamai.mipham-code` extension\n\nTo use after generation:\n\n1. Restart VS Code (or Cmd+Shift+P → Reload Window)\n2. Open terminal: Ctrl+` or Cmd+Esc\n3. Select \"mipham\" profile from terminal dropdown\n\nInstall the VS Code extension:\n\n```bash\ncode --install-extension miphamai.mipham-code\n```\n\n### 8.3 — JetBrains Integration\n\nSettings → Tools → Terminal → Shell path → `bun run mipham`\n\n### 8.4 — Terminal Setup\n\n```\n/terminal-setup # Shell & terminal config wizard\n/setup 6 # Shell integration (part of full wizard)\n```\n\n### ✅ Verification\n\n```bash\nwhich mipham # Should resolve\n# In VS Code: Ctrl+` → select \"mipham\" profile\n```\n\n---\n\n## Phase 9: Full Verification\n\nRun after all configuration phases complete.\n\n### 9.1 — System Diagnostics\n\n```\n/doctor # System diagnostics check\n```\n\n### 9.2 — End-to-End Test\n\nStart a conversation and verify:\n\n1. Model responds (not stuck on \"connecting...\")\n2. File tools work: \"read CLAUDE.md\"\n3. Bash works: \"list files in current directory\"\n4. Skills load: `/skills list`\n\n### 9.3 — Common Issues & Fixes\n\n| Symptom | Diagnosis | Fix |\n| ------------------------- | -------------------------------------- | ------------------------------------------------ |\n| \"Provider not registered\" | Missing or invalid API key | `env \\| grep API_KEY`; check key format |\n| \"Model not found\" | Model ID mismatch or disabled provider | `/models` to list available; `/switch` to change |\n| Slow responses | Large model, network, or context full | `/fast on` or switch to Flash model; `/compact` |\n| Context full | Too many messages in history | `/compact` to compress; `/clear` to reset |\n| Permission denied | Tool blocked by permission mode | `/permissions` to check; adjust mode |\n| \"Workspace not trusted\" | New directory, not yet trusted | Accept startup prompt or run `/trust` |\n| MCP tools not available | Server not connected | `/mcp connect ` or check config |\n| Update not applying | Cached binary | `mipham update --force` then restart |\n| Config changes ignored | YAML syntax error | Validate with `mipham --check-config` |\n\n### 9.4 — Get Help\n\n```\n/help # Full command reference\n/setup # Re-run setup wizard\n/doctor # Run diagnostics\n```\n\nChat-based help: \"help me configure X\" or \"why isn't Y working?\"\n\n---\n\n## Quick Reference: Essential Slash Commands\n\n| Category | Command | Purpose |\n| ------------- | ----------------- | ------------------------------------------------------ |\n| **Setup** | `/setup` | Full 6-step setup wizard |\n| | `/setup 1` | Initialize project (.mipham/ + MIPHAM.md + config.yml) |\n| | `/setup 2` | Configure providers & API keys |\n| | `/setup 3` | Choose default model |\n| | `/setup 4` | Browse & install skills |\n| | `/setup 5` | Configure permissions |\n| | `/setup 6` | Shell & IDE integration |\n| **Diagnosis** | `/doctor` | System diagnostics |\n| | `/trust` | Workspace trust status |\n| | `/permissions` | Tool permission settings |\n| **Model** | `/model` | Interactive model picker (Ctrl+P) |\n| | `/switch` | Switch provider |\n| | `/models` | List available models |\n| **Session** | `/clear` | Reset conversation |\n| | `/compact` | Compress context |\n| | `/rename` | Rename session |\n| **Workflow** | `/plan` | Enter plan mode |\n| | `/review` | Code review |\n| | `/todos` | Task list |\n| **IDE** | `/ide` | Generate VS Code integration files |\n| | `/terminal-setup` | Shell & terminal config |\n| **Skills** | `/skills list` | List installed skills |\n| | `/skills search` | Search skill registry |\n| | `/skills install` | Install a skill |\n\n---\n\n## Post-Setup: What to Do Next\n\nAfter configuration is verified:\n\n1. **Initialize your project**: \"help me understand this codebase\"\n2. **Set up CLAUDE.md**: `/init` to generate project documentation for the AI\n3. **Install relevant skills**: `/setup 4` or `/skills search`\n4. **Configure MCP servers**: `/mcp connect` for external tool integration\n5. **Start coding**: Just start a conversation — the AI will use tools and skills automatically\n" }, { type: 'standard', raw: "---\nname: research\ndescription: Deep research against primary sources, executed as a background agent. Collects findings into a single cited Markdown file. Use for investigation that requires reading official docs, source code, specs, or first-party APIs — not secondary summaries.\nversion: 1.0.0\nuser-invocable: true\nallowed-tools:\n - WebSearch\n - WebFetch\n - Agent\n - Bash\n - Write\n - Read\n---\n\n# Research — Background Deep Research\n\n融合 Mipham web-search v3.0(查询构建+验证)+ Matt Pocock research(后台代理+一手来源+Markdown 报告)。\n\n## When to Use\n\n- \"Research X for me\"\n- \"Find out everything about Y from primary sources\"\n- \"Investigate Z and write up findings\"\n- Any question where googling + reading multiple sources is the right answer\n\n## When NOT to Use\n\n- Quick fact lookup → use `/web-search` directly\n- Question answerable from code already in context\n- Pure logic/algorithmic question\n\n---\n\n## Phase 0: Route\n\n```\nResearch task is...\n├── Quick (1-2 sources, immediate answer)?\n│ └── → Use web-search skill directly (Phase 0-4)\n│\n├── Deep (multiple sources, needs synthesis)?\n│ └── → THIS SKILL — background agent\n│\n└── Login-walled / SPA-only sources?\n └── → web-access skill (ComputerUse browser)\n```\n\n---\n\n## Phase 1: Spin Up Background Agent\n\nLaunch a **background agent** to do the heavy reading, so you keep working while it researches.\n\nThe agent's instructions:\n\n```\nYou are a research agent. Your task:\n\n1. Investigate the question against PRIMARY SOURCES ONLY:\n - Official documentation (docs.*.com, *.org)\n - Source code repositories (GitHub, GitLab)\n - Technical specifications (RFCs, standards)\n - First-party API references\n - NOT: blog posts, Medium articles, forum threads, secondary summaries\n\n2. For every claim, follow it back to the source that owns it.\n If a secondary source makes a claim, find the primary source and cite that.\n\n3. Use WebSearch to find sources.\n Use WebFetch to deep-read promising pages.\n Cross-reference critical claims across 2+ independent primary sources.\n\n4. Write findings to a SINGLE Markdown file.\n - Cite every claim with its primary source URL\n - Distinguish between facts (needs citation) and reasoning (your own)\n - Flag outdated content (\"article from 2024, may be stale\")\n - Note if a source is official docs vs community\n\n5. Save the file where the repo already keeps such notes.\n Match existing conventions. If none exist, put it in docs/research/.\n```\n\n---\n\n## Phase 2: Report Format\n\nThe agent writes findings in this structure:\n\n```markdown\n# [Research Topic]\n\n**Date**: YYYY-MM-DD\n**Sources**: N primary, M cross-references\n\n## Key Findings\n\n- [Finding 1] — [Source](URL)\n- [Finding 2] — [Source](URL)\n\n## Detailed Analysis\n\n### [Subtopic A]\n\n[Claim and citation]\n\n### [Subtopic B]\n\n[Claim and citation]\n\n## Source Evaluation\n\n| Source | Type | Authority | Notes |\n| ----------- | ------------- | --------- | --------------------- |\n| [Name](URL) | Official docs | High | Current as of YYYY-MM |\n| [Name](URL) | Source code | High | Tag vX.Y.Z |\n\n## Open Questions\n\n- [Question 1]\n- [Question 2]\n\nSources:\n\n- [Title](URL) — brief note\n```\n\n---\n\n## Phase 3: Review\n\nWhen the background agent completes:\n\n1. Read the output file\n2. Spot-check: did it follow the chain back to primary sources?\n3. Flag any claims that need further verification\n4. Surface uncertainties to the user\n\n---\n\n## Research Quality Checklist\n\n- [ ] Every factual claim has a primary source citation\n- [ ] At least one critical claim is cross-referenced (2+ sources)\n- [ ] Source type is clearly identified (official docs / source code / spec / community)\n- [ ] Outdated content is flagged with publication year\n- [ ] Reasoning vs facts are clearly distinguished\n- [ ] File saved in repo-appropriate location\n" }, { type: 'standard', raw: "---\nname: safe-coding\ndescription: Safe coding rules for code generation — validate external/user input before use and throw RangeError on invalid input\nversion: 1.0.0\n---\n\n# Safe Coding\n\n处理外部/用户输入前必须校验:`null`、`undefined`、空字符串、格式非法时,抛出 `RangeError`,消息为 `'invalid input'`。\n" }, { type: 'standard', raw: "---\nname: security-review\ndescription: Security audit skill — vulnerability scanning, OWASP Top 10, secrets detection, supply chain analysis, and compliance checking\nversion: 1.0.0\n---\n\n# Security Review\n\nComprehensive security audit for codebases. Covers vulnerability detection, compliance, and hardening recommendations.\n\n## Audit Checklist\n\n### 1. Secrets & Credentials\n\n- [ ] No hardcoded API keys, tokens, or passwords in source files\n- [ ] `.env` and `*.pem` files in `.gitignore`\n- [ ] API keys use environment variables or secret managers\n- [ ] No credentials in git history (check `git log -p`)\n- [ ] CI/CD secrets stored securely (not in workflow files)\n\n### 2. OWASP Top 10\n\n- [ ] **Injection**: SQL, NoSQL, OS command, LDAP injection points\n- [ ] **Broken Authentication**: Weak password policies, missing MFA\n- [ ] **Sensitive Data Exposure**: Unencrypted PII, missing TLS\n- [ ] **XXE**: XML external entity processing\n- [ ] **Broken Access Control**: Missing authorization checks\n- [ ] **Security Misconfiguration**: Default credentials, verbose errors\n- [ ] **XSS**: Reflected, stored, DOM-based cross-site scripting\n- [ ] **Insecure Deserialization**: Untrusted data deserialization\n- [ ] **Using Vulnerable Components**: Outdated dependencies with CVEs\n- [ ] **Insufficient Logging**: Missing audit trails for auth events\n\n### 3. Supply Chain\n\n- [ ] All dependencies have known licenses (no copyleft/GPL)\n- [ ] No dependencies with critical CVEs\n- [ ] Lock files committed (pnpm-lock.yaml, package-lock.json)\n- [ ] Dependency update policy in place\n- [ ] SBOM (Software Bill of Materials) available\n\n### 4. Network & API Security\n\n- [ ] TLS 1.3 enforced for all external communications\n- [ ] API endpoints have rate limiting\n- [ ] CORS configured with explicit origins (not `*`)\n- [ ] SSRF protections in place (URL validation, IP filtering)\n- [ ] WebSocket connections use WSS\n- [ ] GraphQL endpoints have query depth limits\n\n### 5. File System & Path Security\n\n- [ ] Path traversal protections (no `../../../etc/passwd`)\n- [ ] File upload validation (type, size, content inspection)\n- [ ] Symlink attacks prevented\n- [ ] Sensitive directories blocked (`/etc`, `/proc`, `/sys`)\n- [ ] Temporary files cleaned up after use\n\n### 6. Code-Level Security\n\n- [ ] No `eval()` or `Function()` with user input\n- [ ] No `child_process.exec()` with unsanitized input\n- [ ] Regex patterns safe from ReDoS\n- [ ] Prototype pollution prevented\n- [ ] No `dangerouslySetInnerHTML` without sanitization (React)\n- [ ] SQL queries use parameterized statements\n\n### 7. Authentication & Sessions\n\n- [ ] Passwords hashed with bcrypt/argon2 (not MD5/SHA1)\n- [ ] Session tokens use `httpOnly`, `secure`, `SameSite=Strict`\n- [ ] JWT tokens have reasonable expiration\n- [ ] Account lockout after failed attempts\n- [ ] Password reset tokens expire and are single-use\n\n### 8. Data Protection\n\n- [ ] PII data encrypted at rest (AES-256-GCM)\n- [ ] Data encrypted in transit (TLS 1.3)\n- [ ] Logs do not contain sensitive data\n- [ ] Database backups encrypted\n- [ ] Data retention policies defined\n\n### 9. Infrastructure\n\n- [ ] Infrastructure as Code (Terraform/Pulumi) used\n- [ ] Cloud resources not publicly exposed unless intended\n- [ ] Security groups / firewalls restrict inbound traffic\n- [ ] Container images scanned for vulnerabilities\n- [ ] Kubernetes pods run as non-root\n\n### 10. Logging & Monitoring\n\n- [ ] Authentication events logged\n- [ ] Failed access attempts logged and alerted\n- [ ] Structured logging format (JSON)\n- [ ] No PII in log messages\n- [ ] Alert thresholds configured for critical events\n\n## Report Format\n\n```\nSecurity Review Report\n======================\nDate: YYYY-MM-DD\nSeverity: Critical | High | Medium | Low\n\nFinding #N: [Title]\nSeverity: Critical/High/Medium/Low\nLocation: file:line\nDescription: [What was found]\nRisk: [What could happen]\nFix: [How to resolve]\n```\n\n## Compliance Standards\n\n- OWASP ASVS Level 2\n- PCI DSS (if handling payment data)\n- GDPR (if handling EU personal data)\n- SOC 2 Type II\n- ISO 27001\n" }, { type: 'standard', raw: "---\nname: self-review\ndescription: Self-review of staged or recently changed code — reuse, simplification, efficiency, and architectural alignment\nversion: 2.0.0\n---\n\n# Self Review\n\nReview your own code changes before committing or merging. Focus on quality improvements, not bug hunting.\n\n## When to Run\n\n- Before committing changes\n- After completing a feature or fix\n- Before requesting a peer review\n- As the final step before merging\n\n## Review Passes\n\n### Pass 1: Reuse\n\n- Is there existing code that does the same thing?\n- Are there utility functions or shared libraries you missed?\n- Could this be solved with a standard library method?\n- Are you reimplementing something the framework provides?\n\n### Pass 2: Simplification\n\n- Can a complex function be split into smaller, named functions?\n- Are there unnecessary abstractions (interfaces with one impl, unused generics)?\n- Can nested conditionals be flattened with early returns?\n- Is there dead code, unused imports, or commented-out blocks?\n\n### Pass 3: Efficiency\n\n- Are you looping over data multiple times when once would suffice?\n- Are large objects being copied unnecessarily?\n- Could a synchronous operation be made async/non-blocking?\n- Are regex patterns compiled once or on every call?\n\n### Pass 4: Altitude (Architectural Alignment)\n\n- Does this code belong where it is?\n- Is it in the right layer (UI / business logic / data access)?\n- Does it follow existing patterns in the codebase?\n- Would a new developer understand where to find this?\n\n## Output\n\nAfter each pass, either:\n\n- Apply the improvement directly (for clear wins)\n- Note the observation with a recommendation (for trade-off decisions)\n\n## Anti-Patterns\n\n- ❌ Rewriting working code for style preference\n- ❌ Adding abstractions \"just in case\"\n- ❌ Changing code outside the scope of your changes\n- ❌ \"This could be a microservice\" — no it couldn't\n" }, { type: 'standard', raw: "---\nname: superpower\ndescription: Skill discovery and invocation system — find and use skills before any response or action\nversion: 2.1.0\n---\n\n\nIf you were dispatched as a subagent to execute a specific task, ignore this skill.\n\n\n# Superpowers — Using Skills\n\n## The Rule\n\n**Invoke relevant or requested skills BEFORE any response or action.** Even a 1% chance a skill might apply means you should invoke it to check.\n\nThen announce \"Using [skill] to [purpose]\" and follow the skill exactly. If it has a checklist, create a todo per item.\n\n## How to Access Skills\n\nUse the `Skill` tool to invoke skills by name. When you invoke a skill, its content is loaded — follow it directly.\n\n## Skill Discovery\n\n### Check Available Skills\n\nSkills are listed in `` messages. Scan this list when receiving a task.\n\n### Matching Algorithm\n\n1. Parse the user's request for intent keywords\n2. Scan skill names and descriptions for matches\n3. If ANY skill matches at ≥1% probability → invoke it\n4. Multiple matches → invoke all that may apply\n5. Invoked skill doesn't fit → that's fine, don't use it\n\n### Priority Order\n\n1. **Process skills first** — to-spec, debug-loop, tdd. These determine HOW to approach\n2. **Implementation skills second** — implement, codebase-design. These guide execution\n\n## Red Flags\n\nThese thoughts mean STOP — you're rationalizing:\n\n| Thought | Reality |\n| ----------------------------------- | ------------------------------------------------------ |\n| \"This is just a simple question\" | Questions are tasks. Check skills. |\n| \"I need more context first\" | Skill check comes BEFORE clarifying questions. |\n| \"Let me explore the codebase first\" | Skills tell you HOW to explore. Check first. |\n| \"I can check git/files quickly\" | Files lack conversation context. Check for skills. |\n| \"Let me gather information first\" | Skills tell you HOW to gather information. |\n| \"This doesn't need a formal skill\" | If a skill exists, use it. |\n| \"I remember this skill\" | Skills evolve. Read current version. |\n| \"This doesn't count as a task\" | Action = task. Check for skills. |\n| \"The skill is overkill\" | Simple things become complex. Use it. |\n| \"I'll just do this one thing first\" | Check BEFORE doing anything. |\n| \"This feels productive\" | Undisciplined action wastes time. Skills prevent this. |\n| \"I know what that means\" | Knowing the concept ≠ using the skill. Invoke it. |\n\n## Skill Types\n\n- **Rigid** (tdd, debug-loop): Follow exactly. Don't adapt away discipline.\n- **Flexible** (patterns): Adapt principles to context.\n\nThe skill itself tells you which type it is.\n\n## User Instructions\n\nUser instructions (CLAUDE.md, AGENTS.md, MIPHAM.md, direct requests) take precedence over skills, which in turn override default behavior.\n\nInstructions say WHAT, not HOW. \"Add X\" or \"Fix Y\" doesn't mean skip workflows. Only skip a skill workflow when the user has explicitly told you to.\n" }, { type: 'standard', raw: "---\nname: tdd\ndescription: Test-Driven Development — red-green-refactor cycle with language-specific guidance and test design rules\nversion: 2.0.0\n---\n\n# Test-Driven Development (TDD)\n\n## The Cycle\n\n```\nRED → GREEN → REFACTOR → repeat\n```\n\n### 1. RED — Write a Failing Test\n\nWrite the smallest test that captures the behavior you want:\n\n- Name the test descriptively: `it('should return 0 for empty string')`\n- Use the AAA pattern: **A**rrange → **A**ct → **A**ssert\n- Run to confirm it **fails** (not errors — fails)\n- If it passes before implementation, your test is wrong\n\n### 2. GREEN — Make It Pass\n\nWrite the **minimum** code to make the test pass:\n\n- Don't optimize, don't generalize, don't add features\n- A hardcoded return is fine if it passes the test\n- Run all tests — the new one should pass, old ones should still pass\n\n### 3. REFACTOR — Clean Up\n\nImprove the code while tests stay green:\n\n- Remove duplication (test code and production code)\n- Improve names, extract helpers\n- Simplify logic\n- Run tests after each change\n\n## Test Design Rules\n\n- **Deterministic**: No `Date.now()`, `Math.random()`, or network calls in test bodies\n- **Isolated**: Each test sets up its own state; no test-order dependency\n- **Fast**: Unit tests should run in milliseconds, not seconds\n- **Readable**: Test output should explain what broke without reading source\n\n## Language-Specific Guidance\n\n### TypeScript / JavaScript (Vitest)\n\n```ts\nimport { describe, it, expect } from 'vitest'\n\ndescribe('sum', () => {\n it('should add two positive numbers', () => {\n expect(sum(2, 3)).toBe(5)\n })\n it('should handle zero', () => {\n expect(sum(0, 5)).toBe(5)\n })\n})\n```\n\nFile naming: `src/foo.ts` → `test/foo.test.ts`\n\n### Python (pytest)\n\n```python\ndef test_sum_positive():\n assert sum(2, 3) == 5\n\ndef test_sum_zero():\n assert sum(0, 5) == 5\n```\n\n### Go (testing package)\n\n```go\nfunc TestSumPositive(t *testing.T) {\n got := Sum(2, 3)\n want := 5\n if got != want {\n t.Errorf(\"Sum(2,3) = %d; want %d\", got, want)\n }\n}\n```\n\n## When NOT to TDD\n\n- Exploratory spikes (throw away after learning)\n- Configuration files and types (compile-time enforced)\n- Generated code\n" }, { type: 'standard', raw: "---\nname: to-spec\ndescription: Turn a conversation into a structured specification document. Use after a grill-with-docs session or any requirements discussion to capture decisions in a durable, shareable format.\nversion: 1.0.0\nuser-invocable: true\nallowed-tools:\n - Read\n - Write\n - Edit\n - Bash\n---\n\n# To Spec — Conversation → Specification\n\nTurn the output of a requirements discussion into a structured specification document. This is the bridge between `/grill-with-docs` (alignment) and `/triage` (task decomposition).\n\n## When to Use\n\n- After a `/grill-with-docs` session — capture what was decided\n- After any requirements discussion — before starting implementation\n- User asks: \"write this up\", \"create a spec\", \"document the plan\"\n- Before handing off work to another session or person\n\n## When NOT to Use\n\n- The requirements are a single sentence and obvious\n- You're in the middle of a grill session — finish the interview first\n- The scope is so small that the spec would be longer than the implementation\n\n---\n\n## Spec Format\n\nWrite to `docs/specs/YYYY-MM-DD-slug.md`:\n\n```markdown\n---\nstatus: draft | approved | implemented\ncreated: 2026-08-10\n---\n\n# {Title}\n\n## Problem\n\n{What problem are we solving? Why now? 1-3 sentences.}\n\n## Scope\n\n### In Scope\n\n- {What we're building}\n\n### Out of Scope (Explicit)\n\n- {What we're NOT building — prevents scope creep}\n\n## Requirements\n\n### Functional\n\n- **{Requirement}**: {Description}. Acceptance: {measurable criterion}.\n\n### Non-Functional\n\n- **Performance**: {latency, throughput targets}\n- **Security**: {auth, data protection, threat model}\n- **Scale**: {expected volume, growth projections}\n\n## Design Decisions\n\n- **Decision**: {What we decided}. Because: {why}. Alternatives considered: {options + reasons rejected}.\n\n## Domain Model\n\n{Key terms and their definitions — from CONTEXT.md or the grill session.}\n\n## Edge Cases\n\n- **{Scenario}**: {Expected behavior}\n- **{Scenario}**: {Expected behavior}\n\n## Open Questions\n\n- {Question} — {who needs to answer / when needed}\n```\n\n---\n\n## The Spec Workflow\n\n### Step 1: Extract from Conversation\n\nScan the conversation history for:\n\n- Decisions made (explicit and implicit)\n- Terms defined (candidates for CONTEXT.md)\n- Edge cases discussed\n- Alternatives rejected (and why)\n- Open questions that remain\n\n### Step 2: Fill Gaps\n\nFor each gap you find:\n\n- Edge cases not discussed → flag as Open Questions\n- Terms used but not defined → propose definitions\n- Assumptions not stated → make them explicit\n\n### Step 3: Validate with User\n\nPresent the spec and ask:\n\n1. \"Does this match your understanding?\"\n2. \"What's missing?\"\n3. \"What's wrong?\"\n4. \"What surprised you?\"\n\n### Step 4: Feed Into Triage\n\nOnce approved, the spec's functional requirements become tickets in `/triage`. Non-functional requirements become acceptance criteria.\n\n---\n\n## Anti-Patterns\n\n- **Waterfall trap**: Don't try to spec everything upfront. Spec the next increment. Specs are living documents, not contracts.\n- **Premature detail**: Don't spec API signatures or DB schemas in the spec — those are implementation details.\n- **Vague acceptance**: \"Works well\" is not acceptance criteria. \"Returns 200 with valid JWT within 500ms\" is.\n\n---\n\n## Integration With Mipham Code\n\n- **grill-with-docs**: Input — the grill session produces the raw material\n- **triage**: Output — the spec feeds into ticket decomposition\n- **domain-modeling**: Terms discovered during spec writing go to CONTEXT.md\n- **Memory System**: The spec file persists as project reference across sessions\n" }, { type: 'standard', raw: "---\nname: triage\ndescription: Structured task decomposition and tracking across sessions. Use for breaking complex plans into trackable tickets with dependency graphs, checking task status, or continuing work from a previous session.\nversion: 1.0.0\nuser-invocable: true\nallowed-tools:\n - Read\n - Write\n - Edit\n - Bash\n - Glob\n - Grep\n---\n\n# Triage — Cross-Session Task Tracking\n\nTurn plans into trackable tickets with dependency management. Inspired by Matt Pocock's `triage` + `to-tickets` + `wayfinder` skills, consolidated into one Mipham Code skill.\n\n## When to Use\n\n- Breaking a large plan into actionable tickets\n- Tracking work across multiple sessions\n- User asks: \"what's next?\", \"where did I leave off?\", \"what's the status?\"\n- Complex tasks with dependencies between them\n\n---\n\n## The Ticket Format\n\nTickets live in `.mipham/tickets/` as individual Markdown files:\n\n```markdown\n---\nid: T-001\ntitle: Add user authentication\nstatus: in-progress\npriority: P0\ndepends_on: []\nblocks: [T-003]\ncreated: 2026-08-10\ntags:\n - auth\n - backend\n---\n\n## Description\n\nAdd JWT-based authentication with refresh token rotation.\n\n## Acceptance Criteria\n\n- [ ] Login endpoint returns access + refresh tokens\n- [ ] Refresh endpoint rotates tokens\n- [ ] Invalid tokens return 401\n- [ ] Rate limiting on login attempts\n\n## Notes\n\n- OAuth not in scope for T-001 (punted to T-005)\n```\n\n### Status Values\n\n| Status | Meaning |\n| ------------- | ------------------------------------------ |\n| `backlog` | Not yet planned for any session |\n| `planned` | Scoped and ready to work |\n| `in-progress` | Currently being worked on |\n| `review` | Implementation done, awaiting verification |\n| `done` | Verified and merged |\n| `blocked` | Cannot proceed due to dependency |\n| `wontfix` | Decided not to do |\n\n---\n\n## The Triage Workflow\n\n### Phase 1: Decompose (Plan → Tickets)\n\nGiven a plan or feature request:\n\n1. **Identify the smallest independently-valuable units of work**\n - Each ticket should deliver value on its own\n - If a ticket requires 3+ files touched, it's probably too big\n - If a ticket can be done in < 15 minutes, it's probably too small\n\n2. **Map dependencies**\n - What must be done first? (hard dependency)\n - What would be easier after something else? (soft dependency)\n - What blocks other work? (reverse dependency)\n\n3. **Assign priorities**\n - **P0**: Blocks other work, must do first\n - **P1**: High value, should do soon\n - **P2**: Nice to have, can defer\n - **P3**: Optional, do if time permits\n\n4. **Write acceptance criteria**\n - Specific, testable, unambiguous\n - \"Login works\" is bad. \"POST /auth/login with valid credentials returns 200 + JWT\" is good.\n\n### Phase 2: Status Check\n\nWhen the user asks \"what's next?\" or \"what's the status?\":\n\n1. Read `.mipham/tickets/` directory\n2. Report:\n - Currently in-progress tickets\n - Blocked tickets (and what's blocking them)\n - Next unblocked P0/P1 tickets ready to work\n - Recently completed tickets (for context)\n\n### Phase 3: Session Handoff\n\nWhen starting a new session, check for continuity:\n\n1. Read the previous session's context from the session store\n2. Check ticket statuses — any that were `in-progress` last session?\n3. Present: \"Last session you were working on T-004 (Add rate limiting). Continue from there, or start on T-007 (API docs) which is next in the P1 queue?\"\n\n### Phase 4: Ticket Lifecycle\n\nWhen working on a ticket:\n\n- Mark it `in-progress` when you start\n- Mark it `review` when implementation is done\n- Mark it `done` after verification (tests pass, typecheck clean)\n- If you discover new dependencies, add them to `blocks`/`depends_on`\n\n---\n\n## Dependency Graph\n\nFor tickets with complex dependencies, generate a visual summary:\n\n```\nT-001 (Auth) ──blocks──→ T-003 (Dashboard)\n │ │\n └──blocks──→ T-002 (API) ─┘\n │\n └──soft-dep──→ T-004 (Rate Limiting)\n\nReady to work: T-001 (no dependencies)\nBlocked: T-002 (waiting on T-001), T-003 (waiting on T-001, T-002)\n```\n\n---\n\n## Integration With Mipham Code\n\n- **Session Store**: Ticket status persists across sessions via `.mipham/tickets/`\n- **Memory System**: Active tickets are loaded as project memory for context\n- **grill-with-docs**: The output of a grill session feeds directly into ticket decomposition\n- **Background Agents**: Long-running work on a ticket can be spawned as a background agent\n- **Critical Thinking Layer**: When decomposing, ask \"what's the smallest thing that delivers value?\" — don't over-decompose\n" }, { type: 'standard', raw: "---\nname: trim-process-prose\ndescription: Use when cleaning process-perspective narration an AI left in code, comments, docs, or commit messages — \"originally A, changed to B\", design-decision references, or review back-and-forth a reader with only the current checkout cannot independently parse or verify\nversion: 1.0.0\n---\n\n# Trim Process Prose\n\nAgents leave their working perspective in the repo — \"initially we used A, then the reviewer wanted B\", \"decision 7\", \"for now, fix later\" — which only makes sense inside the session that produced it. Months later a maintainer has only the checkout, not the chat, the PR thread, or the task plan. That residue is process prose.\n\n## The test\n\nFor any sentence a change adds — a comment, a doc line, a commit-message clause — ask:\n\n> **Can a reader holding only the current HEAD checkout independently parse and verify this?**\n\n- **Yes** → keep it.\n- **No** → keep the durable fact, drop the process.\n\nThe fact is what a future maintainer needs; the process is how you got there, and it dies with the session.\n\n## What to keep vs drop\n\n| Keep (durable) | Drop (process) |\n| --------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- |\n| Why B is _required_: \"B is used here because A leaks resources under concurrent cancel\" | How you chose it: \"initially A, then reviewer preferred B\" |\n| A contract/invariant: \"this must hold or X breaks\" | A reference a HEAD reader can't resolve: \"decision 7\", \"C2\", \"design §4.7\" |\n| A precondition/postcondition the next editor must respect | A status marker: \"for now\", \"v3 will handle this\", \"TODO after PR\" |\n| A compatibility promise | A review trace: \"reviewer confirmed\", \"per discussion\" |\n\n## Rewrite, don't annotate\n\n```diff\n- // originally plan A had a race; reviewer asked for B; switching to B\n+ // B: plan A could not guarantee resource release under concurrent cancel\n```\n\nThe second line is the only thing the next maintainer needs. The first line is archaeology.\n\n## When NOT to touch\n\n- A sentence that already passes the HEAD-reader test — do not strip facts to be tidy.\n- A working session in progress — trim at commit/push time, not while reasoning.\n- `docs/truth/**` claims that cite `file:line` — those are evidence, not process.\n\n## Red flags\n\n- \"This context is useful\" — useful to _you now_; the test is the HEAD reader, not you.\n- Keeping \"originally X / changed to Y\" — the change is already visible in the diff; the narration is redundant.\n- Leaving a task-plan reference the reader can't resolve — that is the exact leakage to remove.\n" }, { type: 'standard', raw: "---\nname: web-access\ndescription: '联网访问:CDP 驱动用户已登录 Chrome(登录后操作、动态页面、反爬站点、社交媒体、本地书签/历史检索)'\nlicense: MIT\ngithub: https://github.com/eze-is/web-access\nversion: 2.5.0\nuser-invocable: true\nallowed-tools:\n - Bash\n - WebFetch\n - WebSearch\n - Read\n---\n\n# Web Access — CDP 驱动已登录 Chrome\n\n> 来源:eze-is/web-access (MIT),Mipham Code 合并升级。核心能力 = CDP Proxy 直连用户日常 Chrome,天然携带登录态。\n\n## 前置检查\n\n先确保 CDP 就绪:\n\n```bash\nnode ~/.mipham/skills/web-access/scripts/check-deps.mjs\n```\n\n> Mipham Code 环境:`node` 不可用时可用 `bun` 替代(Bun 原生支持 WebSocket 与 node: 内建)。未通过时引导用户:Chrome 地址栏打开 `chrome://inspect/#remote-debugging`,勾选 \"Allow remote debugging for this browser instance\"。\n\n**必须向用户展示**:部分站点对浏览器自动化检测严格,存在账号封禁风险。已内置防护但无法完全避免,Agent 继续操作即视为接受。\n\n## 工具选择\n\n| 场景 | 工具 |\n| --------------------------------------------- | ----------- |\n| 搜索摘要 / 发现来源 | WebSearch |\n| URL 已知,定向提取 | WebFetch |\n| URL 已知,要原始 HTML(meta/JSON-LD) | Bash + curl |\n| 非公开内容 / 反爬站点(小红书、微信公众号等) | 浏览器 CDP |\n| 需要登录态、交互、自由导航 | 浏览器 CDP |\n\n浏览器 CDP 不要求 URL 已知;WebSearch/WebFetch/curl 均不处理登录态。\n\n## 浏览器 CDP 模式\n\n通过 CDP Proxy 直连用户日常 Chrome,天然携带登录态。**不主动操作用户已有 tab**,所有操作在自己创建的后台 tab 中进行,任务结束关闭自建 tab(保留用户原 tab)。\n\nProxy(`scripts/cdp-proxy.mjs`)由 `check-deps.mjs` 自动拉起并常驻。Proxy 首次启动生成共享密钥 `~/.mipham/skills/web-access/.cdp-token`(0600),除 `/health` 外所有端点都要求请求头 `X-CDP-Token`。先取 token 再调 API:\n\n```bash\nTOKEN=$(cat ~/.mipham/skills/web-access/.cdp-token)\ncurl -H \"X-CDP-Token: $TOKEN\" http://localhost:3456/targets\n```\n\n端点列表:\n\n| 端点 | 用途 |\n| ------------------------------------------ | ------------------------------------------------------------------------ |\n| `GET /targets` | 列出已开 tab |\n| `GET /new?url=` | 新建后台 tab(自动等加载) |\n| `GET /navigate?target=&url=` | 导航(自动等加载) |\n| `GET /back?target=` | 后退 |\n| `GET /info?target=` | 页面标题/URL/状态 |\n| `POST /eval?target=`(body=JS) | 执行任意 JS(读写 DOM、提取、提交) |\n| `POST /click?target=`(body=CSS 选择器) | JS 点击(`el.click()`,覆盖大多数场景) |\n| `POST /clickAt?target=`(body=CSS 选择器) | 真实鼠标点击(`Input.dispatchMouseEvent`,算用户手势,能触发文件对话框) |\n| `POST /setFiles?target=`(body JSON) | 设置 file input 本地文件路径(`DOM.setFileInputFiles`,绕过文件对话框) |\n| `GET /scroll?target=&y=&direction=` | 滚动(`direction=down/up/top/bottom`,触发懒加载) |\n| `GET /screenshot?target=&file=` | 截图 |\n| `GET /close?target=` | 关闭 tab |\n\n进入浏览器层后,`/eval` 是眼睛、`/click` 是手:先看 DOM 结构再决定下一步,不预先规划所有步骤。\n\n### 登录判断\n\n核心问题只有一个:**目标内容拿到了吗?** 打开页面先尝试获取目标内容;确认「目标内容无法获取」且判断登录能解决时,告知用户在其 Chrome 登录后继续(无需重启任何东西,刷新页面即可)。\n\n### 媒体资源提取\n\n判断内容在图片里时,用 `/eval` 从 DOM 直接拿图片 URL 定向读取,比全页截图精准。`/scroll` 到底部触发懒加载后再提取图片 URL。\n\n### 视频内容获取\n\n用户 Chrome 真实渲染,截图可捕获当前视频帧。用 `/eval` 操控 `