@martinffx/atelier 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +38 -0
- package/LICENSE +21 -0
- package/README.md +285 -0
- package/agents/architect.md +38 -0
- package/agents/oracle.md +40 -0
- package/agents/recon.md +39 -0
- package/dist/atelier.js +33082 -0
- package/package.json +44 -0
- package/skills/code-conventional-commit/SKILL.md +134 -0
- package/skills/code-conventional-commit/evals/evals.json +23 -0
- package/skills/code-conventional-commit/workspace/iteration-1/eval-0/with_skill/outputs/commit-message.txt +4 -0
- package/skills/code-conventional-commit/workspace/iteration-1/eval-0/with_skill/outputs/eval_metadata.json +6 -0
- package/skills/code-conventional-commit/workspace/iteration-1/eval-1/with_skill/outputs/eval_metadata.json +6 -0
- package/skills/code-conventional-commit/workspace/iteration-1/eval-1/with_skill/outputs/validation-result.txt +16 -0
- package/skills/code-conventional-commit/workspace/iteration-1/eval-2/with_skill/outputs/commit-message.txt +8 -0
- package/skills/code-conventional-commit/workspace/iteration-1/eval-2/with_skill/outputs/eval_metadata.json +6 -0
- package/skills/code-conventional-commit/workspace/iteration-1/report.html +1325 -0
- package/skills/code-debug/SKILL.md +271 -0
- package/skills/code-debug/references/language-tools.md +139 -0
- package/skills/code-debug/references/techniques.md +117 -0
- package/skills/code-docs/SKILL.md +171 -0
- package/skills/code-docs/references/api-docs.md +116 -0
- package/skills/code-docs/references/changelog.md +64 -0
- package/skills/code-docs/references/readme-structure.md +94 -0
- package/skills/code-git-worktrees/SKILL.md +218 -0
- package/skills/code-perf/SKILL.md +163 -0
- package/skills/code-perf/references/common-bottlenecks.md +124 -0
- package/skills/code-perf/references/optimization-patterns.md +167 -0
- package/skills/code-perf/references/profiling-tools.md +126 -0
- package/skills/code-review/SKILL.md +78 -0
- package/skills/code-review/references/output.md +200 -0
- package/skills/code-review/references/reviewers.md +719 -0
- package/skills/code-review/references/rq.md +357 -0
- package/skills/code-review/references/rs.md +30 -0
- package/skills/code-security/SKILL.md +183 -0
- package/skills/code-security/references/owasp-top-10.md +129 -0
- package/skills/code-security/references/security-tools.md +102 -0
- package/skills/code-security/references/vulnerability-patterns.md +129 -0
- package/skills/code-stacked-commit/SKILL.md +155 -0
- package/skills/code-subagents/SKILL.md +184 -0
- package/skills/code-subagents/references/code-quality-reviewer-prompt.md +48 -0
- package/skills/code-subagents/references/implementor-prompt.md +79 -0
- package/skills/code-subagents/references/spec-reviewer-prompt.md +62 -0
- package/skills/oracle-architect/SKILL.md +246 -0
- package/skills/oracle-architect/references/api-design.md +345 -0
- package/skills/oracle-architect/references/data-modeling.md +318 -0
- package/skills/oracle-architect/references/ddd-patterns.md +247 -0
- package/skills/oracle-challenge/SKILL.md +126 -0
- package/skills/oracle-testing/SKILL.md +237 -0
- package/skills/oracle-testing/references/anti-patterns.md +618 -0
- package/skills/oracle-testing/references/boundaries.md +579 -0
- package/skills/oracle-testing/references/core-testing.md +691 -0
- package/skills/oracle-testing/references/edge-testing.md +794 -0
- package/skills/oracle-testing/references/stub-driven-tdd.md +322 -0
- package/skills/oracle-thinkdeep/SKILL.md +164 -0
- package/skills/python-architecture/SKILL.md +148 -0
- package/skills/python-architecture/references/data-modeling.md +558 -0
- package/skills/python-architecture/references/ddd.md +569 -0
- package/skills/python-architecture/references/functional-core.md +337 -0
- package/skills/python-build-tools/SKILL.md +153 -0
- package/skills/python-build-tools/references/basedpyright.md +321 -0
- package/skills/python-build-tools/references/ruff.md +225 -0
- package/skills/python-build-tools/references/uv.md +257 -0
- package/skills/python-fastapi/SKILL.md +184 -0
- package/skills/python-fastapi/references/api-design.md +563 -0
- package/skills/python-fastapi/references/dependencies.md +479 -0
- package/skills/python-fastapi/references/middleware.md +475 -0
- package/skills/python-fastapi/references/validation.md +497 -0
- package/skills/python-modern-python/SKILL.md +201 -0
- package/skills/python-modern-python/references/async.md +76 -0
- package/skills/python-modern-python/references/pattern-matching.md +89 -0
- package/skills/python-modern-python/references/typing.md +96 -0
- package/skills/python-monorepo/SKILL.md +146 -0
- package/skills/python-monorepo/references/docker.md +515 -0
- package/skills/python-monorepo/references/namespace-packages.md +426 -0
- package/skills/python-monorepo/references/workspace-config.md +341 -0
- package/skills/python-sqlalchemy/SKILL.md +119 -0
- package/skills/python-sqlalchemy/references/async.md +51 -0
- package/skills/python-sqlalchemy/references/models.md +67 -0
- package/skills/python-sqlalchemy/references/queries.md +57 -0
- package/skills/python-temporal/SKILL.md +128 -0
- package/skills/python-temporal/references/patterns.md +87 -0
- package/skills/python-temporal/references/testing.md +54 -0
- package/skills/python-testing/SKILL.md +161 -0
- package/skills/python-testing/references/boundaries.md +449 -0
- package/skills/python-testing/references/mocking.md +449 -0
- package/skills/python-testing/references/pytest.md +524 -0
- package/skills/spec-brainstorm/SKILL.md +325 -0
- package/skills/spec-finish/SKILL.md +159 -0
- package/skills/spec-implement/SKILL.md +296 -0
- package/skills/spec-orchestrator/SKILL.md +156 -0
- package/skills/spec-plan/SKILL.md +248 -0
- package/skills/typescript-api-design/SKILL.md +396 -0
- package/skills/typescript-api-design/references/error-responses.md +469 -0
- package/skills/typescript-build-tools/SKILL.md +447 -0
- package/skills/typescript-build-tools/references/biome.md +436 -0
- package/skills/typescript-build-tools/references/bun.md +432 -0
- package/skills/typescript-build-tools/references/turborepo.md +426 -0
- package/skills/typescript-build-tools/references/vitest.md +518 -0
- package/skills/typescript-drizzle-orm/SKILL.md +398 -0
- package/skills/typescript-drizzle-orm/references/cloudflare.md +392 -0
- package/skills/typescript-drizzle-orm/references/entity-pattern.md +412 -0
- package/skills/typescript-drizzle-orm/references/postgresql.md +191 -0
- package/skills/typescript-drizzle-orm/references/repository-pattern.md +479 -0
- package/skills/typescript-drizzle-orm/references/sqlite.md +291 -0
- package/skills/typescript-dynamodb-toolbox/SKILL.md +370 -0
- package/skills/typescript-dynamodb-toolbox/references/entity-layer.md +574 -0
- package/skills/typescript-dynamodb-toolbox/references/error-handling.md +495 -0
- package/skills/typescript-dynamodb-toolbox/references/modeling.md +332 -0
- package/skills/typescript-dynamodb-toolbox/references/repository-layer.md +631 -0
- package/skills/typescript-dynamodb-toolbox/references/testing.md +718 -0
- package/skills/typescript-dynamodb-toolbox/references/transactions.md +423 -0
- package/skills/typescript-effect-ts/SKILL.md +341 -0
- package/skills/typescript-effect-ts/references/core.md +412 -0
- package/skills/typescript-effect-ts/references/error-handling.md +468 -0
- package/skills/typescript-effect-ts/references/resources.md +476 -0
- package/skills/typescript-effect-ts/references/schema.md +536 -0
- package/skills/typescript-effect-ts/references/services.md +461 -0
- package/skills/typescript-fastify/SKILL.md +405 -0
- package/skills/typescript-fastify/references/plugins.md +329 -0
- package/skills/typescript-fastify/references/typeid.md +315 -0
- package/skills/typescript-functional-patterns/SKILL.md +402 -0
- package/skills/typescript-functional-patterns/references/adts.md +497 -0
- package/skills/typescript-functional-patterns/references/branded-types.md +542 -0
- package/skills/typescript-functional-patterns/references/migration-guide.md +695 -0
- package/skills/typescript-functional-patterns/references/option-result.md +585 -0
- package/skills/typescript-testing/SKILL.md +353 -0
- package/skills/typescript-testing/references/mocking.md +675 -0
- package/skills/typescript-testing/references/msw.md +852 -0
- package/skills/typescript-testing/references/snapshot-testing.md +774 -0
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: oracle-testing
|
|
3
|
+
description: Stub-Driven TDD and layer boundary testing. Use when writing tests, deciding what to test, or testing at component boundaries.
|
|
4
|
+
user-invocable: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Testing Skill
|
|
8
|
+
|
|
9
|
+
Stub-Driven Test-Driven Development and layer boundary testing for functional core and effectful edge architecture.
|
|
10
|
+
|
|
11
|
+
## Core Principle: Stub-Driven TDD
|
|
12
|
+
|
|
13
|
+
Test-Driven Development workflow for the functional core / effectful edge pattern:
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
1. Stub → Create minimal interface/function signatures
|
|
17
|
+
2. Test → Write tests against stubs
|
|
18
|
+
3. Implement → Make tests pass with real implementation
|
|
19
|
+
4. Refactor → Improve code while keeping tests green
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
**Key insight:** Write interface signatures first, test against those, then implement—not the other way around.
|
|
23
|
+
|
|
24
|
+
See [references/stub-driven-tdd.md] for complete workflow examples.
|
|
25
|
+
|
|
26
|
+
## Layer Boundary Testing
|
|
27
|
+
|
|
28
|
+
Test at the boundaries between functional core and effectful edge, not internal implementation.
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
Test here ──────▼──────────────────▼────── Test here
|
|
32
|
+
Effectful Edge │ Functional Core
|
|
33
|
+
(stub) │ (unit test)
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Where to Test Each Layer
|
|
37
|
+
|
|
38
|
+
| Layer | Test Type | What to Stub | What to Assert |
|
|
39
|
+
|-------|-----------|--------------|-----------------|
|
|
40
|
+
| **Entity** | Unit | Nothing (pure) | Validation, rules, transforms |
|
|
41
|
+
| **Service** | Unit | Repositories | Orchestration logic, error handling |
|
|
42
|
+
| **Router** | Integration | Service | Status codes, response format |
|
|
43
|
+
| **Repository** | Integration | DB connection | CRUD operations, queries |
|
|
44
|
+
| **Consumer** | Integration | Service | Event parsing, service calls |
|
|
45
|
+
|
|
46
|
+
See [references/boundaries.md] for detailed testing patterns by layer.
|
|
47
|
+
|
|
48
|
+
## Functional Core Testing
|
|
49
|
+
|
|
50
|
+
### Entity Tests (Pure Functions)
|
|
51
|
+
|
|
52
|
+
Focus: Validation, business rules, data transformations
|
|
53
|
+
|
|
54
|
+
```typescript
|
|
55
|
+
describe('Order entity', () => {
|
|
56
|
+
describe('validation', () => {
|
|
57
|
+
it('rejects empty items', () => {
|
|
58
|
+
const order = new Order('1', 'C1', [], 'pending', 0);
|
|
59
|
+
expect(order.validate().ok).toBe(false);
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
describe('business rules', () => {
|
|
64
|
+
it('prevents cancelling shipped order', () => {
|
|
65
|
+
const order = new Order('1', 'C1', [], 'shipped', 0);
|
|
66
|
+
expect(order.canCancel()).toBe(false);
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
describe('transformations', () => {
|
|
71
|
+
it('converts request to entity with calculated total', () => {
|
|
72
|
+
const order = Order.fromRequest({
|
|
73
|
+
customerId: 'C1',
|
|
74
|
+
items: [
|
|
75
|
+
{ productId: 'P1', quantity: 2, price: 10 },
|
|
76
|
+
{ productId: 'P2', quantity: 1, price: 15 }
|
|
77
|
+
]
|
|
78
|
+
});
|
|
79
|
+
expect(order.total).toBe(35);
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Service Tests (Stubbed Dependencies)
|
|
86
|
+
|
|
87
|
+
Focus: Orchestration logic with stubbed repositories
|
|
88
|
+
|
|
89
|
+
```typescript
|
|
90
|
+
describe('OrderService.createOrder', () => {
|
|
91
|
+
let service: OrderService;
|
|
92
|
+
let mockRepo: OrderRepository;
|
|
93
|
+
|
|
94
|
+
beforeEach(() => {
|
|
95
|
+
mockRepo = {
|
|
96
|
+
save: vi.fn().mockResolvedValue({ id: '123' }),
|
|
97
|
+
findById: vi.fn()
|
|
98
|
+
};
|
|
99
|
+
service = new OrderService(mockRepo);
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
it('creates order with valid data', async () => {
|
|
103
|
+
const result = await service.createOrder({
|
|
104
|
+
customerId: 'C1',
|
|
105
|
+
items: [{ productId: 'P1', quantity: 2 }]
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
expect(result.ok).toBe(true);
|
|
109
|
+
expect(mockRepo.save).toHaveBeenCalled();
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
it('does not save when validation fails', async () => {
|
|
113
|
+
const result = await service.createOrder({
|
|
114
|
+
customerId: 'C1',
|
|
115
|
+
items: [] // Invalid
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
expect(result.ok).toBe(false);
|
|
119
|
+
expect(mockRepo.save).not.toHaveBeenCalled();
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
See [references/core-testing.md] for comprehensive Entity and Service examples.
|
|
125
|
+
|
|
126
|
+
## Effectful Edge Testing
|
|
127
|
+
|
|
128
|
+
### Router, Repository, Consumer Integration Tests
|
|
129
|
+
|
|
130
|
+
Focus: Real HTTP/database/events with stubbed core
|
|
131
|
+
|
|
132
|
+
```typescript
|
|
133
|
+
// Router: real HTTP, stub service
|
|
134
|
+
describe('POST /orders', () => {
|
|
135
|
+
it('returns 201 for valid request', async () => {
|
|
136
|
+
const mockService = {
|
|
137
|
+
createOrder: vi.fn().mockResolvedValue(Ok({ id: '123' }))
|
|
138
|
+
};
|
|
139
|
+
const app = createApp(mockService);
|
|
140
|
+
|
|
141
|
+
const response = await request(app)
|
|
142
|
+
.post('/orders')
|
|
143
|
+
.send({ customerId: 'C1', items: [{ productId: 'P1', quantity: 2 }] });
|
|
144
|
+
|
|
145
|
+
expect(response.status).toBe(201);
|
|
146
|
+
});
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
// Repository: real test database
|
|
150
|
+
describe('OrderRepository.save', () => {
|
|
151
|
+
it('persists order to database', async () => {
|
|
152
|
+
const repo = new OrderRepository(testDb);
|
|
153
|
+
const saved = await repo.save({
|
|
154
|
+
id: '123',
|
|
155
|
+
customer_id: 'C1',
|
|
156
|
+
items: '[]',
|
|
157
|
+
status: 'pending',
|
|
158
|
+
total: 0
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
const found = await testDb.orders.findOne({ id: '123' });
|
|
162
|
+
expect(found).toBeDefined();
|
|
163
|
+
});
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
// Consumer: real events, stub service
|
|
167
|
+
describe('OrderConsumer', () => {
|
|
168
|
+
it('handles OrderPlaced event', async () => {
|
|
169
|
+
const mockService = {
|
|
170
|
+
processOrder: vi.fn().mockResolvedValue(Ok({}))
|
|
171
|
+
};
|
|
172
|
+
const consumer = new OrderConsumer(mockService);
|
|
173
|
+
|
|
174
|
+
await consumer.handle({
|
|
175
|
+
type: 'OrderPlaced',
|
|
176
|
+
data: { orderId: '123' }
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
expect(mockService.processOrder).toHaveBeenCalledWith('123');
|
|
180
|
+
});
|
|
181
|
+
});
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
See [references/edge-testing.md] for Router, Repository, Consumer, Producer, and Client patterns.
|
|
185
|
+
|
|
186
|
+
## Test Coverage Guidelines
|
|
187
|
+
|
|
188
|
+
Aim for strategic coverage, not 100%:
|
|
189
|
+
|
|
190
|
+
**High Coverage (Critical):**
|
|
191
|
+
- Entity validation and business rules
|
|
192
|
+
- Service orchestration logic
|
|
193
|
+
- Critical user journeys (integration tests)
|
|
194
|
+
- Data transformations with logic
|
|
195
|
+
|
|
196
|
+
**Medium Coverage (Important):**
|
|
197
|
+
- Error handling paths
|
|
198
|
+
- Edge cases in business logic
|
|
199
|
+
- API contract validation
|
|
200
|
+
|
|
201
|
+
**Low Coverage (Optional):**
|
|
202
|
+
- Simple getters/setters
|
|
203
|
+
- Framework boilerplate
|
|
204
|
+
- Trivial mappings
|
|
205
|
+
- Internal utilities
|
|
206
|
+
|
|
207
|
+
## What NOT to Test
|
|
208
|
+
|
|
209
|
+
Avoid testing implementation details, framework behavior, and trivial code:
|
|
210
|
+
|
|
211
|
+
- Don't test private methods (test through public API)
|
|
212
|
+
- Don't test simple getters/setters (no logic = no test value)
|
|
213
|
+
- Don't test framework behavior (Express, database driver already tested)
|
|
214
|
+
- Don't test third-party library behavior (lodash, validation libraries)
|
|
215
|
+
- Don't test trivial mappings without logic
|
|
216
|
+
|
|
217
|
+
See [references/anti-patterns.md] for anti-patterns with examples and fixes.
|
|
218
|
+
|
|
219
|
+
## Testing → Implementation Flow
|
|
220
|
+
|
|
221
|
+
Follow this dependency order:
|
|
222
|
+
|
|
223
|
+
```
|
|
224
|
+
1. Entity tests (pure functions, fast)
|
|
225
|
+
2. Service tests (stubbed dependencies, fast)
|
|
226
|
+
3. Integration tests (real IO, slower)
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
This enables TDD: write tests first at lower layers, then implement, then build upward.
|
|
230
|
+
|
|
231
|
+
## Quick Reference
|
|
232
|
+
|
|
233
|
+
**For Entity Testing:** See [references/core-testing.md]
|
|
234
|
+
**For Service Testing:** See [references/core-testing.md]
|
|
235
|
+
**For Router/Repo/Consumer:** See [references/edge-testing.md]
|
|
236
|
+
**For Workflow Examples:** See [references/stub-driven-tdd.md]
|
|
237
|
+
**For What NOT to Do:** See [references/anti-patterns.md]
|