@caddis/cli 0.0.0 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +150 -1
  3. package/bundles/antigravity-plugin/agents/code-reviewer.md +47 -0
  4. package/bundles/antigravity-plugin/agents/preflight.md +53 -0
  5. package/bundles/antigravity-plugin/guard_agy.py +338 -0
  6. package/bundles/antigravity-plugin/hooks.json +36 -0
  7. package/bundles/antigravity-plugin/mcp_config.json +8 -0
  8. package/bundles/antigravity-plugin/mcp_ping_server.py +55 -0
  9. package/bundles/antigravity-plugin/plugin.json +5 -0
  10. package/bundles/antigravity-plugin/session_end_agy.py +57 -0
  11. package/bundles/antigravity-plugin/skills/_registry.md +115 -0
  12. package/bundles/antigravity-plugin/skills/add-rules/SKILL.md +45 -0
  13. package/bundles/antigravity-plugin/skills/api-design/SKILL.md +249 -0
  14. package/bundles/antigravity-plugin/skills/backend-development/SKILL.md +305 -0
  15. package/bundles/antigravity-plugin/skills/best-practices/SKILL.md +500 -0
  16. package/bundles/antigravity-plugin/skills/best-practices/agents/best-practices-referencer.md +263 -0
  17. package/bundles/antigravity-plugin/skills/best-practices/agents/codebase-context-builder.md +326 -0
  18. package/bundles/antigravity-plugin/skills/best-practices/agents/task-intent-analyzer.md +245 -0
  19. package/bundles/antigravity-plugin/skills/best-practices/references/anti-patterns.md +571 -0
  20. package/bundles/antigravity-plugin/skills/best-practices/references/before-after-examples.md +1114 -0
  21. package/bundles/antigravity-plugin/skills/best-practices/references/best-practices-guide.md +513 -0
  22. package/bundles/antigravity-plugin/skills/best-practices/references/common-workflows.md +692 -0
  23. package/bundles/antigravity-plugin/skills/best-practices/references/prompt-patterns.md +547 -0
  24. package/bundles/antigravity-plugin/skills/brainstorming/SKILL.md +57 -0
  25. package/bundles/antigravity-plugin/skills/ci-cd-pipeline/SKILL.md +315 -0
  26. package/bundles/antigravity-plugin/skills/code-documentation/SKILL.md +271 -0
  27. package/bundles/antigravity-plugin/skills/code-review/SKILL.md +122 -0
  28. package/bundles/antigravity-plugin/skills/codebase-audit/SKILL.md +204 -0
  29. package/bundles/antigravity-plugin/skills/context-curator/SKILL.md +157 -0
  30. package/bundles/antigravity-plugin/skills/cross-review/SKILL.md +40 -0
  31. package/bundles/antigravity-plugin/skills/css-architecture/SKILL.md +305 -0
  32. package/bundles/antigravity-plugin/skills/css-architecture/references/RESPONSIVE-DESIGN.md +604 -0
  33. package/bundles/antigravity-plugin/skills/database-design/SKILL.md +177 -0
  34. package/bundles/antigravity-plugin/skills/db-diagram/SKILL.md +148 -0
  35. package/bundles/antigravity-plugin/skills/db-diagram/scripts/sql_to_graph.py +1212 -0
  36. package/bundles/antigravity-plugin/skills/digress/SKILL.md +61 -0
  37. package/bundles/antigravity-plugin/skills/draw-io/SKILL.md +162 -0
  38. package/bundles/antigravity-plugin/skills/draw-io/references/aws-icons.md +677 -0
  39. package/bundles/antigravity-plugin/skills/draw-io/references/layout-guidelines.md +142 -0
  40. package/bundles/antigravity-plugin/skills/draw-io/references/troubleshooting.md +118 -0
  41. package/bundles/antigravity-plugin/skills/draw-io/references/workflows.md +103 -0
  42. package/bundles/antigravity-plugin/skills/draw-io/scripts/convert-drawio-to-png.sh +25 -0
  43. package/bundles/antigravity-plugin/skills/draw-io/scripts/find_aws_icon.py +79 -0
  44. package/bundles/antigravity-plugin/skills/error-handling/SKILL.md +260 -0
  45. package/bundles/antigravity-plugin/skills/excalidraw-db/SKILL.md +38 -0
  46. package/bundles/antigravity-plugin/skills/fastapi-dev/SKILL.md +300 -0
  47. package/bundles/antigravity-plugin/skills/feature-plan/SKILL.md +198 -0
  48. package/bundles/antigravity-plugin/skills/frontend-design/SKILL.md +193 -0
  49. package/bundles/antigravity-plugin/skills/frontend-design/references/my-tech-stack.md +127 -0
  50. package/bundles/antigravity-plugin/skills/gh-cli/SKILL.md +195 -0
  51. package/bundles/antigravity-plugin/skills/git-commit/SKILL.md +285 -0
  52. package/bundles/antigravity-plugin/skills/golden-plan/SKILL.md +577 -0
  53. package/bundles/antigravity-plugin/skills/handoff/SKILL.md +100 -0
  54. package/bundles/antigravity-plugin/skills/implement/SKILL.md +114 -0
  55. package/bundles/antigravity-plugin/skills/javascript-typescript/SKILL.md +142 -0
  56. package/bundles/antigravity-plugin/skills/kb/SKILL.md +60 -0
  57. package/bundles/antigravity-plugin/skills/mermaid-db/SKILL.md +33 -0
  58. package/bundles/antigravity-plugin/skills/mermaid-diagrams/SKILL.md +236 -0
  59. package/bundles/antigravity-plugin/skills/mermaid-diagrams/references/ENHANCEMENTS.md +264 -0
  60. package/bundles/antigravity-plugin/skills/mermaid-diagrams/references/MERMAID-SUMMARY.md +137 -0
  61. package/bundles/antigravity-plugin/skills/mermaid-diagrams/references/advanced-features.md +556 -0
  62. package/bundles/antigravity-plugin/skills/mermaid-diagrams/references/architecture-diagrams.md +192 -0
  63. package/bundles/antigravity-plugin/skills/mermaid-diagrams/references/c4-diagrams.md +410 -0
  64. package/bundles/antigravity-plugin/skills/mermaid-diagrams/references/class-diagrams.md +361 -0
  65. package/bundles/antigravity-plugin/skills/mermaid-diagrams/references/erd-diagrams.md +510 -0
  66. package/bundles/antigravity-plugin/skills/mermaid-diagrams/references/flowcharts.md +450 -0
  67. package/bundles/antigravity-plugin/skills/mermaid-diagrams/references/sequence-diagrams.md +394 -0
  68. package/bundles/antigravity-plugin/skills/mermaid-diagrams/references/troubleshooting.md +335 -0
  69. package/bundles/antigravity-plugin/skills/mermaid-diagrams/references/workflows.md +418 -0
  70. package/bundles/antigravity-plugin/skills/migrate-dir/SKILL.md +68 -0
  71. package/bundles/antigravity-plugin/skills/mockup/SKILL.md +242 -0
  72. package/bundles/antigravity-plugin/skills/particle-art/SKILL.md +243 -0
  73. package/bundles/antigravity-plugin/skills/particle-art/references/canvas-utils.ts +171 -0
  74. package/bundles/antigravity-plugin/skills/particle-art/references/dot-field.template.tsx +203 -0
  75. package/bundles/antigravity-plugin/skills/particle-art/references/flow-field.template.tsx +263 -0
  76. package/bundles/antigravity-plugin/skills/particle-art/references/node-shape.template.tsx +261 -0
  77. package/bundles/antigravity-plugin/skills/particle-art/references/shape-sampler.ts +281 -0
  78. package/bundles/antigravity-plugin/skills/particle-art/references/stipple-morph.template.tsx +167 -0
  79. package/bundles/antigravity-plugin/skills/particle-art/references/stipple.template.tsx +175 -0
  80. package/bundles/antigravity-plugin/skills/particle-art/references/trail-ghost.template.tsx +266 -0
  81. package/bundles/antigravity-plugin/skills/particle-art/references/usage-examples.md +320 -0
  82. package/bundles/antigravity-plugin/skills/playwright/API_REFERENCE.md +653 -0
  83. package/bundles/antigravity-plugin/skills/playwright/SKILL.md +454 -0
  84. package/bundles/antigravity-plugin/skills/playwright/lib/helpers.js +441 -0
  85. package/bundles/antigravity-plugin/skills/playwright/package.json +26 -0
  86. package/bundles/antigravity-plugin/skills/playwright/run.js +228 -0
  87. package/bundles/antigravity-plugin/skills/prd/SKILL.md +107 -0
  88. package/bundles/antigravity-plugin/skills/preflight/SKILL.md +435 -0
  89. package/bundles/antigravity-plugin/skills/python/SKILL.md +388 -0
  90. package/bundles/antigravity-plugin/skills/react-best-practices/SKILL.md +269 -0
  91. package/bundles/antigravity-plugin/skills/react-dev/README.md +404 -0
  92. package/bundles/antigravity-plugin/skills/react-dev/SKILL.md +459 -0
  93. package/bundles/antigravity-plugin/skills/react-dev/examples/generic-components.md +579 -0
  94. package/bundles/antigravity-plugin/skills/react-dev/examples/server-components.md +579 -0
  95. package/bundles/antigravity-plugin/skills/react-dev/references/event-handlers.md +574 -0
  96. package/bundles/antigravity-plugin/skills/react-dev/references/hooks.md +456 -0
  97. package/bundles/antigravity-plugin/skills/react-dev/references/react-19-patterns.md +638 -0
  98. package/bundles/antigravity-plugin/skills/react-dev/references/react-router.md +1002 -0
  99. package/bundles/antigravity-plugin/skills/react-dev/references/tanstack-router.md +587 -0
  100. package/bundles/antigravity-plugin/skills/refactoring/SKILL.md +486 -0
  101. package/bundles/antigravity-plugin/skills/resume/SKILL.md +36 -0
  102. package/bundles/antigravity-plugin/skills/security-review/SKILL.md +196 -0
  103. package/bundles/antigravity-plugin/skills/setup-project-ai/SKILL.md +61 -0
  104. package/bundles/antigravity-plugin/skills/ship/SKILL.md +107 -0
  105. package/bundles/antigravity-plugin/skills/ship-merge/SKILL.md +103 -0
  106. package/bundles/antigravity-plugin/skills/ship-pr/SKILL.md +102 -0
  107. package/bundles/antigravity-plugin/skills/skill-creator/LICENSE.txt +202 -0
  108. package/bundles/antigravity-plugin/skills/skill-creator/SKILL.md +491 -0
  109. package/bundles/antigravity-plugin/skills/skill-creator/agents/analyzer.md +274 -0
  110. package/bundles/antigravity-plugin/skills/skill-creator/agents/comparator.md +202 -0
  111. package/bundles/antigravity-plugin/skills/skill-creator/agents/grader.md +223 -0
  112. package/bundles/antigravity-plugin/skills/skill-creator/assets/eval_review.html +146 -0
  113. package/bundles/antigravity-plugin/skills/skill-creator/eval-viewer/generate_review.py +471 -0
  114. package/bundles/antigravity-plugin/skills/skill-creator/eval-viewer/viewer.html +1325 -0
  115. package/bundles/antigravity-plugin/skills/skill-creator/references/schemas.md +430 -0
  116. package/bundles/antigravity-plugin/skills/skill-creator/scripts/__init__.py +0 -0
  117. package/bundles/antigravity-plugin/skills/skill-creator/scripts/aggregate_benchmark.py +401 -0
  118. package/bundles/antigravity-plugin/skills/skill-creator/scripts/generate_report.py +326 -0
  119. package/bundles/antigravity-plugin/skills/skill-creator/scripts/improve_description.py +247 -0
  120. package/bundles/antigravity-plugin/skills/skill-creator/scripts/package_skill.py +136 -0
  121. package/bundles/antigravity-plugin/skills/skill-creator/scripts/quick_validate.py +103 -0
  122. package/bundles/antigravity-plugin/skills/skill-creator/scripts/run_eval.py +310 -0
  123. package/bundles/antigravity-plugin/skills/skill-creator/scripts/run_loop.py +328 -0
  124. package/bundles/antigravity-plugin/skills/skill-creator/scripts/utils.py +47 -0
  125. package/bundles/antigravity-plugin/skills/sql/SKILL.md +321 -0
  126. package/bundles/antigravity-plugin/skills/tdd/SKILL.md +37 -0
  127. package/bundles/antigravity-plugin/skills/tdd-workflow/SKILL.md +188 -0
  128. package/bundles/antigravity-plugin/skills/technical-writing/SKILL.md +286 -0
  129. package/bundles/antigravity-plugin/skills/test-strategy/SKILL.md +155 -0
  130. package/bundles/antigravity-plugin/skills/ui-brief/SKILL.md +84 -0
  131. package/bundles/antigravity-plugin/skills/ui-review/SKILL.md +176 -0
  132. package/bundles/antigravity-plugin/skills/ui-review/references/framework-fixes.md +471 -0
  133. package/bundles/antigravity-plugin/skills/ui-review/references/visual-checklist.md +236 -0
  134. package/bundles/antigravity-plugin/skills/usage-review/SKILL.md +77 -0
  135. package/bundles/antigravity-plugin/skills/use-model/SKILL.md +64 -0
  136. package/bundles/antigravity-plugin/skills/using-git-worktrees/SKILL.md +217 -0
  137. package/bundles/antigravity-plugin/skills/version/SKILL.md +18 -0
  138. package/bundles/antigravity-plugin/skills/warm-editorial-ui/DESIGN_TOKENS.md +487 -0
  139. package/bundles/antigravity-plugin/skills/warm-editorial-ui/IMPLEMENTATION_GUIDE.md +177 -0
  140. package/bundles/antigravity-plugin/skills/warm-editorial-ui/SKILL.md +732 -0
  141. package/bundles/antigravity-plugin/skills/webapp-testing/LICENSE.txt +202 -0
  142. package/bundles/antigravity-plugin/skills/webapp-testing/SKILL.md +97 -0
  143. package/bundles/antigravity-plugin/skills/webapp-testing/examples/console_logging.py +35 -0
  144. package/bundles/antigravity-plugin/skills/webapp-testing/examples/element_discovery.py +40 -0
  145. package/bundles/antigravity-plugin/skills/webapp-testing/examples/static_html_automation.py +33 -0
  146. package/bundles/antigravity-plugin/skills/webapp-testing/scripts/with_server.py +106 -0
  147. package/bundles/antigravity-plugin/skills/windows-deployment/SKILL.md +880 -0
  148. package/bundles/antigravity-plugin/skills/writing-plans/SKILL.md +384 -0
  149. package/bundles/antigravity-plugin/statusline-command-agy.sh +91 -0
  150. package/bundles/antigravity-plugin/warm_start_agy.py +149 -0
  151. package/bundles/manifest.json +6 -0
  152. package/dist/cli.js +5363 -0
  153. package/package.json +61 -4
@@ -0,0 +1,114 @@
1
+ ---
2
+ name: implement
3
+ description: Headless plan executor — implement an approved plan phase-by-phase on the current feature branch, TDD-first, committing per phase
4
+ ---
5
+
6
+ # /caddis:implement — execute an approved plan (headless driver)
7
+
8
+ Implement the plan at **$ARGUMENTS** (falls back to the `DOCKET_PLAN` env var if `$ARGUMENTS` is empty).
9
+
10
+ This command is the **docket Implement lane's driver**. It is spawned autonomously by the docket runner —
11
+ **no human is present**. It does not design or re-plan: the plan is the intelligence, you are the executor.
12
+ The runner independently re-runs the tests and a fresh code-review after you finish and decides success
13
+ itself — so your job is to implement faithfully, commit cleanly, and report honestly. Overstating success
14
+ does not help you; the runner will catch it.
15
+
16
+ ## Non-negotiable safety rules (the runner enforces these too — violating them fails the whole run)
17
+ These override everything below. They exist because branch isolation and the runner's post-run backstops
18
+ depend on them:
19
+
20
+ - **Work ONLY on the current branch.** You are already on the feature branch (`DOCKET_BRANCH`, e.g.
21
+ `agent/<slug>`). **NEVER** run `git checkout`, `git switch`, `git branch`, `git switch -c`, or any
22
+ command that changes, creates, or leaves the current branch. If you somehow find yourself on the default
23
+ branch (`DOCKET_DEFAULT_BRANCH`), **stop immediately, do not commit**, and emit the failure JSON below —
24
+ a commit on the default branch fails the run.
25
+ - **NEVER touch git remotes.** No `git push`, `git pull`, `git fetch`, `git remote`, no PR, no merge. The
26
+ runner never pushes; neither do you.
27
+ - **NEVER edit your own success criteria.** Do not modify `.caddis/PROJECT-FACTS.md`, and do not change
28
+ the project's test command anywhere (config, CI, package scripts). The runner treats any such edit as
29
+ tampering and fails the run. If the plan asks you to touch these, skip that step and note it in the
30
+ review file instead.
31
+ - **Commit per phase, on this branch, with a normal commit.** Use `git add <paths> && git commit -m "…"`.
32
+ Do not use `--no-verify` (a pre-commit hook guards the branch — let it run). Do not amend or rebase
33
+ prior commits. One phase → one (or more) commit(s); never one giant end-of-run commit.
34
+ - **Never ask a question, never pause, never wait for input.** No human will answer. Never use
35
+ AskUserQuestion. Where the plan leaves a genuine gap, make the smallest reasonable assumption, record it
36
+ in the review file, and proceed — asking is always wrong here.
37
+
38
+ ## What to do
39
+
40
+ **1. Read the plan.** Load the plan file (`$ARGUMENTS` / `DOCKET_PLAN`). Read its `## Phases`, `## Affected
41
+ files`, `## Constraints & decisions`, and `## Tracker`. Read the `AGENTS.md` at the repo root and in each
42
+ folder you will touch (the canonical rules; `CLAUDE.md` is an `@AGENTS.md` shim), and
43
+ `.caddis/PROJECT-FACTS.md` if present (for the real run/test commands) —
44
+ **read it, never edit it**. Identify the test command the plan/facts specify so you can run it yourself.
45
+
46
+ **2. Determine where to resume.** The `## Tracker` table is the resume signal. Start at the first phase whose
47
+ status is not `done`/`✅`. If every phase is already done, verify the tests are green and go straight to the
48
+ report — do not redo completed work.
49
+
50
+ **3. Implement each remaining phase, TDD-first.** For each phase, in order:
51
+ - **RED** — write the failing test(s) the phase names (`<test file>::<case>`). Run them; confirm they
52
+ fail for the right reason (the missing behavior, not an import error). If a phase genuinely has no
53
+ testable surface, say so in the review file and implement the minimal change directly.
54
+ - **GREEN** — write the **minimum** code to pass. No speculative abstraction, no scope creep beyond the
55
+ phase. Run the phase's tests; confirm green.
56
+ - **REFACTOR** — clean names/structure/duplication while keeping green.
57
+ - **VERIFY** — run the phase's exit-gate check (the literal command the plan names) and the relevant
58
+ suite so you didn't regress. Do not claim a state you did not run.
59
+ - **COMMIT** — `git add` the phase's files and `git commit` with the phase's conventional-commit message
60
+ (from the plan, or a faithful equivalent). Stay on the current branch.
61
+ - **UPDATE THE TRACKER** — edit the plan's `## Tracker` row for this phase: set Status to `done`, fill
62
+ the short commit hash (`git rev-parse --short HEAD`) and a one-line note. This is what lets a future
63
+ session (or the runner) see progress. Commit the Tracker update with the phase (or as a tiny follow-up
64
+ commit) — it lives in the plan file, which is fine to commit on this branch.
65
+
66
+ If a phase cannot be completed (a blocking gap the plan did not resolve, or a rule above would be
67
+ violated), **stop there**: leave later phases untouched, record the blocker in the review file, mark the
68
+ Tracker row `blocked`, and report honestly with `"tests":"failed"` — never fake completion.
69
+
70
+ **4. Run the tests yourself.** After the last phase you complete, run the project's full test command once
71
+ more and record the real result. The runner will re-run it independently and that decides success — but
72
+ you run it too so your reported `"tests"` value is truthful, not assumed. Never report `"passed"` on a
73
+ suite you did not see go green.
74
+
75
+ **5. Write a concise review file** to the path in the `DOCKET_REVIEW` env var (falls back to
76
+ `.caddis/reviews/<slug>.md`, where `<slug>` is `DOCKET_SLUG`). Create `.caddis/reviews/` if needed.
77
+ Keep it short and scannable — this is what the human reviewer reads before merging the branch:
78
+
79
+ ```markdown
80
+ ---
81
+ type: implement-review
82
+ feature: <slug>
83
+ branch: <DOCKET_BRANCH>
84
+ ---
85
+
86
+ # Implement review — <feature>
87
+ **Branch:** `<DOCKET_BRANCH>` • **Phases done:** <N of M> • **Tests:** passed | failed
88
+
89
+ ## What changed
90
+ - <phase 1 — one line: what shipped + commit hash>
91
+ - <phase 2 — …>
92
+
93
+ ## Assumptions made
94
+ - <any gap the plan left that you decided — or "none">
95
+
96
+ ## Not done / follow-ups
97
+ - <phases skipped/blocked and why — or "none; all phases complete">
98
+
99
+ ## Test result
100
+ `<the exact test command>` → <passed | failed (exit N)> — <one line>
101
+ ```
102
+
103
+ **6. End with EXACTLY one fenced `json` block** as the final output — nothing after it. `phases_done` is the
104
+ count of phases you actually completed (Tracker rows now `done`); `tests` is what your own run in step 4
105
+ showed; `review` is the review-file path you wrote:
106
+
107
+ ```json
108
+ {"implemented":true,"phases_done":<int>,"tests":"passed|failed","review":".caddis/reviews/<slug>.md"}
109
+ ```
110
+
111
+ If you had to stop before implementing anything (e.g. you were on the default branch, or the plan was
112
+ unreadable), still end with the block using `"implemented":false,"phases_done":0,"tests":"failed"` and put
113
+ the reason in the review file. The only acceptable final output is the code + commits + review file + this
114
+ one JSON block — never questions, never prose after the block.
@@ -0,0 +1,142 @@
1
+ ---
2
+ name: javascript-typescript
3
+ description: JavaScript and TypeScript development with ES6+, Node.js, React, and modern web frameworks. Use for frontend, backend, or full-stack JavaScript/TypeScript projects.
4
+ source: wshobson/agents
5
+ license: MIT
6
+ ---
7
+
8
+ # JavaScript/TypeScript Development
9
+
10
+ ## TypeScript Configuration
11
+
12
+ ```json
13
+ {
14
+ "compilerOptions": {
15
+ "target": "ES2022",
16
+ "module": "ESNext",
17
+ "moduleResolution": "bundler",
18
+ "strict": true,
19
+ "noUncheckedIndexedAccess": true,
20
+ "noImplicitOverride": true,
21
+ "skipLibCheck": true,
22
+ "declaration": true,
23
+ "outDir": "./dist"
24
+ },
25
+ "include": ["src/**/*"],
26
+ "exclude": ["node_modules", "dist"]
27
+ }
28
+ ```
29
+
30
+ ## Type Patterns
31
+
32
+ ### Utility Types
33
+ ```typescript
34
+ // Pick specific properties
35
+ type UserPreview = Pick<User, 'id' | 'name'>;
36
+
37
+ // Omit properties
38
+ type CreateUser = Omit<User, 'id' | 'createdAt'>;
39
+
40
+ // Make all properties optional
41
+ type PartialUser = Partial<User>;
42
+
43
+ // Make all properties required
44
+ type RequiredUser = Required<User>;
45
+
46
+ // Extract union types
47
+ type Status = 'pending' | 'active' | 'inactive';
48
+ type ActiveStatus = Extract<Status, 'active' | 'pending'>;
49
+ ```
50
+
51
+ ### Discriminated Unions
52
+ ```typescript
53
+ type Result<T> =
54
+ | { success: true; data: T }
55
+ | { success: false; error: Error };
56
+
57
+ function handleResult<T>(result: Result<T>) {
58
+ if (result.success) {
59
+ console.log(result.data); // T
60
+ } else {
61
+ console.error(result.error); // Error
62
+ }
63
+ }
64
+ ```
65
+
66
+ ### Generic Constraints
67
+ ```typescript
68
+ interface HasId {
69
+ id: string | number;
70
+ }
71
+
72
+ function findById<T extends HasId>(items: T[], id: T['id']): T | undefined {
73
+ return items.find(item => item.id === id);
74
+ }
75
+ ```
76
+
77
+ ## Modern JavaScript
78
+
79
+ ### Destructuring & Spread
80
+ ```javascript
81
+ const { name, ...rest } = user;
82
+ const merged = { ...defaults, ...options };
83
+ const [first, ...others] = items;
84
+ ```
85
+
86
+ ### Optional Chaining & Nullish Coalescing
87
+ ```javascript
88
+ const city = user?.address?.city ?? 'Unknown';
89
+ const count = data?.items?.length ?? 0;
90
+ ```
91
+
92
+ ### Array Methods
93
+ ```javascript
94
+ const adults = users.filter(u => u.age >= 18);
95
+ const names = users.map(u => u.name);
96
+ const total = items.reduce((sum, item) => sum + item.price, 0);
97
+ const hasAdmin = users.some(u => u.role === 'admin');
98
+ const allActive = users.every(u => u.active);
99
+ ```
100
+
101
+ ## React Patterns
102
+
103
+ ```typescript
104
+ // Props with children
105
+ interface CardProps {
106
+ title: string;
107
+ children: React.ReactNode;
108
+ }
109
+
110
+ // Event handlers
111
+ interface ButtonProps {
112
+ onClick: (event: React.MouseEvent<HTMLButtonElement>) => void;
113
+ }
114
+
115
+ // Custom hooks
116
+ function useLocalStorage<T>(key: string, initial: T) {
117
+ const [value, setValue] = useState<T>(() => {
118
+ const stored = localStorage.getItem(key);
119
+ return stored ? JSON.parse(stored) : initial;
120
+ });
121
+
122
+ useEffect(() => {
123
+ localStorage.setItem(key, JSON.stringify(value));
124
+ }, [key, value]);
125
+
126
+ return [value, setValue] as const;
127
+ }
128
+ ```
129
+
130
+ ## Node.js Patterns
131
+
132
+ ```typescript
133
+ // ES Modules
134
+ import { readFile } from 'node:fs/promises';
135
+ import { join } from 'node:path';
136
+
137
+ // Error handling
138
+ process.on('unhandledRejection', (reason) => {
139
+ console.error('Unhandled Rejection:', reason);
140
+ process.exit(1);
141
+ });
142
+ ```
@@ -0,0 +1,60 @@
1
+ ---
2
+ name: kb
3
+ description: Rebuild the KB index (.caddis/kb/DOC-MAP.md) — create it if missing, index un-indexed notes, report dangling links
4
+ ---
5
+
6
+ # /kb — bring the knowledge-base index up to date
7
+
8
+ Reconcile `.caddis/kb/DOC-MAP.md` (the KB index) with the notes on disk. Use this in a repo that
9
+ has the harness but no KB yet (the KB was introduced recently), or after adding/removing KB notes.
10
+
11
+ ## Step 1 — locate the checker
12
+ It ships with the harness. Try, in order:
13
+ - `scripts/check_doc_coverage.py` — a project set up via `setup-project-ai` (checker copied in).
14
+ - `claude-harness/scripts/check_doc_coverage.py` — the harness source repo itself.
15
+
16
+ ## Step 2 — run the reindexer
17
+ ```
18
+ python <path>/check_doc_coverage.py --reindex
19
+ ```
20
+ It is **additive and safe** — never deletes your rows:
21
+ - **Missing map** → creates `.caddis/kb/DOC-MAP.md` from a scaffold, pre-linking the repo's obvious
22
+ reference docs (README, `docs/…`) and any existing `.caddis/kb/*.md` notes.
23
+ - **Existing map** → indexes any KB note that isn't yet linked (adds a row with a placeholder description).
24
+ - **Dangling links** (a linked file that's gone) → **reported, not removed** — handle them in Step 3.
25
+
26
+ ## Step 3 — finish by hand
27
+ Read the `[kb]` summary it printed, then:
28
+ - For each **newly auto-indexed** note, open it and replace the placeholder description with a real
29
+ one-line "what / when to read".
30
+ - If it reported **dangling** links (a linked file that's gone), decide per link:
31
+ - The note was **moved/renamed** → fix the link target by hand.
32
+ - The note is **gone for good** → remove its row. To clear all dangling rows at once, use the
33
+ destructive opt-in — but **show the dangling list and confirm with the user first**:
34
+ ```
35
+ python <path>/check_doc_coverage.py --prune
36
+ ```
37
+ `--prune` removes *only* index rows that link to missing files (never valid rows, never prose),
38
+ and still indexes any orphan notes in the same run.
39
+
40
+ ## Step 4 — verify clean
41
+ ```
42
+ python <path>/check_doc_coverage.py --check
43
+ ```
44
+ Exit `0` = the index is honest (no dangling links; every note indexed). The SessionStart hook will now
45
+ surface the `[DOC-MAP]` "read the index first" pointer for future sessions in this repo.
46
+
47
+ ## KB note format (OKF-lite — mandatory for every new note)
48
+
49
+ Every new `.caddis/kb/*.md` note starts with this frontmatter block (`type` is required;
50
+ the rest recommended). `DOC-MAP.md` is the index, not a note — it stays frontmatter-free:
51
+
52
+ ```yaml
53
+ ---
54
+ type: note # note | runbook | design | reference
55
+ title: <human title>
56
+ description: <one line — keep it identical to the note's DOC-MAP row description>
57
+ tags: [topic, topic]
58
+ timestamp: 2026-01-01 # ISO date of last substantive update
59
+ ---
60
+ ```
@@ -0,0 +1,33 @@
1
+ ---
2
+ name: mermaid-db
3
+ description: Turn a SQL artifact (proc, view, query, .sql file, or table name) into a Mermaid diagram that explains it — git-diffable, saved as .md
4
+ ---
5
+
6
+ # /mermaid-db — diagram a SQL artifact as Mermaid
7
+
8
+ Explain a SQL artifact to a human as a **Mermaid** diagram (the default format: plain text, diffs cleanly
9
+ in git, renders natively in VS Code and Gitea, regenerable when the schema changes).
10
+
11
+ Input: **$ARGUMENTS**
12
+
13
+ ## Do this
14
+
15
+ Load and follow the **`db-diagram`** skill end-to-end. In short:
16
+
17
+ 1. **Get the SQL** — from a file path, a DB object name (look it up via a DB MCP tool if available, else
18
+ read-only `sqlcmd`/`psql`, else ask), the current file in context, or pasted SQL. Multiple objects →
19
+ ONE diagram of their relationships.
20
+ 2. **Extract deterministically** — run the skill's `scripts/sql_to_graph.py` (sqlglot-based) to get the
21
+ typed node/edge graph + a Mermaid skeleton. Don't hand-derive the nodes when the script can run.
22
+ 3. **Narrate** — add a business-terms paragraph above, a per-source-table description list below, the
23
+ source path/object name, a generation date, and the execution-plan caveat (verbatim, per the skill).
24
+ 4. **Validate + save** — confirm the Mermaid parses; save as `.md` (default `docs/diagrams/<object>.md`,
25
+ overridable by a second argument). If the file exists, **diff and report what changed** — never
26
+ silently overwrite.
27
+
28
+ ## Rules (from the skill — non-negotiable)
29
+
30
+ - **Read-only.** Never run DDL/DML. The extractor only parses SQL text.
31
+ - **Never guess schema.** Verify tables/columns against the real DB; mark anything inferred-from-SQL-only.
32
+ - If the extractor reports `partial` confidence (or sqlglot is missing), say so — the diagram is
33
+ best-effort, not authoritative.
@@ -0,0 +1,236 @@
1
+ ---
2
+ name: mermaid-diagrams
3
+ context: fork
4
+ description: Create software diagrams using Mermaid text-based syntax. Use for class diagrams (domain modeling, OOP design), sequence diagrams (API flows, interactions), flowcharts (processes, algorithms, user journeys), ERD (database schemas), C4 architecture diagrams, state diagrams, git graphs, gantt charts, and data visualization.
5
+ ---
6
+
7
+ # Mermaid Diagramming
8
+
9
+ **Works with:** Any AI coding agent (Claude, Cursor, GitHub Copilot, Windsurf, etc.)
10
+
11
+ Create professional software diagrams using Mermaid's text-based syntax. Diagrams are version-controllable, easy to update, and render automatically in GitHub, GitLab, Notion, and more.
12
+
13
+ ## Triggers
14
+
15
+ Use this skill when you need to:
16
+ - "diagram this", "visualize this", "model this"
17
+ - "show the flow", "map out the process"
18
+ - "architecture diagram", "class diagram", "sequence diagram"
19
+ - "database schema", "ERD", "entity relationship"
20
+ - "flowchart", "user journey", "system design"
21
+
22
+ ## Quick Reference
23
+
24
+ | Diagram Type | Use For | Syntax Starts With |
25
+ |--------------|---------|-------------------|
26
+ | **Class Diagram** | Domain models, OOP design | `classDiagram` |
27
+ | **Sequence Diagram** | API flows, interactions | `sequenceDiagram` |
28
+ | **Flowchart** | Processes, algorithms, user journeys | `flowchart TD` or `flowchart LR` |
29
+ | **ERD** | Database schemas | `erDiagram` |
30
+ | **C4 Diagram** | Architecture (context, container, component) | `C4Context`, `C4Container`, `C4Component` |
31
+ | **State Diagram** | State machines, lifecycles | `stateDiagram-v2` |
32
+ | **Git Graph** | Branching strategies | `gitGraph` |
33
+ | **Gantt Chart** | Project timelines | `gantt` |
34
+
35
+ ## Core Syntax Pattern
36
+
37
+ All Mermaid diagrams follow this structure:
38
+
39
+ ```mermaid
40
+ diagramType
41
+ definition content
42
+ ```
43
+
44
+ **Key principles:**
45
+ - First line declares diagram type
46
+ - Use `%%` for comments
47
+ - Indentation improves readability
48
+ - Misspellings break diagrams; validate at [mermaid.live](https://mermaid.live)
49
+
50
+ ## Quick Start Examples
51
+
52
+ ### Class Diagram
53
+ ```mermaid
54
+ classDiagram
55
+ User --> Order : places
56
+ Order *-- LineItem
57
+
58
+ class User {
59
+ +string email
60
+ +string name
61
+ +placeOrder()
62
+ }
63
+
64
+ class Order {
65
+ +int id
66
+ +decimal total
67
+ +addItem()
68
+ }
69
+ ```
70
+
71
+ ### Sequence Diagram
72
+ ```mermaid
73
+ sequenceDiagram
74
+ participant User
75
+ participant API
76
+ participant DB
77
+
78
+ User->>API: POST /login
79
+ API->>DB: Query credentials
80
+ DB-->>API: Return user data
81
+ alt Valid
82
+ API-->>User: 200 OK + token
83
+ else Invalid
84
+ API-->>User: 401 Unauthorized
85
+ end
86
+ ```
87
+
88
+ ### Flowchart
89
+ ```mermaid
90
+ flowchart TD
91
+ Start([User visits]) --> Auth{Authenticated?}
92
+ Auth -->|No| Login[Login page]
93
+ Auth -->|Yes| Dashboard[Dashboard]
94
+ Login --> Validate{Valid?}
95
+ Validate -->|Yes| Dashboard
96
+ Validate -->|No| Error[Error message]
97
+ ```
98
+
99
+ ### ERD
100
+ ```mermaid
101
+ erDiagram
102
+ USER ||--o{ ORDER : places
103
+ ORDER ||--|{ LINE_ITEM : contains
104
+
105
+ USER {
106
+ int id PK
107
+ string email UK
108
+ string name
109
+ }
110
+
111
+ ORDER {
112
+ int id PK
113
+ int user_id FK
114
+ decimal total
115
+ }
116
+ ```
117
+
118
+ ### C4 Context
119
+ ```mermaid
120
+ C4Context
121
+ title System Context
122
+
123
+ Person(user, "User", "Customer")
124
+ System(app, "Web App", "E-commerce platform")
125
+ System_Ext(payment, "Payment Gateway")
126
+
127
+ Rel(user, app, "Browses, purchases")
128
+ Rel(app, payment, "Processes payments", "HTTPS")
129
+ ```
130
+
131
+ ## Essential Syntax
132
+
133
+ ### Relationships (Class/ERD)
134
+ ```
135
+ --> Association
136
+ ..> Dependency
137
+ --|> Inheritance/Generalization
138
+ --* Composition
139
+ --o Aggregation
140
+ ```
141
+
142
+ ### Arrows (Sequence/Flowchart)
143
+ ```
144
+ ->> Solid arrow (sync message)
145
+ -->> Dashed arrow (response)
146
+ --> Flowchart connection
147
+ ```
148
+
149
+ ### Node Shapes (Flowchart)
150
+ ```
151
+ [] Rectangle
152
+ () Rounded
153
+ {} Diamond (decision)
154
+ ([]) Stadium/pill
155
+ [()] Cylinder (database)
156
+ ```
157
+
158
+ ### Cardinality (ERD)
159
+ ```
160
+ ||--|| One to one
161
+ ||--o{ One to many
162
+ }o--o{ Many to many
163
+ ```
164
+
165
+ ## Configuration
166
+
167
+ Add themes and styling:
168
+
169
+ ```mermaid
170
+ ---
171
+ config:
172
+ theme: base
173
+ themeVariables:
174
+ primaryColor: "#ff6b6b"
175
+ look: handDrawn
176
+ ---
177
+ flowchart LR
178
+ A --> B
179
+ ```
180
+
181
+ **Themes:** default, forest, dark, neutral, base
182
+ **Look:** classic, handDrawn
183
+
184
+ ## Export & Rendering
185
+
186
+ **Auto-renders in:**
187
+ - GitHub/GitLab Markdown
188
+ - VS Code (with Mermaid extension)
189
+ - Notion, Obsidian, Confluence
190
+
191
+ **Export to PNG/SVG:**
192
+ - Online: [mermaid.live](https://mermaid.live)
193
+ - CLI: `npm install -g @mermaid-js/mermaid-cli`
194
+ ```bash
195
+ mmdc -i diagram.mmd -o diagram.png
196
+ ```
197
+
198
+ ## Best Practices
199
+
200
+ 1. **Start simple** - Core elements first, add details incrementally
201
+ 2. **One concept per diagram** - Split complex views into focused diagrams
202
+ 3. **Use clear labels** - Meaningful names make diagrams self-documenting
203
+ 4. **Comment extensively** - Use `%%` to explain complex parts
204
+ 5. **Validate syntax** - Test at [mermaid.live](https://mermaid.live) before committing
205
+ 6. **Version control** - Store `.mmd` files with code
206
+ 7. **Keep updated** - Update diagrams when code changes
207
+
208
+ ## Common Issues
209
+
210
+ **Diagram won't render:**
211
+ - Check for typos in diagram type declaration
212
+ - Validate syntax at [mermaid.live](https://mermaid.live)
213
+ - Avoid special characters in labels (use quotes if needed)
214
+
215
+ **Arrows not connecting:**
216
+ - Verify node IDs match exactly
217
+ - Check arrow syntax (`-->` vs `->>` vs `-->>`)
218
+
219
+ **Layout looks wrong:**
220
+ - Try different direction: `TD` (top-down), `LR` (left-right), `RL`, `BT`
221
+ - Use subgraphs to group related elements
222
+ - Consider splitting into multiple diagrams
223
+
224
+ ## Detailed References
225
+
226
+ See `references/` for comprehensive syntax:
227
+
228
+ - **[class-diagrams.md](references/class-diagrams.md)** - Relationships, multiplicity, methods, domain modeling
229
+ - **[sequence-diagrams.md](references/sequence-diagrams.md)** - Messages, activations, loops, alt/opt blocks
230
+ - **[flowcharts.md](references/flowcharts.md)** - Shapes, subgraphs, styling, complex flows
231
+ - **[erd-diagrams.md](references/erd-diagrams.md)** - Entities, cardinality, keys, attributes
232
+ - **[c4-diagrams.md](references/c4-diagrams.md)** - Context, container, component levels
233
+ - **[architecture-diagrams.md](references/architecture-diagrams.md)** - Cloud services, infrastructure, deployment
234
+ - **[advanced-features.md](references/advanced-features.md)** - Themes, configuration, layout options
235
+ - **[workflows.md](references/workflows.md)** - Step-by-step examples
236
+ - **[troubleshooting.md](references/troubleshooting.md)** - Common problems and solutions