@martinffx/atelier 1.2.1 → 1.3.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 +27 -0
- package/README.md +22 -24
- package/agents/architect.md +1 -1
- package/agents/oracle.md +1 -1
- package/dist/atelier.js +12 -14
- package/package.json +1 -1
- package/skills/code-commit/SKILL.md +5 -13
- package/skills/code-pull-request/SKILL.md +36 -0
- package/skills/code-pull-request/references/common.md +76 -0
- package/skills/code-pull-request/references/create-pr.md +122 -0
- package/skills/code-pull-request/references/default-template.md +25 -0
- package/skills/code-pull-request/references/leave-comment.md +53 -0
- package/skills/code-pull-request/references/merge-pr.md +94 -0
- package/skills/code-pull-request/references/read-comments.md +61 -0
- package/skills/code-pull-request/references/respond-to-comment.md +66 -0
- package/skills/code-review/SKILL.md +21 -12
- package/skills/code-review/references/reviewers.md +142 -41
- package/skills/code-review/references/rq.md +48 -32
- package/skills/oracle-debug/SKILL.md +218 -0
- package/skills/{code-debug → oracle-debug}/references/bug-patterns.md +3 -3
- package/skills/oracle-domain-modelling/SKILL.md +84 -0
- package/skills/oracle-grill-me/SKILL.md +20 -0
- package/skills/spec-brainstorm/SKILL.md +91 -71
- package/skills/spec-finish/SKILL.md +20 -14
- package/skills/spec-implement/SKILL.md +3 -2
- package/skills/spec-orchestrator/SKILL.md +4 -15
- package/skills/spec-plan/SKILL.md +1 -1
- package/agents/scout.md +0 -40
- package/skills/code-commit/references/pr-workflow.md +0 -145
- package/skills/code-debug/SKILL.md +0 -199
- package/skills/code-docs/SKILL.md +0 -171
- package/skills/code-docs/references/api-docs.md +0 -116
- package/skills/code-docs/references/changelog.md +0 -64
- package/skills/code-docs/references/readme-structure.md +0 -94
- package/skills/oracle-architect/SKILL.md +0 -327
- package/skills/oracle-architect/references/api-design.md +0 -345
- package/skills/oracle-architect/references/data-modeling.md +0 -318
- package/skills/oracle-architect/references/ddd-patterns.md +0 -348
- package/skills/oracle-architect/references/interface-design.md +0 -203
- package/skills/oracle-challenge/SKILL.md +0 -126
- package/skills/oracle-doubt/SKILL.md +0 -252
- package/skills/oracle-doubt/references/adversarial-prompt.md +0 -47
- package/skills/oracle-grillme/SKILL.md +0 -160
- package/skills/oracle-security/SKILL.md +0 -225
- package/skills/oracle-security/references/security-patterns.md +0 -236
- package/skills/oracle-security/references/threat-modeling-guide.md +0 -137
- package/skills/oracle-testing/SKILL.md +0 -237
- package/skills/oracle-testing/references/anti-patterns.md +0 -618
- package/skills/oracle-testing/references/boundaries.md +0 -579
- package/skills/oracle-testing/references/core-testing.md +0 -691
- package/skills/oracle-testing/references/edge-testing.md +0 -794
- package/skills/oracle-testing/references/stub-driven-tdd.md +0 -322
- package/skills/oracle-thinkdeep/SKILL.md +0 -164
- /package/skills/{code-debug → oracle-debug}/references/language-tools.md +0 -0
- /package/skills/{code-debug → oracle-debug}/references/techniques.md +0 -0
- /package/skills/{oracle-grillme → oracle-domain-modelling}/references/ADR-FORMAT.md +0 -0
- /package/skills/{oracle-grillme → oracle-domain-modelling}/references/CONTEXT-FORMAT.md +0 -0
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
# Threat Modeling Guide
|
|
2
|
-
|
|
3
|
-
Extended approaches for analyzing security threats during system design.
|
|
4
|
-
|
|
5
|
-
## Data Flow Analysis
|
|
6
|
-
|
|
7
|
-
Map how data moves through your system to identify trust boundaries:
|
|
8
|
-
|
|
9
|
-
```
|
|
10
|
-
External Request → [Trust Boundary] → API Gateway → [Trust Boundary] → Service → [Trust Boundary] → Database
|
|
11
|
-
↑ ↑
|
|
12
|
-
Authenticate Authorize
|
|
13
|
-
Validate input Validate output
|
|
14
|
-
Rate limit Audit log
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
**Process**:
|
|
18
|
-
1. Draw the data flow for a specific use case
|
|
19
|
-
2. Identify every trust boundary crossing
|
|
20
|
-
3. Ask: "What's the worst thing that could enter here?"
|
|
21
|
-
4. Ask: "What validation or enforcement should happen at this boundary?"
|
|
22
|
-
5. Look for paths that bypass expected controls
|
|
23
|
-
|
|
24
|
-
## STRIDE in Depth
|
|
25
|
-
|
|
26
|
-
### Spoofing
|
|
27
|
-
- **Threat**: Attacker pretends to be a legitimate user or system
|
|
28
|
-
- **Questions**: How are identities verified? Can tokens be stolen or forged? Can sessions be hijacked?
|
|
29
|
-
- **Controls**: Strong authentication, token binding, session validation, mutual TLS
|
|
30
|
-
|
|
31
|
-
### Tampering
|
|
32
|
-
- **Threat**: Data is modified in transit or at rest
|
|
33
|
-
- **Questions**: Is integrity checked? Can parameters be altered? Can files be modified?
|
|
34
|
-
- **Controls**: Input validation, checksums, signatures, immutable audit logs
|
|
35
|
-
|
|
36
|
-
### Repudiation
|
|
37
|
-
- **Threat**: Actions can't be traced back to an actor
|
|
38
|
-
- **Questions**: Are all sensitive operations logged? Are logs tamper-evident? Can users deny their actions?
|
|
39
|
-
- **Controls**: Comprehensive audit logging, signed logs, non-repudiation mechanisms
|
|
40
|
-
|
|
41
|
-
### Information Disclosure
|
|
42
|
-
- **Threat**: Sensitive data leaks to unauthorized parties
|
|
43
|
-
- **Questions**: What data is exposed in errors? In logs? In API responses? Can users access other users' data?
|
|
44
|
-
- **Controls**: Output filtering, log redaction, access controls, encryption at rest/transit
|
|
45
|
-
|
|
46
|
-
### Denial of Service
|
|
47
|
-
- **Threat**: System becomes unavailable or unusable
|
|
48
|
-
- **Questions**: Can endpoints be overwhelmed? Are there expensive operations? Can resources be exhausted?
|
|
49
|
-
- **Controls**: Rate limiting, resource quotas, circuit breakers, caching, input size limits
|
|
50
|
-
|
|
51
|
-
### Elevation of Privilege
|
|
52
|
-
- **Threat**: User gains more access than authorized
|
|
53
|
-
- **Questions**: Is authorization checked on every operation? Can parameters be manipulated to access other resources? Are roles properly enforced?
|
|
54
|
-
- **Controls**: Resource-level authorization, parameter validation, role enforcement, privilege separation
|
|
55
|
-
|
|
56
|
-
## Attack Trees
|
|
57
|
-
|
|
58
|
-
### Building an Attack Tree
|
|
59
|
-
|
|
60
|
-
```
|
|
61
|
-
Goal: Access User Data
|
|
62
|
-
├── Path A: Steal Session Token
|
|
63
|
-
│ ├── Phishing (requires social engineering)
|
|
64
|
-
│ ├── XSS (requires input injection) ← Mitigated by output encoding
|
|
65
|
-
│ └── Network interception (requires unencrypted traffic) ← Mitigated by HTTPS
|
|
66
|
-
├── Path B: Direct Database Access
|
|
67
|
-
│ ├── SQL Injection (requires unparameterized query) ← Mitigated by parameterized queries
|
|
68
|
-
│ └── Direct connection (requires network access) ← Mitigated by network segmentation
|
|
69
|
-
└── Path C: Abuse API
|
|
70
|
-
├── IDOR (requires missing authorization) ← Mitigated by resource checks
|
|
71
|
-
└── Parameter tampering (requires missing validation) ← Mitigated by input validation
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
**Usage**: Focus on the unmitigated paths. If you find a path with no controls, that's your priority.
|
|
75
|
-
|
|
76
|
-
### Risk Scoring
|
|
77
|
-
|
|
78
|
-
For each identified threat, assess:
|
|
79
|
-
|
|
80
|
-
- **Impact** (1-5): How bad would exploitation be?
|
|
81
|
-
- **Likelihood** (1-5): How easy is it to exploit?
|
|
82
|
-
- **Risk** = Impact × Likelihood
|
|
83
|
-
|
|
84
|
-
| Score | Action |
|
|
85
|
-
|-------|--------|
|
|
86
|
-
| 20-25 | Must mitigate before release |
|
|
87
|
-
| 12-16 | Should mitigate in next release cycle |
|
|
88
|
-
| 6-10 | Track and mitigate when convenient |
|
|
89
|
-
| 1-5 | Accept risk, document reasoning |
|
|
90
|
-
|
|
91
|
-
## Trust Boundary Patterns
|
|
92
|
-
|
|
93
|
-
### External → Internal
|
|
94
|
-
- Every external request is hostile until authenticated and validated
|
|
95
|
-
- Validation must happen before any processing
|
|
96
|
-
- Never use external data to make internal decisions without verification
|
|
97
|
-
|
|
98
|
-
### Internal → External
|
|
99
|
-
- Assume external systems are compromised or malicious
|
|
100
|
-
- Validate all responses from third parties
|
|
101
|
-
- Don't expose internal state or identifiers
|
|
102
|
-
|
|
103
|
-
### User → User
|
|
104
|
-
- Users should never directly access each other's data
|
|
105
|
-
- All cross-user access must go through authorization checks
|
|
106
|
-
- Consider temporal access (can user A access user B's data at time T?)
|
|
107
|
-
|
|
108
|
-
### Process → Process
|
|
109
|
-
- Inter-service communication should be authenticated
|
|
110
|
-
- Don't trust internal network traffic by default
|
|
111
|
-
- Validate messages between components as if they came from outside
|
|
112
|
-
|
|
113
|
-
## Threat Modeling Checklist
|
|
114
|
-
|
|
115
|
-
For each feature or component:
|
|
116
|
-
|
|
117
|
-
- [ ] All entry points identified
|
|
118
|
-
- [ ] All trust boundaries mapped
|
|
119
|
-
- [ ] STRIDE threats considered
|
|
120
|
-
- [ ] Attack paths identified for high-value targets
|
|
121
|
-
- [ ] Existing controls mapped
|
|
122
|
-
- [ ] Gaps identified and prioritized
|
|
123
|
-
- [ ] Risk scores assigned
|
|
124
|
-
- [ ] Mitigations planned and scheduled
|
|
125
|
-
- [ ] Assumptions documented (what are we trusting?)
|
|
126
|
-
|
|
127
|
-
## Lightweight Threat Modeling
|
|
128
|
-
|
|
129
|
-
When you don't have time for full analysis:
|
|
130
|
-
|
|
131
|
-
1. **Write the user story**: "As an attacker, I want to..."
|
|
132
|
-
2. **Identify one critical asset**: What would hurt most to lose?
|
|
133
|
-
3. **Find the shortest path**: What's the easiest way to access it?
|
|
134
|
-
4. **Add one control**: What's the simplest mitigation?
|
|
135
|
-
5. **Repeat**: Do this for 3-5 attack stories
|
|
136
|
-
|
|
137
|
-
This takes 15 minutes and catches the most obvious issues.
|
|
@@ -1,237 +0,0 @@
|
|
|
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]
|