opencastle 1.4.3 → 1.6.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 (235) hide show
  1. package/dist/cli/adapters/claude-code.d.ts.map +1 -1
  2. package/dist/cli/adapters/claude-code.js +1 -0
  3. package/dist/cli/adapters/claude-code.js.map +1 -1
  4. package/dist/cli/adapters/single-file-base.d.ts +8 -0
  5. package/dist/cli/adapters/single-file-base.d.ts.map +1 -1
  6. package/dist/cli/adapters/single-file-base.js +48 -22
  7. package/dist/cli/adapters/single-file-base.js.map +1 -1
  8. package/dist/cli/bootstrap-on-init.test.js +16 -5
  9. package/dist/cli/bootstrap-on-init.test.js.map +1 -1
  10. package/dist/cli/bootstrap.d.ts +17 -0
  11. package/dist/cli/bootstrap.d.ts.map +1 -1
  12. package/dist/cli/bootstrap.js +284 -312
  13. package/dist/cli/bootstrap.js.map +1 -1
  14. package/dist/cli/bootstrap.test.js +22 -16
  15. package/dist/cli/bootstrap.test.js.map +1 -1
  16. package/dist/cli/command-namespace.test.js +17 -0
  17. package/dist/cli/command-namespace.test.js.map +1 -1
  18. package/dist/cli/convoy/engine.d.ts +12 -0
  19. package/dist/cli/convoy/engine.d.ts.map +1 -1
  20. package/dist/cli/convoy/engine.git.test.js +55 -0
  21. package/dist/cli/convoy/engine.git.test.js.map +1 -1
  22. package/dist/cli/convoy/engine.js +47 -3
  23. package/dist/cli/convoy/engine.js.map +1 -1
  24. package/dist/cli/convoy/findings.d.ts +35 -0
  25. package/dist/cli/convoy/findings.d.ts.map +1 -0
  26. package/dist/cli/convoy/findings.js +100 -0
  27. package/dist/cli/convoy/findings.js.map +1 -0
  28. package/dist/cli/convoy/findings.test.d.ts +2 -0
  29. package/dist/cli/convoy/findings.test.d.ts.map +1 -0
  30. package/dist/cli/convoy/findings.test.js +75 -0
  31. package/dist/cli/convoy/findings.test.js.map +1 -0
  32. package/dist/cli/convoy/isolation.d.ts.map +1 -1
  33. package/dist/cli/convoy/isolation.js +2 -1
  34. package/dist/cli/convoy/isolation.js.map +1 -1
  35. package/dist/cli/convoy/worktree.d.ts +5 -0
  36. package/dist/cli/convoy/worktree.d.ts.map +1 -1
  37. package/dist/cli/convoy/worktree.js +12 -0
  38. package/dist/cli/convoy/worktree.js.map +1 -1
  39. package/dist/cli/detect.d.ts +4 -0
  40. package/dist/cli/detect.d.ts.map +1 -1
  41. package/dist/cli/detect.js +1 -1
  42. package/dist/cli/detect.js.map +1 -1
  43. package/dist/cli/docs-accuracy.test.js +34 -0
  44. package/dist/cli/docs-accuracy.test.js.map +1 -1
  45. package/dist/cli/doctor.d.ts +11 -0
  46. package/dist/cli/doctor.d.ts.map +1 -1
  47. package/dist/cli/doctor.js +74 -10
  48. package/dist/cli/doctor.js.map +1 -1
  49. package/dist/cli/doctor.test.js +82 -1
  50. package/dist/cli/doctor.test.js.map +1 -1
  51. package/dist/cli/init.d.ts.map +1 -1
  52. package/dist/cli/init.js +58 -53
  53. package/dist/cli/init.js.map +1 -1
  54. package/dist/cli/init.test.js +32 -28
  55. package/dist/cli/init.test.js.map +1 -1
  56. package/dist/cli/layers.d.ts +20 -0
  57. package/dist/cli/layers.d.ts.map +1 -1
  58. package/dist/cli/layers.js +53 -1
  59. package/dist/cli/layers.js.map +1 -1
  60. package/dist/cli/layers.test.js +67 -1
  61. package/dist/cli/layers.test.js.map +1 -1
  62. package/dist/cli/lessons.d.ts +10 -0
  63. package/dist/cli/lessons.d.ts.map +1 -1
  64. package/dist/cli/lessons.js +26 -1
  65. package/dist/cli/lessons.js.map +1 -1
  66. package/dist/cli/lessons.test.js +38 -1
  67. package/dist/cli/lessons.test.js.map +1 -1
  68. package/dist/cli/log.d.ts +2 -2
  69. package/dist/cli/log.d.ts.map +1 -1
  70. package/dist/cli/log.js +1 -1
  71. package/dist/cli/log.js.map +1 -1
  72. package/dist/cli/log.test.js +1 -1
  73. package/dist/cli/log.test.js.map +1 -1
  74. package/dist/cli/managed-paths.d.ts +1 -1
  75. package/dist/cli/managed-paths.d.ts.map +1 -1
  76. package/dist/cli/managed-paths.js +0 -1
  77. package/dist/cli/managed-paths.js.map +1 -1
  78. package/dist/cli/plan.test.js +10 -8
  79. package/dist/cli/plan.test.js.map +1 -1
  80. package/dist/cli/project-facts.d.ts +103 -0
  81. package/dist/cli/project-facts.d.ts.map +1 -0
  82. package/dist/cli/project-facts.js +577 -0
  83. package/dist/cli/project-facts.js.map +1 -0
  84. package/dist/cli/project-facts.test.d.ts +2 -0
  85. package/dist/cli/project-facts.test.d.ts.map +1 -0
  86. package/dist/cli/project-facts.test.js +209 -0
  87. package/dist/cli/project-facts.test.js.map +1 -0
  88. package/dist/cli/stack-config.js +1 -1
  89. package/dist/cli/stack-config.js.map +1 -1
  90. package/dist/cli/sync-check.test.js +14 -2
  91. package/dist/cli/sync-check.test.js.map +1 -1
  92. package/dist/orchestrator/plugins/notion/config.d.ts.map +1 -1
  93. package/dist/orchestrator/plugins/notion/config.js +21 -17
  94. package/dist/orchestrator/plugins/notion/config.js.map +1 -1
  95. package/package.json +1 -1
  96. package/src/cli/adapters/claude-code.ts +1 -0
  97. package/src/cli/adapters/single-file-base.ts +63 -31
  98. package/src/cli/bootstrap-on-init.test.ts +17 -5
  99. package/src/cli/bootstrap.test.ts +22 -16
  100. package/src/cli/bootstrap.ts +361 -373
  101. package/src/cli/command-namespace.test.ts +17 -0
  102. package/src/cli/convoy/engine.git.test.ts +59 -0
  103. package/src/cli/convoy/engine.ts +53 -2
  104. package/src/cli/convoy/findings.test.ts +86 -0
  105. package/src/cli/convoy/findings.ts +129 -0
  106. package/src/cli/convoy/isolation.ts +2 -1
  107. package/src/cli/convoy/worktree.ts +12 -0
  108. package/src/cli/detect.ts +1 -1
  109. package/src/cli/docs-accuracy.test.ts +42 -0
  110. package/src/cli/doctor.test.ts +101 -1
  111. package/src/cli/doctor.ts +77 -11
  112. package/src/cli/init.test.ts +31 -27
  113. package/src/cli/init.ts +62 -57
  114. package/src/cli/layers.test.ts +72 -1
  115. package/src/cli/layers.ts +52 -1
  116. package/src/cli/lessons.test.ts +48 -0
  117. package/src/cli/lessons.ts +27 -1
  118. package/src/cli/log.test.ts +1 -1
  119. package/src/cli/log.ts +2 -2
  120. package/src/cli/managed-paths.ts +0 -1
  121. package/src/cli/plan.test.ts +10 -8
  122. package/src/cli/project-facts.test.ts +228 -0
  123. package/src/cli/project-facts.ts +647 -0
  124. package/src/cli/stack-config.ts +1 -1
  125. package/src/cli/sync-check.test.ts +16 -2
  126. package/src/orchestrator/agent-workflows/data-pipeline.md +2 -2
  127. package/src/orchestrator/agent-workflows/feature-implementation.md +2 -2
  128. package/src/orchestrator/agent-workflows/schema-changes.md +1 -1
  129. package/src/orchestrator/agents/team-lead.agent.md +6 -6
  130. package/src/orchestrator/agents/testing-expert.agent.md +2 -2
  131. package/src/orchestrator/customizations/LESSONS-LEARNED.md +1 -1
  132. package/src/orchestrator/customizations/README.md +27 -84
  133. package/src/orchestrator/instructions/ai-optimization.instructions.md +6 -23
  134. package/src/orchestrator/instructions/general.instructions.md +22 -95
  135. package/src/orchestrator/plugins/astro/skills/astro-framework/SKILL.md +1 -3
  136. package/src/orchestrator/plugins/chrome-devtools/skills/browser-testing/SKILL.md +3 -5
  137. package/src/orchestrator/plugins/cloudflare/skills/cloudflare-platform/SKILL.md +2 -2
  138. package/src/orchestrator/plugins/contentful/skills/contentful-cms/SKILL.md +1 -1
  139. package/src/orchestrator/plugins/convex/skills/convex-database/SKILL.md +1 -3
  140. package/src/orchestrator/plugins/coolify/skills/coolify-deployment/SKILL.md +1 -1
  141. package/src/orchestrator/plugins/cypress/skills/cypress-testing/SKILL.md +1 -1
  142. package/src/orchestrator/plugins/drizzle/skills/drizzle-orm/SKILL.md +1 -1
  143. package/src/orchestrator/plugins/expo/skills/expo-development/SKILL.md +2 -2
  144. package/src/orchestrator/plugins/figma/skills/figma-design/SKILL.md +1 -3
  145. package/src/orchestrator/plugins/hetzner/skills/hetzner-cloud/SKILL.md +1 -1
  146. package/src/orchestrator/plugins/jira/skills/jira-management/SKILL.md +1 -3
  147. package/src/orchestrator/plugins/linear/skills/linear-task-management/SKILL.md +1 -3
  148. package/src/orchestrator/plugins/netlify/skills/netlify-deployment/SKILL.md +2 -2
  149. package/src/orchestrator/plugins/nextjs/skills/nextjs-framework/SKILL.md +13 -6
  150. package/src/orchestrator/plugins/notion/config.ts +21 -17
  151. package/src/orchestrator/plugins/notion/skills/notion-knowledge-management/SKILL.md +8 -16
  152. package/src/orchestrator/plugins/nx/skills/nx-workspace/SKILL.md +2 -4
  153. package/src/orchestrator/plugins/playwright/skills/playwright-testing/SKILL.md +1 -3
  154. package/src/orchestrator/plugins/prisma/skills/prisma-database/SKILL.md +1 -3
  155. package/src/orchestrator/plugins/resend/skills/resend-email/SKILL.md +2 -2
  156. package/src/orchestrator/plugins/sanity/skills/sanity-cms/SKILL.md +1 -3
  157. package/src/orchestrator/plugins/sentry/skills/sentry-monitoring/SKILL.md +1 -1
  158. package/src/orchestrator/plugins/slack/skills/slack-notifications/SKILL.md +1 -3
  159. package/src/orchestrator/plugins/strapi/skills/strapi-cms/SKILL.md +1 -3
  160. package/src/orchestrator/plugins/stripe/skills/stripe-payments/SKILL.md +4 -4
  161. package/src/orchestrator/plugins/supabase/skills/supabase-database/SKILL.md +3 -5
  162. package/src/orchestrator/plugins/teams/skills/teams-notifications/SKILL.md +1 -3
  163. package/src/orchestrator/plugins/trello/skills/trello-task-management/SKILL.md +1 -1
  164. package/src/orchestrator/plugins/turborepo/skills/turborepo-monorepo/SKILL.md +15 -88
  165. package/src/orchestrator/plugins/vercel/skills/vercel-deployment/SKILL.md +2 -2
  166. package/src/orchestrator/plugins/vitest/skills/vitest-testing/SKILL.md +17 -150
  167. package/src/orchestrator/prompts/assess-complexity.prompt.md +1 -0
  168. package/src/orchestrator/prompts/bootstrap-customizations.prompt.md +38 -238
  169. package/src/orchestrator/prompts/brainstorm.prompt.md +1 -1
  170. package/src/orchestrator/prompts/create-skill.prompt.md +13 -67
  171. package/src/orchestrator/prompts/fix-convoy.prompt.md +1 -0
  172. package/src/orchestrator/prompts/fix-prd.prompt.md +1 -0
  173. package/src/orchestrator/prompts/generate-prd.prompt.md +1 -0
  174. package/src/orchestrator/prompts/implement-feature.prompt.md +6 -6
  175. package/src/orchestrator/prompts/resolve-pr-comments.prompt.md +2 -2
  176. package/src/orchestrator/prompts/validate-convoy.prompt.md +1 -0
  177. package/src/orchestrator/prompts/validate-prd.prompt.md +1 -0
  178. package/src/orchestrator/skills/accessibility-standards/REFERENCE.md +17 -12
  179. package/src/orchestrator/skills/accessibility-standards/SKILL.md +1 -1
  180. package/src/orchestrator/skills/agent-hooks/HOOKS-REFERENCE.md +3 -5
  181. package/src/orchestrator/skills/agent-hooks/SKILL.md +8 -6
  182. package/src/orchestrator/skills/agent-memory/KNOWLEDGE-GRAPH.md +1 -1
  183. package/src/orchestrator/skills/agent-memory/SKILL.md +7 -16
  184. package/src/orchestrator/skills/api-patterns/SKILL.md +1 -1
  185. package/src/orchestrator/skills/code-commenting/SKILL.md +1 -1
  186. package/src/orchestrator/skills/context-map/REFERENCE.md +0 -2
  187. package/src/orchestrator/skills/context-map/SKILL.md +2 -2
  188. package/src/orchestrator/skills/data-engineering/REFERENCE.md +3 -9
  189. package/src/orchestrator/skills/data-engineering/SKILL.md +9 -16
  190. package/src/orchestrator/skills/decomposition/SKILL.md +1 -1
  191. package/src/orchestrator/skills/deployment-infrastructure/SKILL.md +4 -4
  192. package/src/orchestrator/skills/documentation-standards/SKILL.md +5 -3
  193. package/src/orchestrator/skills/fast-review/REFERENCE.md +0 -2
  194. package/src/orchestrator/skills/fast-review/SKILL.md +5 -5
  195. package/src/orchestrator/skills/frontend-design/REFERENCE.md +6 -28
  196. package/src/orchestrator/skills/frontend-design/SKILL.md +19 -9
  197. package/src/orchestrator/skills/git-workflow/SKILL.md +1 -1
  198. package/src/orchestrator/skills/memory-merger/SKILL.md +13 -15
  199. package/src/orchestrator/skills/observability-logging/SKILL.md +2 -2
  200. package/src/orchestrator/skills/orchestration-protocols/REFERENCE.md +5 -9
  201. package/src/orchestrator/skills/orchestration-protocols/SKILL.md +6 -6
  202. package/src/orchestrator/skills/panel-majority-vote/REFERENCE.md +1 -5
  203. package/src/orchestrator/skills/panel-majority-vote/SKILL.md +1 -1
  204. package/src/orchestrator/skills/panel-majority-vote/panel-report.template.md +0 -2
  205. package/src/orchestrator/skills/performance-optimization/SKILL.md +2 -2
  206. package/src/orchestrator/skills/project-consistency/SKILL.md +2 -2
  207. package/src/orchestrator/skills/project-consistency/TEMPLATES.md +0 -4
  208. package/src/orchestrator/skills/react-development/SKILL.md +3 -3
  209. package/src/orchestrator/skills/security-hardening/SKILL.md +5 -5
  210. package/src/orchestrator/skills/self-improvement/LESSON-CATEGORIES.md +0 -2
  211. package/src/orchestrator/skills/self-improvement/SKILL.md +1 -1
  212. package/src/orchestrator/skills/seo-patterns/SKILL.md +1 -1
  213. package/src/orchestrator/skills/session-checkpoints/CHECKPOINT-TEMPLATE.md +0 -2
  214. package/src/orchestrator/skills/session-checkpoints/SKILL.md +1 -1
  215. package/src/orchestrator/skills/team-lead-reference/SKILL.md +3 -3
  216. package/src/orchestrator/skills/technical-writing/SKILL.md +8 -13
  217. package/src/orchestrator/skills/testing-workflow/SKILL.md +6 -6
  218. package/src/orchestrator/skills/typescript-best-practices/SKILL.md +1 -1
  219. package/src/orchestrator/skills/unslop/SKILL.md +1 -1
  220. package/src/orchestrator/skills/validation-gates/REFERENCE.md +6 -31
  221. package/src/orchestrator/skills/validation-gates/SKILL.md +12 -26
  222. package/src/orchestrator/skills/writing-for-agents/SKILL.md +2 -2
  223. package/src/orchestrator/customizations/AGENT-EXPERTISE.md +0 -325
  224. package/src/orchestrator/customizations/AGENT-FAILURES.md +0 -69
  225. package/src/orchestrator/customizations/AGENT-PERFORMANCE.md +0 -55
  226. package/src/orchestrator/customizations/DISPUTES.md +0 -162
  227. package/src/orchestrator/customizations/KNOWLEDGE-GRAPH.md +0 -10
  228. package/src/orchestrator/customizations/agents/skill-matrix.md +0 -111
  229. package/src/orchestrator/customizations/logs/events.ndjson +0 -0
  230. package/src/orchestrator/customizations/project/decisions.md +0 -31
  231. package/src/orchestrator/customizations/project/docs-structure.md +0 -34
  232. package/src/orchestrator/customizations/project/roadmap.md +0 -24
  233. package/src/orchestrator/skills/documentation-standards/WRITING-GUIDE.md +0 -39
  234. package/src/orchestrator/skills/frontend-design/COMPONENTS.md +0 -113
  235. /package/src/orchestrator/{customizations/logs/README.md → skills/observability-logging/LOG-SCHEMA.md} +0 -0
@@ -1,162 +1,29 @@
1
1
  ---
2
2
  name: vitest-testing
3
- description: "Vitest unit and integration testing patterns, commands, mocking (vi.mock), and coverage. Use when writing .test.ts files, configuring the test runner, or adding coverage thresholds."
3
+ description: "Vitest gotchas for mocking, timers, type tests and coverage. Use when writing or debugging Vitest tests, configuring vitest.config, or a coverage threshold fails."
4
4
  ---
5
5
 
6
- <!-- ⚠️ This file is managed by OpenCastle. Edits will be overwritten on update. Customize in the .opencastle/ directory instead. -->
7
-
8
6
  # Vitest Testing
9
7
 
10
- For project-specific test configuration, see `.opencastle/stack/testing-config.md`.
11
-
12
- ## Commands
13
-
14
- ```bash
15
- npx vitest # Run in watch mode
16
- npx vitest run # Run once (CI)
17
- npx vitest run --coverage # Run with coverage report
18
- npx vitest run src/utils/ # Run specific directory
19
- npx vitest run auth.test.ts # Run specific file
20
- npx vitest run -t "should validate" # Filter by test name
21
- npx vitest --ui # Open Vitest UI
22
- npx vitest --reporter=json # JSON output for CI
23
- npx vitest typecheck # Run type-checking tests
24
- ```
25
-
26
- ## Test Structure
27
-
28
- ### File Naming
29
-
30
- ```
31
- src/
32
- ├── utils/
33
- │ ├── format.ts
34
- │ └── format.test.ts # Co-located test
35
- ├── components/
36
- │ ├── Button.tsx
37
- │ └── Button.test.tsx # Component test
38
- └── __tests__/ # Integration tests
39
- └── auth-flow.test.ts
40
- ```
41
-
42
- ### Writing Tests
43
-
44
- ```typescript
45
- import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
46
- import { formatPrice } from './format';
47
-
48
- describe('formatPrice', () => {
49
- it('should format USD prices', () => {
50
- expect(formatPrice(9.99, 'USD')).toBe('$9.99');
51
- });
52
-
53
- it('should handle zero', () => {
54
- expect(formatPrice(0, 'USD')).toBe('$0.00');
55
- });
56
-
57
- it('should throw for negative values', () => {
58
- expect(() => formatPrice(-1, 'USD')).toThrow('Price cannot be negative');
59
- });
60
- });
61
- ```
62
-
63
- ## Mocking
64
-
65
- ### Module Mocking
66
-
67
- ```typescript
68
- import { vi, describe, it, expect } from 'vitest';
69
-
70
- // Mock entire module
71
- vi.mock('./database', () => ({
72
- getUser: vi.fn().mockResolvedValue({ id: '1', name: 'Alice' }),
73
- }));
74
-
75
- // Mock specific export
76
- vi.mock('./config', async (importOriginal) => {
77
- const original = await importOriginal<typeof import('./config')>();
78
- return { ...original, API_URL: 'http://test-api.example.com' };
79
- });
80
- ```
81
-
82
- ### Spy and Stub
83
-
84
- ```typescript
85
- import { vi, describe, it, expect } from 'vitest';
86
-
87
- describe('notifications', () => {
88
- it('should call the API', async () => {
89
- const fetchSpy = vi.spyOn(globalThis, 'fetch').mockResolvedValue(
90
- new Response(JSON.stringify({ ok: true }))
91
- );
92
-
93
- await sendNotification('Hello');
94
-
95
- expect(fetchSpy).toHaveBeenCalledWith('/api/notify', expect.objectContaining({
96
- method: 'POST',
97
- }));
98
-
99
- fetchSpy.mockRestore();
100
- });
101
- });
102
- ```
103
-
104
- ### Timer Mocking
105
-
106
- ```typescript
107
- import { vi, describe, it, expect, beforeEach, afterEach } from 'vitest';
108
-
109
- describe('debounce', () => {
110
- beforeEach(() => vi.useFakeTimers());
111
- afterEach(() => vi.useRealTimers());
112
-
113
- it('should debounce calls', () => {
114
- const fn = vi.fn();
115
- const debounced = debounce(fn, 300);
116
-
117
- debounced();
118
- debounced();
119
- debounced();
8
+ Project test configuration: `.opencastle/stack/testing-config.md`. Coverage thresholds, environment and setup files: the project's `vitest.config.*` (or the `test` block of `vite.config.*`) — read them, never assume a number.
120
9
 
121
- expect(fn).not.toHaveBeenCalled();
122
- vi.advanceTimersByTime(300);
123
- expect(fn).toHaveBeenCalledOnce();
124
- });
125
- });
126
- ```
10
+ ## Running
127
11
 
128
- ## Configuration (vitest.config.ts)
12
+ - `vitest` alone starts **watch mode** in a terminal and never exits. Agents run `vitest run [file] [-t "name"]`.
13
+ - Type tests (`*.test-d.ts`, `expectTypeOf`) run with `vitest --typecheck` (or `vitest run --typecheck`). The old `vitest typecheck` subcommand is gone since 1.0.
14
+ - Coverage: `vitest run --coverage`. Below threshold → read the uncovered lines in the text report, add tests for those branches, re-run.
129
15
 
130
- ```typescript
131
- import { defineConfig } from 'vitest/config';
16
+ ## Mocking gotchas
132
17
 
133
- export default defineConfig({
134
- test: {
135
- globals: true, // Use describe/it/expect without imports
136
- environment: 'jsdom', // 'node' | 'jsdom' | 'happy-dom'
137
- include: ['src/**/*.test.{ts,tsx}'],
138
- coverage: {
139
- provider: 'v8',
140
- reporter: ['text', 'json', 'html'],
141
- include: ['src/**/*.{ts,tsx}'],
142
- exclude: ['src/**/*.test.{ts,tsx}', 'src/**/*.d.ts'],
143
- thresholds: {
144
- branches: 80,
145
- functions: 80,
146
- lines: 80,
147
- statements: 80,
148
- },
149
- },
150
- setupFiles: ['./src/test-setup.ts'],
151
- },
152
- });
153
- ```
18
+ - **`vi.mock()` is hoisted** above every import, so its factory cannot use variables declared in the file. Declare them with `vi.hoisted()`:
154
19
 
155
- ## Workflow
20
+ ```ts
21
+ const { getUser } = vi.hoisted(() => ({ getUser: vi.fn() }))
22
+ vi.mock('./database', () => ({ getUser }))
23
+ ```
156
24
 
157
- 1. Create `*.test.ts` adjacent to the source file.
158
- 2. Write focused unit tests (happy path + edge cases). Use `vi.mock()` before imports; restore in `afterEach` with `vi.restoreAllMocks()`.
159
- 3. Run `npx vitest run <file>` — fix failures.
160
- 4. If tests fail: run `npx vitest run <file> --reporter=verbose` to inspect, fix, re-run.
161
- 5. Coverage validation: run `npx vitest run --coverage --reporter=json` (CI) or `npx vitest run --coverage --reporter=text` (local) to generate coverage reports. Inspect `coverage`/`coverage-final.json` or the human-readable summary to find uncovered files/branches. If coverage is below thresholds, add targeted tests for uncovered branches, then re-run `npx vitest run --coverage` until thresholds pass.
162
- 6. Commit tests alongside source changes.
25
+ - Partial mock: `vi.mock('./config', async (importOriginal) => ({ ...(await importOriginal<typeof import('./config')>()), API_URL: 'http://test' }))`.
26
+ - `vi.spyOn(namespace, 'fn')` on a module's export misses calls made inside that module, and fails in Browser Mode; mock the module instead.
27
+ - **`vi.restoreAllMocks()` only restores `vi.spyOn` spies** (Vitest 3+). It does not reset `vi.fn()` call history; use `vi.clearAllMocks()`, or `restoreMocks` / `clearMocks` in the config, so state cannot leak between tests.
28
+ - Fake timers: `vi.useFakeTimers()` in `beforeEach`, `vi.useRealTimers()` in `afterEach`; advance with `vi.advanceTimersByTime(ms)` or `await vi.advanceTimersByTimeAsync(ms)` when promises are involved.
29
+ - One file needs a DOM in a `node` project: `// @vitest-environment jsdom` on its first line.
@@ -2,6 +2,7 @@
2
2
  description: 'Size the work in a PRD, score each workstream, and say whether to plan it in one go or as groups planned side by side. Returns JSON.'
3
3
  agent: 'Reviewer'
4
4
  output: json
5
+ pipeline: true
5
6
  ---
6
7
 
7
8
  <!-- ⚠️ This file is managed by OpenCastle. Edits will be overwritten on update. Customize in the .opencastle/ directory instead. -->
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: 'Deep-analyze project to complete .opencastle/ configuration with schema details, API routes, environment variables, other info requiring reading actual config files. Programmatic bootstrap (run during opencastle init) already populated deterministic parts — do not redo that work.'
2
+ description: 'Completes the .opencastle/ project files on an existing codebase: checks what opencastle init read from the code, and fills in the "Still to describe" list at the end of each file by reading the code.'
3
3
  agent: 'Team Lead (OpenCastle)'
4
4
  ---
5
5
 
@@ -7,7 +7,7 @@ agent: 'Team Lead (OpenCastle)'
7
7
 
8
8
  # Complete Project Customizations
9
9
 
10
- Complete AI agent framework setup for a new project. Programmatic bootstrap (run automatically during `opencastle init`) already populated `.opencastle/` configuration files with everything it could determine automatically. Your job: **deep-analyze** project — reading actual config files, schemas, source code — to **fill in details** requiring reading real file contents.
10
+ `opencastle init` has already written `.opencastle/` from the repository: the stack with versions, the project structure, commands, routes and API endpoints, models and migrations, environment variable names, test setup, and which skill covers which part. What it could not read from the code, each file lists at its end under **Still to describe**. Your job is that list, and checking the rest.
11
11
 
12
12
  ## Additional Context (optional)
13
13
 
@@ -15,258 +15,58 @@ Complete AI agent framework setup for a new project. Programmatic bootstrap (run
15
15
 
16
16
  ---
17
17
 
18
- ## Background
18
+ ## What the skills read
19
19
 
20
- The `.opencastle/` directory holds project-specific configuration that skills load at runtime. Skills contain generic methodology (how to write migrations, how to test, how to deploy); customizations hold concrete values (which database, which endpoints, which project IDs).
20
+ | File | Holds | Read by |
21
+ |------|-------|---------|
22
+ | `.opencastle/project.instructions.md` | Stack, structure, commands, routes, environment, domain → skill map | Every agent, before planning |
23
+ | `.opencastle/stack/api-config.md` | Endpoints, server actions, middleware, external APIs | `api-patterns` |
24
+ | `.opencastle/stack/<database>-config.md` | Models, migrations, access rules | The database's skill |
25
+ | `.opencastle/stack/<cms>-config.md` | IDs, document types, queries | The CMS's skill |
26
+ | `.opencastle/stack/testing-config.md` | Test frameworks, files, browser checks, breakpoints | `testing-workflow`, `browser-testing` |
27
+ | `.opencastle/stack/deployment-config.md` | Platform, config, CI, environments | `deployment-infrastructure` and the platform's skill |
28
+ | `.opencastle/project/<tracker>-config.md` | Team and project IDs, workflow states, labels | The tracker's skill |
29
+ | `.opencastle/agents/agent-registry.md` | Which agent is for what; Deepen-Plan scopes | `team-lead-reference` |
21
30
 
22
- Without customizations, agents operate blind — they don't know project's table schema, API routes, deployment target, task board. This prompt fixes that.
23
-
24
- ## Pre-Existing Setup
25
-
26
- ### `.opencastle/manifest.json` — Detection Data
27
-
28
- `opencastle init` writes **`.opencastle/manifest.json`**. Two of its fields matter here:
29
-
30
- 1. **`repoInfo`** — what init detected by scanning config files, `package.json` dependencies, and directory structures
31
- 2. **`stack`** — the integrations installed: the ones init detected and the user confirmed, picked with `opencastle init --customize`, or added later with `opencastle add <pack>`
32
-
33
- Example:
34
-
35
- ```json
36
- {
37
- "stack": {
38
- "ides": ["vscode"],
39
- "techTools": ["nextjs", "supabase", "vitest", "chrome-devtools"],
40
- "teamTools": ["linear", "slack"]
41
- },
42
- "repoInfo": {
43
- "packageManager": "pnpm",
44
- "language": "typescript",
45
- "frameworks": ["next"],
46
- "databases": ["supabase"],
47
- "deployment": ["vercel"],
48
- "testing": ["vitest", "chrome-devtools"],
49
- "styling": ["tailwind"],
50
- "mcpConfig": true,
51
- "configFiles": ["package.json", "tsconfig.json", "vercel.json", "vitest.config.ts"]
52
- }
53
- }
54
- ```
55
-
56
- **Use `repoInfo` to:**
57
- - Know which technologies are present — skip re-scanning, go straight to reading their config files
58
- - Identify `configFiles` to read for deep inspection
59
-
60
- **Use `stack` to:** know which integrations are installed. If `stack.teamTools` or `repoInfo.pm` names a tracker (`linear`, `jira`, `trello`), ensure `project/<tracker>-config.md` exists — init creates it only for a tracker it knew about at the time; one added later with `opencastle add` has none yet.
61
-
62
- **Still inspect:** `repoInfo` detects presence, not configuration details. You still need to read the actual config files for schemas, IDs, routes, etc.
63
-
64
- Skill matrix (`.opencastle/agents/skill-matrix.json`) already has `cms`, `database` binding entries pre-filled. Appropriate task management, notifications skills already installed. Verify correctness; fill in remaining empty bindings.
65
-
66
- ### Pre-populated `.opencastle/` Files — What's Already Done
67
-
68
- Programmatic bootstrap running during `opencastle init` already created, partially filled these files. **Do not regenerate from scratch — update them instead.**
69
-
70
- | File | What's already there | What's missing |
71
- |------|---------------------|----------------|
72
- | `project.instructions.md` | Tech stack table, project name/description, key commands (`build`, `test`, `lint`), monorepo workspace listing | Dev server ports, env var inventory, app-by-app purpose descriptions |
73
- | `stack/testing-config.md` | Test framework names and config file paths | Selector conventions, test suite inventory, coverage thresholds, responsive breakpoints |
74
- | `stack/deployment-config.md` | Deployment platforms and config file paths | Env var names, cron jobs, security headers, caching strategy |
75
- | `stack/<provider>-config.md` | Database provider name and config file paths (e.g., `supabase-config.md`) | Table/schema inventory, RLS policies, auth integration details |
76
- | `stack/<provider>-config.md` | CMS provider name and config file paths (e.g., `sanity-config.md`) | Content model inventory, query patterns, project IDs |
77
- | `stack/api-config.md` | Framework name and empty endpoint tables (only when init detected a framework) | Route handler and Server Action inventory |
78
- | `project/<tracker>-config.md` | Template (only when init knew about the tracker) | Team IDs, workflow states, labels |
79
- | `project/docs-structure.md` | The `.opencastle/` documentation files | The project's own docs directory |
80
- | `agents/agent-registry.md`, `agents/skill-matrix.json`, `agents/skill-matrix.md` | Agent tiers and skill bindings for the installed integrations | Nothing in most projects — verify bindings |
81
- | `README.md`, `LESSONS-LEARNED.md`, `AGENT-FAILURES.md`, `AGENT-PERFORMANCE.md` | Full template content | Nothing — these are complete, just verify |
82
- | `logs/README.md`, `logs/events.ndjson` | Schema docs + empty log file | Nothing — these are complete |
83
-
84
- **Files that may not exist yet** (create them only if the project needs them):
85
- - `stack/api-config.md` — if the project has API routes or Server Actions but init detected no framework
86
- - `project/<tracker>-config.md` — if a tracker is in use but has no config file (see `stack` above)
87
- - `stack/data-pipeline-config.md` — init never creates it; requires reading pipeline scripts
88
-
89
- Any template file for technology NOT detected (no DB, no CMS, etc.) already removed.
31
+ `.opencastle/manifest.json` records what init detected (`repoInfo`) and the integrations installed (`stack`); `npx opencastle explain` lists the skills compiled for this project.
90
32
 
91
33
  ## Workflow
92
34
 
93
- ### Phase 1: Discovery
94
-
95
- Programmatic bootstrap already detected tech stack. **Skip re-scanning** — focus on reading actual file contents to extract details.
96
-
97
- #### 1.1 Read Pre-populated Files
98
-
99
- - **First**: Read all existing `.opencastle/` files to understand what's already filled in
100
- - Read `.opencastle/project.instructions.md` to see current tech stack table, gaps
101
- - Read each `stack/*.md` file — note any `<!-- TODO: verify -->` markers and empty table rows
102
- - Read `.opencastle/manifest.json` for `repoInfo` and `configFiles` — use `configFiles` as your reading list
103
- - Note what's missing (empty sections, placeholders, TODO markers)
104
-
105
- #### 1.2 Deep Inspection
106
-
107
- For each technology in pre-populated files, read its actual config files to extract details that couldn't be auto-detected:
108
-
109
- - **Database**: Read migration files, schema definitions, RLS policies, auth setup — extract table names, column types, policy names
110
- - **CMS**: Read schema files, document types, plugin config — extract content model names, field definitions, project/space IDs
111
- - **API**: Read route handlers, Server Actions, middleware — extract HTTP methods, endpoint paths, external API integrations
112
- - **Deployment**: Read deploy config — extract env var names (never values), cron schedules, security header values, cache settings
113
- - **Testing**: Read test config and test files — extract selector conventions, coverage thresholds, test suite structure, responsive breakpoints
114
- - **Docs**: Map the documentation directory tree (if it exists)
115
- - **Task tracking**: Find team IDs, project IDs, workflow states (check Linear/Jira config or docs)
116
-
117
- ### Phase 2: Complete Customization Files
118
-
119
- Update existing `.opencastle/` files using deep inspection data from Phase 1. **Do not regenerate files that already exist** — update them.
120
-
121
- Target file structure for reference:
122
-
123
- ```
124
- .opencastle/
125
- ├── README.md # Already created — verify
126
- ├── project.instructions.md # Already created — complete missing sections
127
- ├── LESSONS-LEARNED.md # Already created — verify
128
- ├── AGENT-FAILURES.md # Already created — verify
129
- ├── AGENT-PERFORMANCE.md # Already created — verify
130
- ├── agents/ # Already created — verify
131
- │ ├── agent-registry.md
132
- │ ├── skill-matrix.json
133
- │ └── skill-matrix.md
134
- ├── stack/ # Partial — update existing, create missing
135
- │ ├── api-config.md # Complete, or create if the project has API routes and it is missing
136
- │ ├── deployment-config.md # Already created — complete missing sections
137
- │ ├── testing-config.md # Already created — complete missing sections
138
- │ ├── <database>-config.md # Already created — complete schema/RLS details
139
- │ ├── <cms>-config.md # Already created — complete content model details
140
- │ └── data-pipeline-config.md # Create if pipelines exist
141
- ├── project/ # Partial — update existing, create missing
142
- │ ├── docs-structure.md # Already created — add the docs directory if one exists
143
- │ └── <tracker>-config.md # Complete, or create if a tracker is in use and it is missing
144
- └── logs/ # Already created — do not touch
145
- ├── README.md
146
- └── events.ndjson
147
- ```
148
-
149
- #### Root Files — Verify Existing
150
-
151
- 1. **`README.md`** — Already exists. Verify it lists all generated files with accurate descriptions.
152
-
153
- 2. **`project.instructions.md`** — Already exists with tech stack table and key commands. **Complete**:
154
- - Fill in dev server ports and URLs (if missing)
155
- - Fill in app-by-app purpose descriptions
156
- - Add environment variable inventory (names only — never values)
157
- - Resolve any `<!-- TODO: verify -->` markers
158
-
159
- 3. **`LESSONS-LEARNED.md`**, **`AGENT-FAILURES.md`**, **`AGENT-PERFORMANCE.md`** — Already exist as templates. Verify they look correct — no changes needed.
160
-
161
- #### `agents/` — Agent Framework Config (already created — verify)
162
-
163
- `npx opencastle explain` lists the agents and skills compiled for this project, and where each assistant reads them.
164
-
165
- 4. **`agents/agent-registry.md`** — Already lists the agents with their tiers. **Complete**:
166
- - Scope descriptions for this project
167
- - File partition examples using this project's real paths
168
-
169
- 5. **`agents/skill-matrix.json`** — Already holds capability slot bindings and `directSkills` per agent. **Verify**:
170
- - Slot bindings point at skills that exist (`npx opencastle doctor` reports unresolved slots)
171
- - Which agents load which skills (slots for integration skills, `directSkills` for process skills)
172
- - Note: `skill-matrix.md` is companion documentation file — JSON is source of truth
173
-
174
- #### `stack/` — Update Existing, Create Missing
175
-
176
- 6. **`stack/api-config.md`** — **Complete** it, or **create** it if the project has API routes or Server Actions and init did not:
177
- - Route handler inventory with HTTP methods
178
- - Server Actions inventory
179
- - External API integrations
180
- - Middleware chain
181
- - Authentication/authorization patterns
182
-
183
- 7. **`stack/deployment-config.md`** — Already exists. **Complete**:
184
- - Fill in environment variable names (never values)
185
- - Add cron jobs / scheduled tasks details
186
- - Add security headers
187
- - Add caching strategy
188
- - Resolve `<!-- TODO: verify -->` markers
189
-
190
- 8. **`stack/testing-config.md`** — Already exists. **Complete**:
191
- - Fill in test app/port for E2E
192
- - Add selector conventions (`data-testid`, etc.)
193
- - Add test suites inventory
194
- - Add coverage thresholds
195
- - Add responsive breakpoints for UI testing
196
-
197
- 9. **Database config** (e.g., `stack/supabase-config.md`, `stack/prisma-config.md`) — **Already exists**. **Complete**:
198
- - Fill in connection details (project ID, not credentials)
199
- - Add schema / table inventory with column summaries
200
- - Add role / permission system details
201
- - Add migration history and naming convention
202
- - Add auth integration flow
203
- - Resolve `<!-- TODO: verify -->` markers
204
-
205
- 10. **CMS config** (e.g., `stack/sanity-config.md`, `stack/contentful-config.md`) — **Already exists**. **Complete**:
206
- - Fill in project/space IDs
207
- - Add schema / content model inventory
208
- - Add plugin configuration
209
- - Add query patterns and examples
210
- - Resolve `<!-- TODO: verify -->` markers
211
-
212
- 11. **`stack/data-pipeline-config.md`** — **Create** if ETL / scraping / data processing exists:
213
- - Pipeline architecture
214
- - Data sources with status
215
- - CLI commands
216
- - Output format
217
- - Key files and directories
218
-
219
- #### `project/` — Project Management Config (create missing files)
220
-
221
- 12. **`project/docs-structure.md`** — Already exists. **Complete** if the project has its own documentation directory:
222
- - Full directory tree
223
- - Purpose of each document
224
- - Documentation conventions
225
-
226
- 13. **Task tracker config** in `project/` (e.g., `project/linear-config.md`, `project/jira-config.md`) — **Complete** it, or **create** it if task tracking is in use and it is missing:
227
- - Team / project IDs
228
- - Workflow state IDs
229
- - Label / category IDs
230
- - Board conventions
35
+ ### 1. Read what is there
231
36
 
232
- #### `logs/` — Do Not Touch
37
+ Read every file above that exists. Note each "Still to describe" item, and anything that looks wrong.
233
38
 
234
- `logs/README.md` and `logs/events.ndjson` are already created by the programmatic bootstrap. Do not modify them.
39
+ ### 2. Check the facts
235
40
 
236
- ### Phase 3: Cross-Reference Verification
41
+ init reads files; it does not run the project. Fix what it got wrong — a directory purpose guessed from its name, a dev port that a config overrides, a route that is not one. Keep everything that is right as it is.
237
42
 
238
- After generating all files:
43
+ ### 3. Fill in the lists
239
44
 
240
- 1. **Check skill references** — For each skill `npx opencastle explain` lists, verify it references the correct customization file (or note if a reference needs to be added)
241
- 2. **Check for gaps** — Is there project-specific knowledge that doesn't fit any file? Create an appropriate new file
242
- 3. **Check for staleness** — Does the generated content match the current state of the code? Flag anything uncertain with `<!-- TODO: verify -->`
45
+ For each "Still to describe" item, read the code that answers it and write the answer into the file as a section of its own, then remove the item. When a list is empty, remove its heading too. Typical sources:
243
46
 
244
- ## Output Format
47
+ - **Architecture** — entry points, how the apps and packages depend on each other, what calls which external service.
48
+ - **Endpoint auth and limits** — middleware, the auth helpers each route handler calls, rate-limit config.
49
+ - **Models and access** — the schema's relations, row-level security policies, role checks in the code.
50
+ - **Selectors and test data** — existing tests, `data-testid` usage, fixtures and seed scripts.
51
+ - **Environments and releases** — deploy config, CI workflows, the README.
245
52
 
246
- For each file **created or updated**, report:
247
- - File path
248
- - Whether it was created new or updated
249
- - Key sections added or completed
53
+ Where only a person can know the answer — a production URL, a team ID behind an API — leave the item and say so in your summary.
250
54
 
251
- End with a summary of what deep inspection revealed, what was completed/created, and what (if anything) still needs manual input (e.g., tracker team IDs that require API access to discover).
55
+ ### 4. Add what is missing
252
56
 
253
- After your summary, suggest next steps:
57
+ - A tracker in use with no `project/<tracker>-config.md`: create it.
58
+ - An ETL, scraping or import pipeline: create `stack/data-pipeline-config.md` — sources, commands, output format, key files.
59
+ - In `agents/agent-registry.md`, keep the Deepen-Plan scopes to directories that exist.
254
60
 
255
- ### Suggested Next Steps
61
+ ## Rules
256
62
 
257
- Now that your `.opencastle/` configuration is complete, here's what you can do:
63
+ - **Discover, don't assume.** Read the files; a Next.js app does not imply Supabase.
64
+ - **Names, never values.** Environment variable names only; never read `.env`.
65
+ - **Specific.** Real table names, endpoint paths and file paths — no placeholders, no empty tables.
66
+ - **Short.** These files are read before planning; write what an agent needs to act, not a tour of the code.
258
67
 
259
- 1. **Review remaining TODOs** — Scan `.opencastle/` for any remaining `<!-- TODO: verify -->` comments and fill in missing values (e.g., tracker team IDs that require API access)
260
- 2. **Implement a feature** — Use the **"Implement Feature"** prompt (`/oc:implement-feature` in Claude Code and Copilot) to have the Team Lead orchestrate a full feature build with task tracking, delegation, and verification
261
- 3. **Fix a bug** — Use the **"Bug Fix"** prompt (`/oc:bug-fix`) for structured triage, root cause analysis, and fix with tracker tracking
262
- 4. **Brainstorm first** — Not sure how to approach something? Use the **"Brainstorm"** prompt (`/oc:brainstorm`) to explore requirements and trade-offs before committing to a plan
263
- 5. **Plan a larger change with the convoy engine (experimental)** — `npx opencastle convoy "<task>"` writes a PRD and a convoy spec to `.opencastle/convoys/<name>.convoy.yml`, then asks before running it
68
+ ## Output
264
69
 
265
- ## Guidelines
70
+ For each file you changed: its path and what you added or corrected. Then what is still open and needs a person.
266
71
 
267
- - **Discover, don't assume.** Read actual config files. Don't guess that the project uses Supabase because it's a Next.js app.
268
- - **Skip what doesn't exist.** If there's no CMS, don't create a CMS config file.
269
- - **Names, not secrets.** Document environment variable names (`SUPABASE_URL`) but never values.
270
- - **Be specific.** Write actual table names, actual endpoint paths, actual file paths — not placeholders.
271
- - **Flag uncertainty.** If you can't determine something from the code, add a `<!-- TODO: verify -->` comment rather than guessing.
272
- - **Keep files focused.** Each file covers one domain. Don't put database schema in the deployment config.
72
+ Then suggest next steps: `/oc:implement-feature` (or ask for the implement-feature prompt) for a feature, `/oc:bug-fix` for a bug, `/oc:brainstorm` to explore first, and `npx opencastle convoy "<task>"` (experimental) to plan larger work as tasks that run in parallel.
@@ -35,7 +35,7 @@ Before exploring solutions, ensure problem is well-understood:
35
35
  Research before proposing. Gather data, don't guess:
36
36
 
37
37
  1. **Search existing code** — is there already a partial implementation, similar pattern, or relevant utility?
38
- 2. **Check documentation** — read `.opencastle/project.instructions.md`, `.opencastle/project/decisions.md`, `.opencastle/KNOWN-ISSUES.md` for constraints
38
+ 2. **Check documentation** — read `.opencastle/project.instructions.md`, `.opencastle/KNOWN-ISSUES.md` and, when the project keeps one, `.opencastle/project/decisions.md` for constraints
39
39
  3. **Check lessons learned** — read `.opencastle/LESSONS-LEARNED.md` for pitfalls in this area
40
40
  4. **Identify affected layers** — which apps, libs, data stores, third-party services are involved?
41
41
  5. **Research unknown topics** — if the request involves a real-world person, place, organization, or topic you don't have confident knowledge about, **search the internet** using any available web search or fetch tools (e.g. `fetch_webpage`, web search MCP, or similar) to gather accurate facts. Never fabricate content about real-world subjects.
@@ -50,53 +50,28 @@ Agents load a skill when a task matches its `description`, so the description is
50
50
 
51
51
  ### Step 3: Create the Skill File
52
52
 
53
- Create `.opencastle/skills/<skill-name>/SKILL.md`.
54
-
55
- Use this template:
53
+ Create `.opencastle/skills/<skill-name>/SKILL.md`. Load the **writing-for-agents** skill first; it holds the levers this step applies.
56
54
 
57
55
  ```markdown
58
56
  ---
59
57
  name: <skill-name>
60
- description: "<Verb1> X, <verb2> Y, and <verb3> Z. Use when <scenario1>, <scenario2>, or <scenario3>."
58
+ description: "<What the skill is for, in third person>. Use when <situation>, <situation> or <situation>."
61
59
  ---
62
60
 
63
61
  # <Display Name>
64
62
 
65
- ## Workflow
66
-
67
- 1. **<Step>** — <Action>
68
- - Checkpoint: <what to verify before proceeding>
69
- - Recovery: <what to do on failure>
70
- 2. **<Step>** — <Action>
71
- - Checkpoint: <validation>
72
- 3. **<Step>** — <Action>
73
- - Fail → fix → re-run from step N.
74
-
75
- ## <Domain Section>
76
-
77
- <Content organized by topic. Use tables, code blocks, and checklists.>
78
-
79
- ## <Executable Example>
80
-
81
- ```<lang>
82
- // Concrete, copy-paste-ready code (5-15 lines)
63
+ <What an agent gets wrong without this skill: rules, gotchas, exact commands. Numbered steps where order matters, each ending on a check it can verify.>
83
64
  ```
84
65
 
85
- ## Anti-Patterns
66
+ **Description** — the pointer that decides when the skill loads:
86
67
 
87
- | Anti-pattern | Fix |
88
- |-------------|-----|
89
- | <Bad pattern> | <What to do instead> |
68
+ - What the skill is for, then when to use it, in third person ("Checks…", "Use when…").
69
+ - One trigger per branch: each situation that should load it, named once, not a list of synonyms.
70
+ - No workflow summary: an agent that reads the steps in the description may follow them instead of the body.
71
+ - No "Trigger terms:" tail; fold the real triggers into the "Use when" sentence.
72
+ - One line, aim for 250 characters or fewer.
90
73
 
91
- ## References
92
-
93
- | Resource | Purpose |
94
- |----------|--------|
95
- | [REFERENCE.md](./REFERENCE.md) | <Extended examples, schemas, large tables> |
96
- | **<related-skill>** skill | <What it contributes> |
97
- ```
98
-
99
- If skill has large code examples (>30 lines), schema tables, or verbose reference material, create companion `REFERENCE.md` in same directory; link to it from SKILL.md. Keep SKILL.md as lean operational overview. Companion files must start with backlink: `> Parent: [SKILL.md](./SKILL.md)`.
74
+ **Body** — as short as the knowledge allows, and under 500 lines. Material only some tasks need goes in a companion file beside `SKILL.md` (e.g. `REFERENCE.md`), linked from `SKILL.md` with the condition for reading it.
100
75
 
101
76
  ### Step 4: Compile the Skill
102
77
 
@@ -109,46 +84,17 @@ If skill has large code examples (>30 lines), schema tables, or verbose referenc
109
84
  - [ ] File created at `.opencastle/skills/<skill-name>/SKILL.md`
110
85
  - [ ] Frontmatter has `name` and `description` fields; `name` equals the directory name
111
86
  - [ ] Description is single line (no line breaks)
112
- - [ ] Content follows template structure
113
87
  - [ ] No overlap with existing skills
114
88
  - [ ] `npx opencastle sync --check` passes — the compiled copies match the source
115
89
  - [ ] `npx opencastle doctor` passes — it checks that every script and path a team skill names exists
116
- - [ ] Run `npx tessl skill review <path>` — target 100 score (see Scoring Criteria below)
117
-
118
- ## Scoring Criteria
119
-
120
- Skills evaluated by `npx tessl skill review` across 8 criteria (3 pts each = 24 total). Target 100.
121
-
122
- ### Description (frontmatter `description` field)
123
-
124
- | Criterion | 3/3 Pattern | Common Pitfall |
125
- |-----------|------------|----------------|
126
- | **Specificity** | List 3+ concrete actions as verbs: "Creates X, validates Y, and manages Z" | Vague "covers" or "handles" without listing what |
127
- | **Trigger terms** | Natural phrases a user would say — broad synonyms and variations | Too specialized; missing common phrasings |
128
- | **Completeness** | Explicit `Use when...` clause with 3+ trigger scenarios | Missing when-to-use guidance |
129
- | **Distinctiveness** | Unique niche; terms unlikely to collide with other skills | Generic terms that overlap with adjacent skills |
130
-
131
- **Formula:** `"<Verb1> X, <verb2> Y, and <verb3> Z. Use when <scenario1>, <scenario2>, or <scenario3>."`
132
-
133
- ### Content (SKILL.md body)
134
-
135
- | Criterion | 3/3 Pattern | Common Pitfall |
136
- |-----------|------------|----------------|
137
- | **Conciseness** | Every line earns its place. No info Claude already knows. Tables over prose. | Explaining obvious concepts, redundant sections, verbose anti-patterns with "Why" columns |
138
- | **Actionability** | ≥1 executable code example (copy-paste ready), concrete CLI commands, specific thresholds | Deferring to other skills without fallback, abstract guidance without examples |
139
- | **Workflow clarity** | Numbered steps with validation checkpoints, explicit error recovery, feedback loops (fail → fix → re-run) | Implied sequence without numbers, no checkpoints between steps, missing recovery path |
140
- | **Progressive disclosure** | SKILL.md = lean overview. Bulky content (>30-line examples, large tables, schemas) in REFERENCE.md. External refs organized in a References section. | Everything inline making the file too heavy, or too much deferred leaving SKILL.md hollow |
90
+ - [ ] Description follows the rules in Step 3
141
91
 
142
92
  ## Quality Guidelines
143
93
 
144
94
  - **Be prescriptive** — "Use `fetchPlaces()` from `libs/queries`" beats "use the query library"
145
- - **Include executable examples** — At least one copy-paste-ready code block (5-15 lines). CLI commands with real flags, not placeholders
95
+ - **Exact commands** — CLI commands with real flags, not placeholders
146
96
  - **Keep it scannable** — Tables over prose. Headings, bullets, code blocks. Agents parse structure, not paragraphs
147
- - **Number your workflows** — Every multi-step process needs numbered steps, checkpoints ("Gate: X passes"), and recovery ("Fail → fix → re-run step N")
97
+ - **Number your workflows** — Where order matters: numbered steps, each ending on a check, with the recovery on failure
148
98
  - **Don't explain what Claude knows** — Skip "what is X" explanations, obvious anti-pattern justifications, concept definitions. Jump straight to the rules
149
99
  - **Avoid duplication** — If rule exists in another skill or instruction file, reference it: "Load **security-hardening** skill for CSP configuration"
150
- - **Use REFERENCE.md for bulk** — Large code examples, schema tables, worked examples, template libraries go in companion `REFERENCE.md`. Link once from SKILL.md
151
100
  - **Stay stack-agnostic in process skills** — Use capability slot references ("the **database** skill" not "Supabase")
152
- - **Size target** — 80-200 lines in SKILL.md. Under 80 too thin; over 200 split content to REFERENCE.md. Over 300 split into multiple skills
153
- - **No standalone trigger-term sections** — Weave trigger terms naturally into description's `Use when...` clause
154
- - **Third-person voice in descriptions** — "Creates X" not "Create X" or "This skill creates X"
@@ -2,6 +2,7 @@
2
2
  description: 'Fix the problems found in a convoy task plan with targeted JSON patches. Goal is the plan as JSON, context is the list of problems.'
3
3
  agent: 'Team Lead (OpenCastle)'
4
4
  output: json
5
+ pipeline: true
5
6
  ---
6
7
 
7
8
  <!-- ⚠️ This file is managed by OpenCastle. Edits will be overwritten on update. Customize in the .opencastle/ directory instead. -->