@dzhechkov/skills-idea2prd 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/LICENSE +21 -0
- package/README.md +71 -0
- package/bin/cli.js +5 -0
- package/package.json +49 -0
- package/sources.json +25 -0
- package/src/cli.js +108 -0
- package/src/commands/doctor.js +340 -0
- package/src/commands/init.js +168 -0
- package/src/commands/list.js +146 -0
- package/src/commands/remove.js +182 -0
- package/src/commands/update.js +170 -0
- package/src/utils.js +154 -0
- package/templates/.claude/commands/idea2prd-manual.md +35 -0
- package/templates/.claude/skills/explore/SKILL.md +218 -0
- package/templates/.claude/skills/explore/references/questioning-techniques.md +151 -0
- package/templates/.claude/skills/explore/references/task-brief-templates.md +355 -0
- package/templates/.claude/skills/goap-research-ed25519/SKILL.md +418 -0
- package/templates/.claude/skills/goap-research-ed25519/references/ed25519-verification.md +658 -0
- package/templates/.claude/skills/goap-research-ed25519/references/research-actions.md +544 -0
- package/templates/.claude/skills/goap-research-ed25519/references/source-evaluation.md +560 -0
- package/templates/.claude/skills/goap-research-ed25519/scripts/ed25519_verifier.py +662 -0
- package/templates/.claude/skills/goap-research-ed25519/scripts/goap_planner.py +720 -0
- package/templates/.claude/skills/idea2prd-manual/SKILL.md +695 -0
- package/templates/.claude/skills/idea2prd-manual/references/adr-catalog.md +288 -0
- package/templates/.claude/skills/idea2prd-manual/references/c4-model.md +277 -0
- package/templates/.claude/skills/idea2prd-manual/references/completion-checklist-template.md +446 -0
- package/templates/.claude/skills/idea2prd-manual/references/ddd-patterns.md +261 -0
- package/templates/.claude/skills/idea2prd-manual/references/fitness-functions-catalog.md +414 -0
- package/templates/.claude/skills/idea2prd-manual/references/pseudocode-style.md +404 -0
- package/templates/.claude/skills/idea2prd-manual/scripts/ai_context_builder.py +491 -0
- package/templates/.claude/skills/idea2prd-manual/scripts/c4_generator.py +311 -0
- package/templates/.claude/skills/idea2prd-manual/scripts/fitness_validator.py +451 -0
- package/templates/.claude/skills/idea2prd-manual/scripts/pseudocode_generator.py +430 -0
- package/templates/.claude/skills/problem-solver-enhanced/SKILL.md +565 -0
|
@@ -0,0 +1,414 @@
|
|
|
1
|
+
# Architecture Fitness Functions Catalog
|
|
2
|
+
|
|
3
|
+
Каталог Architecture Fitness Functions для idea2prd skills.
|
|
4
|
+
|
|
5
|
+
## What are Fitness Functions?
|
|
6
|
+
|
|
7
|
+
**Architecture Fitness Function** — автоматизированная проверка, что система соответствует архитектурным требованиям.
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
Fitness Function = Objective Metric + Threshold + Automation
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
**Примеры:**
|
|
14
|
+
- "Bounded contexts не должны напрямую обращаться к БД друг друга" (Structural)
|
|
15
|
+
- "P95 latency < 500ms" (Performance)
|
|
16
|
+
- "Все endpoints требуют authentication" (Security)
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Categories
|
|
21
|
+
|
|
22
|
+
### 1. Structural Fitness Functions
|
|
23
|
+
|
|
24
|
+
Проверяют архитектурную структуру кода.
|
|
25
|
+
|
|
26
|
+
#### FF-001: Bounded Context Independence
|
|
27
|
+
|
|
28
|
+
```yaml
|
|
29
|
+
Name: Bounded Context Independence
|
|
30
|
+
Category: Structural
|
|
31
|
+
Rule: No direct database access across bounded contexts
|
|
32
|
+
Threshold: 0 violations
|
|
33
|
+
Test: Static analysis of imports and dependencies
|
|
34
|
+
Tools: ArchUnit, custom ESLint rules, dependency-cruiser
|
|
35
|
+
Frequency: Every commit (CI)
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
**Implementation (TypeScript/ESLint):**
|
|
39
|
+
```javascript
|
|
40
|
+
// .eslintrc.js
|
|
41
|
+
module.exports = {
|
|
42
|
+
rules: {
|
|
43
|
+
'no-restricted-imports': ['error', {
|
|
44
|
+
patterns: [
|
|
45
|
+
{
|
|
46
|
+
group: ['**/orders/**'],
|
|
47
|
+
message: 'Cannot import from Orders context directly'
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
}]
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
#### FF-002: Aggregate Size Limit
|
|
58
|
+
|
|
59
|
+
```yaml
|
|
60
|
+
Name: Aggregate Size Limit
|
|
61
|
+
Category: Structural
|
|
62
|
+
Rule: Each aggregate should have ≤7 entities
|
|
63
|
+
Threshold: Max 7 entities per aggregate
|
|
64
|
+
Test: AST analysis or manual review
|
|
65
|
+
Tools: Custom script, code review checklist
|
|
66
|
+
Frequency: PR review
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
**Rationale:** Large aggregates indicate potential design issues and transaction conflicts.
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
#### FF-003: Dependency Direction
|
|
74
|
+
|
|
75
|
+
```yaml
|
|
76
|
+
Name: Dependency Direction
|
|
77
|
+
Category: Structural
|
|
78
|
+
Rule: Dependencies flow inward (Infrastructure → Application → Domain)
|
|
79
|
+
Threshold: 0 violations
|
|
80
|
+
Test: Static analysis
|
|
81
|
+
Tools: dependency-cruiser, madge
|
|
82
|
+
Frequency: Every commit
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
**dependency-cruiser config:**
|
|
86
|
+
```javascript
|
|
87
|
+
module.exports = {
|
|
88
|
+
forbidden: [
|
|
89
|
+
{
|
|
90
|
+
name: 'domain-to-infrastructure',
|
|
91
|
+
from: { path: '^src/domain' },
|
|
92
|
+
to: { path: '^src/infrastructure' }
|
|
93
|
+
}
|
|
94
|
+
]
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
#### FF-004: Cyclic Dependencies
|
|
101
|
+
|
|
102
|
+
```yaml
|
|
103
|
+
Name: No Cyclic Dependencies
|
|
104
|
+
Category: Structural
|
|
105
|
+
Rule: No circular dependencies between modules
|
|
106
|
+
Threshold: 0 cycles
|
|
107
|
+
Test: Dependency graph analysis
|
|
108
|
+
Tools: madge, dependency-cruiser
|
|
109
|
+
Frequency: Every commit
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
### 2. ADR Compliance Fitness Functions
|
|
115
|
+
|
|
116
|
+
Проверяют соответствие принятым архитектурным решениям.
|
|
117
|
+
|
|
118
|
+
#### FF-010: API Style Compliance
|
|
119
|
+
|
|
120
|
+
```yaml
|
|
121
|
+
Name: API Style Compliance
|
|
122
|
+
Category: ADR Compliance
|
|
123
|
+
Related ADR: ADR-003
|
|
124
|
+
Rule: All API endpoints follow REST conventions (or GraphQL schema)
|
|
125
|
+
Threshold: 100% compliance
|
|
126
|
+
Test: OpenAPI/Schema validation
|
|
127
|
+
Tools: Spectral, GraphQL linter
|
|
128
|
+
Frequency: Every commit
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
**Spectral config (.spectral.yaml):**
|
|
132
|
+
```yaml
|
|
133
|
+
extends: spectral:oas
|
|
134
|
+
rules:
|
|
135
|
+
operation-operationId: error
|
|
136
|
+
operation-tags: error
|
|
137
|
+
path-params: error
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
#### FF-011: Authentication Coverage
|
|
143
|
+
|
|
144
|
+
```yaml
|
|
145
|
+
Name: Authentication Coverage
|
|
146
|
+
Category: ADR Compliance
|
|
147
|
+
Related ADR: ADR-004
|
|
148
|
+
Rule: All non-public endpoints require authentication
|
|
149
|
+
Threshold: 100%
|
|
150
|
+
Test: Security scan + route analysis
|
|
151
|
+
Tools: Custom script, OWASP ZAP
|
|
152
|
+
Frequency: Every commit + weekly scan
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
#### FF-012: Error Response Format
|
|
158
|
+
|
|
159
|
+
```yaml
|
|
160
|
+
Name: Error Response Format
|
|
161
|
+
Category: ADR Compliance
|
|
162
|
+
Related ADR: ADR-009
|
|
163
|
+
Rule: All error responses follow RFC 7807 format
|
|
164
|
+
Threshold: 100%
|
|
165
|
+
Test: API contract testing
|
|
166
|
+
Tools: Custom test suite, Pact
|
|
167
|
+
Frequency: Every commit
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
#### FF-013: Logging Format
|
|
173
|
+
|
|
174
|
+
```yaml
|
|
175
|
+
Name: Structured Logging
|
|
176
|
+
Category: ADR Compliance
|
|
177
|
+
Related ADR: ADR-010
|
|
178
|
+
Rule: All logs are structured JSON with required fields
|
|
179
|
+
Threshold: 100%
|
|
180
|
+
Test: Log format validation
|
|
181
|
+
Tools: Custom linter, log analysis
|
|
182
|
+
Frequency: Every commit
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
### 3. Performance Fitness Functions
|
|
188
|
+
|
|
189
|
+
Проверяют производительность системы.
|
|
190
|
+
|
|
191
|
+
#### FF-020: Response Time
|
|
192
|
+
|
|
193
|
+
```yaml
|
|
194
|
+
Name: API Response Time
|
|
195
|
+
Category: Performance
|
|
196
|
+
Related NFR: NFR-P01
|
|
197
|
+
Rule: P95 response time < 500ms
|
|
198
|
+
Threshold: 500ms
|
|
199
|
+
Test: Load testing
|
|
200
|
+
Tools: k6, Artillery, Gatling
|
|
201
|
+
Frequency: Daily (staging), weekly (prod-like)
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
**k6 script:**
|
|
205
|
+
```javascript
|
|
206
|
+
import http from 'k6/http';
|
|
207
|
+
import { check } from 'k6';
|
|
208
|
+
|
|
209
|
+
export const options = {
|
|
210
|
+
thresholds: {
|
|
211
|
+
http_req_duration: ['p(95)<500'],
|
|
212
|
+
},
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
export default function () {
|
|
216
|
+
const res = http.get('https://api.example.com/health');
|
|
217
|
+
check(res, {
|
|
218
|
+
'status is 200': (r) => r.status === 200,
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
|
|
225
|
+
#### FF-021: Database Query Time
|
|
226
|
+
|
|
227
|
+
```yaml
|
|
228
|
+
Name: Database Query Time
|
|
229
|
+
Category: Performance
|
|
230
|
+
Rule: No queries > 100ms in application code
|
|
231
|
+
Threshold: 100ms
|
|
232
|
+
Test: Query analysis, slow query log
|
|
233
|
+
Tools: pg_stat_statements, APM
|
|
234
|
+
Frequency: Continuous monitoring
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
---
|
|
238
|
+
|
|
239
|
+
#### FF-022: Memory Usage
|
|
240
|
+
|
|
241
|
+
```yaml
|
|
242
|
+
Name: Memory Usage
|
|
243
|
+
Category: Performance
|
|
244
|
+
Rule: Application memory < 512MB under normal load
|
|
245
|
+
Threshold: 512MB
|
|
246
|
+
Test: Load testing with memory profiling
|
|
247
|
+
Tools: Prometheus + Grafana, APM
|
|
248
|
+
Frequency: Weekly
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
---
|
|
252
|
+
|
|
253
|
+
### 4. Security Fitness Functions
|
|
254
|
+
|
|
255
|
+
Проверяют безопасность системы.
|
|
256
|
+
|
|
257
|
+
#### FF-030: Dependency Vulnerabilities
|
|
258
|
+
|
|
259
|
+
```yaml
|
|
260
|
+
Name: No Critical Vulnerabilities
|
|
261
|
+
Category: Security
|
|
262
|
+
Rule: No critical/high CVEs in dependencies
|
|
263
|
+
Threshold: 0 critical, 0 high
|
|
264
|
+
Test: Dependency scanning
|
|
265
|
+
Tools: npm audit, Snyk, Dependabot
|
|
266
|
+
Frequency: Every commit + daily
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
---
|
|
270
|
+
|
|
271
|
+
#### FF-031: Secrets in Code
|
|
272
|
+
|
|
273
|
+
```yaml
|
|
274
|
+
Name: No Secrets in Code
|
|
275
|
+
Category: Security
|
|
276
|
+
Rule: No hardcoded secrets, API keys, passwords
|
|
277
|
+
Threshold: 0 violations
|
|
278
|
+
Test: Secret scanning
|
|
279
|
+
Tools: git-secrets, gitleaks, truffleHog
|
|
280
|
+
Frequency: Every commit
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
---
|
|
284
|
+
|
|
285
|
+
#### FF-032: HTTPS Enforcement
|
|
286
|
+
|
|
287
|
+
```yaml
|
|
288
|
+
Name: HTTPS Only
|
|
289
|
+
Category: Security
|
|
290
|
+
Rule: All external communications over HTTPS
|
|
291
|
+
Threshold: 100%
|
|
292
|
+
Test: Configuration audit, traffic analysis
|
|
293
|
+
Tools: Custom script, security scanner
|
|
294
|
+
Frequency: Weekly
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
---
|
|
298
|
+
|
|
299
|
+
### 5. Data Integrity Fitness Functions
|
|
300
|
+
|
|
301
|
+
#### FF-040: Event Schema Compliance
|
|
302
|
+
|
|
303
|
+
```yaml
|
|
304
|
+
Name: Domain Event Schema
|
|
305
|
+
Category: Data Integrity
|
|
306
|
+
Rule: All domain events match their JSON Schema
|
|
307
|
+
Threshold: 100%
|
|
308
|
+
Test: Schema validation in tests
|
|
309
|
+
Tools: ajv, JSON Schema validator
|
|
310
|
+
Frequency: Every commit
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
---
|
|
314
|
+
|
|
315
|
+
#### FF-041: Database Migration Safety
|
|
316
|
+
|
|
317
|
+
```yaml
|
|
318
|
+
Name: Safe Migrations
|
|
319
|
+
Category: Data Integrity
|
|
320
|
+
Rule: All migrations are reversible and non-destructive
|
|
321
|
+
Threshold: 100%
|
|
322
|
+
Test: Migration testing in CI
|
|
323
|
+
Tools: Custom migration tests
|
|
324
|
+
Frequency: Every PR with migrations
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
---
|
|
328
|
+
|
|
329
|
+
### 6. Operational Fitness Functions
|
|
330
|
+
|
|
331
|
+
#### FF-050: Test Coverage
|
|
332
|
+
|
|
333
|
+
```yaml
|
|
334
|
+
Name: Test Coverage
|
|
335
|
+
Category: Operational
|
|
336
|
+
Rule: Code coverage ≥ 80%
|
|
337
|
+
Threshold: 80%
|
|
338
|
+
Test: Coverage report
|
|
339
|
+
Tools: Jest, c8, Istanbul
|
|
340
|
+
Frequency: Every commit
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
---
|
|
344
|
+
|
|
345
|
+
#### FF-051: Build Time
|
|
346
|
+
|
|
347
|
+
```yaml
|
|
348
|
+
Name: Build Time
|
|
349
|
+
Category: Operational
|
|
350
|
+
Rule: CI build completes in < 10 minutes
|
|
351
|
+
Threshold: 10 minutes
|
|
352
|
+
Test: CI metrics
|
|
353
|
+
Tools: CI/CD platform metrics
|
|
354
|
+
Frequency: Continuous
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
---
|
|
358
|
+
|
|
359
|
+
## Fitness Function Template
|
|
360
|
+
|
|
361
|
+
```yaml
|
|
362
|
+
Name: [Descriptive name]
|
|
363
|
+
Category: Structural | ADR Compliance | Performance | Security | Data Integrity | Operational
|
|
364
|
+
Related ADR/NFR: [ADR-XXX or NFR-XXX]
|
|
365
|
+
Rule: [Clear statement of what must be true]
|
|
366
|
+
Threshold: [Numeric or boolean threshold]
|
|
367
|
+
Test: [How to verify]
|
|
368
|
+
Tools: [Automation tools]
|
|
369
|
+
Frequency: Every commit | Daily | Weekly | Monthly
|
|
370
|
+
Owner: [Team/person responsible]
|
|
371
|
+
Alert: [How to alert on failure]
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
---
|
|
375
|
+
|
|
376
|
+
## Implementation Priority
|
|
377
|
+
|
|
378
|
+
| Priority | Fitness Functions | Rationale |
|
|
379
|
+
|----------|-------------------|-----------|
|
|
380
|
+
| **P0** | FF-030 (Vulnerabilities), FF-031 (Secrets), FF-011 (Auth) | Security-critical |
|
|
381
|
+
| **P1** | FF-001 (Context Independence), FF-010 (API Style), FF-050 (Coverage) | Architecture integrity |
|
|
382
|
+
| **P2** | FF-020 (Response Time), FF-040 (Event Schema) | Quality |
|
|
383
|
+
| **P3** | FF-002 (Aggregate Size), FF-021 (Query Time) | Optimization |
|
|
384
|
+
|
|
385
|
+
---
|
|
386
|
+
|
|
387
|
+
## Fitness Function Dashboard
|
|
388
|
+
|
|
389
|
+
```markdown
|
|
390
|
+
# Architecture Fitness Dashboard
|
|
391
|
+
|
|
392
|
+
## Status: [DATE]
|
|
393
|
+
|
|
394
|
+
| Category | Pass | Fail | Trend |
|
|
395
|
+
|----------|------|------|-------|
|
|
396
|
+
| Structural | 4/4 | 0 | ✅ |
|
|
397
|
+
| ADR Compliance | 3/4 | 1 | ⚠️ |
|
|
398
|
+
| Performance | 2/3 | 1 | 🔴 |
|
|
399
|
+
| Security | 5/5 | 0 | ✅ |
|
|
400
|
+
|
|
401
|
+
## Failing Checks
|
|
402
|
+
|
|
403
|
+
### FF-012: Error Response Format
|
|
404
|
+
- **Status:** FAIL
|
|
405
|
+
- **Current:** 85%
|
|
406
|
+
- **Threshold:** 100%
|
|
407
|
+
- **Action:** [JIRA-123] Fix legacy endpoints
|
|
408
|
+
|
|
409
|
+
### FF-020: Response Time
|
|
410
|
+
- **Status:** FAIL
|
|
411
|
+
- **Current:** P95 = 620ms
|
|
412
|
+
- **Threshold:** 500ms
|
|
413
|
+
- **Action:** [JIRA-124] Optimize /search endpoint
|
|
414
|
+
```
|