@duypham93/openkit 0.2.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 (178) hide show
  1. package/.opencode/README.md +47 -0
  2. package/.opencode/install-manifest.json +41 -0
  3. package/.opencode/lib/artifact-scaffolder.js +111 -0
  4. package/.opencode/lib/contract-consistency.js +218 -0
  5. package/.opencode/lib/parallel-execution-rules.js +261 -0
  6. package/.opencode/lib/runtime-paths.js +95 -0
  7. package/.opencode/lib/runtime-summary.js +82 -0
  8. package/.opencode/lib/state-guard.js +99 -0
  9. package/.opencode/lib/task-board-rules.js +375 -0
  10. package/.opencode/lib/work-item-store.js +280 -0
  11. package/.opencode/lib/workflow-state-controller.js +1739 -0
  12. package/.opencode/lib/workflow-state-rules.js +331 -0
  13. package/.opencode/opencode.json +93 -0
  14. package/.opencode/package.json +3 -0
  15. package/.opencode/tests/artifact-scaffolder.test.js +733 -0
  16. package/.opencode/tests/multi-work-item-runtime.test.js +369 -0
  17. package/.opencode/tests/parallel-execution-runtime.test.js +259 -0
  18. package/.opencode/tests/session-start-hook.test.js +357 -0
  19. package/.opencode/tests/state-guard.test.js +124 -0
  20. package/.opencode/tests/task-board-rules.test.js +204 -0
  21. package/.opencode/tests/work-item-store.test.js +380 -0
  22. package/.opencode/tests/workflow-behavior.test.js +149 -0
  23. package/.opencode/tests/workflow-contract-consistency.test.js +387 -0
  24. package/.opencode/tests/workflow-state-cli.test.js +1275 -0
  25. package/.opencode/tests/workflow-state-controller.test.js +1038 -0
  26. package/.opencode/work-items/feature-001/state.json +70 -0
  27. package/.opencode/work-items/index.json +13 -0
  28. package/.opencode/workflow-state.js +489 -0
  29. package/.opencode/workflow-state.json +70 -0
  30. package/AGENTS.md +265 -0
  31. package/README.md +401 -0
  32. package/agents/architect-agent.md +63 -0
  33. package/agents/ba-agent.md +56 -0
  34. package/agents/code-reviewer.md +77 -0
  35. package/agents/fullstack-agent.md +115 -0
  36. package/agents/master-orchestrator.md +60 -0
  37. package/agents/pm-agent.md +56 -0
  38. package/agents/qa-agent.md +124 -0
  39. package/agents/tech-lead-agent.md +60 -0
  40. package/assets/install-bundle/README.md +7 -0
  41. package/assets/install-bundle/opencode/README.md +11 -0
  42. package/assets/install-bundle/opencode/agents/ArchitectAgent.md +63 -0
  43. package/assets/install-bundle/opencode/agents/BAAgent.md +56 -0
  44. package/assets/install-bundle/opencode/agents/CodeReviewer.md +77 -0
  45. package/assets/install-bundle/opencode/agents/FullstackAgent.md +115 -0
  46. package/assets/install-bundle/opencode/agents/MasterOrchestrator.md +60 -0
  47. package/assets/install-bundle/opencode/agents/PMAgent.md +56 -0
  48. package/assets/install-bundle/opencode/agents/QAAgent.md +124 -0
  49. package/assets/install-bundle/opencode/agents/TechLeadAgent.md +60 -0
  50. package/assets/install-bundle/opencode/commands/brainstorm.md +44 -0
  51. package/assets/install-bundle/opencode/commands/delivery.md +45 -0
  52. package/assets/install-bundle/opencode/commands/execute-plan.md +44 -0
  53. package/assets/install-bundle/opencode/commands/migrate.md +61 -0
  54. package/assets/install-bundle/opencode/commands/quick-task.md +45 -0
  55. package/assets/install-bundle/opencode/commands/task.md +46 -0
  56. package/assets/install-bundle/opencode/commands/write-plan.md +50 -0
  57. package/assets/install-bundle/opencode/context/core/lane-selection.md +54 -0
  58. package/assets/install-bundle/opencode/skills/brainstorming/SKILL.md +51 -0
  59. package/assets/install-bundle/opencode/skills/code-review/SKILL.md +48 -0
  60. package/assets/install-bundle/opencode/skills/subagent-driven-development/SKILL.md +79 -0
  61. package/assets/install-bundle/opencode/skills/systematic-debugging/SKILL.md +61 -0
  62. package/assets/install-bundle/opencode/skills/test-driven-development/SKILL.md +48 -0
  63. package/assets/install-bundle/opencode/skills/using-skills/SKILL.md +39 -0
  64. package/assets/install-bundle/opencode/skills/verification-before-completion/SKILL.md +137 -0
  65. package/assets/install-bundle/opencode/skills/writing-plans/SKILL.md +68 -0
  66. package/assets/install-bundle/opencode/skills/writing-specs/SKILL.md +47 -0
  67. package/assets/opencode.json.template +11 -0
  68. package/assets/openkit-install.json.template +19 -0
  69. package/bin/openkit.js +9 -0
  70. package/commands/brainstorm.md +44 -0
  71. package/commands/delivery.md +45 -0
  72. package/commands/execute-plan.md +44 -0
  73. package/commands/migrate.md +61 -0
  74. package/commands/quick-task.md +45 -0
  75. package/commands/task.md +46 -0
  76. package/commands/write-plan.md +50 -0
  77. package/context/core/approval-gates.md +146 -0
  78. package/context/core/code-quality.md +42 -0
  79. package/context/core/issue-routing.md +85 -0
  80. package/context/core/lane-selection.md +54 -0
  81. package/context/core/project-config.md +143 -0
  82. package/context/core/session-resume.md +85 -0
  83. package/context/core/workflow-state-schema.md +224 -0
  84. package/context/core/workflow.md +442 -0
  85. package/context/navigation.md +94 -0
  86. package/docs/adr/README.md +6 -0
  87. package/docs/architecture/2026-03-20-task-intake-dashboard.md +54 -0
  88. package/docs/architecture/README.md +7 -0
  89. package/docs/briefs/2026-03-20-task-intake-dashboard.md +48 -0
  90. package/docs/briefs/README.md +7 -0
  91. package/docs/governance/README.md +25 -0
  92. package/docs/governance/adr-policy.md +27 -0
  93. package/docs/governance/definition-of-done.md +17 -0
  94. package/docs/governance/naming-conventions.md +21 -0
  95. package/docs/governance/severity-levels.md +12 -0
  96. package/docs/maintainer/README.md +51 -0
  97. package/docs/operations/README.md +79 -0
  98. package/docs/operations/internal-records/2026-03-24-release-checklist.md +79 -0
  99. package/docs/operations/internal-records/2026-03-24-simplified-install-ux.md +36 -0
  100. package/docs/operations/internal-records/README.md +18 -0
  101. package/docs/operations/runbooks/README.md +23 -0
  102. package/docs/operations/runbooks/openkit-daily-usage.md +288 -0
  103. package/docs/operations/runbooks/workflow-state-smoke-tests.md +302 -0
  104. package/docs/operator/README.md +50 -0
  105. package/docs/plans/2026-03-20-task-intake-dashboard.md +49 -0
  106. package/docs/plans/2026-03-21-openkit-full-delivery-multi-task-runtime.md +521 -0
  107. package/docs/plans/2026-03-23-openkit-global-install-runtime.md +157 -0
  108. package/docs/plans/README.md +7 -0
  109. package/docs/qa/2026-03-20-task-intake-dashboard.md +41 -0
  110. package/docs/qa/README.md +7 -0
  111. package/docs/specs/2026-03-20-task-intake-dashboard.md +50 -0
  112. package/docs/specs/2026-03-21-openkit-full-delivery-multi-task-runtime.md +462 -0
  113. package/docs/specs/README.md +7 -0
  114. package/docs/templates/README.md +36 -0
  115. package/docs/templates/adr-template.md +18 -0
  116. package/docs/templates/architecture-template.md +31 -0
  117. package/docs/templates/implementation-plan-template.md +32 -0
  118. package/docs/templates/migration-baseline-checklist.md +48 -0
  119. package/docs/templates/migration-plan-template.md +52 -0
  120. package/docs/templates/migration-report-template.md +74 -0
  121. package/docs/templates/migration-verify-checklist.md +39 -0
  122. package/docs/templates/product-brief-template.md +32 -0
  123. package/docs/templates/qa-report-template.md +37 -0
  124. package/docs/templates/quick-task-template.md +36 -0
  125. package/docs/templates/spec-template.md +31 -0
  126. package/hooks/hooks.json +16 -0
  127. package/hooks/session-start +162 -0
  128. package/package.json +24 -0
  129. package/registry.json +328 -0
  130. package/skills/brainstorming/SKILL.md +51 -0
  131. package/skills/code-review/SKILL.md +48 -0
  132. package/skills/subagent-driven-development/SKILL.md +79 -0
  133. package/skills/systematic-debugging/SKILL.md +61 -0
  134. package/skills/test-driven-development/SKILL.md +48 -0
  135. package/skills/using-skills/SKILL.md +39 -0
  136. package/skills/verification-before-completion/SKILL.md +137 -0
  137. package/skills/writing-plans/SKILL.md +68 -0
  138. package/skills/writing-specs/SKILL.md +47 -0
  139. package/src/audit/vietnamese-detection.js +259 -0
  140. package/src/cli/commands/detect-vietnamese.js +24 -0
  141. package/src/cli/commands/doctor.js +33 -0
  142. package/src/cli/commands/help.js +33 -0
  143. package/src/cli/commands/init.js +25 -0
  144. package/src/cli/commands/install-global.js +26 -0
  145. package/src/cli/commands/install.js +25 -0
  146. package/src/cli/commands/run.js +63 -0
  147. package/src/cli/commands/uninstall.js +32 -0
  148. package/src/cli/commands/upgrade.js +25 -0
  149. package/src/cli/conflict-output.js +19 -0
  150. package/src/cli/index.js +56 -0
  151. package/src/global/doctor.js +101 -0
  152. package/src/global/ensure-install.js +32 -0
  153. package/src/global/install-state.js +73 -0
  154. package/src/global/launcher.js +51 -0
  155. package/src/global/materialize.js +123 -0
  156. package/src/global/paths.js +85 -0
  157. package/src/global/uninstall.js +25 -0
  158. package/src/global/workspace-state.js +63 -0
  159. package/src/install/asset-manifest.js +284 -0
  160. package/src/install/conflicts.js +43 -0
  161. package/src/install/discovery.js +138 -0
  162. package/src/install/install-state.js +136 -0
  163. package/src/install/materialize.js +158 -0
  164. package/src/install/merge-policy.js +145 -0
  165. package/src/runtime/doctor.js +281 -0
  166. package/src/runtime/launcher.js +49 -0
  167. package/src/runtime/opencode-layering.js +135 -0
  168. package/src/runtime/openkit-managed-summary.js +27 -0
  169. package/tests/cli/openkit-cli.test.js +417 -0
  170. package/tests/global/doctor.test.js +130 -0
  171. package/tests/global/ensure-install.test.js +105 -0
  172. package/tests/install/discovery.test.js +124 -0
  173. package/tests/install/install-state.test.js +346 -0
  174. package/tests/install/materialize.test.js +244 -0
  175. package/tests/install/merge-policy.test.js +177 -0
  176. package/tests/runtime/doctor.test.js +430 -0
  177. package/tests/runtime/launcher.test.js +230 -0
  178. package/tests/runtime/module-boundary.test.js +16 -0
@@ -0,0 +1,46 @@
1
+ ---
2
+ description: "Default entry command. Lets the Master Orchestrator classify work into Quick Task, Migration, or Full Delivery."
3
+ ---
4
+
5
+ # Command: `/task`
6
+
7
+ Use `/task` when the user wants the default entrypoint and expects the Master Orchestrator to choose the lane.
8
+
9
+ ## Preconditions
10
+
11
+ - A user request exists with enough information to summarize the initial goal, scope, and risk
12
+ - If the workflow is resuming, the current workflow state must be readable before rerouting
13
+
14
+ ## Canonical docs to load
15
+
16
+ - `AGENTS.md`
17
+ - `context/navigation.md`
18
+ - `context/core/workflow.md`
19
+ - `context/core/lane-selection.md`
20
+ - `context/core/project-config.md`
21
+ - `.opencode/workflow-state.json` when resuming
22
+
23
+ For operator checks, use the current workflow-state utility surface: `status`, `doctor`, `show`, and `validate`.
24
+
25
+ ## Expected action
26
+
27
+ - The Master Orchestrator chooses `quick`, `migration`, or `full` using the canonical workflow rules
28
+ - Record `mode` and `mode_reason` in workflow state
29
+ - If the task enters the quick lane, initialize quick intake context and continue through the canonical quick stage chain
30
+ - If the task enters the migration lane, initialize `migration_intake` and continue through the canonical migration stage chain
31
+ - If the task enters the full lane, initialize `full_intake` and route to the PM agent
32
+ - When choosing migration, prefer a behavior-preserving path that decouples blockers before changing the stack broadly
33
+ - Use the lane tie-breaker from `context/core/workflow.md`: product ambiguity goes to `full`, compatibility uncertainty with preserved behavior goes to `migration`, and only bounded low-risk work goes to `quick`
34
+
35
+ ## Rejection or escalation behavior
36
+
37
+ - If the request is ambiguous because product behavior, requirements, or acceptance are unclear, route it to `Full Delivery` per `context/core/workflow.md`
38
+ - If the request is uncertain mainly because of upgrade or compatibility risk while the target behavior is already known, route it to `Migration`
39
+ - If the request is too incomplete to open even `full_intake`, stop at intake and ask for clarification instead of guessing
40
+ - If the quick lane is not appropriate under `context/core/workflow.md`, route directly to the migration or full lane that best matches the request
41
+
42
+ ## Validation guidance
43
+
44
+ - Use `node .opencode/workflow-state.js status` or `node .opencode/workflow-state.js show` to inspect resumable state before rerouting when needed
45
+ - Use `node .opencode/workflow-state.js validate` if the saved state looks stale or manually edited
46
+ - Do not imply repo-native app build, lint, or test commands exist when this repository has not defined them
@@ -0,0 +1,50 @@
1
+ ---
2
+ description: "Triggers the writing-plans skill to create bite-sized tasks from specs."
3
+ ---
4
+
5
+ # Command: `/write-plan`
6
+
7
+ Use `/write-plan` to create an implementation plan for work currently in `Full Delivery` or `Migration` mode.
8
+
9
+ ## Preconditions
10
+
11
+ - The current `mode` must be `full` or `migration`
12
+ - The required architecture artifact already exists for the current work item
13
+ - If the work is in `full`, the required spec artifact already exists for the current feature
14
+ - The Tech Lead Agent is at the stage where `docs/plans/...` should be created
15
+
16
+ ## Canonical docs to load
17
+
18
+ - `AGENTS.md`
19
+ - `context/navigation.md`
20
+ - `context/core/workflow.md`
21
+ - `context/core/project-config.md`
22
+ - `.opencode/workflow-state.json`
23
+ - `docs/templates/implementation-plan-template.md`
24
+ - `docs/templates/migration-report-template.md` when migration work benefits from one running artifact
25
+ - skill `writing-plans`
26
+
27
+ For operator checks, use the current workflow-state utility surface: `status`, `doctor`, `show`, and `validate`.
28
+
29
+ ## Expected action
30
+
31
+ - Create or update `docs/plans/YYYY-MM-DD-<feature>.md`
32
+ - Keep the plan aligned with the current stage and approval context for the active mode
33
+ - In migration mode, record preserved invariants, seam or adapter steps, and parity checks explicitly
34
+ - In migration mode, recommend scaffolding or updating `migration_report` when baseline, plan, execution, and verification should stay visible in one artifact
35
+ - Record the real validation path, or a missing-validation-path note when the repository has no suitable command
36
+ - Return the plan for review and approval through the canonical workflow for the active mode
37
+
38
+ ## Rejection or escalation behavior
39
+
40
+ - If work is still in quick mode, reject this command and route the task into Migration or Full Delivery first
41
+ - If required architecture input is incomplete, stop and require that upstream artifact before writing the plan
42
+ - If work is in `full` and the spec input is incomplete, stop and require that upstream artifact before writing the plan
43
+ - Do not use this command to open a new full lane implicitly or bypass the approval chain
44
+
45
+ ## Validation guidance
46
+
47
+ - The plan should name the strongest real validation path available in the repository
48
+ - In migration mode, use `migration_report` when handoffs would benefit from a single running narrative instead of scattered notes
49
+ - If no repo-native app build, lint, or test command exists, say that explicitly in the plan instead of guessing a stack command
50
+ - Use `node .opencode/workflow-state.js validate` only to confirm workflow state, not to stand in for implementation verification
@@ -0,0 +1,54 @@
1
+ # Lane Selection
2
+
3
+ This file is the detailed routing reference for choosing between `Quick Task`, `Migration`, and `Full Delivery`.
4
+
5
+ Use `context/core/workflow.md` for the canonical live contract. Use this file when you need the stricter routing rubric, tie-breakers, anti-patterns, and examples.
6
+
7
+ ## Core Rule
8
+
9
+ Choose the lane by the dominant uncertainty of the work, not by estimated size alone.
10
+
11
+ - `Quick Task`: low local uncertainty inside already-understood behavior
12
+ - `Migration`: compatibility uncertainty inside behavior-preserving modernization
13
+ - `Full Delivery`: product, requirements, acceptance, or cross-boundary solution uncertainty
14
+
15
+ ## Routing Profile Dimensions
16
+
17
+ Record and reason with these dimensions:
18
+
19
+ - `work_intent`: `maintenance`, `modernization`, `feature`
20
+ - `behavior_delta`: `preserve`, `extend`, `redefine`
21
+ - `dominant_uncertainty`: `low_local`, `compatibility`, `product`
22
+ - `scope_shape`: `local`, `adjacent`, `cross_boundary`
23
+
24
+ Expected combinations:
25
+
26
+ - `Quick Task` -> `maintenance`, `preserve`, `low_local`, `local|adjacent`
27
+ - `Migration` -> `modernization`, `preserve`, `compatibility`, `local|adjacent|cross_boundary`
28
+ - `Full Delivery` -> usually `feature`, `extend|redefine`, `product`, often `cross_boundary`
29
+
30
+ ## Tie-Breaker Priority
31
+
32
+ Apply these in order:
33
+
34
+ 1. If `behavior_delta` is not `preserve`, choose `Full Delivery`.
35
+ 2. If `dominant_uncertainty` is `product`, choose `Full Delivery`.
36
+ 3. If `dominant_uncertainty` is `compatibility` and preserved behavior is known, choose `Migration`.
37
+ 4. If `dominant_uncertainty` is `low_local` and scope stays bounded, choose `Quick Task`.
38
+ 5. If uncertainty still cannot be classified honestly, choose `Full Delivery`.
39
+
40
+ ## Anti-Patterns
41
+
42
+ - Do not choose `Quick Task` for a dependency or framework upgrade just because the code diff looks small.
43
+ - Do not choose `Migration` when acceptance criteria or business semantics are being redefined.
44
+ - Do not choose `Full Delivery` for straightforward modernization work only because internal architecture must change.
45
+ - Do not let file count or estimated duration override the dominant uncertainty rule.
46
+
47
+ ## Fast Examples
48
+
49
+ - Upgrade React 16 to React 19 with preserved screens -> `Migration`
50
+ - Add a new billing workflow -> `Full Delivery`
51
+ - Fix a typo in one operator doc -> `Quick Task`
52
+ - Replace one deprecated helper with known equivalent behavior -> `Quick Task`
53
+ - Modernize fetching to React Query while preserving UX and rules -> `Migration`
54
+ - Upgrade framework and redesign onboarding flow -> `Full Delivery`
@@ -0,0 +1,51 @@
1
+ ---
2
+ name: brainstorming
3
+ description: "Socratic design refinement process. Used before writing any specs or code to clarify intent and explore options."
4
+ ---
5
+
6
+ # Skill: Brainstorming (Socratic Refinement)
7
+
8
+ ## Context
9
+
10
+ When the user brings a new idea or request, or when the PM Agent or Architect Agent starts designing, this skill **must** be used before locking in a solution.
11
+
12
+ Do NOT jump straight into writing a spec or code. You must go through the "ask questions - explore - converge" process first.
13
+
14
+ ## Execution Process
15
+
16
+ ### Phase 1: Context Exploration
17
+ 1. Read the user's initial request.
18
+ 2. Identify any relevant existing files.
19
+ 3. Ask clarifying questions. **Golden Rule: ask only ONE question at a time.**
20
+ - Do not dump a list of 5 questions on the user and overwhelm them.
21
+ - Ask the most important question first. Wait for the answer before asking the next one.
22
+ - Example: "Who is the primary user of this feature: Admin or Client?"
23
+
24
+ ### Phase 2: Option Generation
25
+ Once you have enough information (no major open questions remain), do NOT choose a single solution on your own. You must present 2-3 approaches:
26
+
27
+ **Proposal template:**
28
+ ```markdown
29
+ Based on what you've shared, I see X main approaches:
30
+
31
+ **Option 1: [Short name]**
32
+ * **How it works**: [Brief description]
33
+ * **Pros**: [...]
34
+ * **Cons / Trade-offs**: [...]
35
+
36
+ **Option 2: [Short name]**
37
+ * **How it works**: [Brief description]
38
+ * **Pros**: [...]
39
+ * **Cons / Trade-offs**: [...]
40
+
41
+ Which direction do you prefer, or do you want to combine ideas from both?
42
+ ```
43
+
44
+ ### Phase 3: Incremental Design
45
+ After the user chooses an option, design the solution **one part at a time**.
46
+ - Do not drop one giant design block on the user.
47
+ - For example, design the database first and get feedback. Then design the API and get feedback.
48
+ - Use visual tools when helpful (Mermaid diagrams, ASCII art).
49
+
50
+ ### Phase 4: Handoff
51
+ Finish brainstorming by moving into a Product Brief or Architecture Document (depending on which agent is active), then hand off to the next agent in the pipeline.
@@ -0,0 +1,48 @@
1
+ ---
2
+ name: code-review
3
+ description: "Pre-review checklist and quality gates. Uses a two-stage approach: spec compliance then code quality."
4
+ ---
5
+
6
+ # Skill: Code Review
7
+
8
+ ## Context
9
+
10
+ Used by the Code Reviewer subagent, the QA Agent, or the Tech Lead Agent.
11
+ The goal is to be the final gate that keeps bad code or off-spec code from reaching the main branch.
12
+
13
+ ## Required Inputs
14
+
15
+ - What needs review? (files / commit / PR)
16
+ - Comparison documents: spec (requirements), architecture (design), code standards.
17
+
18
+ ## Two-Stage Review Process
19
+
20
+ Strictly follow these two stages in order. Do not talk about formatting or clean code if the feature itself is off-spec.
21
+
22
+ ### Stage 1: Spec Compliance
23
+ **Ask exactly one question: "Does this code meet the acceptance criteria in the spec exactly, and does it avoid inventing extra features?"**
24
+
25
+ - Inspect each acceptance criterion (Given - When - Then).
26
+ - Does the code handle the edge cases the BA documented?
27
+ - **Overscope Audit (Over-engineering)**: counter the developer instinct to "helpfully" add extra behavior. Has the code built convenience features that were never requested? (YAGNI)
28
+
29
+ => **Record Pass / Fail for Stage 1. If it fails, stop the review there and send it back to the developer. Do not continue to Stage 2.**
30
+
31
+ ### Stage 2: Code Quality
32
+ Only reach this step if Stage 1 has passed. Use `context/core/code-quality.md` as the review baseline.
33
+
34
+ Review by severity:
35
+ 1. **Critical / Security (Must fix immediately)**: SQL injection, leaked environment variables, crash-level memory issues.
36
+ 2. **Architecture (Needs consultation)**: wrong boundary ownership (for example, a controller doing database query logic). Escalate to Tech Lead.
37
+ 3. **Important Quality (Should fix)**: meaningless variable names (`let a = 1`), functions longer than 50 lines, badly degraded test coverage.
38
+ 4. **Minor**: brace and spacing debates. Follow the existing linter or formatter.
39
+
40
+ ## Checklist for a Good Review Report
41
+ - [ ] Clearly state Stage 1 (Pass/Fail) and why.
42
+ - [ ] Cite the exact file path and failing line number.
43
+ - [ ] State severity clearly (Critical / Important / Minor).
44
+ - [ ] Do not just criticize - include a concrete fix suggestion or example snippet.
45
+
46
+ ## Anti-Patterns to Avoid
47
+ - Superficial review: "LGTM" without actually reading the files.
48
+ - Fixing the code for the developer: "I'll just patch it quickly and approve." The reviewer must not touch the implementation. The developer stays responsible for the fix.
@@ -0,0 +1,79 @@
1
+ ---
2
+ name: subagent-driven-development
3
+ description: "Execution engine. Dispatches fresh subagents for each task to avoid context pollution and ensures 2-stage review."
4
+ ---
5
+
6
+ # Skill: Subagent-Driven Development
7
+
8
+ ## Context
9
+
10
+ Used by the Fullstack Agent to execute an implementation plan.
11
+
12
+ When working through a complex sequence of tasks, the primary agent can get overwhelmed or hallucinate because the context grows too large. Subagent-Driven Development solves this by splitting the work into tasks and dispatching a fresh subagent to handle each task individually.
13
+
14
+ ## Execution Process
15
+
16
+ ### 1. Preparation (Task Queueing)
17
+ Read `docs/plans/YYYY-MM-DD-<feature>.md`.
18
+ Build a queue of tasks.
19
+
20
+ ### 2. Batch Execution (Repeat for Each Task)
21
+
22
+ Take Task N from the queue:
23
+
24
+ #### Step 2a: Prepare the Subagent Payload
25
+ Create a prompt (define it first, do not run it yet) with enough context for the subagent (usually the implementation-focused Fullstack Agent):
26
+ - target files
27
+ - exact code requirements from the plan
28
+ - tests that must pass
29
+ - explicit instruction: "Follow the active mode's validation model and the coding standards"; use TDD in full-delivery implementation work and migration validation in migration work
30
+
31
+ #### Step 2b: Dispatch & Execution
32
+ Call the tool or script that runs the subagent independently. (This may be a shell command, a `run_agent.sh` script, or an equivalent delegation mechanism.)
33
+
34
+ The subagent must report one of 4 standard statuses:
35
+
36
+ - `DONE`: task completed, ready for review
37
+ - `DONE_WITH_CONCERNS`: task completed, but with concerns the controller must read before review
38
+ - `NEEDS_CONTEXT`: missing context; must not guess
39
+ - `BLOCKED`: cannot complete with the current scope or context
40
+
41
+ #### Step 2c: Stop and Call a Reviewer (Code Reviewer Subagent)
42
+ Do NOT mark the current task complete and continue.
43
+ You must dispatch an independent `code-reviewer` subagent with a fresh context to evaluate the implementation.
44
+
45
+ Two-stage review process (see `skills/code-review/SKILL.md`):
46
+ - **Stage 1**: spec compliance
47
+ - **Stage 2**: code quality
48
+
49
+ Do not reverse this order.
50
+
51
+ *If it fails*: send the task back to Step 2a with the review feedback.
52
+ *If it passes*: mark the task as DONE and commit.
53
+
54
+ ### 3. Loop and Throughput
55
+ Return to Step 2 for Task N+1.
56
+
57
+ ## Anti-Patterns to Eliminate
58
+ - "I'll just take all 5 tasks in the plan and do them in one shot." -> **Seriously wrong**. The LLM will forget instructions midway and accumulate context garbage.
59
+ - Skipping the code-review subagent because "I trust my own work." -> The implementer subagent can still be wrong. An independent reviewer is mandatory.
60
+ - Letting the implementer reread the whole plan and choose scope when the controller already knows the current task. -> Wrong. The controller should provide the full task text and relevant context, not dump the whole world into the subagent.
61
+ - Moving to the next task while spec review or quality review still has open issues. -> Wrong. A task is DONE only after it passes both gates.
62
+
63
+ ## Handling Implementer Status
64
+
65
+ ### `DONE`
66
+ - move straight into spec review
67
+
68
+ ### `DONE_WITH_CONCERNS`
69
+ - read the concerns first
70
+ - if they affect correctness or scope, resolve them before review
71
+ - if they are only maintainability notes, continue into review but keep them in mind for later work
72
+
73
+ ### `NEEDS_CONTEXT`
74
+ - provide the missing context
75
+ - re-dispatch the same task; do not let the implementer invent assumptions
76
+
77
+ ### `BLOCKED`
78
+ - assess whether the blocker comes from missing context, an oversized task, or a bad plan
79
+ - if needed, split the task smaller or escalate to the coordinating human or agent
@@ -0,0 +1,61 @@
1
+ ---
2
+ name: systematic-debugging
3
+ description: "4-phase root cause process to debug scientifically instead of blindly guessing."
4
+ ---
5
+
6
+ # Skill: Systematic Debugging
7
+
8
+ ## Context
9
+
10
+ This skill is used by any developer agent (Fullstack, QA, Tech Lead) when it hits a bug, a build error, or an unexpected test failure. LLMs tend to guess and jump into random fixes. This skill forces an engineering-style debugging path.
11
+
12
+ ## The Golden Rule
13
+ **Do NOT change or fix any line of code until the ROOT CAUSE is clear.**
14
+
15
+ ## Additional Guardrails
16
+
17
+ - Test only 1 primary hypothesis at a time
18
+ - Do not stack multiple fixes into the same experiment
19
+ - If you have already tried 3 fixes and the original bug keeps returning, question the pattern or architecture instead of attempting a fourth fix
20
+
21
+ ## 4-Phase Bug-Fix Process
22
+
23
+ ### Phase 1: Context and Reproduction
24
+ Do not read code first. Go collect evidence.
25
+ 1. Capture the exact error stack trace.
26
+ 2. Identify the file and line that fails.
27
+ 3. Reproduce the failure: which environment (dev/prod) and which input trigger it?
28
+ 4. If the system has multiple boundaries (CLI -> controller -> rules, hook -> state file, command -> artifact), gather evidence at each boundary instead of jumping straight to the last layer.
29
+
30
+ ### Phase 2: Hypothesis Generation
31
+ Based on the evidence, propose hypotheses for why it fails. Do NOT talk about fixes yet.
32
+
33
+ * Weak guess: "Variable X does not exist, so `.length` fails."
34
+ * Better hypothesis: "Function A expects an array, but the backend API returns `{ data: [] }` (an object), so calling `.map()` crashes."
35
+
36
+ List 2-3 hypotheses. Then narrow them down by grepping and reading code until you identify the most likely root cause.
37
+
38
+ ⚠️ Test only 1 primary hypothesis. Do not fix three hypotheses at once and expect the tests to explain which one was correct.
39
+
40
+ ### Phase 3: Propose Fix
41
+ Propose the Minimal Fix (the fewest lines changed across the fewest files).
42
+
43
+ ⚠️ **RED ALERT: fixing many places usually means architecture surgery.** If you realize the plan requires changing 3-4 separate logic files at once (scattered changes), stop. You are probably not fixing a bug anymore - you are papering over a broken system or bad architecture. Escalate back to the Master Orchestrator and bring in the Architect to review the system.
44
+
45
+ ### Phase 4: Implementation
46
+ Follow the active mode's validation model:
47
+ - In full-delivery implementation work, follow TDD (see `skills/test-driven-development/SKILL.md`): write a test, confirm it fails, apply the minimal fix, and confirm it passes.
48
+ - In migration work, capture the failing compatibility evidence first, apply the minimal fix, then rerun the strongest real regression or compatibility check available.
49
+ - In every mode, keep the fix minimal and evidence-based.
50
+
51
+ If the fix does not work:
52
+
53
+ 1. STOP
54
+ 2. go back to Phase 1 with the new evidence
55
+ 3. if you have already tried 3 fixes and the core failure still remains, report to `MasterOrchestrator` that this may be an architecture or pattern problem rather than a local bug
56
+
57
+ ## Rationalization Checklist
58
+ - [ ] Am I blindly spraying `console.log` everywhere instead of concentrating on the root cause? (If yes -> STOP)
59
+ - [ ] Am I about to wrap everything in `try...catch` and silently swallow errors? (If yes -> STOP)
60
+ - [ ] Have I already tried a third workaround and the same failure still looks unchanged? (The real problem may be cache or environment state. Re-check the environment instead of editing more code.)
61
+ - [ ] Am I changing many scattered files just to make the tests green again without proving the root cause? (If yes -> STOP)
@@ -0,0 +1,48 @@
1
+ ---
2
+ name: test-driven-development
3
+ description: "RED-GREEN-REFACTOR cycle. Enforces strictly writing failing tests before production code."
4
+ ---
5
+
6
+ # Skill: Test-Driven Development (TDD)
7
+
8
+ ## Context
9
+
10
+ This is the Iron Law for the Fullstack Agent. You are NOT ALLOWED to write any production code until a failing test proves that code needs to exist.
11
+
12
+ ## Execution Process (RED-GREEN-REFACTOR)
13
+
14
+ ### Step 1: RED (Write a Failing Test)
15
+ 1. Pick one small task from the implementation plan.
16
+ 2. Write **one** test case for that behavior.
17
+ 3. Run the repository's defined test command for the language or framework in use. If the repo does not define a standard command, stop and report the missing validation path instead of guessing.
18
+ 4. **Mandatory validation**: the test MUST fail. It must fail for the right reason (for example, `ReferenceError: function is not defined`, or `Expected true but got false`).
19
+ - If the test passes immediately -> the test is wrong, delete it and rewrite it.
20
+
21
+ ### Step 2: GREEN (Write the Minimum Code)
22
+ 1. Write **only enough code to make that one test pass**.
23
+ 2. **Lazy Code Rule**: return a hardcoded value if that is enough to make the test pass. Do not think about future needs (YAGNI - You Aren't Gonna Need It).
24
+ 3. Run the tests again.
25
+ 4. **Mandatory validation**: the test must PASS. If it does not, keep fixing until it passes. Do not add extra features.
26
+
27
+ ### Step 3: REFACTOR
28
+ When (and only when) all tests are green:
29
+ 1. Review the code: is there duplication (DRY)? Are names understandable? Is the design still sound?
30
+ 2. Refactor the code.
31
+ 3. Run the tests again. If any test fails -> revert the refactor immediately or repair it quickly.
32
+
33
+ ## Anti-Patterns to Eliminate and Required Responses
34
+
35
+ | Rationalization | Required response |
36
+ |-----------------|-------------------|
37
+ | "This is too simple, writing a test will take longer, I'll just code it." | **STOP.** Delete the code you just wrote and write the test first, even for a simple `add(a, b)` function. |
38
+ | "I'll write 5 tests at once and then code it all in one pass." | **Stop.** One RED, one GREEN, one REFACTOR. Do not batch them together. |
39
+ | "UI testing is too hard, I'll skip TDD for this part." | You may skip it only if the user explicitly allows it. Prefer separating logic from UI so the logic can still be tested. |
40
+ | "The test failed and I already know the issue, so I'll fix files A, B, and C at once." | The root cause still lives in one place. Find it and fix the right place. Read `systematic-debugging`. |
41
+
42
+ ## Checklist for a Complete Cycle
43
+ - [ ] Test written and run (FAIL)
44
+ - [ ] Error message read and understood
45
+ - [ ] Minimal production code written
46
+ - [ ] Test rerun (PASS)
47
+ - [ ] Nearby code cleaned up (REFACTOR)
48
+ - [ ] Commit made (each GREEN/REFACTOR is a chance for a small commit)
@@ -0,0 +1,39 @@
1
+ ---
2
+ name: using-skills
3
+ description: "Meta-skill: Teaches agents how to discover, evaluate, and invoke skills. Loaded at session start."
4
+ ---
5
+
6
+ # Skill Usage Guide - Meta-Skill
7
+
8
+ ## What Skills Mean
9
+
10
+ In the AI Software Factory, "Skills" are standard operating procedures that define how the system should work. When a situation matches a skill, you **must** follow that skill instead of improvising from raw LLM instinct.
11
+
12
+ ## Instruction Priority
13
+
14
+ When instructions conflict, apply this order (1 is highest):
15
+
16
+ 1. **Current user prompt**: direct instructions from the user in the current message
17
+ 2. **Skill instructions**: guidance inside the active `SKILL.md`
18
+ 3. **Agent role instructions**: the agent's role and constraints (for example, `QA Agent does not edit code`)
19
+ 4. **General system prompt**: the base LLM behavior
20
+
21
+ ## How to Use a Skill
22
+
23
+ When you identify a situation (for example: need to write a plan, fix a bug, or test code), follow these steps:
24
+
25
+ 1. **Identify**: "I need to create an implementation plan"
26
+ 2. **Discover**: "Let me use the tool to read `skills/writing-plans/SKILL.md`"
27
+ 3. **Read**: use `view_file` (or the equivalent tool) to read the ENTIRE `SKILL.md`
28
+ 4. **Execute**: apply the steps from that file
29
+
30
+ ## Warning: Rationalization Prevention
31
+
32
+ LLM instinct often tries to short-circuit the process. Watch for these faulty thoughts:
33
+
34
+ | Bad thought (Rationalization) | Correct action |
35
+ |--------------------------------|----------------|
36
+ | "This file is easy, I'll just fix it without reporting to the Master Orchestrator." | Stop. Follow the role boundary. Report to the Master Orchestrator first. |
37
+ | "I already know how to write plans, I don't need to reread `skills/writing-plans/SKILL.md`." | No. Every time you write a plan, reread the skill so you are using the latest checklist. |
38
+ | "This bug is obvious, I can skip root-cause analysis and fix it directly." | No. Use `systematic-debugging`. Root cause analysis is mandatory first. |
39
+ | "The user said it's urgent, so I'll skip the test-writing step (TDD)." | In full-delivery implementation, TDD remains the default unless the user **very explicitly** says "Skip TDD". In migration mode, follow the migration validation model instead of forcing fake TDD. |
@@ -0,0 +1,137 @@
1
+ ---
2
+ name: verification-before-completion
3
+ description: "Use before claiming work is complete, fixed, or passing. Requires fresh verification evidence before any success claim."
4
+ ---
5
+
6
+ # Skill: Verification Before Completion
7
+
8
+ ## Context
9
+
10
+ Use this skill immediately before the agent:
11
+
12
+ - says the work is done
13
+ - claims tests pass / the fix is done / the workflow is complete
14
+ - creates a commit, PR, or merge
15
+ - moves the task to the next step as if it were already complete
16
+
17
+ OpenKit prioritizes **evidence before assertion**. Without fresh verification evidence, you must not speak as if the work is already sound.
18
+
19
+ ## Iron Law
20
+
21
+ ```
22
+ DO NOT CLAIM COMPLETION WITHOUT FRESH VERIFICATION EVIDENCE
23
+ ```
24
+
25
+ If you have not run the command that proves the claim in the current working session, the agent must report the real status as "not yet verified" instead of guessing.
26
+
27
+ ## Gate Function
28
+
29
+ Before making any statement that implies success:
30
+
31
+ 1. IDENTIFY which command proves the claim
32
+ 2. RUN the full command
33
+ 3. READ the real output without inventing meaning
34
+ 4. CHECK the exit code, error count, and pass/fail counts
35
+ 5. ONLY THEN speak as if the outcome succeeded
36
+
37
+ If the command fails, or if no verification path exists yet, report that exact reality.
38
+
39
+ ## What Counts as Valid Evidence
40
+
41
+ ### Tests
42
+
43
+ Valid example:
44
+
45
+ - `node --test ".opencode/tests/*.test.js"` with real passing output
46
+
47
+ Not valid:
48
+
49
+ - "it passed earlier"
50
+ - "the code looks right"
51
+ - "part of the suite passed so the rest is probably fine"
52
+
53
+ ### Runtime behavior
54
+
55
+ Valid examples:
56
+
57
+ - run `node .opencode/workflow-state.js status`
58
+ - run `node .opencode/workflow-state.js doctor`
59
+ - run a manual smoke test with clearly described observed input and output
60
+
61
+ Not valid:
62
+
63
+ - "this hook probably prints the right output because the unit test passed" when the claim is about integrated runtime behavior that has not been checked appropriately
64
+
65
+ ### Requirements / plan completion
66
+
67
+ Valid example:
68
+
69
+ - compare every item in the brief, spec, or plan against the diff and verification output
70
+
71
+ Not valid:
72
+
73
+ - "tests passed, so the requirements must all be done"
74
+
75
+ ## Current OpenKit Reality
76
+
77
+ OpenKit does not currently define repo-wide build, lint, or test commands for general application code.
78
+
79
+ So this skill must stay honest to the actual repo state:
80
+
81
+ - if the repo has workflow-runtime tests, use them
82
+ - if it only has runtime CLI checks or manual checks, say clearly that those are the real verification paths
83
+ - if no suitable validation path exists, report that gap instead of inventing a command
84
+
85
+ ## Common Failure Patterns
86
+
87
+ | Claim | Required evidence | Not enough |
88
+ |------|-------------------|------------|
89
+ | "Tests pass" | latest test-command output | old run, memory, assumption |
90
+ | "Bug fixed" | symptom reproduction + passing verification | code changes alone |
91
+ | "Ready to commit" | passing verification for the relevant scope | only looking at the diff |
92
+ | "Requirements met" | checklist against spec/plan + verification | partial test success |
93
+ | "Agent task done" | inspect changes + verify behavior | trusting a subagent report |
94
+
95
+ ## Red Flags
96
+
97
+ If you catch yourself thinking these phrases, stop:
98
+
99
+ - “should work now”
100
+ - “looks correct”
101
+ - “probably fine”
102
+ - “just this once”
103
+ - “the old test already passed”
104
+ - “I'm pretty sure”
105
+
106
+ Those are signs the agent is shifting from engineering into guessing.
107
+
108
+ ## Required Output Style When Verification Fails or Is Missing
109
+
110
+ If verification fails:
111
+
112
+ - state the command you ran
113
+ - state the real failure status
114
+ - include the important output or summary
115
+ - do not use fuzzy wording like "almost done"
116
+
117
+ If no verification path exists:
118
+
119
+ - say clearly that the repo does not yet have an appropriate command
120
+ - describe any manual check you did perform
121
+ - explain the remaining limitation
122
+
123
+ ## Before Commit / PR / Merge
124
+
125
+ Immediately before commit, PR, or merge, the agent must check:
126
+
127
+ - which claim is about to be made
128
+ - which command proves it
129
+ - whether fresh output actually exists
130
+
131
+ Do not use commit or merge as a way to "close the task and move on" when verification is still missing.
132
+
133
+ ## Bottom Line
134
+
135
+ **Evidence before claims. Always.**
136
+
137
+ OpenKit may still lack tooling in many areas, but it must never lack honesty about verification status.