@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
@@ -0,0 +1,235 @@
1
+ # Testing and Static Analysis
2
+
3
+ ## PHPUnit Setup
4
+
5
+ ```php
6
+ // tests/Unit/Service/OrderServiceTest.php
7
+ declare(strict_types=1);
8
+
9
+ namespace Tests\Unit\Service;
10
+
11
+ use PHPUnit\Framework\TestCase;
12
+ use PHPUnit\Framework\Attributes\Test;
13
+ use PHPUnit\Framework\Attributes\DataProvider;
14
+
15
+ final class OrderServiceTest extends TestCase
16
+ {
17
+ private OrderService $sut;
18
+ private OrderRepository&MockObject $repo;
19
+
20
+ protected function setUp(): void
21
+ {
22
+ $this->repo = $this->createMock(OrderRepository::class);
23
+ $this->sut = new OrderService($this->repo);
24
+ }
25
+
26
+ #[Test]
27
+ public function getOrder_existing_returns_order(): void
28
+ {
29
+ $expected = new Order(id: 1, product: 'Widget');
30
+ $this->repo
31
+ ->expects($this->once())
32
+ ->method('findById')
33
+ ->with(1)
34
+ ->willReturn($expected);
35
+
36
+ $result = $this->sut->getOrder(1);
37
+
38
+ $this->assertSame($expected, $result);
39
+ }
40
+
41
+ #[Test]
42
+ public function getOrder_missing_throws_not_found(): void
43
+ {
44
+ $this->repo->method('findById')->willReturn(null);
45
+
46
+ $this->expectException(OrderNotFoundException::class);
47
+ $this->sut->getOrder(999);
48
+ }
49
+ }
50
+ ```
51
+
52
+ ## Data Providers
53
+
54
+ ```php
55
+ #[DataProvider('discountData')]
56
+ #[Test]
57
+ public function calculates_discount(string $tier, int $years, float $expected): void
58
+ {
59
+ $customer = new Customer(tier: $tier, years: $years);
60
+ $this->assertSame($expected, $this->sut->calculateDiscount($customer));
61
+ }
62
+
63
+ public static function discountData(): array
64
+ {
65
+ return [
66
+ 'gold 5+ years' => ['gold', 6, 0.20],
67
+ 'gold under 5' => ['gold', 3, 0.15],
68
+ 'silver' => ['silver', 1, 0.10],
69
+ 'standard' => ['standard', 0, 0.0],
70
+ ];
71
+ }
72
+ ```
73
+
74
+ ## Pest (Alternative Syntax)
75
+
76
+ ```php
77
+ // tests/Feature/OrderApiTest.php
78
+ use function Pest\Laravel\postJson;
79
+ use function Pest\Laravel\assertDatabaseHas;
80
+
81
+ it('creates an order with valid data', function () {
82
+ $response = postJson('/api/orders', [
83
+ 'product' => 'Widget',
84
+ 'quantity' => 3,
85
+ ]);
86
+
87
+ $response->assertCreated();
88
+ assertDatabaseHas('orders', ['product' => 'Widget']);
89
+ });
90
+
91
+ it('rejects orders with missing product', function () {
92
+ postJson('/api/orders', ['quantity' => 3])
93
+ ->assertUnprocessable()
94
+ ->assertJsonValidationErrors(['product']);
95
+ });
96
+
97
+ it('applies discount for bulk orders')
98
+ ->with([
99
+ [10, 0.05],
100
+ [50, 0.10],
101
+ [100, 0.15],
102
+ ])
103
+ ->expect(fn (int $qty, float $discount) =>
104
+ $this->service->calculateDiscount($qty)
105
+ )->toBe(fn (int $qty, float $discount) => $discount);
106
+ ```
107
+
108
+ ## Mocking External Dependencies
109
+
110
+ ```php
111
+ // Mock HTTP client
112
+ #[Test]
113
+ public function fetches_weather_data(): void
114
+ {
115
+ $httpClient = $this->createMock(HttpClientInterface::class);
116
+ $httpClient->method('request')
117
+ ->with('GET', 'https://api.weather.com/current')
118
+ ->willReturn(new MockResponse(json_encode(['temp' => 22.5])));
119
+
120
+ $service = new WeatherService($httpClient);
121
+ $weather = $service->getCurrent();
122
+
123
+ $this->assertSame(22.5, $weather->temperature);
124
+ }
125
+
126
+ // Prophecy-style mocking (alternative)
127
+ public function prophecy_example(): void
128
+ {
129
+ $repo = $this->prophesize(UserRepository::class);
130
+ $repo->findById(1)->willReturn(new User(id: 1, name: 'Alice'));
131
+ $repo->findById(1)->shouldBeCalledOnce();
132
+
133
+ $service = new UserService($repo->reveal());
134
+ $result = $service->getUser(1);
135
+
136
+ $this->assertSame('Alice', $result->name);
137
+ }
138
+ ```
139
+
140
+ ## PHPStan Configuration
141
+
142
+ ```neon
143
+ # phpstan.neon
144
+ parameters:
145
+ level: 9 # maximum strictness
146
+ paths:
147
+ - src
148
+ - tests
149
+ excludePaths:
150
+ - src/Generated
151
+ treatPhpDocTypesAsCertain: false
152
+ reportUnmatchedIgnoredErrors: true
153
+
154
+ # Custom rules
155
+ ignoreErrors:
156
+ - '#Call to an undefined method Mockery#' # test mocking
157
+
158
+ includes:
159
+ - vendor/phpstan/phpstan-phpunit/extension.neon
160
+ - vendor/phpstan/phpstan-deprecation-rules/rules.neon
161
+ - vendor/phpstan/phpstan-strict-rules/rules.neon
162
+ ```
163
+
164
+ ## Psalm Configuration
165
+
166
+ ```xml
167
+ <!-- psalm.xml -->
168
+ <?xml version="1.0"?>
169
+ <psalm
170
+ errorLevel="1"
171
+ resolveFromConfigFile="true"
172
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
173
+ xmlns="https://getpsalm.org/schema/config"
174
+ >
175
+ <projectFiles>
176
+ <directory name="src" />
177
+ <ignoreFiles>
178
+ <directory name="vendor" />
179
+ </ignoreFiles>
180
+ </projectFiles>
181
+
182
+ <plugins>
183
+ <pluginClass class="Psalm\PhpUnitPlugin\Plugin" />
184
+ </plugins>
185
+ </psalm>
186
+ ```
187
+
188
+ ## CI Pipeline Test Commands
189
+
190
+ ```bash
191
+ # Full test suite
192
+ vendor/bin/phpunit --testdox
193
+
194
+ # With coverage
195
+ XDEBUG_MODE=coverage vendor/bin/phpunit --coverage-clover coverage.xml
196
+
197
+ # Static analysis
198
+ vendor/bin/phpstan analyse --memory-limit=512M
199
+ vendor/bin/psalm --no-cache
200
+
201
+ # Code style
202
+ vendor/bin/php-cs-fixer fix --dry-run --diff
203
+ vendor/bin/phpcs --standard=PSR12 src/
204
+
205
+ # Security audit
206
+ composer audit
207
+
208
+ # Typical CI order:
209
+ # 1. composer install --no-dev=false
210
+ # 2. php-cs-fixer (format check)
211
+ # 3. phpstan/psalm (static analysis)
212
+ # 4. phpunit (tests + coverage)
213
+ # 5. composer audit (security)
214
+ ```
215
+
216
+ ## Test Organization
217
+
218
+ ```
219
+ tests/
220
+ ├── Unit/ # Fast, isolated, mocked dependencies
221
+ │ ├── Service/
222
+ │ │ └── OrderServiceTest.php
223
+ │ ├── Domain/
224
+ │ │ └── MoneyTest.php
225
+ │ └── Validator/
226
+ │ └── EmailValidatorTest.php
227
+ ├── Integration/ # Real database, real HTTP
228
+ │ ├── Repository/
229
+ │ │ └── OrderRepositoryTest.php
230
+ │ └── Api/
231
+ │ └── OrderApiTest.php
232
+ ├── Fixtures/ # Shared test data
233
+ │ └── orders.json
234
+ └── phpunit.xml
235
+ ```
@@ -0,0 +1,85 @@
1
+ ````markdown
2
+ ---
3
+ inclusion: manual
4
+ name: playwright-e2e
5
+ description: "Use when writing or reviewing browser end-to-end tests with Playwright, debugging flaky UI automation, validating auth or checkout flows, or tightening CI evidence with traces and web-first assertions."
6
+ license: MIT
7
+ metadata:
8
+ author: cubis-foundry
9
+ version: "2.0"
10
+ compatibility: Claude Code, Codex, GitHub Copilot
11
+ ---
12
+
13
+ # Playwright E2E
14
+
15
+ ## Purpose
16
+
17
+ Use when writing or reviewing browser end-to-end tests with Playwright, debugging flaky UI automation, validating auth or checkout flows, or tightening CI evidence with traces and web-first assertions. When Playwright MCP upstream is configured in Cubis Foundry, leverage browser automation tools for live page inspection, snapshot-based debugging, and interactive test development.
18
+
19
+ ## When to Use
20
+
21
+ - Writing or refactoring Playwright browser tests for critical user journeys.
22
+ - Debugging flaky E2E failures, locator instability, or auth state leakage in CI.
23
+ - Choosing between fixtures, reusable helpers, and page-level abstractions.
24
+ - Reviewing traces, screenshots, videos, and network activity to isolate browser failures.
25
+ - Using Playwright MCP tools for live browser navigation, snapshot capture, and interactive element inspection during test development.
26
+
27
+ ## Instructions
28
+
29
+ 1. Choose the smallest browser journeys that actually protect revenue, auth, or release confidence.
30
+ 2. Prefer role, label, text, or explicit test-id locators over DOM-shape selectors.
31
+ 3. Keep tests isolated with deterministic data, reusable auth setup, and minimal hidden shared state.
32
+ 4. Use web-first assertions, traces, and network evidence before calling a test flaky.
33
+ 5. Leave CI with artifacts that explain the failure path instead of screenshots alone.
34
+
35
+ ### Playwright MCP tools
36
+
37
+ When the Playwright upstream is configured in the Cubis Foundry MCP gateway, these tool categories are available for interactive browser automation:
38
+
39
+ - **Navigation**: `browser_navigate`, `browser_go_back`, `browser_go_forward`, `browser_wait` — open pages, navigate history, wait for network idle.
40
+ - **Snapshots**: `browser_snapshot` — capture an accessibility-tree snapshot of the current page for element inspection and locator discovery.
41
+ - **Interaction**: `browser_click`, `browser_type`, `browser_select_option`, `browser_hover`, `browser_drag` — interact with page elements using accessibility refs from snapshots.
42
+ - **Keyboard & files**: `browser_press_key`, `browser_file_upload` — press keys or upload files.
43
+ - **Tabs**: `browser_tab_list`, `browser_tab_new`, `browser_tab_select`, `browser_tab_close` — manage browser tabs.
44
+ - **Utilities**: `browser_console_messages`, `browser_generate_playwright_test`, `browser_network_requests`, `browser_install` — read console logs, generate test code, inspect network, install browsers.
45
+
46
+ Use MCP tools during development to inspect live pages and generate locator-accurate test code. Use the Playwright test runner and CI pipeline for execution.
47
+
48
+ ### Baseline standards
49
+
50
+ - Test user-visible behavior rather than component internals or CSS structure.
51
+ - Avoid `waitForTimeout`; let locators, assertions, and explicit app signals do the waiting.
52
+ - Reuse authenticated state only through deliberate setup, not test-to-test coupling.
53
+ - Mock or route third-party dependencies you do not control.
54
+ - Treat trace review as the default path for CI-only failures.
55
+
56
+ ### Constraints
57
+
58
+ - Avoid xPath or fragile class-chain selectors when resilient contracts exist.
59
+ - Avoid giant page-object hierarchies for short or single-owner flows.
60
+ - Avoid browser suites that duplicate unit or integration checks with no added confidence.
61
+ - Avoid marking tests flaky without a trace, reproduction note, and suspected instability source.
62
+
63
+ ## Output Format
64
+
65
+ Provide implementation guidance, code examples, and configuration as appropriate to the task.
66
+
67
+ ## References
68
+
69
+ Load on demand. Do not preload all reference files.
70
+
71
+ | File | Load when |
72
+ | --------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
73
+ | `references/locator-trace-flake-checklist.md` | You need a deeper checklist for locator choice, auth setup, trace-driven debugging, retries, CI artifacts, flake triage, or MCP workflow patterns. |
74
+
75
+ ## Scripts
76
+
77
+ No helper scripts are required for this skill right now. Keep execution in `SKILL.md` and `references/` unless repeated automation becomes necessary.
78
+
79
+ ## Examples
80
+
81
+ - "Help me with playwright e2e best practices in this project"
82
+ - "Review my playwright e2e implementation for issues"
83
+ - "Use Playwright MCP to inspect the login page and generate test code"
84
+ - "Check playwright upstream status and available browser tools"
85
+ ````
@@ -0,0 +1,82 @@
1
+ ---
2
+ name: playwright-e2e
3
+ description: "Use when writing or reviewing browser end-to-end tests with Playwright, debugging flaky UI automation, validating auth or checkout flows, or tightening CI evidence with traces and web-first assertions."
4
+ license: MIT
5
+ metadata:
6
+ author: cubis-foundry
7
+ version: "2.0"
8
+ compatibility: Claude Code, Codex, GitHub Copilot
9
+ ---
10
+
11
+ # Playwright E2E
12
+
13
+ ## Purpose
14
+
15
+ Use when writing or reviewing browser end-to-end tests with Playwright, debugging flaky UI automation, validating auth or checkout flows, or tightening CI evidence with traces and web-first assertions. When Playwright MCP upstream is configured in Cubis Foundry, leverage browser automation tools for live page inspection, snapshot-based debugging, and interactive test development.
16
+
17
+ ## When to Use
18
+
19
+ - Writing or refactoring Playwright browser tests for critical user journeys.
20
+ - Debugging flaky E2E failures, locator instability, or auth state leakage in CI.
21
+ - Choosing between fixtures, reusable helpers, and page-level abstractions.
22
+ - Reviewing traces, screenshots, videos, and network activity to isolate browser failures.
23
+ - Using Playwright MCP tools for live browser navigation, snapshot capture, and interactive element inspection during test development.
24
+
25
+ ## Instructions
26
+
27
+ 1. Choose the smallest browser journeys that actually protect revenue, auth, or release confidence.
28
+ 2. Prefer role, label, text, or explicit test-id locators over DOM-shape selectors.
29
+ 3. Keep tests isolated with deterministic data, reusable auth setup, and minimal hidden shared state.
30
+ 4. Use web-first assertions, traces, and network evidence before calling a test flaky.
31
+ 5. Leave CI with artifacts that explain the failure path instead of screenshots alone.
32
+
33
+ ### Playwright MCP tools
34
+
35
+ When the Playwright upstream is configured in the Cubis Foundry MCP gateway, these tool categories are available for interactive browser automation:
36
+
37
+ - **Navigation**: `browser_navigate`, `browser_go_back`, `browser_go_forward`, `browser_wait` — open pages, navigate history, wait for network idle.
38
+ - **Snapshots**: `browser_snapshot` — capture an accessibility-tree snapshot of the current page for element inspection and locator discovery.
39
+ - **Interaction**: `browser_click`, `browser_type`, `browser_select_option`, `browser_hover`, `browser_drag` — interact with page elements using accessibility refs from snapshots.
40
+ - **Keyboard & files**: `browser_press_key`, `browser_file_upload` — press keys or upload files.
41
+ - **Tabs**: `browser_tab_list`, `browser_tab_new`, `browser_tab_select`, `browser_tab_close` — manage browser tabs.
42
+ - **Utilities**: `browser_console_messages`, `browser_generate_playwright_test`, `browser_network_requests`, `browser_install` — read console logs, generate test code, inspect network, install browsers.
43
+
44
+ Use MCP tools during development to inspect live pages and generate locator-accurate test code. Use the Playwright test runner and CI pipeline for execution.
45
+
46
+ ### Baseline standards
47
+
48
+ - Test user-visible behavior rather than component internals or CSS structure.
49
+ - Avoid `waitForTimeout`; let locators, assertions, and explicit app signals do the waiting.
50
+ - Reuse authenticated state only through deliberate setup, not test-to-test coupling.
51
+ - Mock or route third-party dependencies you do not control.
52
+ - Treat trace review as the default path for CI-only failures.
53
+
54
+ ### Constraints
55
+
56
+ - Avoid xPath or fragile class-chain selectors when resilient contracts exist.
57
+ - Avoid giant page-object hierarchies for short or single-owner flows.
58
+ - Avoid browser suites that duplicate unit or integration checks with no added confidence.
59
+ - Avoid marking tests flaky without a trace, reproduction note, and suspected instability source.
60
+
61
+ ## Output Format
62
+
63
+ Provide implementation guidance, code examples, and configuration as appropriate to the task.
64
+
65
+ ## References
66
+
67
+ Load on demand. Do not preload all reference files.
68
+
69
+ | File | Load when |
70
+ | --------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
71
+ | `references/locator-trace-flake-checklist.md` | You need a deeper checklist for locator choice, auth setup, trace-driven debugging, retries, CI artifacts, flake triage, or MCP workflow patterns. |
72
+
73
+ ## Scripts
74
+
75
+ No helper scripts are required for this skill right now. Keep execution in `SKILL.md` and `references/` unless repeated automation becomes necessary.
76
+
77
+ ## Examples
78
+
79
+ - "Help me with playwright e2e best practices in this project"
80
+ - "Review my playwright e2e implementation for issues"
81
+ - "Use Playwright MCP to inspect the login page and generate test code"
82
+ - "Check playwright upstream status and available browser tools"
@@ -0,0 +1,80 @@
1
+ # Locator, Trace, and Flake Checklist
2
+
3
+ Use this when Playwright is already the right tool and you need exact implementation guidance.
4
+
5
+ ## Locator priority
6
+
7
+ 1. Start with `getByRole`, `getByLabel`, `getByPlaceholder`, `getByText`, or `getByTestId`.
8
+ 2. Add filtering or chaining before reaching for positional selectors.
9
+ 3. Use explicit test ids only for controls with unstable visible text or repeated semantics.
10
+ 4. Treat CSS or XPath selectors as last-resort escape hatches with a comment-worthy reason.
11
+
12
+ ## Test isolation
13
+
14
+ - Keep each test able to run alone.
15
+ - Build auth setup through fixtures, setup projects, or seeded state, not cross-test ordering.
16
+ - Control database and network inputs for critical flows.
17
+ - Stub or route third-party dependencies you do not own.
18
+
19
+ ## Assertion and waiting rules
20
+
21
+ - Prefer `await expect(locator).to...` over manual `isVisible()`-style polling.
22
+ - Wait on user-visible state changes, not arbitrary timers.
23
+ - Use network or URL assertions only when they are part of the behavior you are protecting.
24
+ - Do not normalize flakiness by increasing timeouts before understanding the wait condition.
25
+
26
+ ## Trace-driven debugging
27
+
28
+ - Capture traces on first retry or on failure in CI.
29
+ - When a test fails, inspect:
30
+ - timeline ordering
31
+ - actionability logs
32
+ - DOM snapshot at the failing step
33
+ - network calls and mocked routes
34
+ - console or page errors tied to the same flow
35
+ - Add screenshots or videos only as supporting artifacts, not as the primary debugging surface.
36
+
37
+ ## Flake triage
38
+
39
+ Check these in order:
40
+
41
+ 1. Locator ambiguity or unstable text.
42
+ 2. Hidden app loading state or optimistic UI race.
43
+ 3. Shared auth or storage state leakage.
44
+ 4. Server or mocked dependency nondeterminism.
45
+ 5. Environment-only timing differences in CI.
46
+
47
+ ## CI defaults
48
+
49
+ - Keep retries low and intentional.
50
+ - Upload traces for failed or retried tests.
51
+ - Shard only after local determinism is solid.
52
+ - Separate smoke-critical browser flows from broad exploratory suites.
53
+
54
+ ## MCP workflow patterns
55
+
56
+ When Playwright MCP upstream is configured in the Cubis Foundry gateway:
57
+
58
+ ### Interactive test development
59
+
60
+ 1. Use `browser_navigate` to open the target page.
61
+ 2. Use `browser_snapshot` to capture the accessibility tree and discover locator targets.
62
+ 3. Interact with elements via `browser_click`, `browser_type`, `browser_select_option` using accessibility refs from the snapshot.
63
+ 4. Use `browser_generate_playwright_test` to produce test code from the recorded interactions.
64
+ 5. Refine generated tests with proper assertions, fixtures, and isolation.
65
+
66
+ ### Snapshot-based debugging
67
+
68
+ - Take `browser_snapshot` at the failing step to compare the DOM state against expected locators.
69
+ - Use `browser_console_messages` to capture console errors tied to the flow.
70
+ - Use `browser_network_requests` to verify API calls and mocked routes.
71
+
72
+ ### Tab and navigation workflow
73
+
74
+ - Use `browser_tab_new` and `browser_tab_select` to manage multi-tab flows (OAuth popups, payment redirects).
75
+ - Use `browser_go_back` and `browser_go_forward` to test browser history behavior.
76
+
77
+ ### When to use MCP vs test runner
78
+
79
+ - **MCP tools**: Interactive exploration, locator discovery, test code generation, debugging live pages during development.
80
+ - **Test runner (`npx playwright test`)**: Execution, CI, parallel sharding, retries, reporting, and deterministic assertions.
@@ -0,0 +1,67 @@
1
+ ````markdown
2
+ ---
3
+ inclusion: manual
4
+ name: postgres
5
+ description: "Use when the task is specifically PostgreSQL: schema design with Postgres features, query plans, indexes, JSONB, extensions, partitioning, logical replication, or managed Postgres operational tradeoffs."
6
+ license: MIT
7
+ metadata:
8
+ author: cubis-foundry
9
+ version: "3.0"
10
+ compatibility: Claude Code, Codex, GitHub Copilot
11
+ ---
12
+
13
+ # Postgres
14
+
15
+ ## Purpose
16
+
17
+ Use when the task is specifically PostgreSQL: schema design with Postgres features, query plans, indexes, JSONB, extensions, partitioning, logical replication, or managed Postgres operational tradeoffs.
18
+
19
+ ## When to Use
20
+
21
+ - The engine is PostgreSQL or a managed Postgres product.
22
+ - The task depends on Postgres-specific features such as JSONB, partial indexes, CTEs, extensions, or partitioning.
23
+ - You need Postgres-aware migration, replication, or query-plan guidance.
24
+
25
+ ## Instructions
26
+
27
+ 1. Confirm the Postgres variant, version, hosting model, and write/read shape.
28
+ 2. Choose the smallest Postgres-specific feature set that solves the real workload.
29
+ 3. Design indexes, constraints, and pagination from actual predicates and sort order.
30
+ 4. Validate migrations and operational impact, including replication, locks, or extension constraints.
31
+ 5. Re-check with `EXPLAIN` evidence and rollback notes before finalizing.
32
+
33
+ ### Baseline standards
34
+
35
+ - Prefer plain relational design before reaching for JSONB or exotic features.
36
+ - Treat `EXPLAIN`, lock behavior, and index cost as part of every non-trivial change.
37
+ - Keep extension usage deliberate and portable only when portability matters.
38
+ - Make write amplification, autovacuum, and migration blast radius explicit.
39
+
40
+ ### Constraints
41
+
42
+ - Avoid using JSONB to avoid normal modeling without evidence.
43
+ - Avoid adding indexes without predicate, join, or ordering evidence.
44
+ - Avoid large blocking schema changes without a staged rollout.
45
+ - Avoid treating every Postgres problem as a tuning problem instead of a workload-design problem.
46
+
47
+ ## Output Format
48
+
49
+ Provide implementation guidance, code examples, and configuration as appropriate to the task.
50
+
51
+ ## References
52
+
53
+ Load on demand. Do not preload all reference files.
54
+
55
+ | File | Load when |
56
+ | --- | --- |
57
+ | `references/postgres-checklist.md` | You need a deeper Postgres checklist for indexes, JSONB, extensions, locking, partitioning, and migration safety. |
58
+
59
+ ## Scripts
60
+
61
+ No helper scripts are required for this skill right now. Keep execution in `SKILL.md` and `references/` unless repeated automation becomes necessary.
62
+
63
+ ## Examples
64
+
65
+ - "Help me with postgres best practices in this project"
66
+ - "Review my postgres implementation for issues"
67
+ ````
@@ -0,0 +1,64 @@
1
+ ---
2
+ name: postgres
3
+ description: "Use when the task is specifically PostgreSQL: schema design with Postgres features, query plans, indexes, JSONB, extensions, partitioning, logical replication, or managed Postgres operational tradeoffs."
4
+ license: MIT
5
+ metadata:
6
+ author: cubis-foundry
7
+ version: "3.0"
8
+ compatibility: Claude Code, Codex, GitHub Copilot
9
+ ---
10
+
11
+ # Postgres
12
+
13
+ ## Purpose
14
+
15
+ Use when the task is specifically PostgreSQL: schema design with Postgres features, query plans, indexes, JSONB, extensions, partitioning, logical replication, or managed Postgres operational tradeoffs.
16
+
17
+ ## When to Use
18
+
19
+ - The engine is PostgreSQL or a managed Postgres product.
20
+ - The task depends on Postgres-specific features such as JSONB, partial indexes, CTEs, extensions, or partitioning.
21
+ - You need Postgres-aware migration, replication, or query-plan guidance.
22
+
23
+ ## Instructions
24
+
25
+ 1. Confirm the Postgres variant, version, hosting model, and write/read shape.
26
+ 2. Choose the smallest Postgres-specific feature set that solves the real workload.
27
+ 3. Design indexes, constraints, and pagination from actual predicates and sort order.
28
+ 4. Validate migrations and operational impact, including replication, locks, or extension constraints.
29
+ 5. Re-check with `EXPLAIN` evidence and rollback notes before finalizing.
30
+
31
+ ### Baseline standards
32
+
33
+ - Prefer plain relational design before reaching for JSONB or exotic features.
34
+ - Treat `EXPLAIN`, lock behavior, and index cost as part of every non-trivial change.
35
+ - Keep extension usage deliberate and portable only when portability matters.
36
+ - Make write amplification, autovacuum, and migration blast radius explicit.
37
+
38
+ ### Constraints
39
+
40
+ - Avoid using JSONB to avoid normal modeling without evidence.
41
+ - Avoid adding indexes without predicate, join, or ordering evidence.
42
+ - Avoid large blocking schema changes without a staged rollout.
43
+ - Avoid treating every Postgres problem as a tuning problem instead of a workload-design problem.
44
+
45
+ ## Output Format
46
+
47
+ Provide implementation guidance, code examples, and configuration as appropriate to the task.
48
+
49
+ ## References
50
+
51
+ Load on demand. Do not preload all reference files.
52
+
53
+ | File | Load when |
54
+ | --- | --- |
55
+ | `references/postgres-checklist.md` | You need a deeper Postgres checklist for indexes, JSONB, extensions, locking, partitioning, and migration safety. |
56
+
57
+ ## Scripts
58
+
59
+ No helper scripts are required for this skill right now. Keep execution in `SKILL.md` and `references/` unless repeated automation becomes necessary.
60
+
61
+ ## Examples
62
+
63
+ - "Help me with postgres best practices in this project"
64
+ - "Review my postgres implementation for issues"
@@ -0,0 +1,20 @@
1
+ # Postgres Checklist
2
+
3
+ Load this when PostgreSQL work needs deeper tactical guidance.
4
+
5
+ ## Modeling and indexes
6
+
7
+ - Prefer ordinary relational design before JSONB or specialized extensions.
8
+ - Choose indexes from actual predicates, joins, and ordering.
9
+ - Keep pagination aligned to index shape.
10
+
11
+ ## Operations
12
+
13
+ - Check lock behavior and migration blast radius.
14
+ - Keep replication and failover posture visible when schema or extension usage changes.
15
+ - Use staged rollouts for heavy DDL or large backfills.
16
+
17
+ ## Evidence
18
+
19
+ - Use `EXPLAIN` or `EXPLAIN ANALYZE` when query behavior is in scope.
20
+ - Make write amplification, vacuum impact, and rollback explicit.