@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,120 @@
1
+ #!/usr/bin/env python3
2
+ """Analyze built JavaScript/CSS asset sizes without external dependencies."""
3
+ from __future__ import annotations
4
+
5
+ import argparse
6
+ import gzip
7
+ import json
8
+ from datetime import datetime, timezone
9
+ from pathlib import Path
10
+ from typing import Any
11
+
12
+ SKIP_DIRS = {"node_modules", ".git", ".agents", ".agent", ".venv", "venv"}
13
+ BUILD_ROOTS = (".next/static", "dist", "build/static", "build/assets", "out/_next/static")
14
+ SEVERITY = {"none": 99, "low": 1, "medium": 2, "high": 3, "critical": 4}
15
+
16
+
17
+ def human_bytes(value: int) -> str:
18
+ units = ("B", "KiB", "MiB", "GiB")
19
+ size = float(value)
20
+ for unit in units:
21
+ if size < 1024 or unit == units[-1]:
22
+ return f"{size:.1f} {unit}"
23
+ size /= 1024
24
+ return f"{value} B"
25
+
26
+
27
+ def analyze(root: Path, file_warn_kib: int, file_fail_kib: int, total_fail_kib: int) -> dict[str, Any]:
28
+ assets: list[dict[str, Any]] = []
29
+ seen: set[Path] = set()
30
+ for relative in BUILD_ROOTS:
31
+ build_root = root / relative
32
+ if not build_root.is_dir():
33
+ continue
34
+ for path in build_root.rglob("*"):
35
+ if not path.is_file() or path.suffix.lower() not in {".js", ".mjs", ".css"}:
36
+ continue
37
+ resolved = path.resolve()
38
+ if resolved in seen:
39
+ continue
40
+ seen.add(resolved)
41
+ try:
42
+ data = path.read_bytes()
43
+ except OSError:
44
+ continue
45
+ assets.append({
46
+ "file": path.relative_to(root).as_posix(),
47
+ "type": path.suffix.lower().lstrip("."),
48
+ "bytes": len(data),
49
+ "gzip_bytes": len(gzip.compress(data, compresslevel=6)),
50
+ })
51
+
52
+ findings: list[dict[str, Any]] = []
53
+ for asset in assets:
54
+ kib = asset["bytes"] / 1024
55
+ if kib >= file_fail_kib:
56
+ findings.append({"severity": "high", "issue": "Oversized asset", "file": asset["file"], "size": human_bytes(asset["bytes"])})
57
+ elif kib >= file_warn_kib:
58
+ findings.append({"severity": "medium", "issue": "Large asset", "file": asset["file"], "size": human_bytes(asset["bytes"])})
59
+
60
+ js_total = sum(a["bytes"] for a in assets if a["type"] in {"js", "mjs"})
61
+ if js_total / 1024 >= total_fail_kib:
62
+ findings.append({"severity": "high", "issue": "Large total JavaScript payload", "file": "<all JS assets>", "size": human_bytes(js_total)})
63
+
64
+ assets.sort(key=lambda item: item["bytes"], reverse=True)
65
+ counts = {severity: sum(f["severity"] == severity for f in findings) for severity in ("critical", "high", "medium", "low")}
66
+ return {
67
+ "project": str(root),
68
+ "timestamp": datetime.now(timezone.utc).isoformat(),
69
+ "build_roots_checked": [name for name in BUILD_ROOTS if (root / name).is_dir()],
70
+ "asset_count": len(assets),
71
+ "totals": {
72
+ "bytes": sum(a["bytes"] for a in assets),
73
+ "gzip_bytes": sum(a["gzip_bytes"] for a in assets),
74
+ "javascript_bytes": js_total,
75
+ "css_bytes": sum(a["bytes"] for a in assets if a["type"] == "css"),
76
+ },
77
+ "largest_assets": assets[:30],
78
+ "findings": findings,
79
+ "summary": {"total": len(findings), **counts},
80
+ }
81
+
82
+
83
+ def should_fail(report: dict[str, Any], threshold: str) -> bool:
84
+ if threshold == "none":
85
+ return False
86
+ rank = SEVERITY[threshold]
87
+ return any(report["summary"].get(level, 0) and value >= rank for level, value in SEVERITY.items() if level != "none")
88
+
89
+
90
+ def main() -> int:
91
+ parser = argparse.ArgumentParser(description="Audit generated JavaScript and CSS bundle sizes")
92
+ parser.add_argument("project", nargs="?", default=".")
93
+ parser.add_argument("--output", choices=["json", "summary"], default="summary")
94
+ parser.add_argument("--file-warn-kib", type=int, default=250)
95
+ parser.add_argument("--file-fail-kib", type=int, default=750)
96
+ parser.add_argument("--total-js-fail-kib", type=int, default=2048)
97
+ parser.add_argument("--fail-on", choices=list(SEVERITY), default="high")
98
+ args = parser.parse_args()
99
+ root = Path(args.project).resolve()
100
+ if not root.is_dir():
101
+ parser.error(f"Project directory does not exist: {root}")
102
+ report = analyze(root, args.file_warn_kib, args.file_fail_kib, args.total_js_fail_kib)
103
+ if args.output == "json":
104
+ print(json.dumps(report, indent=2, ensure_ascii=False))
105
+ else:
106
+ totals = report["totals"]
107
+ print(f"Bundle Analysis: {root}")
108
+ if not report["build_roots_checked"]:
109
+ print("[SKIP] No supported build output found. Build the project first for meaningful results.")
110
+ else:
111
+ print(f"Assets: {report['asset_count']} | Raw: {human_bytes(totals['bytes'])} | Gzip: {human_bytes(totals['gzip_bytes'])}")
112
+ for asset in report["largest_assets"][:10]:
113
+ print(f"{human_bytes(asset['bytes']):>10} ({human_bytes(asset['gzip_bytes'])} gzip) {asset['file']}")
114
+ for finding in report["findings"]:
115
+ print(f"[{finding['severity'].upper()}] {finding['issue']}: {finding['file']} ({finding['size']})")
116
+ return 1 if should_fail(report, args.fail_on) else 0
117
+
118
+
119
+ if __name__ == "__main__":
120
+ raise SystemExit(main())
@@ -0,0 +1,108 @@
1
+ #!/usr/bin/env python3
2
+ """Run a Lighthouse audit and enforce configurable quality thresholds."""
3
+ from __future__ import annotations
4
+
5
+ import argparse
6
+ import json
7
+ import os
8
+ import shutil
9
+ import subprocess
10
+ import tempfile
11
+ from pathlib import Path
12
+ from urllib.parse import urlparse
13
+
14
+
15
+ def valid_url(value: str) -> str:
16
+ parsed = urlparse(value)
17
+ if parsed.scheme not in {"http", "https"} or not parsed.netloc:
18
+ raise argparse.ArgumentTypeError("URL must start with http:// or https://")
19
+ return value
20
+
21
+
22
+ def run_lighthouse(url: str, timeout: int = 180) -> dict:
23
+ executable = shutil.which("lighthouse")
24
+ if not executable:
25
+ return {"url": url, "status": "error", "error": "Lighthouse CLI not found", "fix": "npm install -g lighthouse"}
26
+
27
+ output_path: Path | None = None
28
+ try:
29
+ fd, raw_path = tempfile.mkstemp(prefix="agkit-lighthouse-", suffix=".json")
30
+ os.close(fd)
31
+ output_path = Path(raw_path)
32
+ proc = subprocess.run(
33
+ [
34
+ executable,
35
+ url,
36
+ "--output=json",
37
+ f"--output-path={output_path}",
38
+ "--chrome-flags=--headless --no-sandbox --disable-dev-shm-usage",
39
+ "--only-categories=performance,accessibility,best-practices,seo",
40
+ "--quiet",
41
+ ],
42
+ capture_output=True,
43
+ text=True,
44
+ timeout=timeout,
45
+ check=False,
46
+ )
47
+ if proc.returncode != 0 and (not output_path.exists() or output_path.stat().st_size == 0):
48
+ return {"url": url, "status": "error", "error": "Lighthouse execution failed", "stderr": proc.stderr[-1200:]}
49
+ report = json.loads(output_path.read_text("utf-8"))
50
+ categories = report.get("categories", {})
51
+ scores = {
52
+ "performance": round(float(categories.get("performance", {}).get("score") or 0) * 100),
53
+ "accessibility": round(float(categories.get("accessibility", {}).get("score") or 0) * 100),
54
+ "best_practices": round(float(categories.get("best-practices", {}).get("score") or 0) * 100),
55
+ "seo": round(float(categories.get("seo", {}).get("score") or 0) * 100),
56
+ }
57
+ audits = report.get("audits", {})
58
+ metrics = {}
59
+ for key, label in (
60
+ ("largest-contentful-paint", "lcp_ms"),
61
+ ("cumulative-layout-shift", "cls"),
62
+ ("interaction-to-next-paint", "inp_ms"),
63
+ ("total-blocking-time", "tbt_ms"),
64
+ ):
65
+ value = audits.get(key, {}).get("numericValue")
66
+ if value is not None:
67
+ metrics[label] = round(float(value), 3)
68
+ return {"url": url, "status": "success", "scores": scores, "metrics": metrics}
69
+ except subprocess.TimeoutExpired:
70
+ return {"url": url, "status": "error", "error": f"Lighthouse timed out after {timeout}s"}
71
+ except (OSError, json.JSONDecodeError, ValueError) as exc:
72
+ return {"url": url, "status": "error", "error": str(exc)}
73
+ finally:
74
+ if output_path:
75
+ output_path.unlink(missing_ok=True)
76
+
77
+
78
+ def main() -> int:
79
+ parser = argparse.ArgumentParser(description="Run Lighthouse and enforce score thresholds")
80
+ parser.add_argument("url", type=valid_url)
81
+ parser.add_argument("--min-performance", type=int, default=50)
82
+ parser.add_argument("--min-accessibility", type=int, default=80)
83
+ parser.add_argument("--min-best-practices", type=int, default=80)
84
+ parser.add_argument("--min-seo", type=int, default=80)
85
+ parser.add_argument("--timeout", type=int, default=180)
86
+ args = parser.parse_args()
87
+
88
+ result = run_lighthouse(args.url, args.timeout)
89
+ thresholds = {
90
+ "performance": args.min_performance,
91
+ "accessibility": args.min_accessibility,
92
+ "best_practices": args.min_best_practices,
93
+ "seo": args.min_seo,
94
+ }
95
+ failures = []
96
+ if result.get("status") == "success":
97
+ failures = [name for name, minimum in thresholds.items() if result["scores"].get(name, 0) < minimum]
98
+ result["thresholds"] = thresholds
99
+ result["failed_thresholds"] = failures
100
+ result["passed"] = not failures
101
+ else:
102
+ result["passed"] = False
103
+ print(json.dumps(result, indent=2, ensure_ascii=False))
104
+ return 0 if result["passed"] else 1
105
+
106
+
107
+ if __name__ == "__main__":
108
+ raise SystemExit(main())
@@ -0,0 +1,153 @@
1
+ ---
2
+ name: plan-writing
3
+ description: Structured task planning with clear breakdowns, dependencies, and verification criteria. Use when implementing features, refactoring, or any multi-step work.
4
+ compatibility: opencode
5
+ metadata:
6
+ when_to_use: "\"When creating structured task plans, breaking down features into tasks, or defining verification criteria. Use with /plan workflow.\""
7
+ version: "1.0.0"
8
+ ---
9
+ # Plan Writing
10
+
11
+ > Source: obra/superpowers
12
+
13
+ ## Overview
14
+ This skill provides a framework for breaking down work into clear, actionable tasks with verification criteria.
15
+
16
+ ## Task Breakdown Principles
17
+
18
+ ### 1. Small, Focused Tasks
19
+ - Each task should take 2-5 minutes
20
+ - One clear outcome per task
21
+ - Independently verifiable
22
+
23
+ ### 2. Clear Verification
24
+ - How do you know it's done?
25
+ - What can you check/test?
26
+ - What's the expected output?
27
+
28
+ ### 3. Logical Ordering
29
+ - Dependencies identified
30
+ - Parallel work where possible
31
+ - Critical path highlighted
32
+ - **Phase X: Verification is always LAST**
33
+
34
+ ### 4. Dynamic Naming in Project Root
35
+ - Plan files are saved as `{task-slug}.md` in the PROJECT ROOT
36
+ - Name derived from task (e.g., "add auth" → `auth-feature.md`)
37
+ - **NEVER** inside `.opencode/`, `docs/`, or temp folders
38
+
39
+ ## Planning Principles (NOT Templates!)
40
+
41
+ > 🔴 **NO fixed templates. Each plan is UNIQUE to the task.**
42
+
43
+ ### Principle 1: Keep It SHORT
44
+
45
+ | ❌ Wrong | ✅ Right |
46
+ |----------|----------|
47
+ | 50 tasks with sub-sub-tasks | 5-10 clear tasks max |
48
+ | Every micro-step listed | Only actionable items |
49
+ | Verbose descriptions | One-line per task |
50
+
51
+ > **Rule:** If plan is longer than 1 page, it's too long. Simplify.
52
+
53
+ ---
54
+
55
+ ### Principle 2: Be SPECIFIC, Not Generic
56
+
57
+ | ❌ Wrong | ✅ Right |
58
+ |----------|----------|
59
+ | "Set up project" | "Run `npx create-next-app`" |
60
+ | "Add authentication" | "Install next-auth, create `/api/auth/[...nextauth].ts`" |
61
+ | "Style the UI" | "Add Tailwind classes to `Header.tsx`" |
62
+
63
+ > **Rule:** Each task should have a clear, verifiable outcome.
64
+
65
+ ---
66
+
67
+ ### Principle 3: Dynamic Content Based on Project Type
68
+
69
+ **For NEW PROJECT:**
70
+ - What tech stack? (decide first)
71
+ - What's the MVP? (minimal features)
72
+ - What's the file structure?
73
+
74
+ **For FEATURE ADDITION:**
75
+ - Which files are affected?
76
+ - What dependencies needed?
77
+ - How to verify it works?
78
+
79
+ **For BUG FIX:**
80
+ - What's the root cause?
81
+ - What file/line to change?
82
+ - How to test the fix?
83
+
84
+ ---
85
+
86
+ ### Principle 4: Scripts Are Project-Specific
87
+
88
+ > 🔴 **DO NOT copy-paste script commands. Choose based on project type.**
89
+
90
+ | Project Type | Relevant Scripts |
91
+ |--------------|------------------|
92
+ | Frontend/React | `ux_audit.py`, `accessibility_checker.py` |
93
+ | Backend/API | `api_validator.py`, `security_scan.py` |
94
+ | Mobile | `mobile_audit.py` |
95
+ | Database | `schema_validator.py` |
96
+ | Full-stack | Mix of above based on what you touched |
97
+
98
+ **Wrong:** Adding all scripts to every plan
99
+ **Right:** Only scripts relevant to THIS task
100
+
101
+ ---
102
+
103
+ ### Principle 5: Verification is Simple
104
+
105
+ | ❌ Wrong | ✅ Right |
106
+ |----------|----------|
107
+ | "Verify the component works correctly" | "Run `npm run dev`, click button, see toast" |
108
+ | "Test the API" | "curl localhost:3000/api/users returns 200" |
109
+ | "Check styles" | "Open browser, verify dark mode toggle works" |
110
+
111
+ ---
112
+
113
+ ## Plan Structure (Flexible, Not Fixed!)
114
+
115
+ ```
116
+ # [Task Name]
117
+
118
+ ## Goal
119
+ One sentence: What are we building/fixing?
120
+
121
+ ## Tasks
122
+ - [ ] Task 1: [Specific action] → Verify: [How to check]
123
+ - [ ] Task 2: [Specific action] → Verify: [How to check]
124
+ - [ ] Task 3: [Specific action] → Verify: [How to check]
125
+
126
+ ## Done When
127
+ - [ ] [Main success criteria]
128
+
129
+ ## Notes
130
+ [Any important considerations]
131
+ ```
132
+
133
+ > **That's it.** No phases, no sub-sections unless truly needed.
134
+ > Keep it minimal. Add complexity only when required.
135
+
136
+ ---
137
+
138
+ ## Best Practices (Quick Reference)
139
+
140
+ 1. **Start with goal** - What are we building/fixing?
141
+ 2. **Max 10 tasks** - If more, break into multiple plans
142
+ 3. **Each task verifiable** - Clear "done" criteria
143
+ 4. **Project-specific** - No copy-paste templates
144
+ 5. **Update as you go** - Mark `[x]` when complete
145
+
146
+ ---
147
+
148
+ ## When to Use
149
+
150
+ - New project from scratch
151
+ - Adding a feature
152
+ - Fixing a bug (if complex)
153
+ - Refactoring multiple files
@@ -0,0 +1,169 @@
1
+ ---
2
+ name: powershell-windows
3
+ description: PowerShell Windows patterns. Critical pitfalls, operator syntax, error handling.
4
+ compatibility: opencode
5
+ metadata:
6
+ when_to_use: "\"When working on Windows systems, writing PowerShell scripts, or using Windows-specific commands. NOT for macOS/Linux.\""
7
+ version: "1.0.0"
8
+ ---
9
+ # PowerShell Windows Patterns
10
+
11
+ > Critical patterns and pitfalls for Windows PowerShell.
12
+
13
+ ---
14
+
15
+ ## 1. Operator Syntax Rules
16
+
17
+ ### CRITICAL: Parentheses Required
18
+
19
+ | ❌ Wrong | ✅ Correct |
20
+ |----------|-----------|
21
+ | `if (Test-Path "a" -or Test-Path "b")` | `if ((Test-Path "a") -or (Test-Path "b"))` |
22
+ | `if (Get-Item $x -and $y -eq 5)` | `if ((Get-Item $x) -and ($y -eq 5))` |
23
+
24
+ **Rule:** Each cmdlet call MUST be in parentheses when using logical operators.
25
+
26
+ ---
27
+
28
+ ## 2. Unicode/Emoji Restriction
29
+
30
+ ### CRITICAL: No Unicode in Scripts
31
+
32
+ | Purpose | ❌ Don't Use | ✅ Use |
33
+ |---------|-------------|--------|
34
+ | Success | ✅ ✓ | [OK] [+] |
35
+ | Error | ❌ ✗ 🔴 | [!] [X] |
36
+ | Warning | ⚠️ 🟡 | [*] [WARN] |
37
+ | Info | ℹ️ 🔵 | [i] [INFO] |
38
+ | Progress | ⏳ | [...] |
39
+
40
+ **Rule:** Use ASCII characters only in PowerShell scripts.
41
+
42
+ ---
43
+
44
+ ## 3. Null Check Patterns
45
+
46
+ ### Always Check Before Access
47
+
48
+ | ❌ Wrong | ✅ Correct |
49
+ |----------|-----------|
50
+ | `$array.Count -gt 0` | `$array -and $array.Count -gt 0` |
51
+ | `$text.Length` | `if ($text) { $text.Length }` |
52
+
53
+ ---
54
+
55
+ ## 4. String Interpolation
56
+
57
+ ### Complex Expressions
58
+
59
+ | ❌ Wrong | ✅ Correct |
60
+ |----------|-----------|
61
+ | `"Value: $($obj.prop.sub)"` | Store in variable first |
62
+
63
+ **Pattern:**
64
+ ```
65
+ $value = $obj.prop.sub
66
+ Write-Output "Value: $value"
67
+ ```
68
+
69
+ ---
70
+
71
+ ## 5. Error Handling
72
+
73
+ ### ErrorActionPreference
74
+
75
+ | Value | Use |
76
+ |-------|-----|
77
+ | Stop | Development (fail fast) |
78
+ | Continue | Production scripts |
79
+ | SilentlyContinue | When errors expected |
80
+
81
+ ### Try/Catch Pattern
82
+
83
+ - Don't return inside try block
84
+ - Use finally for cleanup
85
+ - Return after try/catch
86
+
87
+ ---
88
+
89
+ ## 6. File Paths
90
+
91
+ ### Windows Path Rules
92
+
93
+ | Pattern | Use |
94
+ |---------|-----|
95
+ | Literal path | `C:\Users\User\file.txt` |
96
+ | Variable path | `Join-Path $env:USERPROFILE "file.txt"` |
97
+ | Relative | `Join-Path $ScriptDir "data"` |
98
+
99
+ **Rule:** Use Join-Path for cross-platform safety.
100
+
101
+ ---
102
+
103
+ ## 7. Array Operations
104
+
105
+ ### Correct Patterns
106
+
107
+ | Operation | Syntax |
108
+ |-----------|--------|
109
+ | Empty array | `$array = @()` |
110
+ | Add item | `$array += $item` |
111
+ | ArrayList add | `$list.Add($item) \| Out-Null` |
112
+
113
+ ---
114
+
115
+ ## 8. JSON Operations
116
+
117
+ ### CRITICAL: Depth Parameter
118
+
119
+ | ❌ Wrong | ✅ Correct |
120
+ |----------|-----------|
121
+ | `ConvertTo-Json` | `ConvertTo-Json -Depth 10` |
122
+
123
+ **Rule:** Always specify `-Depth` for nested objects.
124
+
125
+ ### File Operations
126
+
127
+ | Operation | Pattern |
128
+ |-----------|---------|
129
+ | Read | `Get-Content "file.json" -Raw \| ConvertFrom-Json` |
130
+ | Write | `$data \| ConvertTo-Json -Depth 10 \| Out-File "file.json" -Encoding UTF8` |
131
+
132
+ ---
133
+
134
+ ## 9. Common Errors
135
+
136
+ | Error Message | Cause | Fix |
137
+ |---------------|-------|-----|
138
+ | "parameter 'or'" | Missing parentheses | Wrap cmdlets in () |
139
+ | "Unexpected token" | Unicode character | Use ASCII only |
140
+ | "Cannot find property" | Null object | Check null first |
141
+ | "Cannot convert" | Type mismatch | Use .ToString() |
142
+
143
+ ---
144
+
145
+ ## 10. Script Template
146
+
147
+ ```powershell
148
+ # Strict mode
149
+ Set-StrictMode -Version Latest
150
+ $ErrorActionPreference = "Continue"
151
+
152
+ # Paths
153
+ $ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
154
+
155
+ # Main
156
+ try {
157
+ # Logic here
158
+ Write-Output "[OK] Done"
159
+ exit 0
160
+ }
161
+ catch {
162
+ Write-Warning "Error: $_"
163
+ exit 1
164
+ }
165
+ ```
166
+
167
+ ---
168
+
169
+ > **Remember:** PowerShell has unique syntax rules. Parentheses, ASCII-only, and null checks are non-negotiable.