@paulojalowyj/openkit 0.1.1

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 (281) hide show
  1. package/.opencode/ARCHITECTURE.md +150 -0
  2. package/.opencode/LICENSE +21 -0
  3. package/.opencode/bin/cli.js +213 -0
  4. package/.opencode/commands/README.md +273 -0
  5. package/.opencode/commands/analyze.md +64 -0
  6. package/.opencode/commands/brainstorm.md +186 -0
  7. package/.opencode/commands/checklist.md +62 -0
  8. package/.opencode/commands/clarify.md +40 -0
  9. package/.opencode/commands/context.md +68 -0
  10. package/.opencode/commands/create.md +70 -0
  11. package/.opencode/commands/debug.md +160 -0
  12. package/.opencode/commands/deploy.md +244 -0
  13. package/.opencode/commands/doc.md +45 -0
  14. package/.opencode/commands/engineer.md +483 -0
  15. package/.opencode/commands/impl.md +242 -0
  16. package/.opencode/commands/plan.md +250 -0
  17. package/.opencode/commands/preview.md +87 -0
  18. package/.opencode/commands/specify.md +66 -0
  19. package/.opencode/commands/status.md +103 -0
  20. package/.opencode/commands/tasks.md +58 -0
  21. package/.opencode/commands/test.md +104 -0
  22. package/.opencode/commands/ui-ux.md +216 -0
  23. package/.opencode/prompts/backend-specialist.md +315 -0
  24. package/.opencode/prompts/chat.md +36 -0
  25. package/.opencode/prompts/database-architect.md +244 -0
  26. package/.opencode/prompts/debugger.md +244 -0
  27. package/.opencode/prompts/devops-engineer.md +259 -0
  28. package/.opencode/prompts/documentation-writer.md +121 -0
  29. package/.opencode/prompts/explorer-agent.md +92 -0
  30. package/.opencode/prompts/frontend-specialist.md +608 -0
  31. package/.opencode/prompts/mobile-developer.md +393 -0
  32. package/.opencode/prompts/orchestrator.md +472 -0
  33. package/.opencode/prompts/penetration-tester.md +205 -0
  34. package/.opencode/prompts/performance-optimizer.md +204 -0
  35. package/.opencode/prompts/product-owner.md +113 -0
  36. package/.opencode/prompts/project-planner.md +413 -0
  37. package/.opencode/prompts/security-auditor.md +187 -0
  38. package/.opencode/prompts/seo-specialist.md +128 -0
  39. package/.opencode/prompts/test-engineer.md +190 -0
  40. package/.opencode/rules/AGENT_TEMPLATE.md +391 -0
  41. package/.opencode/rules/MASTER.md +272 -0
  42. package/.opencode/rules/README.md +266 -0
  43. package/.opencode/rules/TODOLIST_EXAMPLES.md +675 -0
  44. package/.opencode/rules/TODOLIST_PROTOCOL.md +495 -0
  45. package/.opencode/rules/TOOL_USAGE.md +731 -0
  46. package/.opencode/scripts/auto_preview.py +100 -0
  47. package/.opencode/scripts/checklist.py +217 -0
  48. package/.opencode/scripts/session_manager.py +225 -0
  49. package/.opencode/scripts/verify_all.py +403 -0
  50. package/.opencode/skills/api-patterns/SKILL.md +80 -0
  51. package/.opencode/skills/api-patterns/api-style.md +42 -0
  52. package/.opencode/skills/api-patterns/auth.md +24 -0
  53. package/.opencode/skills/api-patterns/documentation.md +26 -0
  54. package/.opencode/skills/api-patterns/graphql.md +41 -0
  55. package/.opencode/skills/api-patterns/rate-limiting.md +31 -0
  56. package/.opencode/skills/api-patterns/response.md +37 -0
  57. package/.opencode/skills/api-patterns/rest.md +40 -0
  58. package/.opencode/skills/api-patterns/scripts/api_validator.py +211 -0
  59. package/.opencode/skills/api-patterns/security-testing.md +122 -0
  60. package/.opencode/skills/api-patterns/trpc.md +41 -0
  61. package/.opencode/skills/api-patterns/versioning.md +22 -0
  62. package/.opencode/skills/app-builder/SKILL.md +101 -0
  63. package/.opencode/skills/app-builder/agent-coordination.md +71 -0
  64. package/.opencode/skills/app-builder/feature-building.md +53 -0
  65. package/.opencode/skills/app-builder/project-detection.md +34 -0
  66. package/.opencode/skills/app-builder/scaffolding.md +116 -0
  67. package/.opencode/skills/app-builder/tech-stack.md +40 -0
  68. package/.opencode/skills/app-builder/templates/SKILL.md +39 -0
  69. package/.opencode/skills/app-builder/templates/astro-static/TEMPLATE.md +76 -0
  70. package/.opencode/skills/app-builder/templates/chrome-extension/TEMPLATE.md +92 -0
  71. package/.opencode/skills/app-builder/templates/cli-tool/TEMPLATE.md +88 -0
  72. package/.opencode/skills/app-builder/templates/electron-desktop/TEMPLATE.md +88 -0
  73. package/.opencode/skills/app-builder/templates/express-api/TEMPLATE.md +83 -0
  74. package/.opencode/skills/app-builder/templates/flutter-app/TEMPLATE.md +90 -0
  75. package/.opencode/skills/app-builder/templates/monorepo-turborepo/TEMPLATE.md +90 -0
  76. package/.opencode/skills/app-builder/templates/nextjs-fullstack/TEMPLATE.md +81 -0
  77. package/.opencode/skills/app-builder/templates/nextjs-saas/TEMPLATE.md +100 -0
  78. package/.opencode/skills/app-builder/templates/nextjs-static/TEMPLATE.md +106 -0
  79. package/.opencode/skills/app-builder/templates/nuxt-app/TEMPLATE.md +100 -0
  80. package/.opencode/skills/app-builder/templates/python-fastapi/TEMPLATE.md +82 -0
  81. package/.opencode/skills/app-builder/templates/react-native-app/TEMPLATE.md +93 -0
  82. package/.opencode/skills/architecture/SKILL.md +55 -0
  83. package/.opencode/skills/architecture/context-discovery.md +43 -0
  84. package/.opencode/skills/architecture/examples.md +94 -0
  85. package/.opencode/skills/architecture/pattern-selection.md +68 -0
  86. package/.opencode/skills/architecture/patterns-reference.md +50 -0
  87. package/.opencode/skills/architecture/trade-off-analysis.md +77 -0
  88. package/.opencode/skills/bash-linux/SKILL.md +199 -0
  89. package/.opencode/skills/behavioral-modes/SKILL.md +242 -0
  90. package/.opencode/skills/brainstorming/SKILL.md +163 -0
  91. package/.opencode/skills/brainstorming/dynamic-questioning.md +350 -0
  92. package/.opencode/skills/clean-code/SKILL.md +201 -0
  93. package/.opencode/skills/code-review-checklist/SKILL.md +109 -0
  94. package/.opencode/skills/database-design/SKILL.md +73 -0
  95. package/.opencode/skills/database-design/database-selection.md +43 -0
  96. package/.opencode/skills/database-design/indexing.md +39 -0
  97. package/.opencode/skills/database-design/migrations.md +48 -0
  98. package/.opencode/skills/database-design/optimization.md +36 -0
  99. package/.opencode/skills/database-design/orm-selection.md +30 -0
  100. package/.opencode/skills/database-design/schema-design.md +56 -0
  101. package/.opencode/skills/database-design/scripts/schema_validator.py +172 -0
  102. package/.opencode/skills/deployment-procedures/SKILL.md +241 -0
  103. package/.opencode/skills/documentation-templates/SKILL.md +279 -0
  104. package/.opencode/skills/frontend-design/SKILL.md +446 -0
  105. package/.opencode/skills/frontend-design/animation-guide.md +331 -0
  106. package/.opencode/skills/frontend-design/color-system.md +311 -0
  107. package/.opencode/skills/frontend-design/data/charts.csv +26 -0
  108. package/.opencode/skills/frontend-design/data/colors.csv +97 -0
  109. package/.opencode/skills/frontend-design/data/icons.csv +101 -0
  110. package/.opencode/skills/frontend-design/data/landing.csv +31 -0
  111. package/.opencode/skills/frontend-design/data/products.csv +97 -0
  112. package/.opencode/skills/frontend-design/data/prompts.csv +24 -0
  113. package/.opencode/skills/frontend-design/data/react-performance.csv +45 -0
  114. package/.opencode/skills/frontend-design/data/stacks/flutter.csv +53 -0
  115. package/.opencode/skills/frontend-design/data/stacks/html-tailwind.csv +56 -0
  116. package/.opencode/skills/frontend-design/data/stacks/jetpack-compose.csv +53 -0
  117. package/.opencode/skills/frontend-design/data/stacks/nextjs.csv +53 -0
  118. package/.opencode/skills/frontend-design/data/stacks/nuxt-ui.csv +51 -0
  119. package/.opencode/skills/frontend-design/data/stacks/nuxtjs.csv +59 -0
  120. package/.opencode/skills/frontend-design/data/stacks/react-native.csv +52 -0
  121. package/.opencode/skills/frontend-design/data/stacks/react.csv +54 -0
  122. package/.opencode/skills/frontend-design/data/stacks/shadcn.csv +61 -0
  123. package/.opencode/skills/frontend-design/data/stacks/svelte.csv +54 -0
  124. package/.opencode/skills/frontend-design/data/stacks/swiftui.csv +51 -0
  125. package/.opencode/skills/frontend-design/data/stacks/vue.csv +50 -0
  126. package/.opencode/skills/frontend-design/data/styles.csv +59 -0
  127. package/.opencode/skills/frontend-design/data/typography.csv +58 -0
  128. package/.opencode/skills/frontend-design/data/ui-reasoning.csv +101 -0
  129. package/.opencode/skills/frontend-design/data/ux-guidelines.csv +100 -0
  130. package/.opencode/skills/frontend-design/data/web-interface.csv +31 -0
  131. package/.opencode/skills/frontend-design/decision-trees.md +418 -0
  132. package/.opencode/skills/frontend-design/motion-graphics.md +306 -0
  133. package/.opencode/skills/frontend-design/scripts/accessibility_checker.py +183 -0
  134. package/.opencode/skills/frontend-design/scripts/core.py +258 -0
  135. package/.opencode/skills/frontend-design/scripts/design_system.py +1067 -0
  136. package/.opencode/skills/frontend-design/scripts/search.py +106 -0
  137. package/.opencode/skills/frontend-design/scripts/ux_audit.py +735 -0
  138. package/.opencode/skills/frontend-design/typography-system.md +345 -0
  139. package/.opencode/skills/frontend-design/ux-psychology.md +541 -0
  140. package/.opencode/skills/frontend-design/visual-effects.md +383 -0
  141. package/.opencode/skills/geo-fundamentals/SKILL.md +156 -0
  142. package/.opencode/skills/geo-fundamentals/scripts/geo_checker.py +289 -0
  143. package/.opencode/skills/i18n-localization/SKILL.md +154 -0
  144. package/.opencode/skills/i18n-localization/scripts/i18n_checker.py +241 -0
  145. package/.opencode/skills/intelligent-routing/SKILL.md +335 -0
  146. package/.opencode/skills/lint-and-validate/SKILL.md +45 -0
  147. package/.opencode/skills/lint-and-validate/scripts/lint_runner.py +172 -0
  148. package/.opencode/skills/lint-and-validate/scripts/type_coverage.py +173 -0
  149. package/.opencode/skills/mobile-design/SKILL.md +394 -0
  150. package/.opencode/skills/mobile-design/decision-trees.md +516 -0
  151. package/.opencode/skills/mobile-design/mobile-backend.md +491 -0
  152. package/.opencode/skills/mobile-design/mobile-color-system.md +420 -0
  153. package/.opencode/skills/mobile-design/mobile-debugging.md +122 -0
  154. package/.opencode/skills/mobile-design/mobile-design-thinking.md +357 -0
  155. package/.opencode/skills/mobile-design/mobile-navigation.md +458 -0
  156. package/.opencode/skills/mobile-design/mobile-performance.md +767 -0
  157. package/.opencode/skills/mobile-design/mobile-testing.md +356 -0
  158. package/.opencode/skills/mobile-design/mobile-typography.md +433 -0
  159. package/.opencode/skills/mobile-design/platform-android.md +666 -0
  160. package/.opencode/skills/mobile-design/platform-ios.md +561 -0
  161. package/.opencode/skills/mobile-design/scripts/mobile_audit.py +670 -0
  162. package/.opencode/skills/mobile-design/touch-psychology.md +537 -0
  163. package/.opencode/skills/nextjs-react-expert/1-async-eliminating-waterfalls.md +312 -0
  164. package/.opencode/skills/nextjs-react-expert/2-bundle-bundle-size-optimization.md +240 -0
  165. package/.opencode/skills/nextjs-react-expert/3-server-server-side-performance.md +490 -0
  166. package/.opencode/skills/nextjs-react-expert/4-client-client-side-data-fetching.md +264 -0
  167. package/.opencode/skills/nextjs-react-expert/5-rerender-re-render-optimization.md +581 -0
  168. package/.opencode/skills/nextjs-react-expert/6-rendering-rendering-performance.md +432 -0
  169. package/.opencode/skills/nextjs-react-expert/7-js-javascript-performance.md +684 -0
  170. package/.opencode/skills/nextjs-react-expert/8-advanced-advanced-patterns.md +150 -0
  171. package/.opencode/skills/nextjs-react-expert/SKILL.md +267 -0
  172. package/.opencode/skills/nextjs-react-expert/scripts/convert_rules.py +222 -0
  173. package/.opencode/skills/nextjs-react-expert/scripts/react_performance_checker.py +252 -0
  174. package/.opencode/skills/parallel-agents/SKILL.md +175 -0
  175. package/.opencode/skills/performance-profiling/SKILL.md +143 -0
  176. package/.opencode/skills/performance-profiling/scripts/lighthouse_audit.py +76 -0
  177. package/.opencode/skills/plan-writing/SKILL.md +176 -0
  178. package/.opencode/skills/python-patterns/SKILL.md +462 -0
  179. package/.opencode/skills/red-team-tactics/SKILL.md +199 -0
  180. package/.opencode/skills/seo-fundamentals/SKILL.md +129 -0
  181. package/.opencode/skills/seo-fundamentals/scripts/seo_checker.py +222 -0
  182. package/.opencode/skills/server-management/SKILL.md +161 -0
  183. package/.opencode/skills/stack-selection/SKILL.md +448 -0
  184. package/.opencode/skills/systematic-debugging/SKILL.md +109 -0
  185. package/.opencode/skills/tailwind-patterns/SKILL.md +269 -0
  186. package/.opencode/skills/tdd-workflow/SKILL.md +149 -0
  187. package/.opencode/skills/testing-patterns/SKILL.md +178 -0
  188. package/.opencode/skills/testing-patterns/scripts/test_runner.py +219 -0
  189. package/.opencode/skills/vulnerability-scanner/SKILL.md +276 -0
  190. package/.opencode/skills/vulnerability-scanner/checklists.md +121 -0
  191. package/.opencode/skills/vulnerability-scanner/scripts/security_scan.py +458 -0
  192. package/.opencode/skills/web-design-guidelines/SKILL.md +57 -0
  193. package/.opencode/skills/webapp-testing/SKILL.md +187 -0
  194. package/.opencode/skills/webapp-testing/scripts/playwright_runner.py +173 -0
  195. package/.opencode/templates/DOCS-ACTION_ITEMS.md +5 -0
  196. package/.opencode/templates/DOCS-API.md +11 -0
  197. package/.opencode/templates/DOCS-BACKEND.md +10 -0
  198. package/.opencode/templates/DOCS-CONTEXT.md +25 -0
  199. package/.opencode/templates/DOCS-DATABASE.md +10 -0
  200. package/.opencode/templates/DOCS-FRONTEND.md +11 -0
  201. package/.opencode/templates/DOCS-QUALITY_GATES.md +20 -0
  202. package/.opencode/templates/DOCS-SECURITY.md +17 -0
  203. package/.opencode/templates/SDD-AcceptanceCriteria.md +21 -0
  204. package/.opencode/templates/SDD-Checklist.md +27 -0
  205. package/.opencode/templates/SDD-Contracts.md +21 -0
  206. package/.opencode/templates/SDD-Plan.md +45 -0
  207. package/.opencode/templates/SDD-ProblemStatement.md +25 -0
  208. package/.opencode/templates/SDD-Quickstart.md +23 -0
  209. package/.opencode/templates/SDD-Research.md +24 -0
  210. package/.opencode/templates/SDD-Risks.md +16 -0
  211. package/.opencode/templates/SDD-Tasks.md +41 -0
  212. package/.opencode/templates/SDD-UserStories.md +45 -0
  213. package/.opencode/templates/TechStack.md +111 -0
  214. package/LICENSE +21 -0
  215. package/PACKAGE_STATUS.md +97 -0
  216. package/README.md +251 -0
  217. package/README.pt-BR.md +192 -0
  218. package/bin/cli.js +505 -0
  219. package/blueprints/fullstack/.env.example +15 -0
  220. package/blueprints/fullstack/AGENTS.md +3 -0
  221. package/blueprints/fullstack/README.md +65 -0
  222. package/blueprints/fullstack/backend/.dockerignore +10 -0
  223. package/blueprints/fullstack/backend/.python-version +1 -0
  224. package/blueprints/fullstack/backend/Dockerfile +33 -0
  225. package/blueprints/fullstack/backend/alembic.ini +40 -0
  226. package/blueprints/fullstack/backend/app/__init__.py +0 -0
  227. package/blueprints/fullstack/backend/app/api/README.md +3 -0
  228. package/blueprints/fullstack/backend/app/api/__init__.py +0 -0
  229. package/blueprints/fullstack/backend/app/celery_app.py +5 -0
  230. package/blueprints/fullstack/backend/app/core/README.md +3 -0
  231. package/blueprints/fullstack/backend/app/core/__init__.py +0 -0
  232. package/blueprints/fullstack/backend/app/database.py +14 -0
  233. package/blueprints/fullstack/backend/app/main.py +16 -0
  234. package/blueprints/fullstack/backend/app/models/README.md +3 -0
  235. package/blueprints/fullstack/backend/app/models/__init__.py +3 -0
  236. package/blueprints/fullstack/backend/app/models/item.py +10 -0
  237. package/blueprints/fullstack/backend/app/routers/__init__.py +0 -0
  238. package/blueprints/fullstack/backend/app/routers/items.py +20 -0
  239. package/blueprints/fullstack/backend/app/schemas/README.md +3 -0
  240. package/blueprints/fullstack/backend/app/schemas/__init__.py +0 -0
  241. package/blueprints/fullstack/backend/app/schemas/item.py +15 -0
  242. package/blueprints/fullstack/backend/app/services/item_service.py +23 -0
  243. package/blueprints/fullstack/backend/app/settings.py +36 -0
  244. package/blueprints/fullstack/backend/app/tasks/README.md +3 -0
  245. package/blueprints/fullstack/backend/app/tasks/__init__.py +0 -0
  246. package/blueprints/fullstack/backend/migrations/env.py +47 -0
  247. package/blueprints/fullstack/backend/migrations/versions/0001_initial_sample_data.py +31 -0
  248. package/blueprints/fullstack/backend/pyproject.toml +45 -0
  249. package/blueprints/fullstack/docker-compose.dev.yml +114 -0
  250. package/blueprints/fullstack/docker-compose.prod.yml +90 -0
  251. package/blueprints/fullstack/docs/README.md +29 -0
  252. package/blueprints/fullstack/docs/engineering/api/README.md +3 -0
  253. package/blueprints/fullstack/docs/engineering/architecture/README.md +3 -0
  254. package/blueprints/fullstack/docs/engineering/backend/README.md +3 -0
  255. package/blueprints/fullstack/docs/engineering/frontend/README.md +3 -0
  256. package/blueprints/fullstack/docs/engineering/security/README.md +3 -0
  257. package/blueprints/fullstack/docs/engineering/standards/README.md +3 -0
  258. package/blueprints/fullstack/frontend/.dockerignore +4 -0
  259. package/blueprints/fullstack/frontend/Dockerfile +23 -0
  260. package/blueprints/fullstack/frontend/components.json +17 -0
  261. package/blueprints/fullstack/frontend/index.html +12 -0
  262. package/blueprints/fullstack/frontend/package.json +28 -0
  263. package/blueprints/fullstack/frontend/src/components/README.md +3 -0
  264. package/blueprints/fullstack/frontend/src/components/ui/.keep +4 -0
  265. package/blueprints/fullstack/frontend/src/index.css +57 -0
  266. package/blueprints/fullstack/frontend/src/lib/README.md +3 -0
  267. package/blueprints/fullstack/frontend/src/lib/api.ts +1 -0
  268. package/blueprints/fullstack/frontend/src/lib/utils.ts +6 -0
  269. package/blueprints/fullstack/frontend/src/main.tsx +66 -0
  270. package/blueprints/fullstack/frontend/src/routes/README.md +3 -0
  271. package/blueprints/fullstack/frontend/src/routes/root.tsx +7 -0
  272. package/blueprints/fullstack/frontend/src/vite-env.d.ts +1 -0
  273. package/blueprints/fullstack/frontend/tailwind.config.ts +12 -0
  274. package/blueprints/fullstack/frontend/tsconfig.json +13 -0
  275. package/blueprints/fullstack/frontend/tsconfig.node.json +12 -0
  276. package/blueprints/fullstack/frontend/vite.config.ts +12 -0
  277. package/index.js +14 -0
  278. package/opencode.json +306 -0
  279. package/package.json +57 -0
  280. package/scripts/prepare.js +65 -0
  281. package/scripts/update-version.js +29 -0
@@ -0,0 +1,272 @@
1
+ ---
2
+ trigger: always_on
3
+ ---
4
+
5
+ # MASTER RULESET — OPENCODE AGENT SYSTEM
6
+
7
+ > Single source of mandatory rules for all agents, skills, and commands.
8
+
9
+ ---
10
+
11
+ ## Tool Usage (MANDATORY)
12
+
13
+ **All agents, commands, and skills MUST follow:** `.opencode/rules/TOOL_USAGE.md`
14
+
15
+ This rule defines:
16
+ - Correct tool selection (glob vs grep vs read vs bash)
17
+ - File operation patterns (read -> edit/write)
18
+ - User interaction (question tool vs inline)
19
+ - Task tracking (todolist tools vs inline)
20
+ - Common mistakes and fixes
21
+
22
+ **Key principles:**
23
+ - Use `glob` for file patterns, NOT `bash find`
24
+ - Use `grep` for content search, NOT `bash grep`
25
+ - Use `read` for file reading, NOT `bash cat`
26
+ - Use `edit` for existing files, `write` for new files
27
+ - Use `question` tool for multiple options, NOT inline questions
28
+ - Use `todolist` tools for complex tasks (3+ steps), NOT inline tracking
29
+ - Use `workdir` parameter, NOT `cd && command`
30
+
31
+ ---
32
+
33
+ ## Context & Language
34
+
35
+ - Respond in the user's language; keep code/comments in English.
36
+ - Follow `@[skills/clean-code]`: SRP, DRY, KISS, functions <= 20 lines, max 3 args, use guard clauses.
37
+ - Before changing any file, understand dependencies via `CODEBASE.md` or local references.
38
+ - Philosophy `Read → Understand → Apply`: identify objective, principles, and differences from generic output.
39
+
40
+ ## Response Style (MANDATORY)
41
+
42
+ - Be objective, technical, consistent, and direct.
43
+ - Avoid embellishment, filler, and marketing language.
44
+ - Prefer short, information-dense sentences.
45
+
46
+ ## Emoji Policy (MANDATORY)
47
+
48
+ - Do not use emojis in assistant responses.
49
+ - Do not introduce emojis into documentation.
50
+ - Exception: only use emojis if the user explicitly requests them.
51
+
52
+ ---
53
+
54
+ ## Question Tool Protocol (MANDATORY)
55
+
56
+ ### When to Use `question` Tool
57
+
58
+ **MUST use `question` tool (never inline questions) when:**
59
+
60
+ | Situation | Example |
61
+ |-----------|----------|
62
+ | User must choose from **multiple options** | "Which framework: FastAPI or Django?" |
63
+ | User needs to make a **decision** | "Deploy to staging or production?" |
64
+ | **Ambiguous instructions** need clarification | "What authentication method: JWT or OAuth?" |
65
+ | **STOP points** requiring explicit approval | "Proceed with implementation?" |
66
+ | **Multiple choices** with trade-offs | "Option A or Option B for caching?" |
67
+
68
+ Additional enforcement:
69
+ - If you present 2+ next-step options (e.g., "I can do A or B"), you MUST use the `question` tool.
70
+ - Do not present multiple options as plain text and wait for a free-form reply.
71
+
72
+ ### When Inline Questions Are OK
73
+
74
+ Single yes/no confirmations where context is clear:
75
+ - "Delete this file?" (after showing what will be deleted)
76
+ - "Continue with the plan?" (after presenting it)
77
+ - "What would you like to do?" (has multiple options) -> MUST use `question`
78
+
79
+ ### Question Format
80
+
81
+ Use `question` tool with proper structure:
82
+
83
+ ```javascript
84
+ question({
85
+ questions: [{
86
+ question: "Clear, concise question text",
87
+ header: "Short title (max 30 chars)",
88
+ options: [
89
+ { label: "Option 1", description: "Why choose this" },
90
+ { label: "Option 2", description: "Alternative reason" }
91
+ ],
92
+ multiple: false // or true for multi-select
93
+ }]
94
+ })
95
+ ```
96
+
97
+ **This is a MANDATORY pattern. Agents, skills, and commands MUST follow it.**
98
+
99
+ ---
100
+
101
+ ## TodoList Protocol (MANDATORY)
102
+
103
+ **Complete protocol:** `.opencode/rules/TODOLIST_PROTOCOL.md`
104
+
105
+ ### When to Use `todowrite`/`todoread` Tools
106
+
107
+ **MUST use todolist tools (never inline tracking) when:**
108
+
109
+ | Situation | Example |
110
+ |-----------|----------|
111
+ | **Multi-step tasks** (3+ steps) | "Build e-commerce checkout with 5+ components" |
112
+ | **Complex planning phases** | Sprint planning with 5+ stories |
113
+ | **Orchestration mode** | Coordinating 3+ agents (backend, frontend, security) |
114
+ | **Tracking execution** | Marking progress across agent invocations |
115
+ | **Parallel workflows** | Managing multiple simultaneous tasks with dependencies |
116
+ | **STOP points with multiple outcomes** | "P0 complete. Proceed to P1, P2, or stop?" |
117
+
118
+ CRITICAL: After creating todolist, MUST use `question` tool to request user approval before execution.
119
+
120
+ ### When Inline Tracking Is OK
121
+
122
+ Single-task operations where progress is obvious:
123
+ - "Installing dependencies..." (immediate single step)
124
+ - "Running tests..." (one command, output shows result)
125
+ - "Building feature with 5 steps" -> MUST use todolist
126
+
127
+ ### TodoList Lifecycle
128
+
129
+ **1. Create:**
130
+ - Use `todowrite` at START of complex tasks (3+ steps)
131
+ - Include: task id, description (NO emojis), status, priority
132
+
133
+ **2. Request Approval (MANDATORY):**
134
+ - Use `question` tool to ask user approval
135
+ - Wait for user response before executing
136
+
137
+ **3. Update:**
138
+ - Mark tasks as `in_progress` when starting
139
+ - Mark tasks as `completed` when done (NO emojis in content)
140
+ - Always `todoread` before updating to check current state
141
+
142
+ **4. Read:**
143
+ - Use `todoread` to check current state before any action
144
+ - Verify no duplicate or conflicting tasks exist
145
+
146
+ ### TodoList Format
147
+
148
+ Use `todowrite` tool with proper structure:
149
+
150
+ ```javascript
151
+ todowrite({
152
+ todos: [
153
+ {
154
+ id: "task-1",
155
+ content: "Brief task description (max 50 chars)",
156
+ status: "pending",
157
+ priority: "high"
158
+ },
159
+ {
160
+ id: "task-2",
161
+ content: "Another task description",
162
+ status: "in_progress",
163
+ priority: "medium"
164
+ }
165
+ ]
166
+ })
167
+ ```
168
+
169
+ **Status values:** `pending`, `in_progress`, `completed`, `cancelled`
170
+ **Priority values:** `high`, `medium`, `low`
171
+
172
+ CRITICAL RULES:
173
+ - NO emojis in task content
174
+ - MUST use `question` tool for approval after creating todolist
175
+ - Only ONE task `in_progress` at a time
176
+
177
+ **See complete protocol:** `.opencode/rules/TODOLIST_PROTOCOL.md`
178
+
179
+ **This is a MANDATORY pattern. Agents, skills, and commands MUST follow it.**
180
+
181
+ ---
182
+
183
+ ## Runtime Model Choice
184
+
185
+ Model selection is handled by runtime/user environment. Agents and prompts must not emit model recommendation suggestions during execution.
186
+
187
+ ---
188
+
189
+ ## Agent & Skill Protocol
190
+
191
+ 1. Detect the domain (frontend, backend, mobile, security, etc.).
192
+ 2. Read the corresponding prompt file (`.opencode/prompts/<agent>.md`).
193
+ 3. Load all skills listed in the frontmatter (`SKILL.md`).
194
+ 4. Announce: `Applying knowledge of @[agent-name]...` before any specialized output.
195
+ 5. Follow `@[skills/intelligent-routing]` and keep the checklist:
196
+ - Correct agent? → If not, re-evaluate.
197
+ - Agent file read? → Open and review.
198
+ - Skills loaded? → Read each relevant `SKILL.md`.
199
+ - Announcement made? → Inform the user.
200
+
201
+ ### Socratic Gate
202
+ Always ask clarifying questions before execution when there is significant ambiguity. Use `@[skills/brainstorming]` for discovery.
203
+
204
+ ---
205
+
206
+ ## Project Structure & Standards
207
+
208
+ - **frontend/**: Use stack defined in project (check existing code or `docs/requirements/`). Follow `frontend-specialist` rules.
209
+ - **backend/**: Use stack defined in project (check existing code or `docs/requirements/`). Follow `backend-specialist` rules.
210
+ - **docs/**: Source of truth for discovery, planning, and documentation. Create `docs/` if missing.
211
+ - **Stack Selection**: For new projects, use `@[skills/stack-selection]` to determine appropriate technologies with user input.
212
+ - Record cross-scope impacts in `docs/ACTION_ITEMS.md` (when it exists).
213
+ - Branches `feat/<area>-<slug>`; commits `feat|fix|docs|test|refactor|perf|chore|revert`.
214
+ - No `console.log`/`print`. Use official loggers.
215
+
216
+ ---
217
+
218
+ ## SDD Gate (Mandatory)
219
+
220
+ Before any `/impl` execution, the following artifacts MUST exist:
221
+
222
+ - `docs/requirements/<feature>/PROBLEM_STATEMENT.md`
223
+ - `docs/requirements/<feature>/USER_STORIES.md`
224
+ - `docs/requirements/<feature>/ACCEPTANCE_CRITERIA.md`
225
+ - `docs/requirements/<feature>/RISKS.md`
226
+ - `docs/requirements/<feature>/PLAN.md`
227
+
228
+ If any are missing, STOP and direct the user to run `/specify`, `/clarify`, and `/plan` first.
229
+
230
+ ---
231
+
232
+ ## Sprint Documentation & Artifacts
233
+
234
+ 1. **Identification**: Locate `docs/sprint/Sprint-XX/` and review `SPRINT_GOAL.md`, `BACKLOG.md`, `TASKS.md`.
235
+ 2. **Sprint Selection**: Ask the user whether to use the latest sprint or create a new one.
236
+ - If no sprint exists, create `Sprint-01`.
237
+ - If creating a new sprint, use the next sequential number.
238
+ 3. **Planning**: Create requirements in `docs/requirements/<feature>/` and update Backlog/Tasks.
239
+ 4. **Execution**: Mark progress in `TASKS.md`; update story status in `BACKLOG.md`.
240
+ 5. **Completion**: Mark tasks as `[x]`, register changes in `docs/CHANGELOG.md` when requested.
241
+ 6. **Templates**: Use `@[skills/documentation-templates]` for requirements, sprints, and reports.
242
+
243
+ CRITICAL: Ending a task without syncing `docs/sprint/` is a protocol violation.
244
+
245
+ ---
246
+
247
+ ## Final Checklist & Scripts
248
+
249
+ 1. Execution order: **Security → Lint → Schema → Tests → UX → SEO → Lighthouse/E2E**.
250
+ 2. Main commands:
251
+ - `python .opencode/scripts/checklist.py .`
252
+ - `python .opencode/scripts/checklist.py . --url <URL>` (full pre-deploy)
253
+ 3. Skill scripts (run based on scope):
254
+ - Security: `python .opencode/skills/vulnerability-scanner/scripts/security_scan.py .`
255
+ - Lint/Types: `python .opencode/skills/lint-and-validate/scripts/lint_runner.py .`
256
+ - Tests: `python .opencode/skills/testing-patterns/scripts/test_runner.py .`
257
+ - UX/Accessibility: `python .opencode/skills/frontend-design/scripts/ux_audit.py .`
258
+ - SEO: `python .opencode/skills/seo-fundamentals/scripts/seo_checker.py .`
259
+ - Mobile/Performance/etc.: see `skills/<skill>/scripts/`.
260
+
261
+ A task only ends when `checklist.py` succeeds. If it fails, resolve critical blockers (Security/Lint) before proceeding.
262
+
263
+ ---
264
+
265
+ ## Additional Best Practices
266
+
267
+ - References to commands (`/plan`, `/impl`, `/engineer`, `/test`, `/deploy`, `/doc`, `/ui-ux`, `/preview`, `/status`) must follow `.opencode/commands/`.
268
+ - When generating new artifacts, record times using timezone UTC-3 as per `AGENTS.md`.
269
+ - Update `docs/.context` and `docs/ACTION_ITEMS.md` when there is multi-repo impact.
270
+ - Always validate sensitive data: never expose secrets, tokens, or `.env`.
271
+
272
+ This file supersedes all previous rules (`CORE`, `ROUTING`, `CHECKLIST`, `SPRINTS`).
@@ -0,0 +1,266 @@
1
+ # Rules Directory
2
+
3
+ > Central repository of mandatory protocols for the OpenCode agent system.
4
+
5
+ ---
6
+
7
+ ## Overview
8
+
9
+ This directory contains **system-wide rules** that enforce consistent behavior across:
10
+ - **Orchestrator** (`.opencode/prompts/orchestrator.md`)
11
+ - **All specialist prompts** (`.opencode/prompts/*.md`)
12
+ - **All commands** (`.opencode/commands/*.md`)
13
+ - **All skills** (`.opencode/skills/*/SKILL.md`)
14
+
15
+ ---
16
+
17
+ ## Rule Files
18
+
19
+ ### 1. **MASTER.md** (Priority: P0)
20
+ **Purpose:** Single source of truth for all mandatory rules.
21
+
22
+ **Contains:**
23
+ - Tool usage reference (delegates to TOOL_USAGE.md)
24
+ - Context & language protocols
25
+ - Question tool protocol
26
+ - TodoList protocol
27
+ - Model selection guidelines
28
+ - Agent & skill protocol
29
+ - Project structure standards
30
+ - Sprint documentation requirements
31
+ - Final checklist & scripts
32
+ - Best practices
33
+
34
+ **Applies to:** All agents, commands, skills
35
+
36
+ **Trigger:** `always_on`
37
+
38
+ ---
39
+
40
+ ### 2. **TOOL_USAGE.md** (Priority: P0)
41
+ **Purpose:** Definitive guide for correct tool selection and usage patterns.
42
+
43
+ **Contains:**
44
+ - Tool selection decision tree
45
+ - File discovery & search patterns
46
+ - File operation rules (read → edit/write)
47
+ - Code execution & shell patterns
48
+ - User interaction protocols
49
+ - Task tracking lifecycle
50
+ - Knowledge loading patterns
51
+ - Common mistakes & fixes
52
+ - Validation checklist
53
+
54
+ **Applies to:** All agents, commands, skills
55
+
56
+ **Trigger:** `always_on`
57
+
58
+ **Key Enforcements:**
59
+ - Use `glob` for file patterns, NOT `bash find`
60
+ - Use `grep` for content search, NOT `bash grep`
61
+ - Use `read` for file reading, NOT `bash cat`
62
+ - Use `edit` for existing files, `write` for new files
63
+ - Use `question` tool for multiple options, NOT inline questions
64
+ - Use `todolist` tools for complex tasks (3+ steps), NOT inline tracking
65
+ - Use `workdir` parameter, NOT `cd && command`
66
+
67
+ ---
68
+
69
+ ## Rule Hierarchy
70
+
71
+ ```
72
+ MASTER.md (Root)
73
+
74
+ ├─ TOOL_USAGE.md (Tool patterns)
75
+
76
+ ├─ Agent Prompts (.opencode/prompts/*.md)
77
+ │ └─ Reference MASTER.md + TOOL_USAGE.md
78
+
79
+ ├─ Command Files (.opencode/commands/*.md)
80
+ │ └─ Reference MASTER.md + TOOL_USAGE.md
81
+
82
+ └─ Skill Files (.opencode/skills/*/SKILL.md)
83
+ └─ Reference MASTER.md + TOOL_USAGE.md
84
+ ```
85
+
86
+ ---
87
+
88
+ ## How Rules Are Applied
89
+
90
+ ### 1. **Automatic Loading**
91
+ - All rules with `trigger: always_on` are loaded at system startup
92
+ - `MASTER.md` is ALWAYS active
93
+ - `TOOL_USAGE.md` is ALWAYS active
94
+
95
+ ### 2. **Agent Invocation**
96
+ When an agent is invoked:
97
+ 1. System loads `MASTER.md` (automatic)
98
+ 2. System loads `TOOL_USAGE.md` (automatic)
99
+ 3. Agent reads its own prompt (`.opencode/prompts/<agent>.md`)
100
+ 4. Agent loads skills from frontmatter
101
+
102
+ ### 3. **Command Execution**
103
+ When a command is executed:
104
+ 1. System loads `MASTER.md` (automatic)
105
+ 2. System loads `TOOL_USAGE.md` (automatic)
106
+ 3. Command reads its own file (`.opencode/commands/<command>.md`)
107
+ 4. Command follows protocols from rules
108
+
109
+ ### 4. **Skill Loading**
110
+ When a skill is loaded:
111
+ 1. System loads `MASTER.md` (automatic)
112
+ 2. System loads `TOOL_USAGE.md` (automatic)
113
+ 3. Skill instructions are read from `SKILL.md`
114
+ 4. Skill follows protocols from rules
115
+
116
+ ---
117
+
118
+ ## Enforcement
119
+
120
+ ### Priority Levels
121
+ - **P0 (Critical):** Must be followed. Violations break the system.
122
+ - **P1 (High):** Should be followed. Violations cause inconsistency.
123
+ - **P2 (Medium):** Recommended. Violations reduce quality.
124
+ - **P3 (Low):** Nice to have. Violations are acceptable.
125
+
126
+ ### Conflict Resolution
127
+ 1. `MASTER.md` supersedes all other rules
128
+ 2. `TOOL_USAGE.md` supersedes agent/command/skill instructions for tool usage
129
+ 3. Agent-specific rules override generic patterns (within their domain)
130
+ 4. User instructions override all rules (when explicit)
131
+
132
+ ---
133
+
134
+ ## Validation
135
+
136
+ ### For Agents
137
+ Before any action, verify:
138
+ - [ ] Have I read `MASTER.md`? (automatic)
139
+ - [ ] Have I read `TOOL_USAGE.md`? (automatic)
140
+ - [ ] Am I using the correct tool? (check decision tree)
141
+ - [ ] Have I loaded required skills? (check frontmatter)
142
+ - [ ] Am I following todolist protocol? (for complex tasks)
143
+ - [ ] Am I following question tool protocol? (for multiple options)
144
+
145
+ ### For Commands
146
+ Before execution, verify:
147
+ - [ ] Have I read `MASTER.md`? (automatic)
148
+ - [ ] Have I read `TOOL_USAGE.md`? (automatic)
149
+ - [ ] Am I using the correct tool? (check decision tree)
150
+ - [ ] Am I following user interaction patterns? (question/todolist)
151
+
152
+ ### For Skills
153
+ Before applying, verify:
154
+ - [ ] Have I read `MASTER.md`? (automatic)
155
+ - [ ] Have I read `TOOL_USAGE.md`? (automatic)
156
+ - [ ] Am I using the correct tool? (check decision tree)
157
+ - [ ] Am I announcing skill usage? (`Applying knowledge of @[skill-name]...`)
158
+
159
+ ---
160
+
161
+ ## Quick Reference
162
+
163
+ ### Tool Configuration
164
+
165
+ **Tools are configured in `opencode.json`**, NOT in prompt markdown files.
166
+
167
+ Example orchestrator configuration:
168
+ ```json
169
+ {
170
+ "agent": {
171
+ "orchestrator": {
172
+ "tools": {
173
+ "read": true,
174
+ "grep": true,
175
+ "glob": true,
176
+ "list": true,
177
+ "bash": true,
178
+ "edit": true,
179
+ "write": true,
180
+ "patch": true,
181
+ "webfetch": true,
182
+ "skill": true,
183
+ "todowrite": true,
184
+ "todoread": true,
185
+ "question": true
186
+ }
187
+ }
188
+ }
189
+ }
190
+ ```
191
+
192
+ ### Tool Selection
193
+ | Need | Use | NOT |
194
+ |------|-----|-----|
195
+ | Find files by name | `glob` | `bash find` |
196
+ | Find files by content | `grep` | `bash grep` |
197
+ | List directory | `list` | `bash ls` |
198
+ | Read file | `read` | `bash cat` |
199
+ | Edit existing file | `edit` | `write` (unless rewriting) |
200
+ | Create new file | `write` | `bash echo >` |
201
+ | Apply patch | `patch` | `bash patch` |
202
+ | Execute command | `bash` | Manual execution |
203
+ | Change directory | `workdir` param | `cd &&` |
204
+ | Ask multiple options | `question` tool | Inline text |
205
+ | Track complex tasks | `todolist` tools | Inline text |
206
+
207
+ ### Common Patterns
208
+ ```javascript
209
+ // File discovery
210
+ glob("**/*.tsx")
211
+ grep("useState", "src/**/*.tsx")
212
+
213
+ // File operations
214
+ read("file.ts")
215
+ edit("file.ts", "old", "new")
216
+
217
+ // User interaction
218
+ question({
219
+ questions: [{
220
+ question: "Choose option",
221
+ header: "Title",
222
+ options: [...]
223
+ }]
224
+ })
225
+
226
+ // Task tracking
227
+ todoread()
228
+ todowrite({ todos: [...] })
229
+
230
+ // Command execution
231
+ bash("pytest tests", workdir="/backend")
232
+ ```
233
+
234
+ ---
235
+
236
+ ## Maintenance
237
+
238
+ ### Adding New Rules
239
+ 1. Create new `.md` file in `.opencode/rules/`
240
+ 2. Add frontmatter with `trigger` and `priority`
241
+ 3. Update `MASTER.md` to reference it (if needed)
242
+ 4. Update this README with the new rule
243
+
244
+ ### Updating Existing Rules
245
+ 1. Edit the rule file directly
246
+ 2. Update version/date in frontmatter (if present)
247
+ 3. Announce changes to all agents (via system update)
248
+
249
+ ### Deprecating Rules
250
+ 1. Mark rule as `deprecated: true` in frontmatter
251
+ 2. Add `superseded_by: <new-rule>.md` reference
252
+ 3. Keep file for 2 versions, then delete
253
+
254
+ ---
255
+
256
+ ## Related Documentation
257
+
258
+ - **Agent Prompts**: `.opencode/prompts/`
259
+ - **Command System**: `.opencode/commands/README.md`
260
+ - **Skill System**: `docs/SKILLS.md`
261
+ - **Architecture**: `.opencode/ARCHITECTURE.md`
262
+
263
+ ---
264
+
265
+ **Last Updated:** 2026-02-04
266
+ **Maintained By:** OpenCode System