@cubis/foundry 0.3.71 → 0.3.73
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.
- package/CHANGELOG.md +23 -2
- package/dist/cli/core.js +9 -22
- package/dist/cli/core.js.map +1 -1
- package/package.json +1 -1
- package/src/cli/core.ts +13 -22
- package/workflows/powers/accessibility/POWER.md +83 -94
- package/workflows/powers/accessibility/SKILL.md +82 -94
- package/workflows/powers/agent-design/POWER.md +201 -0
- package/workflows/powers/agent-design/SKILL.md +198 -0
- package/workflows/powers/agent-design/references/clarification-patterns.md +153 -0
- package/workflows/powers/agent-design/references/skill-testing.md +164 -0
- package/workflows/powers/agent-design/references/workflow-patterns.md +226 -0
- package/workflows/powers/agentic-eval/POWER.md +62 -0
- package/workflows/powers/agentic-eval/SKILL.md +59 -0
- package/workflows/powers/agentic-eval/references/rubric-and-regression-checklist.md +11 -0
- package/workflows/powers/api-designer/POWER.md +43 -71
- package/workflows/powers/api-designer/SKILL.md +43 -71
- package/workflows/powers/api-patterns/POWER.md +42 -56
- package/workflows/powers/api-patterns/SKILL.md +42 -57
- package/workflows/powers/architecture-designer/POWER.md +43 -60
- package/workflows/powers/architecture-designer/SKILL.md +43 -60
- package/workflows/powers/ask-questions-if-underspecified/POWER.md +51 -3
- package/workflows/powers/auth-architect/POWER.md +69 -0
- package/workflows/powers/auth-architect/SKILL.md +66 -0
- package/workflows/powers/auth-architect/references/session-token-policy-checklist.md +45 -0
- package/workflows/powers/behavioral-modes/POWER.md +100 -9
- package/workflows/powers/c-pro/POWER.md +105 -0
- package/workflows/powers/c-pro/SKILL.md +102 -0
- package/workflows/powers/c-pro/references/build-systems-and-toolchains.md +148 -0
- package/workflows/powers/c-pro/references/common-ub-and-portability.md +166 -0
- package/workflows/powers/c-pro/references/debugging-with-sanitizers.md +205 -0
- package/workflows/powers/c-pro/references/memory-safety-and-build-checklist.md +60 -0
- package/workflows/powers/c-pro/references/posix-and-platform-apis.md +244 -0
- package/workflows/powers/changelog-generator/POWER.md +127 -63
- package/workflows/powers/changelog-generator/SKILL.md +126 -63
- package/workflows/powers/ci-cd-pipelines/POWER.md +156 -0
- package/workflows/powers/ci-cd-pipelines/SKILL.md +153 -0
- package/workflows/powers/ci-cd-pipelines/references/github-actions-patterns.md +160 -0
- package/workflows/powers/ci-cd-pipelines/references/pipeline-security-checklist.md +57 -0
- package/workflows/powers/cli-developer/POWER.md +152 -95
- package/workflows/powers/cli-developer/SKILL.md +152 -95
- package/workflows/powers/cpp-pro/POWER.md +111 -0
- package/workflows/powers/cpp-pro/SKILL.md +108 -0
- package/workflows/powers/cpp-pro/references/concurrency-primitives.md +266 -0
- package/workflows/powers/cpp-pro/references/move-semantics-and-value-types.md +149 -0
- package/workflows/powers/cpp-pro/references/performance-and-profiling.md +191 -0
- package/workflows/powers/cpp-pro/references/raii-and-modern-cpp-checklist.md +87 -0
- package/workflows/powers/cpp-pro/references/template-and-concepts-patterns.md +205 -0
- package/workflows/powers/csharp-pro/POWER.md +47 -22
- package/workflows/powers/csharp-pro/SKILL.md +47 -22
- package/workflows/powers/dart-pro/POWER.md +68 -0
- package/workflows/powers/dart-pro/SKILL.md +65 -0
- package/workflows/powers/dart-pro/references/isolate-and-concurrency.md +180 -0
- package/workflows/powers/dart-pro/references/null-safety-and-async-patterns.md +133 -0
- package/workflows/powers/dart-pro/references/package-structure-and-linting.md +193 -0
- package/workflows/powers/dart-pro/references/sealed-records-patterns.md +173 -0
- package/workflows/powers/dart-pro/references/testing-and-mocking.md +235 -0
- package/workflows/powers/database-design/POWER.md +47 -33
- package/workflows/powers/database-design/SKILL.md +47 -33
- package/workflows/powers/database-optimizer/POWER.md +43 -64
- package/workflows/powers/database-optimizer/SKILL.md +43 -64
- package/workflows/powers/database-skills/POWER.md +59 -93
- package/workflows/powers/database-skills/SKILL.md +59 -93
- package/workflows/powers/debugging-strategies/POWER.md +69 -0
- package/workflows/powers/debugging-strategies/SKILL.md +66 -0
- package/workflows/powers/debugging-strategies/references/reproduce-isolate-verify-checklist.md +42 -0
- package/workflows/powers/deep-research/POWER.md +67 -0
- package/workflows/powers/deep-research/SKILL.md +64 -0
- package/workflows/powers/deep-research/references/multi-round-research-loop.md +80 -0
- package/workflows/powers/design-system-builder/POWER.md +130 -116
- package/workflows/powers/design-system-builder/SKILL.md +130 -116
- package/workflows/powers/devops-engineer/POWER.md +120 -57
- package/workflows/powers/devops-engineer/SKILL.md +120 -57
- package/workflows/powers/docker-kubernetes/POWER.md +94 -0
- package/workflows/powers/docker-kubernetes/SKILL.md +91 -0
- package/workflows/powers/docker-kubernetes/references/dockerfile-optimization-checklist.md +35 -0
- package/workflows/powers/docker-kubernetes/references/kubernetes-deployment-patterns.md +59 -0
- package/workflows/powers/documentation-templates/POWER.md +158 -127
- package/workflows/powers/documentation-templates/SKILL.md +158 -127
- package/workflows/powers/drizzle-expert/POWER.md +66 -0
- package/workflows/powers/drizzle-expert/SKILL.md +63 -0
- package/workflows/powers/drizzle-expert/references/runtime-pairing-matrix.md +16 -0
- package/workflows/powers/drizzle-expert/references/schema-and-migration-playbook.md +18 -0
- package/workflows/powers/error-ux-observability/POWER.md +144 -131
- package/workflows/powers/error-ux-observability/SKILL.md +143 -131
- package/workflows/powers/fastapi-expert/POWER.md +46 -60
- package/workflows/powers/fastapi-expert/SKILL.md +46 -60
- package/workflows/powers/firebase/POWER.md +65 -0
- package/workflows/powers/firebase/SKILL.md +62 -0
- package/workflows/powers/firebase/references/platform-routing.md +16 -0
- package/workflows/powers/firebase/references/rules-and-indexes-checklist.md +11 -0
- package/workflows/powers/flutter-design-system/POWER.md +63 -0
- package/workflows/powers/flutter-design-system/SKILL.md +60 -0
- package/workflows/powers/flutter-design-system/references/shared-widgets.md +29 -0
- package/workflows/powers/flutter-design-system/references/tokens-and-theme.md +34 -0
- package/workflows/powers/flutter-drift/POWER.md +65 -0
- package/workflows/powers/flutter-drift/SKILL.md +62 -0
- package/workflows/powers/flutter-drift/references/migrations.md +22 -0
- package/workflows/powers/flutter-drift/references/query-patterns.md +26 -0
- package/workflows/powers/flutter-feature/POWER.md +65 -0
- package/workflows/powers/flutter-feature/SKILL.md +62 -0
- package/workflows/powers/flutter-feature/references/architecture-rules.md +85 -0
- package/workflows/powers/flutter-feature/references/composite-provider.md +58 -0
- package/workflows/powers/flutter-feature/references/outbox-pattern.md +87 -0
- package/workflows/powers/flutter-feature/references/testing-patterns.md +218 -0
- package/workflows/powers/flutter-go-router/POWER.md +64 -0
- package/workflows/powers/flutter-go-router/SKILL.md +61 -0
- package/workflows/powers/flutter-go-router/references/guards-and-deeplinks.md +20 -0
- package/workflows/powers/flutter-go-router/references/typed-routes.md +27 -0
- package/workflows/powers/flutter-offline-sync/POWER.md +62 -0
- package/workflows/powers/flutter-offline-sync/SKILL.md +59 -0
- package/workflows/powers/flutter-offline-sync/references/outbox-full.md +44 -0
- package/workflows/powers/flutter-repository/POWER.md +64 -0
- package/workflows/powers/flutter-repository/SKILL.md +61 -0
- package/workflows/powers/flutter-repository/references/drift-patterns.md +21 -0
- package/workflows/powers/flutter-repository/references/retrofit-patterns.md +20 -0
- package/workflows/powers/flutter-riverpod/POWER.md +70 -0
- package/workflows/powers/flutter-riverpod/SKILL.md +67 -0
- package/workflows/powers/flutter-riverpod/references/async-and-mutations.md +19 -0
- package/workflows/powers/flutter-riverpod/references/async-lifecycle.md +19 -0
- package/workflows/powers/flutter-riverpod/references/provider-selection.md +20 -0
- package/workflows/powers/flutter-riverpod/references/testing.md +21 -0
- package/workflows/powers/flutter-riverpod/references/version-matrix.md +24 -0
- package/workflows/powers/flutter-state-machine/POWER.md +62 -0
- package/workflows/powers/flutter-state-machine/SKILL.md +59 -0
- package/workflows/powers/flutter-state-machine/references/app-state-contract.md +23 -0
- package/workflows/powers/flutter-state-machine/references/ui-rendering.md +14 -0
- package/workflows/powers/flutter-testing/POWER.md +64 -0
- package/workflows/powers/flutter-testing/SKILL.md +61 -0
- package/workflows/powers/flutter-testing/references/offline-sync-tests.md +16 -0
- package/workflows/powers/flutter-testing/references/test-layers.md +33 -0
- package/workflows/powers/frontend-code-review/POWER.md +137 -0
- package/workflows/powers/frontend-code-review/SKILL.md +134 -0
- package/workflows/powers/frontend-code-review/references/common-antipatterns.md +86 -0
- package/workflows/powers/frontend-code-review/references/performance-budgets.md +56 -0
- package/workflows/powers/frontend-code-review/references/review-checklists.md +47 -0
- package/workflows/powers/frontend-design/POWER.md +163 -362
- package/workflows/powers/frontend-design/SKILL.md +163 -362
- package/workflows/powers/game-development/POWER.md +57 -140
- package/workflows/powers/game-development/SKILL.md +57 -140
- package/workflows/powers/geo-fundamentals/POWER.md +64 -126
- package/workflows/powers/geo-fundamentals/SKILL.md +64 -127
- package/workflows/powers/git-workflow/POWER.md +135 -0
- package/workflows/powers/git-workflow/SKILL.md +132 -0
- package/workflows/powers/git-workflow/references/pr-review-checklist.md +63 -0
- package/workflows/powers/golang-pro/POWER.md +46 -35
- package/workflows/powers/golang-pro/SKILL.md +46 -35
- package/workflows/powers/graphql-architect/POWER.md +44 -62
- package/workflows/powers/graphql-architect/SKILL.md +44 -62
- package/workflows/powers/i18n-localization/POWER.md +118 -103
- package/workflows/powers/i18n-localization/SKILL.md +118 -103
- package/workflows/powers/java-pro/POWER.md +47 -22
- package/workflows/powers/java-pro/SKILL.md +47 -22
- package/workflows/powers/javascript-pro/POWER.md +47 -34
- package/workflows/powers/javascript-pro/SKILL.md +47 -34
- package/workflows/powers/kotlin-pro/POWER.md +46 -23
- package/workflows/powers/kotlin-pro/SKILL.md +46 -23
- package/workflows/powers/legacy-modernizer/POWER.md +43 -60
- package/workflows/powers/legacy-modernizer/SKILL.md +43 -60
- package/workflows/powers/mcp-builder/POWER.md +65 -0
- package/workflows/powers/mcp-builder/SKILL.md +62 -0
- package/workflows/powers/mcp-builder/references/testing-and-evals.md +17 -0
- package/workflows/powers/mcp-builder/references/transport-and-tool-design.md +17 -0
- package/workflows/powers/microservices-architect/POWER.md +43 -70
- package/workflows/powers/microservices-architect/SKILL.md +43 -70
- package/workflows/powers/mobile-design/POWER.md +110 -345
- package/workflows/powers/mobile-design/SKILL.md +110 -345
- package/workflows/powers/mongodb/POWER.md +67 -0
- package/workflows/powers/mongodb/SKILL.md +64 -0
- package/workflows/powers/mongodb/references/mongodb-checklist.md +20 -0
- package/workflows/powers/mysql/POWER.md +67 -0
- package/workflows/powers/mysql/SKILL.md +64 -0
- package/workflows/powers/mysql/references/mysql-checklist.md +20 -0
- package/workflows/powers/neki/POWER.md +67 -0
- package/workflows/powers/neki/SKILL.md +64 -0
- package/workflows/powers/neki/references/neki-checklist.md +18 -0
- package/workflows/powers/nestjs-expert/POWER.md +45 -91
- package/workflows/powers/nestjs-expert/SKILL.md +45 -91
- package/workflows/powers/nextjs-developer/POWER.md +51 -44
- package/workflows/powers/nextjs-developer/SKILL.md +51 -44
- package/workflows/powers/nodejs-best-practices/POWER.md +48 -29
- package/workflows/powers/nodejs-best-practices/SKILL.md +48 -29
- package/workflows/powers/observability/POWER.md +109 -0
- package/workflows/powers/observability/SKILL.md +106 -0
- package/workflows/powers/observability/references/alerting-and-slo-checklist.md +87 -0
- package/workflows/powers/observability/references/opentelemetry-setup-guide.md +121 -0
- package/workflows/powers/openai-docs/POWER.md +61 -0
- package/workflows/powers/openai-docs/SKILL.md +58 -0
- package/workflows/powers/openai-docs/references/official-source-playbook.md +10 -0
- package/workflows/powers/performance-profiling/POWER.md +61 -114
- package/workflows/powers/performance-profiling/SKILL.md +61 -114
- package/workflows/powers/php-pro/POWER.md +116 -0
- package/workflows/powers/php-pro/SKILL.md +113 -0
- package/workflows/powers/php-pro/references/architecture-and-di.md +239 -0
- package/workflows/powers/php-pro/references/modern-php-features.md +189 -0
- package/workflows/powers/php-pro/references/performance-and-deployment.md +197 -0
- package/workflows/powers/php-pro/references/php84-strict-typing-checklist.md +161 -0
- package/workflows/powers/php-pro/references/testing-and-static-analysis.md +235 -0
- package/workflows/powers/playwright-e2e/POWER.md +85 -0
- package/workflows/powers/playwright-e2e/SKILL.md +82 -0
- package/workflows/powers/playwright-e2e/references/locator-trace-flake-checklist.md +80 -0
- package/workflows/powers/postgres/POWER.md +67 -0
- package/workflows/powers/postgres/SKILL.md +64 -0
- package/workflows/powers/postgres/references/postgres-checklist.md +20 -0
- package/workflows/powers/prompt-engineer/POWER.md +47 -30
- package/workflows/powers/prompt-engineer/SKILL.md +47 -30
- package/workflows/powers/python-pro/POWER.md +47 -36
- package/workflows/powers/python-pro/SKILL.md +47 -36
- package/workflows/powers/react-best-practices/POWER.md +56 -33
- package/workflows/powers/react-best-practices/SKILL.md +56 -33
- package/workflows/powers/react-expert/POWER.md +47 -37
- package/workflows/powers/react-expert/SKILL.md +47 -37
- package/workflows/powers/redis/POWER.md +67 -0
- package/workflows/powers/redis/SKILL.md +64 -0
- package/workflows/powers/redis/references/redis-checklist.md +19 -0
- package/workflows/powers/ruby-pro/POWER.md +118 -0
- package/workflows/powers/ruby-pro/SKILL.md +115 -0
- package/workflows/powers/ruby-pro/references/modern-ruby-features.md +189 -0
- package/workflows/powers/ruby-pro/references/object-design-patterns.md +220 -0
- package/workflows/powers/ruby-pro/references/performance-and-profiling.md +224 -0
- package/workflows/powers/ruby-pro/references/ruby-concurrency-and-testing.md +190 -0
- package/workflows/powers/ruby-pro/references/testing-and-rspec.md +236 -0
- package/workflows/powers/rust-pro/POWER.md +45 -31
- package/workflows/powers/rust-pro/SKILL.md +45 -31
- package/workflows/powers/security-engineer/POWER.md +129 -0
- package/workflows/powers/security-engineer/SKILL.md +126 -0
- package/workflows/powers/seo-fundamentals/POWER.md +59 -102
- package/workflows/powers/seo-fundamentals/SKILL.md +59 -102
- package/workflows/powers/serverless-patterns/POWER.md +171 -0
- package/workflows/powers/serverless-patterns/SKILL.md +168 -0
- package/workflows/powers/skill-creator/POWER.md +90 -0
- package/workflows/powers/skill-creator/SKILL.md +87 -0
- package/workflows/powers/skill-creator/references/platform-formats.md +181 -0
- package/workflows/powers/skill-creator/references/schemas.md +430 -0
- package/workflows/powers/spec-miner/POWER.md +49 -57
- package/workflows/powers/spec-miner/SKILL.md +49 -57
- package/workflows/powers/sqlite/POWER.md +67 -0
- package/workflows/powers/sqlite/SKILL.md +64 -0
- package/workflows/powers/sqlite/references/sqlite-checklist.md +19 -0
- package/workflows/powers/sre-engineer/POWER.md +123 -64
- package/workflows/powers/sre-engineer/SKILL.md +123 -64
- package/workflows/powers/static-analysis/POWER.md +121 -77
- package/workflows/powers/static-analysis/SKILL.md +121 -77
- package/workflows/powers/stripe-best-practices/POWER.md +140 -17
- package/workflows/powers/stripe-best-practices/SKILL.md +139 -17
- package/workflows/powers/supabase/POWER.md +67 -0
- package/workflows/powers/supabase/SKILL.md +64 -0
- package/workflows/powers/supabase/references/supabase-checklist.md +19 -0
- package/workflows/powers/swift-pro/POWER.md +118 -0
- package/workflows/powers/swift-pro/SKILL.md +115 -0
- package/workflows/powers/swift-pro/references/concurrency-patterns.md +165 -0
- package/workflows/powers/swift-pro/references/protocol-and-generics.md +172 -0
- package/workflows/powers/swift-pro/references/sendable-and-isolation.md +116 -0
- package/workflows/powers/swift-pro/references/swift-concurrency-and-protocols.md +260 -0
- package/workflows/powers/swift-pro/references/testing-and-packages.md +192 -0
- package/workflows/powers/tailwind-patterns/POWER.md +71 -240
- package/workflows/powers/tailwind-patterns/SKILL.md +71 -240
- package/workflows/powers/testing-patterns/POWER.md +155 -10
- package/workflows/powers/testing-patterns/SKILL.md +155 -10
- package/workflows/powers/typescript-pro/POWER.md +47 -38
- package/workflows/powers/typescript-pro/SKILL.md +47 -38
- package/workflows/powers/vitess/POWER.md +67 -0
- package/workflows/powers/vitess/SKILL.md +64 -0
- package/workflows/powers/vitess/references/vitess-checklist.md +19 -0
- package/workflows/powers/vulnerability-scanner/POWER.md +146 -10
- package/workflows/powers/vulnerability-scanner/SKILL.md +146 -10
- package/workflows/powers/web-perf/POWER.md +43 -170
- package/workflows/powers/web-perf/SKILL.md +43 -170
- package/workflows/powers/webapp-testing/POWER.md +43 -164
- package/workflows/powers/webapp-testing/SKILL.md +43 -164
- package/workflows/workflows/agent-environment-setup/platforms/antigravity/rules/GEMINI.md +65 -42
- package/workflows/workflows/agent-environment-setup/platforms/claude/rules/CLAUDE.md +8 -6
- package/workflows/workflows/agent-environment-setup/platforms/codex/rules/AGENTS.md +65 -41
- package/workflows/workflows/agent-environment-setup/platforms/copilot/rules/copilot-instructions.md +8 -6
- package/workflows/workflows/agent-environment-setup/shared/rules/STEERING.md +9 -8
- package/workflows/workflows/agent-environment-setup/shared/rules/overrides/codex.md +1 -1
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
# Testing and Mocking
|
|
2
|
+
|
|
3
|
+
## Test Structure
|
|
4
|
+
|
|
5
|
+
```dart
|
|
6
|
+
import 'package:test/test.dart';
|
|
7
|
+
|
|
8
|
+
void main() {
|
|
9
|
+
group('OrderService', () {
|
|
10
|
+
late OrderService sut;
|
|
11
|
+
late MockOrderRepository mockRepo;
|
|
12
|
+
|
|
13
|
+
setUp(() {
|
|
14
|
+
mockRepo = MockOrderRepository();
|
|
15
|
+
sut = OrderService(repository: mockRepo);
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
test('getOrder returns order when exists', () async {
|
|
19
|
+
// Arrange
|
|
20
|
+
final expected = Order(id: 1, product: 'Widget');
|
|
21
|
+
when(() => mockRepo.findById(1)).thenAnswer((_) async => expected);
|
|
22
|
+
|
|
23
|
+
// Act
|
|
24
|
+
final result = await sut.getOrder(1);
|
|
25
|
+
|
|
26
|
+
// Assert
|
|
27
|
+
expect(result, equals(expected));
|
|
28
|
+
verify(() => mockRepo.findById(1)).called(1);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
test('getOrder throws when not found', () {
|
|
32
|
+
when(() => mockRepo.findById(any())).thenAnswer((_) async => null);
|
|
33
|
+
|
|
34
|
+
expect(
|
|
35
|
+
() => sut.getOrder(999),
|
|
36
|
+
throwsA(isA<OrderNotFoundException>()),
|
|
37
|
+
);
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Mocking with Mocktail
|
|
44
|
+
|
|
45
|
+
```dart
|
|
46
|
+
import 'package:mocktail/mocktail.dart';
|
|
47
|
+
|
|
48
|
+
// Create mocks — no code generation needed
|
|
49
|
+
class MockAuthService extends Mock implements AuthService {}
|
|
50
|
+
class MockHttpClient extends Mock implements Client {}
|
|
51
|
+
|
|
52
|
+
// Register fallback values for custom types
|
|
53
|
+
void main() {
|
|
54
|
+
setUpAll(() {
|
|
55
|
+
registerFallbackValue(User(name: 'fallback', email: 'f@b.com'));
|
|
56
|
+
registerFallbackValue(Uri.parse('https://example.com'));
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
test('login calls API with credentials', () async {
|
|
60
|
+
final mockHttp = MockHttpClient();
|
|
61
|
+
final service = AuthService(client: mockHttp);
|
|
62
|
+
|
|
63
|
+
when(() => mockHttp.post(
|
|
64
|
+
any(),
|
|
65
|
+
body: any(named: 'body'),
|
|
66
|
+
headers: any(named: 'headers'),
|
|
67
|
+
)).thenAnswer((_) async => Response('{"token":"abc"}', 200));
|
|
68
|
+
|
|
69
|
+
final token = await service.login('user', 'pass');
|
|
70
|
+
|
|
71
|
+
expect(token, 'abc');
|
|
72
|
+
verify(() => mockHttp.post(
|
|
73
|
+
Uri.parse('https://api.example.com/login'),
|
|
74
|
+
body: '{"username":"user","password":"pass"}',
|
|
75
|
+
headers: any(named: 'headers'),
|
|
76
|
+
)).called(1);
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Async Test Patterns
|
|
82
|
+
|
|
83
|
+
```dart
|
|
84
|
+
test('stream emits values in order', () async {
|
|
85
|
+
final controller = StreamController<int>();
|
|
86
|
+
|
|
87
|
+
// expectLater for async matchers
|
|
88
|
+
expectLater(
|
|
89
|
+
controller.stream,
|
|
90
|
+
emitsInOrder([1, 2, 3, emitsDone]),
|
|
91
|
+
);
|
|
92
|
+
|
|
93
|
+
controller
|
|
94
|
+
..add(1)
|
|
95
|
+
..add(2)
|
|
96
|
+
..add(3)
|
|
97
|
+
..close();
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
test('completes within timeout', () async {
|
|
101
|
+
final future = fetchData();
|
|
102
|
+
await expectLater(
|
|
103
|
+
future.timeout(const Duration(seconds: 5)),
|
|
104
|
+
completes,
|
|
105
|
+
);
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
// Fake async for timer-dependent code
|
|
109
|
+
import 'package:fake_async/fake_async.dart';
|
|
110
|
+
|
|
111
|
+
test('debounce fires after delay', () {
|
|
112
|
+
fakeAsync((async) {
|
|
113
|
+
var fired = false;
|
|
114
|
+
debounce(
|
|
115
|
+
duration: const Duration(milliseconds: 300),
|
|
116
|
+
callback: () => fired = true,
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
async.elapse(const Duration(milliseconds: 200));
|
|
120
|
+
expect(fired, isFalse); // not yet
|
|
121
|
+
|
|
122
|
+
async.elapse(const Duration(milliseconds: 150));
|
|
123
|
+
expect(fired, isTrue); // fired after 300ms total
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Flutter Widget Testing
|
|
129
|
+
|
|
130
|
+
```dart
|
|
131
|
+
import 'package:flutter_test/flutter_test.dart';
|
|
132
|
+
|
|
133
|
+
testWidgets('login button triggers auth flow', (tester) async {
|
|
134
|
+
final mockAuth = MockAuthService();
|
|
135
|
+
when(() => mockAuth.login(any(), any()))
|
|
136
|
+
.thenAnswer((_) async => AuthResult.success);
|
|
137
|
+
|
|
138
|
+
await tester.pumpWidget(
|
|
139
|
+
MaterialApp(
|
|
140
|
+
home: LoginScreen(authService: mockAuth),
|
|
141
|
+
),
|
|
142
|
+
);
|
|
143
|
+
|
|
144
|
+
// Find and interact with widgets
|
|
145
|
+
await tester.enterText(find.byKey(const Key('email-field')), 'alice@test.com');
|
|
146
|
+
await tester.enterText(find.byKey(const Key('password-field')), 'secret');
|
|
147
|
+
await tester.tap(find.byKey(const Key('login-button')));
|
|
148
|
+
await tester.pumpAndSettle(); // wait for animations
|
|
149
|
+
|
|
150
|
+
// Verify navigation or state change
|
|
151
|
+
expect(find.text('Welcome, Alice'), findsOneWidget);
|
|
152
|
+
verify(() => mockAuth.login('alice@test.com', 'secret')).called(1);
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
testWidgets('shows error on failed login', (tester) async {
|
|
156
|
+
final mockAuth = MockAuthService();
|
|
157
|
+
when(() => mockAuth.login(any(), any()))
|
|
158
|
+
.thenThrow(AuthException('Invalid credentials'));
|
|
159
|
+
|
|
160
|
+
await tester.pumpWidget(
|
|
161
|
+
MaterialApp(home: LoginScreen(authService: mockAuth)),
|
|
162
|
+
);
|
|
163
|
+
|
|
164
|
+
await tester.tap(find.byKey(const Key('login-button')));
|
|
165
|
+
await tester.pumpAndSettle();
|
|
166
|
+
|
|
167
|
+
expect(find.text('Invalid credentials'), findsOneWidget);
|
|
168
|
+
});
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## Golden Tests
|
|
172
|
+
|
|
173
|
+
```dart
|
|
174
|
+
testWidgets('profile card matches golden', (tester) async {
|
|
175
|
+
await tester.pumpWidget(
|
|
176
|
+
MaterialApp(
|
|
177
|
+
home: Scaffold(
|
|
178
|
+
body: ProfileCard(
|
|
179
|
+
user: User(name: 'Alice', avatar: 'default.png'),
|
|
180
|
+
),
|
|
181
|
+
),
|
|
182
|
+
),
|
|
183
|
+
);
|
|
184
|
+
|
|
185
|
+
await expectLater(
|
|
186
|
+
find.byType(ProfileCard),
|
|
187
|
+
matchesGoldenFile('goldens/profile_card.png'),
|
|
188
|
+
);
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
// Update goldens: flutter test --update-goldens
|
|
192
|
+
// CI: flutter test (fails if pixels differ)
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
## Coverage-Driven CI
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
# Run with coverage
|
|
199
|
+
dart test --coverage=coverage
|
|
200
|
+
flutter test --coverage
|
|
201
|
+
|
|
202
|
+
# Generate HTML report
|
|
203
|
+
dart pub global activate coverage
|
|
204
|
+
dart pub global run coverage:format_coverage \
|
|
205
|
+
--lcov --in=coverage --out=coverage/lcov.info \
|
|
206
|
+
--report-on=lib
|
|
207
|
+
|
|
208
|
+
genhtml coverage/lcov.info -o coverage/html
|
|
209
|
+
# Open coverage/html/index.html
|
|
210
|
+
|
|
211
|
+
# CI enforcement — fail below threshold
|
|
212
|
+
# In CI pipeline:
|
|
213
|
+
# lcov --summary coverage/lcov.info | grep "lines" | awk -F'%' '{if ($1 < 80) exit 1}'
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
## Test Organization
|
|
217
|
+
|
|
218
|
+
```
|
|
219
|
+
test/
|
|
220
|
+
├── unit/ # Pure logic, fast, mocked dependencies
|
|
221
|
+
│ ├── models/
|
|
222
|
+
│ │ └── order_test.dart
|
|
223
|
+
│ └── services/
|
|
224
|
+
│ └── order_service_test.dart
|
|
225
|
+
├── widget/ # Flutter widget tests
|
|
226
|
+
│ └── screens/
|
|
227
|
+
│ └── login_screen_test.dart
|
|
228
|
+
├── integration/ # Real dependencies, slower
|
|
229
|
+
│ └── api/
|
|
230
|
+
│ └── order_api_test.dart
|
|
231
|
+
├── goldens/ # Golden image files
|
|
232
|
+
│ └── profile_card.png
|
|
233
|
+
└── fixtures/ # Shared test data
|
|
234
|
+
└── sample_order.json
|
|
235
|
+
```
|
|
@@ -2,54 +2,68 @@
|
|
|
2
2
|
---
|
|
3
3
|
inclusion: manual
|
|
4
4
|
name: database-design
|
|
5
|
-
description:
|
|
6
|
-
|
|
5
|
+
description: "Use when designing schemas, relationships, indexes, ORM boundaries, and safe migration plans for relational or document-oriented workloads."
|
|
6
|
+
license: MIT
|
|
7
|
+
metadata:
|
|
8
|
+
author: cubis-foundry
|
|
9
|
+
version: "3.0"
|
|
10
|
+
compatibility: Claude Code, Codex, GitHub Copilot
|
|
7
11
|
---
|
|
8
12
|
|
|
9
13
|
# Database Design
|
|
10
14
|
|
|
11
|
-
|
|
15
|
+
## Purpose
|
|
12
16
|
|
|
13
|
-
|
|
17
|
+
Use when designing schemas, relationships, indexes, ORM boundaries, and safe migration plans for relational or document-oriented workloads.
|
|
14
18
|
|
|
15
|
-
|
|
19
|
+
## When to Use
|
|
16
20
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
| `schema-design.md` | Normalization, PKs, relationships | Designing schema |
|
|
22
|
-
| `indexing.md` | Index types, composite indexes | Performance tuning |
|
|
23
|
-
| `optimization.md` | N+1, EXPLAIN ANALYZE | Query optimization |
|
|
24
|
-
| `migrations.md` | Safe migrations, serverless DBs | Schema changes |
|
|
21
|
+
- Designing or refactoring schemas, keys, and relationships.
|
|
22
|
+
- Choosing relational vs document vs local-first structure.
|
|
23
|
+
- Planning ORM and persistence boundaries.
|
|
24
|
+
- Designing migrations and indexing strategy before rollout.
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
## Instructions
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
1. Model the workload and lifecycle constraints before choosing tables or collections.
|
|
29
|
+
2. Define entities, ownership, keys, and read/write paths explicitly.
|
|
30
|
+
3. Design indexes and pagination from real access patterns.
|
|
31
|
+
4. Plan migrations, backfills, and rollback before implementation.
|
|
32
|
+
5. Validate that the design lowers long-term change risk rather than hiding it.
|
|
29
33
|
|
|
30
|
-
|
|
31
|
-
- Choose database/ORM based on CONTEXT
|
|
32
|
-
- Don't default to PostgreSQL for everything
|
|
34
|
+
### Baseline standards
|
|
33
35
|
|
|
34
|
-
|
|
36
|
+
- Prefer schema decisions backed by access patterns.
|
|
37
|
+
- Treat indexes as part of the model, not an afterthought.
|
|
38
|
+
- Keep persistence models and transport models distinct when that lowers coupling.
|
|
39
|
+
- Make migration safety explicit.
|
|
40
|
+
- Choose normalization or denormalization deliberately.
|
|
35
41
|
|
|
36
|
-
|
|
42
|
+
### Constraints
|
|
37
43
|
|
|
38
|
-
|
|
44
|
+
- Avoid modeling by ORM convenience alone.
|
|
45
|
+
- Avoid deferring migration planning until after shipping.
|
|
46
|
+
- Avoid adding indexes with no predicate or sort evidence.
|
|
47
|
+
- Avoid using unstructured blobs to avoid real data modeling.
|
|
39
48
|
|
|
40
|
-
|
|
41
|
-
- [ ] Chosen database for THIS context?
|
|
42
|
-
- [ ] Considered deployment environment?
|
|
43
|
-
- [ ] Planned index strategy?
|
|
44
|
-
- [ ] Defined relationship types?
|
|
49
|
+
## Output Format
|
|
45
50
|
|
|
46
|
-
|
|
51
|
+
Provide implementation guidance, code examples, and configuration as appropriate to the task.
|
|
52
|
+
|
|
53
|
+
## References
|
|
54
|
+
|
|
55
|
+
Load on demand. Do not preload all reference files.
|
|
56
|
+
|
|
57
|
+
| File | Load when |
|
|
58
|
+
| --- | --- |
|
|
59
|
+
| `references/schema-migration-checklist.md` | You need more explicit guidance for keys, indexes, pagination, ORM boundaries, backfills, and rollback-safe migration plans. |
|
|
60
|
+
|
|
61
|
+
## Scripts
|
|
62
|
+
|
|
63
|
+
No helper scripts are required for this skill right now. Keep execution in `SKILL.md` and `references/` unless repeated automation becomes necessary.
|
|
47
64
|
|
|
48
|
-
##
|
|
65
|
+
## Examples
|
|
49
66
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
❌ Use SELECT * in production
|
|
53
|
-
❌ Store JSON when structured data is better
|
|
54
|
-
❌ Ignore N+1 queries
|
|
67
|
+
- "Help me with database design best practices in this project"
|
|
68
|
+
- "Review my database design implementation for issues"
|
|
55
69
|
````
|
|
@@ -1,52 +1,66 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: database-design
|
|
3
|
-
description:
|
|
4
|
-
|
|
3
|
+
description: "Use when designing schemas, relationships, indexes, ORM boundaries, and safe migration plans for relational or document-oriented workloads."
|
|
4
|
+
license: MIT
|
|
5
|
+
metadata:
|
|
6
|
+
author: cubis-foundry
|
|
7
|
+
version: "3.0"
|
|
8
|
+
compatibility: Claude Code, Codex, GitHub Copilot
|
|
5
9
|
---
|
|
6
10
|
|
|
7
11
|
# Database Design
|
|
8
12
|
|
|
9
|
-
|
|
13
|
+
## Purpose
|
|
10
14
|
|
|
11
|
-
|
|
15
|
+
Use when designing schemas, relationships, indexes, ORM boundaries, and safe migration plans for relational or document-oriented workloads.
|
|
12
16
|
|
|
13
|
-
|
|
17
|
+
## When to Use
|
|
14
18
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
| `schema-design.md` | Normalization, PKs, relationships | Designing schema |
|
|
20
|
-
| `indexing.md` | Index types, composite indexes | Performance tuning |
|
|
21
|
-
| `optimization.md` | N+1, EXPLAIN ANALYZE | Query optimization |
|
|
22
|
-
| `migrations.md` | Safe migrations, serverless DBs | Schema changes |
|
|
19
|
+
- Designing or refactoring schemas, keys, and relationships.
|
|
20
|
+
- Choosing relational vs document vs local-first structure.
|
|
21
|
+
- Planning ORM and persistence boundaries.
|
|
22
|
+
- Designing migrations and indexing strategy before rollout.
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
## Instructions
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
1. Model the workload and lifecycle constraints before choosing tables or collections.
|
|
27
|
+
2. Define entities, ownership, keys, and read/write paths explicitly.
|
|
28
|
+
3. Design indexes and pagination from real access patterns.
|
|
29
|
+
4. Plan migrations, backfills, and rollback before implementation.
|
|
30
|
+
5. Validate that the design lowers long-term change risk rather than hiding it.
|
|
27
31
|
|
|
28
|
-
|
|
29
|
-
- Choose database/ORM based on CONTEXT
|
|
30
|
-
- Don't default to PostgreSQL for everything
|
|
32
|
+
### Baseline standards
|
|
31
33
|
|
|
32
|
-
|
|
34
|
+
- Prefer schema decisions backed by access patterns.
|
|
35
|
+
- Treat indexes as part of the model, not an afterthought.
|
|
36
|
+
- Keep persistence models and transport models distinct when that lowers coupling.
|
|
37
|
+
- Make migration safety explicit.
|
|
38
|
+
- Choose normalization or denormalization deliberately.
|
|
33
39
|
|
|
34
|
-
|
|
40
|
+
### Constraints
|
|
35
41
|
|
|
36
|
-
|
|
42
|
+
- Avoid modeling by ORM convenience alone.
|
|
43
|
+
- Avoid deferring migration planning until after shipping.
|
|
44
|
+
- Avoid adding indexes with no predicate or sort evidence.
|
|
45
|
+
- Avoid using unstructured blobs to avoid real data modeling.
|
|
37
46
|
|
|
38
|
-
|
|
39
|
-
- [ ] Chosen database for THIS context?
|
|
40
|
-
- [ ] Considered deployment environment?
|
|
41
|
-
- [ ] Planned index strategy?
|
|
42
|
-
- [ ] Defined relationship types?
|
|
47
|
+
## Output Format
|
|
43
48
|
|
|
44
|
-
|
|
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/schema-migration-checklist.md` | You need more explicit guidance for keys, indexes, pagination, ORM boundaries, backfills, and rollback-safe migration plans. |
|
|
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.
|
|
45
62
|
|
|
46
|
-
##
|
|
63
|
+
## Examples
|
|
47
64
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
❌ Use SELECT * in production
|
|
51
|
-
❌ Store JSON when structured data is better
|
|
52
|
-
❌ Ignore N+1 queries
|
|
65
|
+
- "Help me with database design best practices in this project"
|
|
66
|
+
- "Review my database design implementation for issues"
|
|
@@ -1,90 +1,69 @@
|
|
|
1
1
|
````markdown
|
|
2
2
|
---
|
|
3
3
|
inclusion: manual
|
|
4
|
-
name:
|
|
5
|
-
description: "Use for
|
|
4
|
+
name: database-optimizer
|
|
5
|
+
description: "Use for database performance triage across engines: query-plan analysis, indexing changes, wait and contention diagnosis, config tuning, and safe before/after validation."
|
|
6
|
+
license: MIT
|
|
7
|
+
metadata:
|
|
8
|
+
author: cubis-foundry
|
|
9
|
+
version: "3.0"
|
|
10
|
+
compatibility: Claude Code, Codex, GitHub Copilot
|
|
6
11
|
---
|
|
7
12
|
|
|
8
|
-
|
|
9
13
|
# Database Optimizer
|
|
10
14
|
|
|
11
|
-
##
|
|
12
|
-
|
|
13
|
-
Senior database optimizer with expertise in performance tuning, query optimization, and scalability across multiple database systems.
|
|
14
|
-
|
|
15
|
-
## Role Definition
|
|
16
|
-
|
|
17
|
-
You are a senior database performance engineer with 10+ years of experience optimizing high-traffic databases. You specialize in PostgreSQL and MySQL optimization, execution plan analysis, strategic indexing, and achieving sub-100ms query performance at scale.
|
|
18
|
-
|
|
19
|
-
## When to Use This Skill
|
|
15
|
+
## Purpose
|
|
20
16
|
|
|
21
|
-
-
|
|
22
|
-
- Designing optimal index strategies
|
|
23
|
-
- Tuning database configuration parameters
|
|
24
|
-
- Optimizing schema design and partitioning
|
|
25
|
-
- Reducing lock contention and deadlocks
|
|
26
|
-
- Improving cache hit rates and memory usage
|
|
17
|
+
Use for database performance triage across engines: query-plan analysis, indexing changes, wait and contention diagnosis, config tuning, and safe before/after validation.
|
|
27
18
|
|
|
28
|
-
##
|
|
19
|
+
## When to Use
|
|
29
20
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
5. **Validate Results** - Measure improvements, ensure stability, document changes
|
|
21
|
+
- Investigating slow queries, bad plans, lock contention, or throughput collapse.
|
|
22
|
+
- Choosing targeted indexing or query-shape fixes.
|
|
23
|
+
- Deciding whether the bottleneck is query logic, schema, config, or concurrency.
|
|
24
|
+
- Validating performance changes with before/after evidence.
|
|
35
25
|
|
|
36
|
-
##
|
|
26
|
+
## Instructions
|
|
37
27
|
|
|
38
|
-
|
|
28
|
+
1. Establish the real symptom with timings, plans, waits, or metrics.
|
|
29
|
+
2. Identify whether the bottleneck is query shape, indexing, contention, config, or workload pattern.
|
|
30
|
+
3. Choose the smallest safe optimization with explicit tradeoffs.
|
|
31
|
+
4. Apply one high-signal change at a time when isolating a root cause.
|
|
32
|
+
5. Re-measure and report whether the change actually improved the bottleneck.
|
|
39
33
|
|
|
40
|
-
|
|
41
|
-
| --------------------- | --------------------------------- | --------------------------------------- |
|
|
42
|
-
| Query Optimization | `references/query-optimization.md` | Analyzing slow queries, execution plans |
|
|
43
|
-
| Index Strategies | `references/index-strategies.md` | Designing indexes, covering indexes |
|
|
44
|
-
| PostgreSQL Tuning | `references/postgresql-tuning.md` | PostgreSQL-specific optimizations |
|
|
45
|
-
| MySQL Tuning | `references/mysql-tuning.md` | MySQL-specific optimizations |
|
|
46
|
-
| Monitoring & Analysis | `references/monitoring-analysis.md` | Performance metrics, diagnostics |
|
|
34
|
+
### Baseline standards
|
|
47
35
|
|
|
48
|
-
|
|
36
|
+
- Explain before optimizing.
|
|
37
|
+
- Measure before and after every proposed change.
|
|
38
|
+
- Account for write amplification and operational cost of indexes.
|
|
39
|
+
- Include rollback and monitoring in the optimization plan.
|
|
40
|
+
- Prefer correctness and predictable operations over benchmark vanity.
|
|
49
41
|
|
|
50
|
-
###
|
|
42
|
+
### Constraints
|
|
51
43
|
|
|
52
|
-
-
|
|
53
|
-
-
|
|
54
|
-
-
|
|
55
|
-
-
|
|
56
|
-
- Document all optimization decisions
|
|
57
|
-
- Monitor impact on write performance
|
|
58
|
-
- Consider replication lag for distributed systems
|
|
44
|
+
- Avoid blind config churn.
|
|
45
|
+
- Avoid index additions without real predicate evidence.
|
|
46
|
+
- Avoid query rewrites that ignore semantics or maintenance cost.
|
|
47
|
+
- Avoid treating every slowdown as a single-query problem.
|
|
59
48
|
|
|
60
|
-
|
|
49
|
+
## Output Format
|
|
61
50
|
|
|
62
|
-
|
|
63
|
-
- Create redundant or unused indexes
|
|
64
|
-
- Skip execution plan analysis
|
|
65
|
-
- Ignore write performance impact
|
|
66
|
-
- Make multiple changes simultaneously
|
|
67
|
-
- Optimize without understanding query patterns
|
|
68
|
-
- Neglect statistics updates (ANALYZE/VACUUM)
|
|
51
|
+
Provide implementation guidance, code examples, and configuration as appropriate to the task.
|
|
69
52
|
|
|
70
|
-
##
|
|
53
|
+
## References
|
|
71
54
|
|
|
72
|
-
|
|
55
|
+
Load on demand. Do not preload all reference files.
|
|
73
56
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
4. Implementation SQL/config changes
|
|
78
|
-
5. Validation queries to measure improvement
|
|
79
|
-
6. Monitoring recommendations
|
|
57
|
+
| File | Load when |
|
|
58
|
+
| --- | --- |
|
|
59
|
+
| `references/query-triage-checklist.md` | You need a deeper performance triage checklist for plans, waits, index tradeoffs, rollback, and before/after evidence. |
|
|
80
60
|
|
|
81
|
-
##
|
|
61
|
+
## Scripts
|
|
82
62
|
|
|
83
|
-
|
|
63
|
+
No helper scripts are required for this skill right now. Keep execution in `SKILL.md` and `references/` unless repeated automation becomes necessary.
|
|
84
64
|
|
|
85
|
-
##
|
|
65
|
+
## Examples
|
|
86
66
|
|
|
87
|
-
-
|
|
88
|
-
-
|
|
89
|
-
- **Data Engineer** - ETL and analytical query optimization
|
|
67
|
+
- "Help me with database optimizer best practices in this project"
|
|
68
|
+
- "Review my database optimizer implementation for issues"
|
|
90
69
|
````
|