@iamnishankhan/opencode-kit-grok 1.0.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 (198) hide show
  1. package/bin/cli.js +46 -0
  2. package/kit/.opencode/AGENTS.md +392 -0
  3. package/kit/.opencode/README.md +71 -0
  4. package/kit/.opencode/USAGE.md +405 -0
  5. package/kit/.opencode/agents/backend-specialist.md +278 -0
  6. package/kit/.opencode/agents/code-archaeologist.md +114 -0
  7. package/kit/.opencode/agents/database-architect.md +233 -0
  8. package/kit/.opencode/agents/debugger.md +234 -0
  9. package/kit/.opencode/agents/devops-engineer.md +252 -0
  10. package/kit/.opencode/agents/documentation-writer.md +111 -0
  11. package/kit/.opencode/agents/explorer-agent.md +83 -0
  12. package/kit/.opencode/agents/frontend-specialist.md +606 -0
  13. package/kit/.opencode/agents/game-developer.md +169 -0
  14. package/kit/.opencode/agents/mobile-developer.md +385 -0
  15. package/kit/.opencode/agents/orchestrator.md +213 -0
  16. package/kit/.opencode/agents/penetration-tester.md +197 -0
  17. package/kit/.opencode/agents/performance-optimizer.md +194 -0
  18. package/kit/.opencode/agents/product-manager.md +120 -0
  19. package/kit/.opencode/agents/product-owner.md +103 -0
  20. package/kit/.opencode/agents/project-planner.md +418 -0
  21. package/kit/.opencode/agents/qa-automation-engineer.md +113 -0
  22. package/kit/.opencode/agents/security-auditor.md +179 -0
  23. package/kit/.opencode/agents/seo-specialist.md +119 -0
  24. package/kit/.opencode/agents/test-engineer.md +169 -0
  25. package/kit/.opencode/commands/brainstorm.md +113 -0
  26. package/kit/.opencode/commands/coordinate.md +72 -0
  27. package/kit/.opencode/commands/create.md +63 -0
  28. package/kit/.opencode/commands/debug.md +102 -0
  29. package/kit/.opencode/commands/deploy.md +175 -0
  30. package/kit/.opencode/commands/enhance.md +62 -0
  31. package/kit/.opencode/commands/orchestrate.md +241 -0
  32. package/kit/.opencode/commands/plan.md +89 -0
  33. package/kit/.opencode/commands/preview.md +80 -0
  34. package/kit/.opencode/commands/remember.md +67 -0
  35. package/kit/.opencode/commands/status.md +86 -0
  36. package/kit/.opencode/commands/test.md +143 -0
  37. package/kit/.opencode/commands/verify.md +71 -0
  38. package/kit/.opencode/memory/MEMORY.md +6 -0
  39. package/kit/.opencode/memory/feedback-history.md +9 -0
  40. package/kit/.opencode/memory/project-conventions.md +16 -0
  41. package/kit/.opencode/memory/tech-decisions.md +10 -0
  42. package/kit/.opencode/memory/user-preferences.md +9 -0
  43. package/kit/.opencode/opencode.json +15 -0
  44. package/kit/.opencode/scripts/README.md +95 -0
  45. package/kit/.opencode/scripts/auto_preview.py +149 -0
  46. package/kit/.opencode/scripts/checklist.py +75 -0
  47. package/kit/.opencode/scripts/component_registry.py +238 -0
  48. package/kit/.opencode/scripts/dependency_graph.py +73 -0
  49. package/kit/.opencode/scripts/generate_manifest.py +44 -0
  50. package/kit/.opencode/scripts/session_manager.py +120 -0
  51. package/kit/.opencode/scripts/tests/test_toolkit.py +238 -0
  52. package/kit/.opencode/scripts/validate_kit.py +397 -0
  53. package/kit/.opencode/scripts/validation_runner.py +216 -0
  54. package/kit/.opencode/scripts/verify_all.py +85 -0
  55. package/kit/.opencode/skills/api-patterns/SKILL.md +83 -0
  56. package/kit/.opencode/skills/api-patterns/api-style.md +42 -0
  57. package/kit/.opencode/skills/api-patterns/auth.md +24 -0
  58. package/kit/.opencode/skills/api-patterns/documentation.md +26 -0
  59. package/kit/.opencode/skills/api-patterns/graphql.md +41 -0
  60. package/kit/.opencode/skills/api-patterns/rate-limiting.md +31 -0
  61. package/kit/.opencode/skills/api-patterns/response.md +37 -0
  62. package/kit/.opencode/skills/api-patterns/rest.md +40 -0
  63. package/kit/.opencode/skills/api-patterns/scripts/api_validator.py +211 -0
  64. package/kit/.opencode/skills/api-patterns/security-testing.md +122 -0
  65. package/kit/.opencode/skills/api-patterns/trpc.md +41 -0
  66. package/kit/.opencode/skills/api-patterns/versioning.md +22 -0
  67. package/kit/.opencode/skills/app-builder/SKILL.md +78 -0
  68. package/kit/.opencode/skills/app-builder/agent-coordination.md +71 -0
  69. package/kit/.opencode/skills/app-builder/feature-building.md +53 -0
  70. package/kit/.opencode/skills/app-builder/project-detection.md +45 -0
  71. package/kit/.opencode/skills/app-builder/scaffolding.md +110 -0
  72. package/kit/.opencode/skills/app-builder/tech-stack.md +41 -0
  73. package/kit/.opencode/skills/app-builder/templates/SKILL.md +39 -0
  74. package/kit/.opencode/skills/app-builder/templates/astro-static/TEMPLATE.md +78 -0
  75. package/kit/.opencode/skills/app-builder/templates/chrome-extension/TEMPLATE.md +96 -0
  76. package/kit/.opencode/skills/app-builder/templates/cli-tool/TEMPLATE.md +88 -0
  77. package/kit/.opencode/skills/app-builder/templates/electron-desktop/TEMPLATE.md +97 -0
  78. package/kit/.opencode/skills/app-builder/templates/express-api/TEMPLATE.md +89 -0
  79. package/kit/.opencode/skills/app-builder/templates/flutter-app/TEMPLATE.md +93 -0
  80. package/kit/.opencode/skills/app-builder/templates/monorepo-turborepo/TEMPLATE.md +97 -0
  81. package/kit/.opencode/skills/app-builder/templates/nextjs-fullstack/TEMPLATE.md +126 -0
  82. package/kit/.opencode/skills/app-builder/templates/nextjs-saas/TEMPLATE.md +125 -0
  83. package/kit/.opencode/skills/app-builder/templates/nextjs-static/TEMPLATE.md +174 -0
  84. package/kit/.opencode/skills/app-builder/templates/nuxt-app/TEMPLATE.md +127 -0
  85. package/kit/.opencode/skills/app-builder/templates/python-fastapi/TEMPLATE.md +94 -0
  86. package/kit/.opencode/skills/app-builder/templates/react-native-app/TEMPLATE.md +121 -0
  87. package/kit/.opencode/skills/architecture/SKILL.md +57 -0
  88. package/kit/.opencode/skills/architecture/context-discovery.md +43 -0
  89. package/kit/.opencode/skills/architecture/examples.md +94 -0
  90. package/kit/.opencode/skills/architecture/pattern-selection.md +68 -0
  91. package/kit/.opencode/skills/architecture/patterns-reference.md +50 -0
  92. package/kit/.opencode/skills/architecture/trade-off-analysis.md +77 -0
  93. package/kit/.opencode/skills/bash-linux/SKILL.md +201 -0
  94. package/kit/.opencode/skills/batch-operations/SKILL.md +105 -0
  95. package/kit/.opencode/skills/behavioral-modes/SKILL.md +253 -0
  96. package/kit/.opencode/skills/brainstorming/SKILL.md +178 -0
  97. package/kit/.opencode/skills/brainstorming/dynamic-questioning.md +350 -0
  98. package/kit/.opencode/skills/clean-code/SKILL.md +201 -0
  99. package/kit/.opencode/skills/code-review-checklist/SKILL.md +111 -0
  100. package/kit/.opencode/skills/code-review-graph/SKILL.md +305 -0
  101. package/kit/.opencode/skills/context-compression/SKILL.md +145 -0
  102. package/kit/.opencode/skills/coordinator-mode/SKILL.md +208 -0
  103. package/kit/.opencode/skills/database-design/SKILL.md +54 -0
  104. package/kit/.opencode/skills/database-design/database-selection.md +43 -0
  105. package/kit/.opencode/skills/database-design/indexing.md +39 -0
  106. package/kit/.opencode/skills/database-design/migrations.md +48 -0
  107. package/kit/.opencode/skills/database-design/optimization.md +36 -0
  108. package/kit/.opencode/skills/database-design/orm-selection.md +30 -0
  109. package/kit/.opencode/skills/database-design/schema-design.md +56 -0
  110. package/kit/.opencode/skills/database-design/scripts/schema_validator.py +172 -0
  111. package/kit/.opencode/skills/deployment-procedures/SKILL.md +243 -0
  112. package/kit/.opencode/skills/design-spec/SKILL.md +185 -0
  113. package/kit/.opencode/skills/design-spec/collection.md +106 -0
  114. package/kit/.opencode/skills/documentation-templates/SKILL.md +196 -0
  115. package/kit/.opencode/skills/frontend-architecture/SKILL.md +245 -0
  116. package/kit/.opencode/skills/frontend-design/SKILL.md +1222 -0
  117. package/kit/.opencode/skills/frontend-design/redesign.md +178 -0
  118. package/kit/.opencode/skills/frontend-design/scripts/accessibility_checker.py +145 -0
  119. package/kit/.opencode/skills/frontend-design/scripts/ux_audit.py +722 -0
  120. package/kit/.opencode/skills/frontend-design/style-brutalist.md +92 -0
  121. package/kit/.opencode/skills/frontend-design/style-minimalist.md +85 -0
  122. package/kit/.opencode/skills/game-development/2d-games/SKILL.md +118 -0
  123. package/kit/.opencode/skills/game-development/3d-games/SKILL.md +134 -0
  124. package/kit/.opencode/skills/game-development/SKILL.md +169 -0
  125. package/kit/.opencode/skills/game-development/game-art/SKILL.md +184 -0
  126. package/kit/.opencode/skills/game-development/game-audio/SKILL.md +189 -0
  127. package/kit/.opencode/skills/game-development/game-design/SKILL.md +128 -0
  128. package/kit/.opencode/skills/game-development/mobile-games/SKILL.md +107 -0
  129. package/kit/.opencode/skills/game-development/multiplayer/SKILL.md +131 -0
  130. package/kit/.opencode/skills/game-development/pc-games/SKILL.md +143 -0
  131. package/kit/.opencode/skills/game-development/vr-ar/SKILL.md +122 -0
  132. package/kit/.opencode/skills/game-development/web-games/SKILL.md +149 -0
  133. package/kit/.opencode/skills/geo-fundamentals/SKILL.md +158 -0
  134. package/kit/.opencode/skills/geo-fundamentals/scripts/geo_checker.py +273 -0
  135. package/kit/.opencode/skills/i18n-localization/SKILL.md +156 -0
  136. package/kit/.opencode/skills/i18n-localization/scripts/i18n_checker.py +223 -0
  137. package/kit/.opencode/skills/intelligent-routing/SKILL.md +337 -0
  138. package/kit/.opencode/skills/lint-and-validate/SKILL.md +47 -0
  139. package/kit/.opencode/skills/lint-and-validate/scripts/lint_runner.py +184 -0
  140. package/kit/.opencode/skills/lint-and-validate/scripts/type_coverage.py +245 -0
  141. package/kit/.opencode/skills/mcp-builder/SKILL.md +205 -0
  142. package/kit/.opencode/skills/memory-system/SKILL.md +181 -0
  143. package/kit/.opencode/skills/mobile-design/SKILL.md +396 -0
  144. package/kit/.opencode/skills/mobile-design/decision-trees.md +516 -0
  145. package/kit/.opencode/skills/mobile-design/mobile-backend.md +491 -0
  146. package/kit/.opencode/skills/mobile-design/mobile-color-system.md +420 -0
  147. package/kit/.opencode/skills/mobile-design/mobile-debugging.md +122 -0
  148. package/kit/.opencode/skills/mobile-design/mobile-design-thinking.md +357 -0
  149. package/kit/.opencode/skills/mobile-design/mobile-navigation.md +458 -0
  150. package/kit/.opencode/skills/mobile-design/mobile-performance.md +767 -0
  151. package/kit/.opencode/skills/mobile-design/mobile-testing.md +356 -0
  152. package/kit/.opencode/skills/mobile-design/mobile-typography.md +433 -0
  153. package/kit/.opencode/skills/mobile-design/platform-android.md +666 -0
  154. package/kit/.opencode/skills/mobile-design/platform-ios.md +561 -0
  155. package/kit/.opencode/skills/mobile-design/scripts/mobile_audit.py +670 -0
  156. package/kit/.opencode/skills/mobile-design/touch-psychology.md +537 -0
  157. package/kit/.opencode/skills/nextjs-react-expert/1-async-eliminating-waterfalls.md +351 -0
  158. package/kit/.opencode/skills/nextjs-react-expert/2-bundle-bundle-size-optimization.md +240 -0
  159. package/kit/.opencode/skills/nextjs-react-expert/3-server-server-side-performance.md +490 -0
  160. package/kit/.opencode/skills/nextjs-react-expert/4-client-client-side-data-fetching.md +264 -0
  161. package/kit/.opencode/skills/nextjs-react-expert/5-rerender-re-render-optimization.md +581 -0
  162. package/kit/.opencode/skills/nextjs-react-expert/6-rendering-rendering-performance.md +432 -0
  163. package/kit/.opencode/skills/nextjs-react-expert/7-js-javascript-performance.md +684 -0
  164. package/kit/.opencode/skills/nextjs-react-expert/8-advanced-advanced-patterns.md +150 -0
  165. package/kit/.opencode/skills/nextjs-react-expert/9-cache-components.md +103 -0
  166. package/kit/.opencode/skills/nextjs-react-expert/SKILL.md +293 -0
  167. package/kit/.opencode/skills/nextjs-react-expert/scripts/convert_rules.py +222 -0
  168. package/kit/.opencode/skills/nextjs-react-expert/scripts/react_performance_checker.py +281 -0
  169. package/kit/.opencode/skills/nodejs-best-practices/SKILL.md +336 -0
  170. package/kit/.opencode/skills/parallel-agents/SKILL.md +192 -0
  171. package/kit/.opencode/skills/performance-profiling/SKILL.md +145 -0
  172. package/kit/.opencode/skills/performance-profiling/scripts/bundle_analyzer.py +120 -0
  173. package/kit/.opencode/skills/performance-profiling/scripts/lighthouse_audit.py +108 -0
  174. package/kit/.opencode/skills/plan-writing/SKILL.md +153 -0
  175. package/kit/.opencode/skills/powershell-windows/SKILL.md +169 -0
  176. package/kit/.opencode/skills/python-patterns/SKILL.md +443 -0
  177. package/kit/.opencode/skills/red-team-tactics/SKILL.md +201 -0
  178. package/kit/.opencode/skills/rust-pro/SKILL.md +177 -0
  179. package/kit/.opencode/skills/seo-fundamentals/SKILL.md +131 -0
  180. package/kit/.opencode/skills/seo-fundamentals/scripts/seo_checker.py +219 -0
  181. package/kit/.opencode/skills/server-management/SKILL.md +163 -0
  182. package/kit/.opencode/skills/simplify-code/SKILL.md +131 -0
  183. package/kit/.opencode/skills/skillify/SKILL.md +115 -0
  184. package/kit/.opencode/skills/systematic-debugging/SKILL.md +111 -0
  185. package/kit/.opencode/skills/tailwind-patterns/SKILL.md +271 -0
  186. package/kit/.opencode/skills/tdd-workflow/SKILL.md +151 -0
  187. package/kit/.opencode/skills/testing-patterns/SKILL.md +180 -0
  188. package/kit/.opencode/skills/testing-patterns/scripts/test_runner.py +219 -0
  189. package/kit/.opencode/skills/verify-changes/SKILL.md +127 -0
  190. package/kit/.opencode/skills/vulnerability-scanner/SKILL.md +278 -0
  191. package/kit/.opencode/skills/vulnerability-scanner/checklists.md +124 -0
  192. package/kit/.opencode/skills/vulnerability-scanner/scripts/dependency_analyzer.py +144 -0
  193. package/kit/.opencode/skills/vulnerability-scanner/scripts/security_scan.py +410 -0
  194. package/kit/.opencode/skills/web-design-guidelines/SKILL.md +56 -0
  195. package/kit/.opencode/skills/webapp-testing/SKILL.md +189 -0
  196. package/kit/.opencode/skills/webapp-testing/scripts/playwright_runner.py +123 -0
  197. package/lib/init.js +61 -0
  198. package/package.json +21 -0
@@ -0,0 +1,172 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ Schema Validator - Database schema validation
4
+ Validates Prisma schemas and checks for common issues.
5
+
6
+ Usage:
7
+ python schema_validator.py <project_path>
8
+
9
+ Checks:
10
+ - Prisma schema syntax
11
+ - Missing relations
12
+ - Index recommendations
13
+ - Naming conventions
14
+ """
15
+
16
+ import sys
17
+ import json
18
+ import re
19
+ from pathlib import Path
20
+ from datetime import datetime
21
+
22
+ # Fix Windows console encoding
23
+ try:
24
+ sys.stdout.reconfigure(encoding='utf-8', errors='replace')
25
+ except:
26
+ pass
27
+
28
+
29
+ def find_schema_files(project_path: Path) -> list:
30
+ """Find database schema files."""
31
+ schemas = []
32
+
33
+ # Prisma schema
34
+ prisma_files = list(project_path.glob('**/prisma/schema.prisma'))
35
+ schemas.extend([('prisma', f) for f in prisma_files])
36
+
37
+ # Drizzle schema files
38
+ drizzle_files = list(project_path.glob('**/drizzle/*.ts'))
39
+ drizzle_files.extend(project_path.glob('**/schema/*.ts'))
40
+ for f in drizzle_files:
41
+ if 'schema' in f.name.lower() or 'table' in f.name.lower():
42
+ schemas.append(('drizzle', f))
43
+
44
+ return schemas[:10] # Limit
45
+
46
+
47
+ def validate_prisma_schema(file_path: Path) -> list:
48
+ """Validate Prisma schema file."""
49
+ issues = []
50
+
51
+ try:
52
+ content = file_path.read_text(encoding='utf-8', errors='ignore')
53
+
54
+ # Find all models
55
+ models = re.findall(r'model\s+(\w+)\s*{([^}]+)}', content, re.DOTALL)
56
+
57
+ for model_name, model_body in models:
58
+ # Check naming convention (PascalCase)
59
+ if not model_name[0].isupper():
60
+ issues.append(f"Model '{model_name}' should be PascalCase")
61
+
62
+ # Check for id field
63
+ if '@id' not in model_body and 'id' not in model_body.lower():
64
+ issues.append(f"Model '{model_name}' might be missing @id field")
65
+
66
+ # Check for createdAt/updatedAt
67
+ if 'createdAt' not in model_body and 'created_at' not in model_body:
68
+ issues.append(f"Model '{model_name}' missing createdAt field (recommended)")
69
+
70
+ # Check for @relation without fields
71
+ relations = re.findall(r'@relation\([^)]*\)', model_body)
72
+ for rel in relations:
73
+ if 'fields:' not in rel and 'references:' not in rel:
74
+ pass # Implicit relation, ok
75
+
76
+ # Check for @@index suggestions
77
+ foreign_keys = re.findall(r'(\w+Id)\s+\w+', model_body)
78
+ for fk in foreign_keys:
79
+ if f'@@index([{fk}])' not in content and f'@@index(["{fk}"])' not in content:
80
+ issues.append(f"Consider adding @@index([{fk}]) for better query performance in {model_name}")
81
+
82
+ # Check for enum definitions
83
+ enums = re.findall(r'enum\s+(\w+)\s*{', content)
84
+ for enum_name in enums:
85
+ if not enum_name[0].isupper():
86
+ issues.append(f"Enum '{enum_name}' should be PascalCase")
87
+
88
+ except Exception as e:
89
+ issues.append(f"Error reading schema: {str(e)[:50]}")
90
+
91
+ return issues
92
+
93
+
94
+ def main():
95
+ project_path = Path(sys.argv[1] if len(sys.argv) > 1 else ".").resolve()
96
+
97
+ print(f"\n{'='*60}")
98
+ print(f"[SCHEMA VALIDATOR] Database Schema Validation")
99
+ print(f"{'='*60}")
100
+ print(f"Project: {project_path}")
101
+ print(f"Time: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}")
102
+ print("-"*60)
103
+
104
+ # Find schema files
105
+ schemas = find_schema_files(project_path)
106
+ print(f"Found {len(schemas)} schema files")
107
+
108
+ if not schemas:
109
+ output = {
110
+ "script": "schema_validator",
111
+ "project": str(project_path),
112
+ "schemas_checked": 0,
113
+ "issues_found": 0,
114
+ "passed": True,
115
+ "message": "No schema files found"
116
+ }
117
+ print(json.dumps(output, indent=2))
118
+ sys.exit(0)
119
+
120
+ # Validate each schema
121
+ all_issues = []
122
+
123
+ for schema_type, file_path in schemas:
124
+ print(f"\nValidating: {file_path.name} ({schema_type})")
125
+
126
+ if schema_type == 'prisma':
127
+ issues = validate_prisma_schema(file_path)
128
+ else:
129
+ issues = [] # Drizzle validation could be added
130
+
131
+ if issues:
132
+ all_issues.append({
133
+ "file": str(file_path.name),
134
+ "type": schema_type,
135
+ "issues": issues
136
+ })
137
+
138
+ # Summary
139
+ print("\n" + "="*60)
140
+ print("SCHEMA ISSUES")
141
+ print("="*60)
142
+
143
+ if all_issues:
144
+ for item in all_issues:
145
+ print(f"\n{item['file']} ({item['type']}):")
146
+ for issue in item["issues"][:5]: # Limit per file
147
+ print(f" - {issue}")
148
+ if len(item["issues"]) > 5:
149
+ print(f" ... and {len(item['issues']) - 5} more issues")
150
+ else:
151
+ print("No schema issues found!")
152
+
153
+ total_issues = sum(len(item["issues"]) for item in all_issues)
154
+ # Schema issues are warnings, not failures
155
+ passed = True
156
+
157
+ output = {
158
+ "script": "schema_validator",
159
+ "project": str(project_path),
160
+ "schemas_checked": len(schemas),
161
+ "issues_found": total_issues,
162
+ "passed": passed,
163
+ "issues": all_issues
164
+ }
165
+
166
+ print("\n" + json.dumps(output, indent=2))
167
+
168
+ sys.exit(0)
169
+
170
+
171
+ if __name__ == "__main__":
172
+ main()
@@ -0,0 +1,243 @@
1
+ ---
2
+ name: deployment-procedures
3
+ description: Production deployment principles and decision-making. Safe deployment workflows, rollback strategies, and verification. Teaches thinking, not scripts.
4
+ compatibility: opencode
5
+ metadata:
6
+ when_to_use: "\"When deploying to production, planning rollback strategies, or setting up CI/CD pipelines. Use with /deploy workflow.\""
7
+ version: "1.0.0"
8
+ ---
9
+ # Deployment Procedures
10
+
11
+ > Deployment principles and decision-making for safe production releases.
12
+ > **Learn to THINK, not memorize scripts.**
13
+
14
+ ---
15
+
16
+ ## ⚠️ How to Use This Skill
17
+
18
+ This skill teaches **deployment principles**, not bash scripts to copy.
19
+
20
+ - Every deployment is unique
21
+ - Understand the WHY behind each step
22
+ - Adapt procedures to your platform
23
+
24
+ ---
25
+
26
+ ## 1. Platform Selection
27
+
28
+ ### Decision Tree
29
+
30
+ ```
31
+ What are you deploying?
32
+
33
+ ├── Static site / JAMstack
34
+ │ └── Vercel, Netlify, Cloudflare Pages
35
+
36
+ ├── Simple web app
37
+ │ ├── Managed → Railway, Render, Fly.io
38
+ │ └── Control → VPS + PM2/Docker
39
+
40
+ ├── Microservices
41
+ │ └── Container orchestration
42
+
43
+ └── Serverless
44
+ └── Edge functions, Lambda
45
+ ```
46
+
47
+ ### Each Platform Has Different Procedures
48
+
49
+ | Platform | Deployment Method |
50
+ |----------|------------------|
51
+ | **Vercel/Netlify** | Git push, auto-deploy |
52
+ | **Railway/Render** | Git push or CLI |
53
+ | **VPS + PM2** | SSH + manual steps |
54
+ | **Docker** | Image push + orchestration |
55
+ | **Kubernetes** | kubectl apply |
56
+
57
+ ---
58
+
59
+ ## 2. Pre-Deployment Principles
60
+
61
+ ### The 4 Verification Categories
62
+
63
+ | Category | What to Check |
64
+ |----------|--------------|
65
+ | **Code Quality** | Tests passing, linting clean, reviewed |
66
+ | **Build** | Production build works, no warnings |
67
+ | **Environment** | Env vars set, secrets current |
68
+ | **Safety** | Backup done, rollback plan ready |
69
+
70
+ ### Pre-Deployment Checklist
71
+
72
+ - [ ] All tests passing
73
+ - [ ] Code reviewed and approved
74
+ - [ ] Production build successful
75
+ - [ ] Environment variables verified
76
+ - [ ] Database migrations ready (if any)
77
+ - [ ] Rollback plan documented
78
+ - [ ] Team notified
79
+ - [ ] Monitoring ready
80
+
81
+ ---
82
+
83
+ ## 3. Deployment Workflow Principles
84
+
85
+ ### The 5-Phase Process
86
+
87
+ ```
88
+ 1. PREPARE
89
+ └── Verify code, build, env vars
90
+
91
+ 2. BACKUP
92
+ └── Save current state before changing
93
+
94
+ 3. DEPLOY
95
+ └── Execute with monitoring open
96
+
97
+ 4. VERIFY
98
+ └── Health check, logs, key flows
99
+
100
+ 5. CONFIRM or ROLLBACK
101
+ └── All good? Confirm. Issues? Rollback.
102
+ ```
103
+
104
+ ### Phase Principles
105
+
106
+ | Phase | Principle |
107
+ |-------|-----------|
108
+ | **Prepare** | Never deploy untested code |
109
+ | **Backup** | Can't rollback without backup |
110
+ | **Deploy** | Watch it happen, don't walk away |
111
+ | **Verify** | Trust but verify |
112
+ | **Confirm** | Have rollback trigger ready |
113
+
114
+ ---
115
+
116
+ ## 4. Post-Deployment Verification
117
+
118
+ ### What to Verify
119
+
120
+ | Check | Why |
121
+ |-------|-----|
122
+ | **Health endpoint** | Service is running |
123
+ | **Error logs** | No new errors |
124
+ | **Key user flows** | Critical features work |
125
+ | **Performance** | Response times acceptable |
126
+
127
+ ### Verification Window
128
+
129
+ - **First 5 minutes**: Active monitoring
130
+ - **15 minutes**: Confirm stable
131
+ - **1 hour**: Final verification
132
+ - **Next day**: Review metrics
133
+
134
+ ---
135
+
136
+ ## 5. Rollback Principles
137
+
138
+ ### When to Rollback
139
+
140
+ | Symptom | Action |
141
+ |---------|--------|
142
+ | Service down | Rollback immediately |
143
+ | Critical errors | Rollback |
144
+ | Performance >50% degraded | Consider rollback |
145
+ | Minor issues | Fix forward if quick |
146
+
147
+ ### Rollback Strategy by Platform
148
+
149
+ | Platform | Rollback Method |
150
+ |----------|----------------|
151
+ | **Vercel/Netlify** | Redeploy previous commit |
152
+ | **Railway/Render** | Rollback in dashboard |
153
+ | **VPS + PM2** | Restore backup, restart |
154
+ | **Docker** | Previous image tag |
155
+ | **K8s** | kubectl rollout undo |
156
+
157
+ ### Rollback Principles
158
+
159
+ 1. **Speed over perfection**: Rollback first, debug later
160
+ 2. **Don't compound errors**: One rollback, not multiple changes
161
+ 3. **Communicate**: Tell team what happened
162
+ 4. **Post-mortem**: Understand why after stable
163
+
164
+ ---
165
+
166
+ ## 6. Zero-Downtime Deployment
167
+
168
+ ### Strategies
169
+
170
+ | Strategy | How It Works |
171
+ |----------|--------------|
172
+ | **Rolling** | Replace instances one by one |
173
+ | **Blue-Green** | Switch traffic between environments |
174
+ | **Canary** | Gradual traffic shift |
175
+
176
+ ### Selection Principles
177
+
178
+ | Scenario | Strategy |
179
+ |----------|----------|
180
+ | Standard release | Rolling |
181
+ | High-risk change | Blue-green (easy rollback) |
182
+ | Need validation | Canary (test with real traffic) |
183
+
184
+ ---
185
+
186
+ ## 7. Emergency Procedures
187
+
188
+ ### Service Down Priority
189
+
190
+ 1. **Assess**: What's the symptom?
191
+ 2. **Quick fix**: Restart if unclear
192
+ 3. **Rollback**: If restart doesn't help
193
+ 4. **Investigate**: After stable
194
+
195
+ ### Investigation Order
196
+
197
+ | Check | Common Issues |
198
+ |-------|--------------|
199
+ | **Logs** | Errors, exceptions |
200
+ | **Resources** | Disk full, memory |
201
+ | **Network** | DNS, firewall |
202
+ | **Dependencies** | Database, APIs |
203
+
204
+ ---
205
+
206
+ ## 8. Anti-Patterns
207
+
208
+ | ❌ Don't | ✅ Do |
209
+ |----------|-------|
210
+ | Deploy on Friday | Deploy early in week |
211
+ | Rush deployment | Follow the process |
212
+ | Skip staging | Always test first |
213
+ | Deploy without backup | Backup before deploy |
214
+ | Walk away after deploy | Monitor for 15+ min |
215
+ | Multiple changes at once | One change at a time |
216
+
217
+ ---
218
+
219
+ ## 9. Decision Checklist
220
+
221
+ Before deploying:
222
+
223
+ - [ ] **Platform-appropriate procedure?**
224
+ - [ ] **Backup strategy ready?**
225
+ - [ ] **Rollback plan documented?**
226
+ - [ ] **Monitoring configured?**
227
+ - [ ] **Team notified?**
228
+ - [ ] **Time to monitor after?**
229
+
230
+ ---
231
+
232
+ ## 10. Best Practices
233
+
234
+ 1. **Small, frequent deploys** over big releases
235
+ 2. **Feature flags** for risky changes
236
+ 3. **Automate** repetitive steps
237
+ 4. **Document** every deployment
238
+ 5. **Review** what went wrong after issues
239
+ 6. **Test rollback** before you need it
240
+
241
+ ---
242
+
243
+ > **Remember:** Every deployment is a risk. Minimize risk through preparation, not speed.
@@ -0,0 +1,185 @@
1
+ ---
2
+ name: design-spec
3
+ description: How to author a DESIGN.md file — the machine-readable design-token + human-rationale format that must exist before any UI is built. YAML front-matter token schema (colors, typography, spacing, rounded, components), type system, token references, and canonical section order.
4
+ compatibility: opencode
5
+ metadata:
6
+ when_to_use: "\"BEFORE writing any UI code (web or mobile). Read when creating or updating a project's DESIGN.md, defining design tokens, or when a UI task needs a design source-of-truth. Pair with frontend-design ("
7
+ version: "1.0.0"
8
+ ---
9
+ # DESIGN.md Specification
10
+
11
+ > A DESIGN.md is the **single source of truth** for a project's visual language. Create it BEFORE building UI.
12
+ > Two layers: machine-readable **design tokens** (YAML front matter) + human-readable **rationale** (markdown body).
13
+ > Tokens are normative; prose gives context. Prose may use descriptive names ("Midnight Forest Green") that map to systematic token names (`primary`).
14
+ >
15
+ > _Format adapted from the [DESIGN.md spec](https://github.com/google-labs-code/design.md) (Google Labs, Apache-2.0). A linter/exporter exists: `npx @google/design.md`._
16
+ >
17
+ > 📚 **Reference library:** [collection.md](collection.md) — 70+ real-world DESIGN.md files (Airbnb, Stripe, Linear, Vercel, Apple…) to study or adapt as a starting point.
18
+
19
+ ---
20
+
21
+ ## When to produce a DESIGN.md
22
+
23
+ This is a **hard gate** for UI work (see `.opencode/rules/design-rules.md`): before writing components, pages, or styles, a `DESIGN.md` must exist at the project root. If absent, create it first from the brief; if present, read it and conform.
24
+
25
+ The token block converts cleanly to/from `tokens.json`, Figma variables, and Tailwind theme config — so it is the bridge between design intent and code.
26
+
27
+ ---
28
+
29
+ ## 1. File structure
30
+
31
+ ```
32
+ ---
33
+ <YAML token front matter>
34
+ ---
35
+
36
+ # Project Name (optional title)
37
+
38
+ ## Overview
39
+ ## Colors
40
+ ## Typography
41
+ ## Layout
42
+ ## Elevation & Depth
43
+ ## Shapes
44
+ ## Components
45
+ ## Do's and Don'ts
46
+ ```
47
+
48
+ Front matter MUST begin and end with a line containing exactly `---`. Sections use `##` headings, appear in the order above, and may be omitted if irrelevant. Domain-specific sections may be added.
49
+
50
+ ---
51
+
52
+ ## 2. Token schema (YAML front matter)
53
+
54
+ ```yaml
55
+ version: alpha # optional
56
+ name: Daylight Prestige
57
+ description: ... # optional
58
+ colors:
59
+ <token-name>: "#RRGGBB"
60
+ typography:
61
+ <token-name>:
62
+ fontFamily: Public Sans
63
+ fontSize: 48px
64
+ fontWeight: 600
65
+ lineHeight: 1.1
66
+ letterSpacing: -0.02em
67
+ rounded:
68
+ <scale>: 8px
69
+ spacing:
70
+ <scale>: 16px # Dimension or unitless number
71
+ components:
72
+ <component-name>:
73
+ backgroundColor: "{colors.primary}"
74
+ rounded: "{rounded.md}"
75
+ padding: 12px
76
+ ```
77
+
78
+ `<scale>` is a named level: `xs sm md lg xl full` (any descriptive key is valid).
79
+
80
+ ---
81
+
82
+ ## 3. Type system
83
+
84
+ | Type | Format | Example |
85
+ |------|--------|---------|
86
+ | Color | `#` + hex (sRGB) | `"#1A1C1E"` |
87
+ | Dimension | number + unit (`px`/`em`/`rem`) | `48px`, `-0.02em` |
88
+ | Token Reference | `{path.to.token}` | `{colors.primary}` |
89
+ | Typography | composite object | see §4 |
90
+
91
+ **Typography properties:** `fontFamily` (string), `fontSize` (Dimension), `fontWeight` (number — bare or quoted are equivalent in YAML), `lineHeight` (Dimension or unitless multiplier — unitless recommended), `letterSpacing` (Dimension), `fontFeature` (string), `fontVariation` (string).
92
+
93
+ **Token references:** wrapped in `{}` pointing to another value in the tree. Most groups must reference a **primitive** (`{colors.primary-60}`), not a group. Inside `components`, references to **composite** values are allowed (`{typography.label-md}`).
94
+
95
+ **Component property tokens:** `backgroundColor`, `textColor` (Color); `typography` (Typography); `rounded`, `padding`, `size`, `height`, `width` (Dimension).
96
+
97
+ **Variants:** define UI states as separate entries with a related key — `button-primary`, `button-primary-hover`.
98
+
99
+ ---
100
+
101
+ ## 4. Sections (canonical order)
102
+
103
+ | # | Section | Aliases | Purpose |
104
+ |---|---------|---------|---------|
105
+ | 1 | Overview | Brand & Style | Brand personality, audience, emotional tone. Fallback context when a token isn't defined. |
106
+ | 2 | Colors | | Palettes; at least `primary`. Common: primary/secondary/tertiary/neutral. |
107
+ | 3 | Typography | | 9–15 levels, each a semantic role (headline/body/label) × size. |
108
+ | 4 | Layout | Layout & Spacing | Grid model, spacing scale, containment. |
109
+ | 5 | Elevation & Depth | Elevation | Shadows, OR for flat designs the alternative (borders, tonal layers, contrast). |
110
+ | 6 | Shapes | | Corner radii, edge treatment, shape language. |
111
+ | 7 | Components | | Per-atom guidance: Buttons, Inputs, Cards, Chips, Lists, etc. |
112
+ | 8 | Do's and Don'ts | | Guardrails during generation. |
113
+
114
+ ---
115
+
116
+ ## 5. Recommended token names (guidance, not required)
117
+
118
+ - **Colors:** `primary secondary tertiary neutral surface on-surface error`
119
+ - **Typography:** `headline-display headline-lg headline-md body-lg body-md body-sm label-lg label-md label-sm`
120
+ - **Rounded:** `none sm md lg xl full`
121
+
122
+ ---
123
+
124
+ ## 6. Consumer behavior for unknown content
125
+
126
+ The spec is extensible. When encountering content it doesn't define:
127
+
128
+ | Scenario | Behavior |
129
+ |----------|----------|
130
+ | Unknown section heading (`## Iconography`) | Preserve; do not error |
131
+ | Unknown color token name | Accept if value is valid |
132
+ | Unknown typography token name | Accept as valid typography |
133
+ | Unknown spacing value | Accept; store as string if not a valid dimension |
134
+ | Unknown component property | Accept with warning |
135
+ | **Duplicate section heading** (two `## Colors`) | **Error; reject the file** |
136
+
137
+ ---
138
+
139
+ ## 7. Minimal example
140
+
141
+ ```markdown
142
+ ---
143
+ name: Calm Scheduler
144
+ colors:
145
+ primary: "#1A1C1E"
146
+ tertiary: "#B8422E"
147
+ neutral: "#F7F5F2"
148
+ typography:
149
+ h1: { fontFamily: Public Sans, fontSize: 48px, fontWeight: 600, lineHeight: 1.1 }
150
+ body-md: { fontFamily: Public Sans, fontSize: 16px, fontWeight: 400, lineHeight: 1.6 }
151
+ rounded: { sm: 4px, md: 8px }
152
+ spacing: { sm: 8px, md: 16px, lg: 32px }
153
+ components:
154
+ button-primary:
155
+ backgroundColor: "{colors.tertiary}"
156
+ rounded: "{rounded.md}"
157
+ padding: 12px
158
+ ---
159
+
160
+ # Calm Scheduler
161
+
162
+ ## Overview
163
+ A calm, professional interface for a healthcare scheduling platform.
164
+ Accessibility-first: high contrast, generous touch targets.
165
+
166
+ ## Colors
167
+ - **Primary (#1A1C1E):** Deep ink for headlines and core text.
168
+ - **Tertiary (#B8422E):** The sole driver for interaction.
169
+ - **Neutral (#F7F5F2):** Warm limestone foundation.
170
+
171
+ ## Do's and Don'ts
172
+ - Do use the tertiary color only for the single most important action per screen.
173
+ - Don't mix rounded and sharp corners in the same view.
174
+ - Do maintain WCAG AA contrast (4.5:1 for normal text).
175
+ ```
176
+
177
+ ---
178
+
179
+ ## Workflow
180
+
181
+ 1. Read the brief and infer the design direction (see `frontend-design` / `mobile-design`).
182
+ 2. **ALWAYS read [collection.md](collection.md) first** — 70+ real-world DESIGN.md files. Find the 1–2 closest in vibe/industry to the brief, open their `DESIGN.md` on GitHub, and study how they structure tokens. Adapt, never blindly copy.
183
+ 3. **Write `DESIGN.md` at the project root** — tokens first, then rationale prose.
184
+ 4. Build UI strictly against the tokens. Descriptive names in prose must map to token names.
185
+ 5. Keep DESIGN.md in sync when the visual language changes — it stays the source of truth.