@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,252 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ React Performance Checker
4
+ Automated performance audit for React/Next.js projects
5
+ Based on Vercel Engineering best practices
6
+ """
7
+
8
+ import os
9
+ import re
10
+ import json
11
+ from pathlib import Path
12
+ from typing import List, Dict, Tuple
13
+
14
+ class PerformanceChecker:
15
+ def __init__(self, project_path: str):
16
+ self.project_path = Path(project_path)
17
+ self.issues = []
18
+ self.warnings = []
19
+ self.passed = []
20
+
21
+ def check_waterfalls(self):
22
+ """Check for sequential await patterns (Section 1)"""
23
+ print("\n[*] Checking for waterfalls (sequential awaits)...")
24
+
25
+ for filepath in self.project_path.rglob('*.{ts,tsx,js,jsx}'):
26
+ if 'node_modules' in str(filepath):
27
+ continue
28
+
29
+ try:
30
+ content = filepath.read_text(encoding='utf-8')
31
+
32
+ # Pattern: multiple awaits in sequence without Promise.all
33
+ sequential_awaits = re.findall(r'await\s+\w+.*?\n\s*await\s+\w+', content)
34
+
35
+ if sequential_awaits:
36
+ self.issues.append({
37
+ 'file': str(filepath.relative_to(self.project_path)),
38
+ 'type': 'CRITICAL',
39
+ 'issue': 'Sequential awaits detected (waterfall)',
40
+ 'fix': 'Use Promise.all() for parallel fetching',
41
+ 'section': '1-async-eliminating-waterfalls.md'
42
+ })
43
+ except Exception as e:
44
+ continue
45
+
46
+ def check_barrel_imports(self):
47
+ """Check for barrel imports (Section 2)"""
48
+ print("[*] Checking for barrel imports...")
49
+
50
+ for filepath in self.project_path.rglob('*.{ts,tsx,js,jsx}'):
51
+ if 'node_modules' in str(filepath):
52
+ continue
53
+
54
+ try:
55
+ content = filepath.read_text(encoding='utf-8')
56
+
57
+ # Pattern: import from index files or barrel exports
58
+ barrel_imports = re.findall(r"import.*from\s+['\"](@/.*?)/index['\"]", content)
59
+ barrel_imports += re.findall(r"import.*from\s+['\"]\.\.?/.*?['\"](?!.*?\.tsx?)", content)
60
+
61
+ if barrel_imports:
62
+ self.warnings.append({
63
+ 'file': str(filepath.relative_to(self.project_path)),
64
+ 'type': 'CRITICAL',
65
+ 'issue': 'Potential barrel imports detected',
66
+ 'fix': 'Import directly from specific files',
67
+ 'section': '2-bundle-bundle-size-optimization.md'
68
+ })
69
+ except Exception as e:
70
+ continue
71
+
72
+ def check_dynamic_imports(self):
73
+ """Check if large components use dynamic imports (Section 2)"""
74
+ print("[*] Checking for missing dynamic imports...")
75
+
76
+ for filepath in self.project_path.rglob('*.{ts,tsx}'):
77
+ if 'node_modules' in str(filepath):
78
+ continue
79
+
80
+ try:
81
+ content = filepath.read_text(encoding='utf-8')
82
+
83
+ # Check file size - if > 10KB, should probably use dynamic import
84
+ if len(content) > 10000:
85
+ # Check if it's imported statically somewhere
86
+ filename = filepath.stem
87
+
88
+ # Search for static imports of this component
89
+ for check_file in self.project_path.rglob('*.{ts,tsx}'):
90
+ if check_file == filepath or 'node_modules' in str(check_file):
91
+ continue
92
+
93
+ check_content = check_file.read_text(encoding='utf-8')
94
+ if f"import {filename}" in check_content or f"import {{ {filename}" in check_content:
95
+ if 'dynamic(' not in check_content:
96
+ self.warnings.append({
97
+ 'file': str(check_file.relative_to(self.project_path)),
98
+ 'type': 'CRITICAL',
99
+ 'issue': f'Large component {filename} imported statically',
100
+ 'fix': 'Use dynamic() for code splitting',
101
+ 'section': '2-bundle-bundle-size-optimization.md'
102
+ })
103
+ break
104
+ except Exception as e:
105
+ continue
106
+
107
+ def check_useEffect_fetching(self):
108
+ """Check for data fetching in useEffect (Section 4)"""
109
+ print("[*] Checking for useEffect data fetching...")
110
+
111
+ for filepath in self.project_path.rglob('*.{ts,tsx}'):
112
+ if 'node_modules' in str(filepath):
113
+ continue
114
+
115
+ try:
116
+ content = filepath.read_text(encoding='utf-8')
117
+
118
+ # Pattern: fetch or axios in useEffect
119
+ if 'useEffect' in content:
120
+ if re.search(r'useEffect.*?fetch\(', content, re.DOTALL):
121
+ self.warnings.append({
122
+ 'file': str(filepath.relative_to(self.project_path)),
123
+ 'type': 'MEDIUM-HIGH',
124
+ 'issue': 'Data fetching in useEffect',
125
+ 'fix': 'Consider using SWR or React Query for deduplication',
126
+ 'section': '4-client-client-side-data-fetching.md'
127
+ })
128
+ except Exception as e:
129
+ continue
130
+
131
+ def check_missing_memoization(self):
132
+ """Check for missing React.memo, useMemo, useCallback (Section 5)"""
133
+ print("[*] Checking for missing memoization...")
134
+
135
+ for filepath in self.project_path.rglob('*.{tsx}'):
136
+ if 'node_modules' in str(filepath):
137
+ continue
138
+
139
+ try:
140
+ content = filepath.read_text(encoding='utf-8')
141
+
142
+ # Check for component definitions without memo
143
+ components = re.findall(r'(?:export\s+)?(?:const|function)\s+([A-Z]\w+)', content)
144
+
145
+ if components and 'React.memo' not in content and 'memo(' not in content:
146
+ # Check if component receives props
147
+ if 'props:' in content or 'Props>' in content:
148
+ self.warnings.append({
149
+ 'file': str(filepath.relative_to(self.project_path)),
150
+ 'type': 'MEDIUM',
151
+ 'issue': 'Component with props not memoized',
152
+ 'fix': 'Consider using React.memo if props are stable',
153
+ 'section': '5-rerender-re-render-optimization.md'
154
+ })
155
+ except Exception as e:
156
+ continue
157
+
158
+ def check_image_optimization(self):
159
+ """Check for unoptimized images (Section 6)"""
160
+ print("[*] Checking for image optimization...")
161
+
162
+ for filepath in self.project_path.rglob('*.{ts,tsx,js,jsx}'):
163
+ if 'node_modules' in str(filepath):
164
+ continue
165
+
166
+ try:
167
+ content = filepath.read_text(encoding='utf-8')
168
+
169
+ # Check for <img> tags instead of next/image
170
+ if '<img' in content and 'next/image' not in content:
171
+ self.warnings.append({
172
+ 'file': str(filepath.relative_to(self.project_path)),
173
+ 'type': 'MEDIUM',
174
+ 'issue': 'Using <img> instead of next/image',
175
+ 'fix': 'Use next/image for automatic optimization',
176
+ 'section': '6-rendering-rendering-performance.md'
177
+ })
178
+ except Exception as e:
179
+ continue
180
+
181
+ def generate_report(self):
182
+ """Generate final report"""
183
+ print("\n" + "="*60)
184
+ print("REACT PERFORMANCE AUDIT REPORT")
185
+ print("="*60)
186
+
187
+ print(f"\n[CRITICAL ISSUES] ({len([i for i in self.issues if i['type'] == 'CRITICAL'])})")
188
+ for issue in self.issues:
189
+ if issue['type'] == 'CRITICAL':
190
+ print(f" - {issue['file']}")
191
+ print(f" Issue: {issue['issue']}")
192
+ print(f" Fix: {issue['fix']}")
193
+ print(f" Reference: {issue['section']}\n")
194
+
195
+ print(f"\n[WARNINGS] ({len(self.warnings)})")
196
+ for warning in self.warnings[:10]: # Show first 10
197
+ print(f" - {warning['file']}")
198
+ print(f" Issue: {warning['issue']}")
199
+ print(f" Fix: {warning['fix']}")
200
+ print(f" Reference: {warning['section']}\n")
201
+
202
+ if len(self.warnings) > 10:
203
+ print(f" ... and {len(self.warnings) - 10} more warnings")
204
+
205
+ print("\n" + "="*60)
206
+ print(f"SUMMARY:")
207
+ print(f" Critical Issues: {len([i for i in self.issues if i['type'] == 'CRITICAL'])}")
208
+ print(f" Warnings: {len(self.warnings)}")
209
+ print("="*60)
210
+
211
+ if len(self.issues) == 0 and len(self.warnings) == 0:
212
+ print("\n[SUCCESS] No major performance issues detected!")
213
+ else:
214
+ print("\n[ACTION REQUIRED] Review and fix issues above")
215
+ print("Priority: CRITICAL > HIGH > MEDIUM > LOW")
216
+
217
+ def run(self):
218
+ """Run all checks"""
219
+ print("="*60)
220
+ print("React Performance Checker (Vercel Engineering)")
221
+ print("="*60)
222
+ print(f"Scanning: {self.project_path}")
223
+
224
+ self.check_waterfalls()
225
+ self.check_barrel_imports()
226
+ self.check_dynamic_imports()
227
+ self.check_useEffect_fetching()
228
+ self.check_missing_memoization()
229
+ self.check_image_optimization()
230
+
231
+ self.generate_report()
232
+
233
+
234
+ def main():
235
+ import sys
236
+
237
+ if len(sys.argv) < 2:
238
+ print("Usage: python react_performance_checker.py <project_path>")
239
+ sys.exit(1)
240
+
241
+ project_path = sys.argv[1]
242
+
243
+ if not os.path.exists(project_path):
244
+ print(f"[ERROR] Path not found: {project_path}")
245
+ sys.exit(1)
246
+
247
+ checker = PerformanceChecker(project_path)
248
+ checker.run()
249
+
250
+
251
+ if __name__ == '__main__':
252
+ main()
@@ -0,0 +1,175 @@
1
+ ---
2
+ name: parallel-agents
3
+ description: Multi-agent orchestration patterns. Use when multiple independent tasks can run with different domain expertise or when comprehensive analysis requires multiple perspectives.
4
+ allowed-tools: Read, Glob, Grep
5
+ ---
6
+
7
+ # Native Parallel Agents
8
+
9
+ > Orchestration through Opencode's built-in Agent Tool
10
+
11
+ ## Overview
12
+
13
+ This skill enables coordinating multiple specialized agents through Opencode's native agent system. Unlike external scripts, this approach keeps all orchestration within Opencode's control.
14
+
15
+ ## When to Use Orchestration
16
+
17
+ **Good for:**
18
+ - Complex tasks requiring multiple expertise domains
19
+ - Code analysis from security, performance, and quality perspectives
20
+ - Comprehensive reviews (architecture + security + testing)
21
+ - Feature implementation needing backend + frontend + database work
22
+
23
+ **Not for:**
24
+ - Simple, single-domain tasks
25
+ - Quick fixes or small changes
26
+ - Tasks where one agent suffices
27
+
28
+ ---
29
+
30
+ ## Native Agent Invocation
31
+
32
+ ### Single Agent
33
+ ```
34
+ Use the security-auditor agent to review authentication
35
+ ```
36
+
37
+ ### Sequential Chain
38
+ ```
39
+ First, use the explorer-agent to discover project structure.
40
+ Then, use the backend-specialist to review API endpoints.
41
+ Finally, use the test-engineer to identify test gaps.
42
+ ```
43
+
44
+ ### With Context Passing
45
+ ```
46
+ Use the frontend-specialist to analyze React components.
47
+ Based on those findings, have the test-engineer generate component tests.
48
+ ```
49
+
50
+ ### Resume Previous Work
51
+ ```
52
+ Resume agent [agentId] and continue with additional requirements.
53
+ ```
54
+
55
+ ---
56
+
57
+ ## Orchestration Patterns
58
+
59
+ ### Pattern 1: Comprehensive Analysis
60
+ ```
61
+ Agents: explorer-agent → [domain-agents] → synthesis
62
+
63
+ 1. explorer-agent: Map codebase structure
64
+ 2. security-auditor: Security posture
65
+ 3. backend-specialist: API quality
66
+ 4. frontend-specialist: UI/UX patterns
67
+ 5. test-engineer: Test coverage
68
+ 6. Synthesize all findings
69
+ ```
70
+
71
+ ### Pattern 2: Feature Review
72
+ ```
73
+ Agents: affected-domain-agents → test-engineer
74
+
75
+ 1. Identify affected domains (backend? frontend? both?)
76
+ 2. Invoke relevant domain agents
77
+ 3. test-engineer verifies changes
78
+ 4. Synthesize recommendations
79
+ ```
80
+
81
+ ### Pattern 3: Security Audit
82
+ ```
83
+ Agents: security-auditor → penetration-tester → synthesis
84
+
85
+ 1. security-auditor: Configuration and code review
86
+ 2. penetration-tester: Active vulnerability testing
87
+ 3. Synthesize with prioritized remediation
88
+ ```
89
+
90
+ ---
91
+
92
+ ## Available Agents
93
+
94
+ | Agent | Expertise | Trigger Phrases |
95
+ |-------|-----------|-----------------|
96
+ | `orchestrator` | Coordination | "comprehensive", "multi-perspective" |
97
+ | `security-auditor` | Security | "security", "auth", "vulnerabilities" |
98
+ | `penetration-tester` | Security Testing | "pentest", "red team", "exploit" |
99
+ | `backend-specialist` | Backend | "API", "server", "Node.js", "Express" |
100
+ | `frontend-specialist` | Frontend | "React", "UI", "components", "Next.js" |
101
+ | `test-engineer` | Testing | "tests", "coverage", "TDD" |
102
+ | `devops-engineer` | DevOps | "deploy", "CI/CD", "infrastructure" |
103
+ | `database-architect` | Database | "schema", "Prisma", "migrations" |
104
+ | `mobile-developer` | Mobile | "React Native", "Flutter", "mobile" |
105
+ | `api-designer` | API Design | "REST", "GraphQL", "OpenAPI" |
106
+ | `debugger` | Debugging | "bug", "error", "not working" |
107
+ | `explorer-agent` | Discovery | "explore", "map", "structure" |
108
+ | `documentation-writer` | Documentation | "write docs", "create README", "generate API docs" |
109
+ | `performance-optimizer` | Performance | "slow", "optimize", "profiling" |
110
+ | `project-planner` | Planning | "plan", "roadmap", "milestones" |
111
+ | `seo-specialist` | SEO | "SEO", "meta tags", "search ranking" |
112
+ | `game-developer` | Game Development | "game", "Unity", "Godot", "Phaser" |
113
+
114
+ ---
115
+
116
+ ## Opencode Built-in Agents
117
+
118
+ These work alongside custom agents:
119
+
120
+ | Agent | Model | Purpose |
121
+ |-------|-------|---------|
122
+ | **Explore** | Haiku | Fast read-only codebase search |
123
+ | **Plan** | Sonnet | Research during plan mode |
124
+ | **General-purpose** | Sonnet | Complex multi-step modifications |
125
+
126
+ Use **Explore** for quick searches, **custom agents** for domain expertise.
127
+
128
+ ---
129
+
130
+ ## Synthesis Protocol
131
+
132
+ After all agents complete, synthesize:
133
+
134
+ ```markdown
135
+ ## Orchestration Synthesis
136
+
137
+ ### Task Summary
138
+ [What was accomplished]
139
+
140
+ ### Agent Contributions
141
+ | Agent | Finding |
142
+ |-------|---------|
143
+ | security-auditor | Found X |
144
+ | backend-specialist | Identified Y |
145
+
146
+ ### Consolidated Recommendations
147
+ 1. **Critical**: [Issue from Agent A]
148
+ 2. **Important**: [Issue from Agent B]
149
+ 3. **Nice-to-have**: [Enhancement from Agent C]
150
+
151
+ ### Action Items
152
+ - [ ] Fix critical security issue
153
+ - [ ] Refactor API endpoint
154
+ - [ ] Add missing tests
155
+ ```
156
+
157
+ ---
158
+
159
+ ## Best Practices
160
+
161
+ 1. **Available agents** - 17 specialized agents can be orchestrated
162
+ 2. **Logical order** - Discovery → Analysis → Implementation → Testing
163
+ 3. **Share context** - Pass relevant findings to subsequent agents
164
+ 4. **Single synthesis** - One unified report, not separate outputs
165
+ 5. **Verify changes** - Always include test-engineer for code modifications
166
+
167
+ ---
168
+
169
+ ## Key Benefits
170
+
171
+ - **Single session** - All agents share context
172
+ - **AI-controlled** - Agent system orchestrates autonomously
173
+ - **Native integration** - Works with built-in Explore, Plan agents
174
+ - **Resume support** - Can continue previous agent work
175
+ - **Context passing** - Findings flow between agents
@@ -0,0 +1,143 @@
1
+ ---
2
+ name: performance-profiling
3
+ description: Performance profiling principles. Measurement, analysis, and optimization techniques.
4
+ allowed-tools: Read, Glob, Grep, Bash
5
+ ---
6
+
7
+ # Performance Profiling
8
+
9
+ > Measure, analyze, optimize - in that order.
10
+
11
+ ## Runtime Scripts
12
+
13
+ **Execute these for automated profiling:**
14
+
15
+ | Script | Purpose | Usage |
16
+ |--------|---------|-------|
17
+ | `scripts/lighthouse_audit.py` | Lighthouse performance audit | `python scripts/lighthouse_audit.py https://example.com` |
18
+
19
+ ---
20
+
21
+ ## 1. Core Web Vitals
22
+
23
+ ### Targets
24
+
25
+ | Metric | Good | Poor | Measures |
26
+ |--------|------|------|----------|
27
+ | **LCP** | < 2.5s | > 4.0s | Loading |
28
+ | **INP** | < 200ms | > 500ms | Interactivity |
29
+ | **CLS** | < 0.1 | > 0.25 | Stability |
30
+
31
+ ### When to Measure
32
+
33
+ | Stage | Tool |
34
+ |-------|------|
35
+ | Development | Local Lighthouse |
36
+ | CI/CD | Lighthouse CI |
37
+ | Production | RUM (Real User Monitoring) |
38
+
39
+ ---
40
+
41
+ ## 2. Profiling Workflow
42
+
43
+ ### The 4-Step Process
44
+
45
+ ```
46
+ 1. BASELINE → Measure current state
47
+ 2. IDENTIFY → Find the bottleneck
48
+ 3. FIX → Make targeted change
49
+ 4. VALIDATE → Confirm improvement
50
+ ```
51
+
52
+ ### Profiling Tool Selection
53
+
54
+ | Problem | Tool |
55
+ |---------|------|
56
+ | Page load | Lighthouse |
57
+ | Bundle size | Bundle analyzer |
58
+ | Runtime | DevTools Performance |
59
+ | Memory | DevTools Memory |
60
+ | Network | DevTools Network |
61
+
62
+ ---
63
+
64
+ ## 3. Bundle Analysis
65
+
66
+ ### What to Look For
67
+
68
+ | Issue | Indicator |
69
+ |-------|-----------|
70
+ | Large dependencies | Top of bundle |
71
+ | Duplicate code | Multiple chunks |
72
+ | Unused code | Low coverage |
73
+ | Missing splits | Single large chunk |
74
+
75
+ ### Optimization Actions
76
+
77
+ | Finding | Action |
78
+ |---------|--------|
79
+ | Big library | Import specific modules |
80
+ | Duplicate deps | Dedupe, update versions |
81
+ | Route in main | Code split |
82
+ | Unused exports | Tree shake |
83
+
84
+ ---
85
+
86
+ ## 4. Runtime Profiling
87
+
88
+ ### Performance Tab Analysis
89
+
90
+ | Pattern | Meaning |
91
+ |---------|---------|
92
+ | Long tasks (>50ms) | UI blocking |
93
+ | Many small tasks | Possible batching opportunity |
94
+ | Layout/paint | Rendering bottleneck |
95
+ | Script | JavaScript execution |
96
+
97
+ ### Memory Tab Analysis
98
+
99
+ | Pattern | Meaning |
100
+ |---------|---------|
101
+ | Growing heap | Possible leak |
102
+ | Large retained | Check references |
103
+ | Detached DOM | Not cleaned up |
104
+
105
+ ---
106
+
107
+ ## 5. Common Bottlenecks
108
+
109
+ ### By Symptom
110
+
111
+ | Symptom | Likely Cause |
112
+ |---------|--------------|
113
+ | Slow initial load | Large JS, render blocking |
114
+ | Slow interactions | Heavy event handlers |
115
+ | Jank during scroll | Layout thrashing |
116
+ | Growing memory | Leaks, retained refs |
117
+
118
+ ---
119
+
120
+ ## 6. Quick Win Priorities
121
+
122
+ | Priority | Action | Impact |
123
+ |----------|--------|--------|
124
+ | 1 | Enable compression | High |
125
+ | 2 | Lazy load images | High |
126
+ | 3 | Code split routes | High |
127
+ | 4 | Cache static assets | Medium |
128
+ | 5 | Optimize images | Medium |
129
+
130
+ ---
131
+
132
+ ## 7. Anti-Patterns
133
+
134
+ | Don't | Do |
135
+ |----------|-------|
136
+ | Guess at problems | Profile first |
137
+ | Micro-optimize | Fix biggest issue |
138
+ | Optimize early | Optimize when needed |
139
+ | Ignore real users | Use RUM data |
140
+
141
+ ---
142
+
143
+ > **Remember:** The fastest code is code that doesn't run. Remove before optimizing.
@@ -0,0 +1,76 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ Skill: performance-profiling
4
+ Script: lighthouse_audit.py
5
+ Purpose: Run Lighthouse performance audit on a URL
6
+ Usage: python lighthouse_audit.py https://example.com
7
+ Output: JSON with performance scores
8
+ Note: Requires lighthouse CLI (npm install -g lighthouse)
9
+ """
10
+ import subprocess
11
+ import json
12
+ import sys
13
+ import os
14
+ import tempfile
15
+
16
+ def run_lighthouse(url: str) -> dict:
17
+ """Run Lighthouse audit on URL."""
18
+ try:
19
+ with tempfile.NamedTemporaryFile(suffix='.json', delete=False) as f:
20
+ output_path = f.name
21
+
22
+ result = subprocess.run(
23
+ [
24
+ "lighthouse",
25
+ url,
26
+ "--output=json",
27
+ f"--output-path={output_path}",
28
+ "--chrome-flags=--headless",
29
+ "--only-categories=performance,accessibility,best-practices,seo"
30
+ ],
31
+ capture_output=True,
32
+ text=True,
33
+ timeout=120
34
+ )
35
+
36
+ if os.path.exists(output_path):
37
+ with open(output_path, 'r') as f:
38
+ report = json.load(f)
39
+ os.unlink(output_path)
40
+
41
+ categories = report.get("categories", {})
42
+ return {
43
+ "url": url,
44
+ "scores": {
45
+ "performance": int(categories.get("performance", {}).get("score", 0) * 100),
46
+ "accessibility": int(categories.get("accessibility", {}).get("score", 0) * 100),
47
+ "best_practices": int(categories.get("best-practices", {}).get("score", 0) * 100),
48
+ "seo": int(categories.get("seo", {}).get("score", 0) * 100)
49
+ },
50
+ "summary": get_summary(categories)
51
+ }
52
+ else:
53
+ return {"error": "Lighthouse failed to generate report", "stderr": result.stderr[:500]}
54
+
55
+ except subprocess.TimeoutExpired:
56
+ return {"error": "Lighthouse audit timed out"}
57
+ except FileNotFoundError:
58
+ return {"error": "Lighthouse CLI not found. Install with: npm install -g lighthouse"}
59
+
60
+ def get_summary(categories: dict) -> str:
61
+ """Generate summary based on scores."""
62
+ perf = categories.get("performance", {}).get("score", 0) * 100
63
+ if perf >= 90:
64
+ return "[OK] Excellent performance"
65
+ elif perf >= 50:
66
+ return "[!] Needs improvement"
67
+ else:
68
+ return "[X] Poor performance"
69
+
70
+ if __name__ == "__main__":
71
+ if len(sys.argv) < 2:
72
+ print(json.dumps({"error": "Usage: python lighthouse_audit.py <url>"}))
73
+ sys.exit(1)
74
+
75
+ result = run_lighthouse(sys.argv[1])
76
+ print(json.dumps(result, indent=2))