@cubis/foundry 0.3.71 → 0.3.72

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 (270) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/cli/core.js +4 -18
  3. package/dist/cli/core.js.map +1 -1
  4. package/package.json +1 -1
  5. package/src/cli/core.ts +4 -18
  6. package/workflows/powers/accessibility/POWER.md +83 -94
  7. package/workflows/powers/accessibility/SKILL.md +82 -94
  8. package/workflows/powers/agent-design/POWER.md +201 -0
  9. package/workflows/powers/agent-design/SKILL.md +198 -0
  10. package/workflows/powers/agent-design/references/clarification-patterns.md +153 -0
  11. package/workflows/powers/agent-design/references/skill-testing.md +164 -0
  12. package/workflows/powers/agent-design/references/workflow-patterns.md +226 -0
  13. package/workflows/powers/agentic-eval/POWER.md +62 -0
  14. package/workflows/powers/agentic-eval/SKILL.md +59 -0
  15. package/workflows/powers/agentic-eval/references/rubric-and-regression-checklist.md +11 -0
  16. package/workflows/powers/api-designer/POWER.md +43 -71
  17. package/workflows/powers/api-designer/SKILL.md +43 -71
  18. package/workflows/powers/api-patterns/POWER.md +42 -56
  19. package/workflows/powers/api-patterns/SKILL.md +42 -57
  20. package/workflows/powers/architecture-designer/POWER.md +43 -60
  21. package/workflows/powers/architecture-designer/SKILL.md +43 -60
  22. package/workflows/powers/ask-questions-if-underspecified/POWER.md +51 -3
  23. package/workflows/powers/auth-architect/POWER.md +69 -0
  24. package/workflows/powers/auth-architect/SKILL.md +66 -0
  25. package/workflows/powers/auth-architect/references/session-token-policy-checklist.md +45 -0
  26. package/workflows/powers/behavioral-modes/POWER.md +100 -9
  27. package/workflows/powers/c-pro/POWER.md +105 -0
  28. package/workflows/powers/c-pro/SKILL.md +102 -0
  29. package/workflows/powers/c-pro/references/build-systems-and-toolchains.md +148 -0
  30. package/workflows/powers/c-pro/references/common-ub-and-portability.md +166 -0
  31. package/workflows/powers/c-pro/references/debugging-with-sanitizers.md +205 -0
  32. package/workflows/powers/c-pro/references/memory-safety-and-build-checklist.md +60 -0
  33. package/workflows/powers/c-pro/references/posix-and-platform-apis.md +244 -0
  34. package/workflows/powers/changelog-generator/POWER.md +127 -63
  35. package/workflows/powers/changelog-generator/SKILL.md +126 -63
  36. package/workflows/powers/ci-cd-pipelines/POWER.md +156 -0
  37. package/workflows/powers/ci-cd-pipelines/SKILL.md +153 -0
  38. package/workflows/powers/ci-cd-pipelines/references/github-actions-patterns.md +160 -0
  39. package/workflows/powers/ci-cd-pipelines/references/pipeline-security-checklist.md +57 -0
  40. package/workflows/powers/cli-developer/POWER.md +152 -95
  41. package/workflows/powers/cli-developer/SKILL.md +152 -95
  42. package/workflows/powers/cpp-pro/POWER.md +111 -0
  43. package/workflows/powers/cpp-pro/SKILL.md +108 -0
  44. package/workflows/powers/cpp-pro/references/concurrency-primitives.md +266 -0
  45. package/workflows/powers/cpp-pro/references/move-semantics-and-value-types.md +149 -0
  46. package/workflows/powers/cpp-pro/references/performance-and-profiling.md +191 -0
  47. package/workflows/powers/cpp-pro/references/raii-and-modern-cpp-checklist.md +87 -0
  48. package/workflows/powers/cpp-pro/references/template-and-concepts-patterns.md +205 -0
  49. package/workflows/powers/csharp-pro/POWER.md +47 -22
  50. package/workflows/powers/csharp-pro/SKILL.md +47 -22
  51. package/workflows/powers/dart-pro/POWER.md +68 -0
  52. package/workflows/powers/dart-pro/SKILL.md +65 -0
  53. package/workflows/powers/dart-pro/references/isolate-and-concurrency.md +180 -0
  54. package/workflows/powers/dart-pro/references/null-safety-and-async-patterns.md +133 -0
  55. package/workflows/powers/dart-pro/references/package-structure-and-linting.md +193 -0
  56. package/workflows/powers/dart-pro/references/sealed-records-patterns.md +173 -0
  57. package/workflows/powers/dart-pro/references/testing-and-mocking.md +235 -0
  58. package/workflows/powers/database-design/POWER.md +47 -33
  59. package/workflows/powers/database-design/SKILL.md +47 -33
  60. package/workflows/powers/database-optimizer/POWER.md +43 -64
  61. package/workflows/powers/database-optimizer/SKILL.md +43 -64
  62. package/workflows/powers/database-skills/POWER.md +59 -93
  63. package/workflows/powers/database-skills/SKILL.md +59 -93
  64. package/workflows/powers/debugging-strategies/POWER.md +69 -0
  65. package/workflows/powers/debugging-strategies/SKILL.md +66 -0
  66. package/workflows/powers/debugging-strategies/references/reproduce-isolate-verify-checklist.md +42 -0
  67. package/workflows/powers/deep-research/POWER.md +67 -0
  68. package/workflows/powers/deep-research/SKILL.md +64 -0
  69. package/workflows/powers/deep-research/references/multi-round-research-loop.md +80 -0
  70. package/workflows/powers/design-system-builder/POWER.md +130 -116
  71. package/workflows/powers/design-system-builder/SKILL.md +130 -116
  72. package/workflows/powers/devops-engineer/POWER.md +120 -57
  73. package/workflows/powers/devops-engineer/SKILL.md +120 -57
  74. package/workflows/powers/docker-kubernetes/POWER.md +94 -0
  75. package/workflows/powers/docker-kubernetes/SKILL.md +91 -0
  76. package/workflows/powers/docker-kubernetes/references/dockerfile-optimization-checklist.md +35 -0
  77. package/workflows/powers/docker-kubernetes/references/kubernetes-deployment-patterns.md +59 -0
  78. package/workflows/powers/documentation-templates/POWER.md +158 -127
  79. package/workflows/powers/documentation-templates/SKILL.md +158 -127
  80. package/workflows/powers/drizzle-expert/POWER.md +66 -0
  81. package/workflows/powers/drizzle-expert/SKILL.md +63 -0
  82. package/workflows/powers/drizzle-expert/references/runtime-pairing-matrix.md +16 -0
  83. package/workflows/powers/drizzle-expert/references/schema-and-migration-playbook.md +18 -0
  84. package/workflows/powers/error-ux-observability/POWER.md +144 -131
  85. package/workflows/powers/error-ux-observability/SKILL.md +143 -131
  86. package/workflows/powers/fastapi-expert/POWER.md +46 -60
  87. package/workflows/powers/fastapi-expert/SKILL.md +46 -60
  88. package/workflows/powers/firebase/POWER.md +65 -0
  89. package/workflows/powers/firebase/SKILL.md +62 -0
  90. package/workflows/powers/firebase/references/platform-routing.md +16 -0
  91. package/workflows/powers/firebase/references/rules-and-indexes-checklist.md +11 -0
  92. package/workflows/powers/flutter-design-system/POWER.md +63 -0
  93. package/workflows/powers/flutter-design-system/SKILL.md +60 -0
  94. package/workflows/powers/flutter-design-system/references/shared-widgets.md +29 -0
  95. package/workflows/powers/flutter-design-system/references/tokens-and-theme.md +34 -0
  96. package/workflows/powers/flutter-drift/POWER.md +65 -0
  97. package/workflows/powers/flutter-drift/SKILL.md +62 -0
  98. package/workflows/powers/flutter-drift/references/migrations.md +22 -0
  99. package/workflows/powers/flutter-drift/references/query-patterns.md +26 -0
  100. package/workflows/powers/flutter-feature/POWER.md +65 -0
  101. package/workflows/powers/flutter-feature/SKILL.md +62 -0
  102. package/workflows/powers/flutter-feature/references/architecture-rules.md +85 -0
  103. package/workflows/powers/flutter-feature/references/composite-provider.md +58 -0
  104. package/workflows/powers/flutter-feature/references/outbox-pattern.md +87 -0
  105. package/workflows/powers/flutter-feature/references/testing-patterns.md +218 -0
  106. package/workflows/powers/flutter-go-router/POWER.md +64 -0
  107. package/workflows/powers/flutter-go-router/SKILL.md +61 -0
  108. package/workflows/powers/flutter-go-router/references/guards-and-deeplinks.md +20 -0
  109. package/workflows/powers/flutter-go-router/references/typed-routes.md +27 -0
  110. package/workflows/powers/flutter-offline-sync/POWER.md +62 -0
  111. package/workflows/powers/flutter-offline-sync/SKILL.md +59 -0
  112. package/workflows/powers/flutter-offline-sync/references/outbox-full.md +44 -0
  113. package/workflows/powers/flutter-repository/POWER.md +64 -0
  114. package/workflows/powers/flutter-repository/SKILL.md +61 -0
  115. package/workflows/powers/flutter-repository/references/drift-patterns.md +21 -0
  116. package/workflows/powers/flutter-repository/references/retrofit-patterns.md +20 -0
  117. package/workflows/powers/flutter-riverpod/POWER.md +70 -0
  118. package/workflows/powers/flutter-riverpod/SKILL.md +67 -0
  119. package/workflows/powers/flutter-riverpod/references/async-and-mutations.md +19 -0
  120. package/workflows/powers/flutter-riverpod/references/async-lifecycle.md +19 -0
  121. package/workflows/powers/flutter-riverpod/references/provider-selection.md +20 -0
  122. package/workflows/powers/flutter-riverpod/references/testing.md +21 -0
  123. package/workflows/powers/flutter-riverpod/references/version-matrix.md +24 -0
  124. package/workflows/powers/flutter-state-machine/POWER.md +62 -0
  125. package/workflows/powers/flutter-state-machine/SKILL.md +59 -0
  126. package/workflows/powers/flutter-state-machine/references/app-state-contract.md +23 -0
  127. package/workflows/powers/flutter-state-machine/references/ui-rendering.md +14 -0
  128. package/workflows/powers/flutter-testing/POWER.md +64 -0
  129. package/workflows/powers/flutter-testing/SKILL.md +61 -0
  130. package/workflows/powers/flutter-testing/references/offline-sync-tests.md +16 -0
  131. package/workflows/powers/flutter-testing/references/test-layers.md +33 -0
  132. package/workflows/powers/frontend-code-review/POWER.md +137 -0
  133. package/workflows/powers/frontend-code-review/SKILL.md +134 -0
  134. package/workflows/powers/frontend-code-review/references/common-antipatterns.md +86 -0
  135. package/workflows/powers/frontend-code-review/references/performance-budgets.md +56 -0
  136. package/workflows/powers/frontend-code-review/references/review-checklists.md +47 -0
  137. package/workflows/powers/frontend-design/POWER.md +163 -362
  138. package/workflows/powers/frontend-design/SKILL.md +163 -362
  139. package/workflows/powers/game-development/POWER.md +57 -140
  140. package/workflows/powers/game-development/SKILL.md +57 -140
  141. package/workflows/powers/geo-fundamentals/POWER.md +64 -126
  142. package/workflows/powers/geo-fundamentals/SKILL.md +64 -127
  143. package/workflows/powers/git-workflow/POWER.md +135 -0
  144. package/workflows/powers/git-workflow/SKILL.md +132 -0
  145. package/workflows/powers/git-workflow/references/pr-review-checklist.md +63 -0
  146. package/workflows/powers/golang-pro/POWER.md +46 -35
  147. package/workflows/powers/golang-pro/SKILL.md +46 -35
  148. package/workflows/powers/graphql-architect/POWER.md +44 -62
  149. package/workflows/powers/graphql-architect/SKILL.md +44 -62
  150. package/workflows/powers/i18n-localization/POWER.md +118 -103
  151. package/workflows/powers/i18n-localization/SKILL.md +118 -103
  152. package/workflows/powers/java-pro/POWER.md +47 -22
  153. package/workflows/powers/java-pro/SKILL.md +47 -22
  154. package/workflows/powers/javascript-pro/POWER.md +47 -34
  155. package/workflows/powers/javascript-pro/SKILL.md +47 -34
  156. package/workflows/powers/kotlin-pro/POWER.md +46 -23
  157. package/workflows/powers/kotlin-pro/SKILL.md +46 -23
  158. package/workflows/powers/legacy-modernizer/POWER.md +43 -60
  159. package/workflows/powers/legacy-modernizer/SKILL.md +43 -60
  160. package/workflows/powers/mcp-builder/POWER.md +65 -0
  161. package/workflows/powers/mcp-builder/SKILL.md +62 -0
  162. package/workflows/powers/mcp-builder/references/testing-and-evals.md +17 -0
  163. package/workflows/powers/mcp-builder/references/transport-and-tool-design.md +17 -0
  164. package/workflows/powers/microservices-architect/POWER.md +43 -70
  165. package/workflows/powers/microservices-architect/SKILL.md +43 -70
  166. package/workflows/powers/mobile-design/POWER.md +110 -345
  167. package/workflows/powers/mobile-design/SKILL.md +110 -345
  168. package/workflows/powers/mongodb/POWER.md +67 -0
  169. package/workflows/powers/mongodb/SKILL.md +64 -0
  170. package/workflows/powers/mongodb/references/mongodb-checklist.md +20 -0
  171. package/workflows/powers/mysql/POWER.md +67 -0
  172. package/workflows/powers/mysql/SKILL.md +64 -0
  173. package/workflows/powers/mysql/references/mysql-checklist.md +20 -0
  174. package/workflows/powers/neki/POWER.md +67 -0
  175. package/workflows/powers/neki/SKILL.md +64 -0
  176. package/workflows/powers/neki/references/neki-checklist.md +18 -0
  177. package/workflows/powers/nestjs-expert/POWER.md +45 -91
  178. package/workflows/powers/nestjs-expert/SKILL.md +45 -91
  179. package/workflows/powers/nextjs-developer/POWER.md +51 -44
  180. package/workflows/powers/nextjs-developer/SKILL.md +51 -44
  181. package/workflows/powers/nodejs-best-practices/POWER.md +48 -29
  182. package/workflows/powers/nodejs-best-practices/SKILL.md +48 -29
  183. package/workflows/powers/observability/POWER.md +109 -0
  184. package/workflows/powers/observability/SKILL.md +106 -0
  185. package/workflows/powers/observability/references/alerting-and-slo-checklist.md +87 -0
  186. package/workflows/powers/observability/references/opentelemetry-setup-guide.md +121 -0
  187. package/workflows/powers/openai-docs/POWER.md +61 -0
  188. package/workflows/powers/openai-docs/SKILL.md +58 -0
  189. package/workflows/powers/openai-docs/references/official-source-playbook.md +10 -0
  190. package/workflows/powers/performance-profiling/POWER.md +61 -114
  191. package/workflows/powers/performance-profiling/SKILL.md +61 -114
  192. package/workflows/powers/php-pro/POWER.md +116 -0
  193. package/workflows/powers/php-pro/SKILL.md +113 -0
  194. package/workflows/powers/php-pro/references/architecture-and-di.md +239 -0
  195. package/workflows/powers/php-pro/references/modern-php-features.md +189 -0
  196. package/workflows/powers/php-pro/references/performance-and-deployment.md +197 -0
  197. package/workflows/powers/php-pro/references/php84-strict-typing-checklist.md +161 -0
  198. package/workflows/powers/php-pro/references/testing-and-static-analysis.md +235 -0
  199. package/workflows/powers/playwright-e2e/POWER.md +85 -0
  200. package/workflows/powers/playwright-e2e/SKILL.md +82 -0
  201. package/workflows/powers/playwright-e2e/references/locator-trace-flake-checklist.md +80 -0
  202. package/workflows/powers/postgres/POWER.md +67 -0
  203. package/workflows/powers/postgres/SKILL.md +64 -0
  204. package/workflows/powers/postgres/references/postgres-checklist.md +20 -0
  205. package/workflows/powers/prompt-engineer/POWER.md +47 -30
  206. package/workflows/powers/prompt-engineer/SKILL.md +47 -30
  207. package/workflows/powers/python-pro/POWER.md +47 -36
  208. package/workflows/powers/python-pro/SKILL.md +47 -36
  209. package/workflows/powers/react-best-practices/POWER.md +56 -33
  210. package/workflows/powers/react-best-practices/SKILL.md +56 -33
  211. package/workflows/powers/react-expert/POWER.md +47 -37
  212. package/workflows/powers/react-expert/SKILL.md +47 -37
  213. package/workflows/powers/redis/POWER.md +67 -0
  214. package/workflows/powers/redis/SKILL.md +64 -0
  215. package/workflows/powers/redis/references/redis-checklist.md +19 -0
  216. package/workflows/powers/ruby-pro/POWER.md +118 -0
  217. package/workflows/powers/ruby-pro/SKILL.md +115 -0
  218. package/workflows/powers/ruby-pro/references/modern-ruby-features.md +189 -0
  219. package/workflows/powers/ruby-pro/references/object-design-patterns.md +220 -0
  220. package/workflows/powers/ruby-pro/references/performance-and-profiling.md +224 -0
  221. package/workflows/powers/ruby-pro/references/ruby-concurrency-and-testing.md +190 -0
  222. package/workflows/powers/ruby-pro/references/testing-and-rspec.md +236 -0
  223. package/workflows/powers/rust-pro/POWER.md +45 -31
  224. package/workflows/powers/rust-pro/SKILL.md +45 -31
  225. package/workflows/powers/security-engineer/POWER.md +129 -0
  226. package/workflows/powers/security-engineer/SKILL.md +126 -0
  227. package/workflows/powers/seo-fundamentals/POWER.md +59 -102
  228. package/workflows/powers/seo-fundamentals/SKILL.md +59 -102
  229. package/workflows/powers/serverless-patterns/POWER.md +171 -0
  230. package/workflows/powers/serverless-patterns/SKILL.md +168 -0
  231. package/workflows/powers/skill-creator/POWER.md +90 -0
  232. package/workflows/powers/skill-creator/SKILL.md +87 -0
  233. package/workflows/powers/skill-creator/references/platform-formats.md +181 -0
  234. package/workflows/powers/skill-creator/references/schemas.md +430 -0
  235. package/workflows/powers/spec-miner/POWER.md +49 -57
  236. package/workflows/powers/spec-miner/SKILL.md +49 -57
  237. package/workflows/powers/sqlite/POWER.md +67 -0
  238. package/workflows/powers/sqlite/SKILL.md +64 -0
  239. package/workflows/powers/sqlite/references/sqlite-checklist.md +19 -0
  240. package/workflows/powers/sre-engineer/POWER.md +123 -64
  241. package/workflows/powers/sre-engineer/SKILL.md +123 -64
  242. package/workflows/powers/static-analysis/POWER.md +121 -77
  243. package/workflows/powers/static-analysis/SKILL.md +121 -77
  244. package/workflows/powers/stripe-best-practices/POWER.md +140 -17
  245. package/workflows/powers/stripe-best-practices/SKILL.md +139 -17
  246. package/workflows/powers/supabase/POWER.md +67 -0
  247. package/workflows/powers/supabase/SKILL.md +64 -0
  248. package/workflows/powers/supabase/references/supabase-checklist.md +19 -0
  249. package/workflows/powers/swift-pro/POWER.md +118 -0
  250. package/workflows/powers/swift-pro/SKILL.md +115 -0
  251. package/workflows/powers/swift-pro/references/concurrency-patterns.md +165 -0
  252. package/workflows/powers/swift-pro/references/protocol-and-generics.md +172 -0
  253. package/workflows/powers/swift-pro/references/sendable-and-isolation.md +116 -0
  254. package/workflows/powers/swift-pro/references/swift-concurrency-and-protocols.md +260 -0
  255. package/workflows/powers/swift-pro/references/testing-and-packages.md +192 -0
  256. package/workflows/powers/tailwind-patterns/POWER.md +71 -240
  257. package/workflows/powers/tailwind-patterns/SKILL.md +71 -240
  258. package/workflows/powers/testing-patterns/POWER.md +155 -10
  259. package/workflows/powers/testing-patterns/SKILL.md +155 -10
  260. package/workflows/powers/typescript-pro/POWER.md +47 -38
  261. package/workflows/powers/typescript-pro/SKILL.md +47 -38
  262. package/workflows/powers/vitess/POWER.md +67 -0
  263. package/workflows/powers/vitess/SKILL.md +64 -0
  264. package/workflows/powers/vitess/references/vitess-checklist.md +19 -0
  265. package/workflows/powers/vulnerability-scanner/POWER.md +146 -10
  266. package/workflows/powers/vulnerability-scanner/SKILL.md +146 -10
  267. package/workflows/powers/web-perf/POWER.md +43 -170
  268. package/workflows/powers/web-perf/SKILL.md +43 -170
  269. package/workflows/powers/webapp-testing/POWER.md +43 -164
  270. package/workflows/powers/webapp-testing/SKILL.md +43 -164
@@ -1,143 +1,90 @@
1
1
  ---
2
2
  name: performance-profiling
3
- description: Performance profiling principles. Measurement, analysis, and optimization techniques.
4
- allowed-tools: Read, Glob, Grep, Bash
3
+ description: "Use when measuring, analyzing, and optimizing application performance with Core Web Vitals, bundle analysis, runtime profiling, and lighthouse audits."
4
+ license: MIT
5
+ metadata:
6
+ author: cubis-foundry
7
+ version: "1.0"
8
+ compatibility: Claude Code, Codex, GitHub Copilot
5
9
  ---
6
10
 
7
11
  # Performance Profiling
8
12
 
9
- > Measure, analyze, optimize - in that order.
13
+ ## Purpose
10
14
 
11
- ## 🔧 Runtime Scripts
15
+ Use when measuring, analyzing, and optimizing application performance with Core Web Vitals, bundle analysis, runtime profiling, and lighthouse audits.
12
16
 
13
- **Execute these for automated profiling:**
17
+ ## When to Use
14
18
 
15
- | Script | Purpose | Usage |
16
- |--------|---------|-------|
17
- | `scripts/lighthouse_audit.py` | Lighthouse performance audit | `python scripts/lighthouse_audit.py https://example.com` |
19
+ - Measuring and improving Core Web Vitals (LCP, INP, CLS).
20
+ - Analyzing bundle size, finding large dependencies, and code splitting.
21
+ - Profiling runtime performance in browser Performance or Memory tabs.
22
+ - Diagnosing performance bottlenecks (slow API, large payload, memory leak, layout thrash).
23
+ - Planning performance optimization with measurement-first discipline.
18
24
 
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
25
+ ## Instructions
53
26
 
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 |
27
+ 1. Baseline measure current performance with Lighthouse, WebPageTest, or browser DevTools.
28
+ 2. Identify — find the biggest bottleneck using profiling data, not assumptions.
29
+ 3. Fix apply targeted optimization for the measured bottleneck.
30
+ 4. Validate re-measure to confirm improvement and check for regressions.
61
31
 
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 |
32
+ ### Core Web Vitals targets
83
33
 
84
- ---
85
-
86
- ## 4. Runtime Profiling
34
+ | Metric | Good | Needs Improvement | Poor |
35
+ | ------ | ------- | ----------------- | ------- |
36
+ | LCP | < 2.5s | 2.5s – 4.0s | > 4.0s |
37
+ | INP | < 200ms | 200ms – 500ms | > 500ms |
38
+ | CLS | < 0.1 | 0.1 – 0.25 | > 0.25 |
87
39
 
88
- ### Performance Tab Analysis
40
+ ### Baseline standards
89
41
 
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 |
42
+ - Always measure before optimizing — intuition is unreliable for performance.
43
+ - Use real user metrics (RUM) alongside synthetic benchmarks.
44
+ - Profile on representative hardware, not just developer machines.
45
+ - Address the largest bottleneck first for maximum impact.
46
+ - Verify optimizations don't introduce regressions elsewhere.
96
47
 
97
- ### Memory Tab Analysis
48
+ ### Quick wins priority
98
49
 
99
- | Pattern | Meaning |
100
- |---------|---------|
101
- | Growing heap | Possible leak |
102
- | Large retained | Check references |
103
- | Detached DOM | Not cleaned up |
50
+ | Priority | Action | Typical Impact |
51
+ | -------- | -------------------------------- | ------------------------- |
52
+ | 1 | Enable compression (gzip/brotli) | 60-80% transfer reduction |
53
+ | 2 | Lazy load below-fold images | LCP improvement |
54
+ | 3 | Code split routes | Initial load reduction |
55
+ | 4 | Set proper cache headers | Repeat visit speed |
56
+ | 5 | Optimize images (WebP/AVIF) | Transfer size reduction |
104
57
 
105
- ---
58
+ ### Common bottlenecks by symptom
106
59
 
107
- ## 5. Common Bottlenecks
60
+ | Symptom | Likely Cause | Investigation |
61
+ | ----------------- | --------------------------------------- | ---------------------------------- |
62
+ | Slow initial load | Large bundle, render-blocking resources | Bundle analysis, waterfall |
63
+ | Janky scrolling | Layout thrash, paint storms | Performance tab, layers panel |
64
+ | Memory growth | Detached DOM, event listener leaks | Memory tab, heap snapshots |
65
+ | Slow interaction | Long tasks, main thread blocking | Performance tab, long task markers |
108
66
 
109
- ### By Symptom
67
+ ### Constraints
110
68
 
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 |
69
+ - Never optimize without measuring first.
70
+ - Never assume a change improved performance — always validate with data.
71
+ - Never sacrifice correctness for performance.
72
+ - Avoid premature optimization of code paths that aren't bottlenecks.
117
73
 
118
- ---
74
+ ## Output Format
119
75
 
120
- ## 6. Quick Win Priorities
76
+ Provide measurement data, identified bottlenecks with evidence, optimization recommendations, and before/after comparisons.
121
77
 
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 |
78
+ ## References
129
79
 
130
- ---
80
+ No reference files for this skill right now.
131
81
 
132
- ## 7. Anti-Patterns
82
+ ## Scripts
133
83
 
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 |
84
+ No helper scripts are required for this skill right now.
140
85
 
141
- ---
86
+ ## Examples
142
87
 
143
- > **Remember:** The fastest code is code that doesn't run. Remove before optimizing.
88
+ - "Profile and optimize the Core Web Vitals for our landing page"
89
+ - "Analyze our bundle and recommend code splitting strategy"
90
+ - "Find and fix the memory leak in our real-time dashboard"
@@ -0,0 +1,116 @@
1
+ ````markdown
2
+ ---
3
+ inclusion: manual
4
+ name: php-pro
5
+ description: "Use for modern PHP 8.4-era backend and application engineering with strict typing, framework-aware architecture, testing, and operational safety."
6
+ license: MIT
7
+ metadata:
8
+ author: cubis-foundry
9
+ version: "2.0"
10
+ compatibility: Claude Code, Codex, GitHub Copilot
11
+ ---
12
+
13
+ # PHP Pro
14
+
15
+ ## Purpose
16
+
17
+ Use for modern PHP 8.4-era backend and application engineering with strict typing, framework-aware architecture, testing, and operational safety.
18
+
19
+ ## When to Use
20
+
21
+ - Building or refactoring PHP services and applications.
22
+ - Tightening typing, dependency boundaries, and package hygiene.
23
+ - Improving request handling, background jobs, and test structure.
24
+
25
+ ## Instructions
26
+
27
+ 1. Confirm runtime, framework, and PHP version baseline.
28
+ 2. Enable strict typing and explicit contracts at module boundaries.
29
+ 3. Keep service, controller, and persistence responsibilities separate.
30
+ 4. Prefer deterministic Composer and test workflows.
31
+ 5. Validate with targeted tests and static analysis where available.
32
+
33
+ ### Baseline standards
34
+
35
+ - Add `declare(strict_types=1);` to every PHP file. No exceptions.
36
+ - Use typed properties, parameter types, and return types on all public methods.
37
+ - Run PHPStan or Psalm at level 8+ in CI. Treat analysis failures as build failures.
38
+ - Use PHP CS Fixer or PHP_CodeSniffer for consistent formatting.
39
+ - Pin Composer dependencies to exact versions in `composer.lock`. Commit the lock file.
40
+
41
+ ### Type system
42
+
43
+ - Use union types (`string|int`), intersection types (`Countable&Iterator`), and `never` return type where they add clarity.
44
+ - Use enums (backed or pure) instead of string/int constants for fixed value sets.
45
+ - Use readonly properties and readonly classes for immutable data transfer objects.
46
+ - Prefer named arguments for functions with many optional parameters.
47
+ - Use `null` as a return type only when null is a meaningful domain value — prefer exceptions or result objects for errors.
48
+
49
+ ### Architecture patterns
50
+
51
+ - Separate request handling (controllers) from business logic (services) from persistence (repositories).
52
+ - Use dependency injection (constructor injection preferred) — avoid `new` inside business logic.
53
+ - Keep controllers thin: validate input, call service, return response. No business logic in controllers.
54
+ - Use value objects for domain concepts (Money, Email, UserId) instead of primitive types.
55
+ - Use interfaces at module boundaries. Concrete implementations are internal details.
56
+
57
+ ### Error handling
58
+
59
+ - Use specific exception classes per failure domain (e.g., `UserNotFoundException`, `ValidationException`).
60
+ - Catch exceptions at the boundary layer (controller, middleware) — not inside business logic unless recovery is possible.
61
+ - Never catch `\Exception` or `\Throwable` silently. At minimum, log the exception.
62
+ - Use result objects or typed return values instead of exceptions for expected failure paths (validation, not-found).
63
+
64
+ ### Testing
65
+
66
+ - Use PHPUnit for unit and integration tests. Use Pest for more readable test syntax when the team prefers it.
67
+ - Mock external dependencies (HTTP clients, databases, file systems) — test business logic in isolation.
68
+ - Use data providers for parameterized tests instead of copy-paste test methods.
69
+ - Run tests in CI with code coverage reporting. Target meaningful coverage, not 100%.
70
+ - Use fixtures and factories for test data — never rely on production database state.
71
+
72
+ ### Composer and dependencies
73
+
74
+ - Run `composer audit` in CI to catch known vulnerabilities.
75
+ - Use `composer outdated` to identify stale dependencies. Update regularly.
76
+ - Prefer well-maintained packages with active security patch records.
77
+ - Use autoloading via `composer.json` PSR-4 — never use `require`/`include` for class loading.
78
+
79
+ ### Performance
80
+
81
+ - Use OPcache in production with preloading for frequently used classes.
82
+ - Profile with Xdebug or Blackfire before optimizing. Measure, don't guess.
83
+ - Use connection pooling (Swoole, FrankenPHP, or external proxy) for high-concurrency workloads.
84
+ - Cache expensive computations and database queries — invalidate on writes.
85
+
86
+ ### Constraints
87
+
88
+ - Avoid `mixed` type as a lazy escape — use proper union types or generics (via PHPStan/Psalm).
89
+ - Avoid `@` error suppression operator — handle errors explicitly.
90
+ - Avoid global functions or static state for business logic — makes testing impossible.
91
+ - Avoid concatenating SQL strings — use prepared statements or query builders.
92
+ - Avoid storing sensitive data in plain-text config files — use environment variables or vault.
93
+
94
+ ## Output Format
95
+
96
+ Provide implementation guidance, code examples, and configuration as appropriate to the task.
97
+
98
+ ## References
99
+
100
+ | File | Load when |
101
+ | --------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
102
+ | `references/php84-strict-typing-checklist.md` | Strict typing migration, enum patterns, readonly properties, PHPStan configuration, or Composer security audit is needed. |
103
+ | `references/modern-php-features.md` | You need enums, fibers, readonly classes, match expressions, named args, or first-class callable syntax. |
104
+ | `references/testing-and-static-analysis.md` | You need PHPUnit/Pest setup, data providers, mocking, PHPStan/Psalm config, or CI test pipeline patterns. |
105
+ | `references/architecture-and-di.md` | You need DI container patterns, service layers, repository design, or value object implementations. |
106
+ | `references/performance-and-deployment.md` | You need OPcache tuning, preloading, connection pooling, profiling with Xdebug/Blackfire, or FrankenPHP/Swoole setup. |
107
+
108
+ ## Scripts
109
+
110
+ No helper scripts are required for this skill right now. Keep execution in `SKILL.md` and `references/` unless repeated automation becomes necessary.
111
+
112
+ ## Examples
113
+
114
+ - "Help me with php pro best practices in this project"
115
+ - "Review my php pro implementation for issues"
116
+ ````
@@ -0,0 +1,113 @@
1
+ ---
2
+ name: php-pro
3
+ description: "Use for modern PHP 8.4-era backend and application engineering with strict typing, framework-aware architecture, testing, and operational safety."
4
+ license: MIT
5
+ metadata:
6
+ author: cubis-foundry
7
+ version: "2.0"
8
+ compatibility: Claude Code, Codex, GitHub Copilot
9
+ ---
10
+
11
+ # PHP Pro
12
+
13
+ ## Purpose
14
+
15
+ Use for modern PHP 8.4-era backend and application engineering with strict typing, framework-aware architecture, testing, and operational safety.
16
+
17
+ ## When to Use
18
+
19
+ - Building or refactoring PHP services and applications.
20
+ - Tightening typing, dependency boundaries, and package hygiene.
21
+ - Improving request handling, background jobs, and test structure.
22
+
23
+ ## Instructions
24
+
25
+ 1. Confirm runtime, framework, and PHP version baseline.
26
+ 2. Enable strict typing and explicit contracts at module boundaries.
27
+ 3. Keep service, controller, and persistence responsibilities separate.
28
+ 4. Prefer deterministic Composer and test workflows.
29
+ 5. Validate with targeted tests and static analysis where available.
30
+
31
+ ### Baseline standards
32
+
33
+ - Add `declare(strict_types=1);` to every PHP file. No exceptions.
34
+ - Use typed properties, parameter types, and return types on all public methods.
35
+ - Run PHPStan or Psalm at level 8+ in CI. Treat analysis failures as build failures.
36
+ - Use PHP CS Fixer or PHP_CodeSniffer for consistent formatting.
37
+ - Pin Composer dependencies to exact versions in `composer.lock`. Commit the lock file.
38
+
39
+ ### Type system
40
+
41
+ - Use union types (`string|int`), intersection types (`Countable&Iterator`), and `never` return type where they add clarity.
42
+ - Use enums (backed or pure) instead of string/int constants for fixed value sets.
43
+ - Use readonly properties and readonly classes for immutable data transfer objects.
44
+ - Prefer named arguments for functions with many optional parameters.
45
+ - Use `null` as a return type only when null is a meaningful domain value — prefer exceptions or result objects for errors.
46
+
47
+ ### Architecture patterns
48
+
49
+ - Separate request handling (controllers) from business logic (services) from persistence (repositories).
50
+ - Use dependency injection (constructor injection preferred) — avoid `new` inside business logic.
51
+ - Keep controllers thin: validate input, call service, return response. No business logic in controllers.
52
+ - Use value objects for domain concepts (Money, Email, UserId) instead of primitive types.
53
+ - Use interfaces at module boundaries. Concrete implementations are internal details.
54
+
55
+ ### Error handling
56
+
57
+ - Use specific exception classes per failure domain (e.g., `UserNotFoundException`, `ValidationException`).
58
+ - Catch exceptions at the boundary layer (controller, middleware) — not inside business logic unless recovery is possible.
59
+ - Never catch `\Exception` or `\Throwable` silently. At minimum, log the exception.
60
+ - Use result objects or typed return values instead of exceptions for expected failure paths (validation, not-found).
61
+
62
+ ### Testing
63
+
64
+ - Use PHPUnit for unit and integration tests. Use Pest for more readable test syntax when the team prefers it.
65
+ - Mock external dependencies (HTTP clients, databases, file systems) — test business logic in isolation.
66
+ - Use data providers for parameterized tests instead of copy-paste test methods.
67
+ - Run tests in CI with code coverage reporting. Target meaningful coverage, not 100%.
68
+ - Use fixtures and factories for test data — never rely on production database state.
69
+
70
+ ### Composer and dependencies
71
+
72
+ - Run `composer audit` in CI to catch known vulnerabilities.
73
+ - Use `composer outdated` to identify stale dependencies. Update regularly.
74
+ - Prefer well-maintained packages with active security patch records.
75
+ - Use autoloading via `composer.json` PSR-4 — never use `require`/`include` for class loading.
76
+
77
+ ### Performance
78
+
79
+ - Use OPcache in production with preloading for frequently used classes.
80
+ - Profile with Xdebug or Blackfire before optimizing. Measure, don't guess.
81
+ - Use connection pooling (Swoole, FrankenPHP, or external proxy) for high-concurrency workloads.
82
+ - Cache expensive computations and database queries — invalidate on writes.
83
+
84
+ ### Constraints
85
+
86
+ - Avoid `mixed` type as a lazy escape — use proper union types or generics (via PHPStan/Psalm).
87
+ - Avoid `@` error suppression operator — handle errors explicitly.
88
+ - Avoid global functions or static state for business logic — makes testing impossible.
89
+ - Avoid concatenating SQL strings — use prepared statements or query builders.
90
+ - Avoid storing sensitive data in plain-text config files — use environment variables or vault.
91
+
92
+ ## Output Format
93
+
94
+ Provide implementation guidance, code examples, and configuration as appropriate to the task.
95
+
96
+ ## References
97
+
98
+ | File | Load when |
99
+ | --------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
100
+ | `references/php84-strict-typing-checklist.md` | Strict typing migration, enum patterns, readonly properties, PHPStan configuration, or Composer security audit is needed. |
101
+ | `references/modern-php-features.md` | You need enums, fibers, readonly classes, match expressions, named args, or first-class callable syntax. |
102
+ | `references/testing-and-static-analysis.md` | You need PHPUnit/Pest setup, data providers, mocking, PHPStan/Psalm config, or CI test pipeline patterns. |
103
+ | `references/architecture-and-di.md` | You need DI container patterns, service layers, repository design, or value object implementations. |
104
+ | `references/performance-and-deployment.md` | You need OPcache tuning, preloading, connection pooling, profiling with Xdebug/Blackfire, or FrankenPHP/Swoole setup. |
105
+
106
+ ## Scripts
107
+
108
+ No helper scripts are required for this skill right now. Keep execution in `SKILL.md` and `references/` unless repeated automation becomes necessary.
109
+
110
+ ## Examples
111
+
112
+ - "Help me with php pro best practices in this project"
113
+ - "Review my php pro implementation for issues"
@@ -0,0 +1,239 @@
1
+ # Architecture and Dependency Injection
2
+
3
+ ## Service Layer Pattern
4
+
5
+ ```php
6
+ declare(strict_types=1);
7
+
8
+ // Controller — thin, delegates to service
9
+ final class OrderController
10
+ {
11
+ public function __construct(
12
+ private readonly OrderService $orderService,
13
+ ) {}
14
+
15
+ public function create(Request $request): JsonResponse
16
+ {
17
+ $dto = CreateOrderDto::fromRequest($request);
18
+ $order = $this->orderService->create($dto);
19
+ return new JsonResponse(OrderResource::from($order), 201);
20
+ }
21
+ }
22
+
23
+ // Service — business logic, orchestrates domain objects
24
+ final class OrderService
25
+ {
26
+ public function __construct(
27
+ private readonly OrderRepository $orderRepository,
28
+ private readonly PricingService $pricingService,
29
+ private readonly EventDispatcher $events,
30
+ ) {}
31
+
32
+ public function create(CreateOrderDto $dto): Order
33
+ {
34
+ $price = $this->pricingService->calculate($dto->items);
35
+ $order = Order::create(
36
+ customerId: $dto->customerId,
37
+ items: $dto->items,
38
+ total: $price,
39
+ );
40
+
41
+ $this->orderRepository->save($order);
42
+ $this->events->dispatch(new OrderCreated($order));
43
+
44
+ return $order;
45
+ }
46
+ }
47
+
48
+ // Repository interface — persistence contract
49
+ interface OrderRepository
50
+ {
51
+ public function findById(int $id): ?Order;
52
+ public function save(Order $order): void;
53
+ /** @return list<Order> */
54
+ public function findByCustomer(int $customerId): array;
55
+ }
56
+ ```
57
+
58
+ ## Value Objects
59
+
60
+ ```php
61
+ // Type-safe wrappers with validation
62
+ readonly class Email
63
+ {
64
+ public function __construct(
65
+ public string $value,
66
+ ) {
67
+ if (!filter_var($value, FILTER_VALIDATE_EMAIL)) {
68
+ throw new \InvalidArgumentException("Invalid email: $value");
69
+ }
70
+ }
71
+
72
+ public function domain(): string
73
+ {
74
+ return substr($this->value, strpos($this->value, '@') + 1);
75
+ }
76
+
77
+ public function equals(self $other): bool
78
+ {
79
+ return strtolower($this->value) === strtolower($other->value);
80
+ }
81
+ }
82
+
83
+ readonly class Money
84
+ {
85
+ public function __construct(
86
+ public int $amount, // store in cents
87
+ public string $currency,
88
+ ) {
89
+ if ($amount < 0) throw new \DomainException('Amount cannot be negative');
90
+ }
91
+
92
+ public function add(self $other): self
93
+ {
94
+ if ($this->currency !== $other->currency) {
95
+ throw new \DomainException('Cannot add different currencies');
96
+ }
97
+ return new self($this->amount + $other->amount, $this->currency);
98
+ }
99
+
100
+ public function format(): string
101
+ {
102
+ return number_format($this->amount / 100, 2) . ' ' . $this->currency;
103
+ }
104
+ }
105
+ ```
106
+
107
+ ## DI Container Patterns
108
+
109
+ ```php
110
+ // Constructor injection (preferred)
111
+ final class NotificationService
112
+ {
113
+ public function __construct(
114
+ private readonly MailerInterface $mailer,
115
+ private readonly LoggerInterface $logger,
116
+ private readonly string $fromAddress, // primitive config via container
117
+ ) {}
118
+ }
119
+
120
+ // Interface binding (Laravel example)
121
+ // AppServiceProvider
122
+ $this->app->bind(OrderRepository::class, EloquentOrderRepository::class);
123
+ $this->app->bind(MailerInterface::class, SmtpMailer::class);
124
+
125
+ // Singleton binding for shared instances
126
+ $this->app->singleton(CacheInterface::class, RedisCache::class);
127
+
128
+ // Factory binding for complex construction
129
+ $this->app->bind(PaymentGateway::class, function ($app) {
130
+ return new StripeGateway(
131
+ apiKey: config('services.stripe.secret'),
132
+ logger: $app->make(LoggerInterface::class),
133
+ );
134
+ });
135
+
136
+ // Symfony service configuration (services.yaml)
137
+ // services:
138
+ // App\Service\OrderService:
139
+ // arguments:
140
+ // $fromAddress: '%env(MAIL_FROM)%'
141
+ // App\Repository\OrderRepository: '@App\Infrastructure\EloquentOrderRepository'
142
+ ```
143
+
144
+ ## DTOs and Request Validation
145
+
146
+ ```php
147
+ // DTO with factory method from request
148
+ readonly class CreateOrderDto
149
+ {
150
+ /** @param list<OrderItemDto> $items */
151
+ public function __construct(
152
+ public int $customerId,
153
+ public array $items,
154
+ public ?string $notes = null,
155
+ ) {}
156
+
157
+ public static function fromRequest(Request $request): self
158
+ {
159
+ $validated = $request->validate([
160
+ 'customer_id' => 'required|integer|exists:customers,id',
161
+ 'items' => 'required|array|min:1',
162
+ 'items.*.product_id' => 'required|integer|exists:products,id',
163
+ 'items.*.quantity' => 'required|integer|min:1',
164
+ 'notes' => 'nullable|string|max:500',
165
+ ]);
166
+
167
+ return new self(
168
+ customerId: $validated['customer_id'],
169
+ items: array_map(
170
+ fn (array $item) => new OrderItemDto(
171
+ productId: $item['product_id'],
172
+ quantity: $item['quantity'],
173
+ ),
174
+ $validated['items'],
175
+ ),
176
+ notes: $validated['notes'] ?? null,
177
+ );
178
+ }
179
+ }
180
+ ```
181
+
182
+ ## Result Objects for Expected Failures
183
+
184
+ ```php
185
+ // Instead of exceptions for validation/not-found
186
+ readonly class Result
187
+ {
188
+ private function __construct(
189
+ public bool $success,
190
+ public mixed $value = null,
191
+ public ?string $error = null,
192
+ ) {}
193
+
194
+ public static function ok(mixed $value): self
195
+ {
196
+ return new self(success: true, value: $value);
197
+ }
198
+
199
+ public static function fail(string $error): self
200
+ {
201
+ return new self(success: false, error: $error);
202
+ }
203
+ }
204
+
205
+ // Usage in service
206
+ public function transfer(int $fromId, int $toId, Money $amount): Result
207
+ {
208
+ $from = $this->accountRepo->findById($fromId);
209
+ if ($from === null) return Result::fail('Source account not found');
210
+
211
+ if ($from->balance->amount < $amount->amount) {
212
+ return Result::fail('Insufficient funds');
213
+ }
214
+
215
+ // ... perform transfer
216
+ return Result::ok($transaction);
217
+ }
218
+ ```
219
+
220
+ ## Middleware Pattern
221
+
222
+ ```php
223
+ // Middleware for cross-cutting concerns
224
+ final class RateLimitMiddleware
225
+ {
226
+ public function __construct(
227
+ private readonly RateLimiter $limiter,
228
+ ) {}
229
+
230
+ public function handle(Request $request, \Closure $next): Response
231
+ {
232
+ $key = $request->ip();
233
+ if (!$this->limiter->attempt($key, maxAttempts: 60, decayMinutes: 1)) {
234
+ return new JsonResponse(['error' => 'Too many requests'], 429);
235
+ }
236
+ return $next($request);
237
+ }
238
+ }
239
+ ```