ultra-builder-pro-cli 0.10.0 → 0.12.1
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/.ultra-template/specs/architecture.md +54 -223
- package/.ultra-template/specs/discovery.md +34 -231
- package/.ultra-template/specs/product.md +44 -200
- package/.ultra-template/tasks/contexts/TEMPLATE.md +36 -0
- package/.ultra-template/tasks/tasks.json +6 -0
- package/CHANGELOG.md +86 -1
- package/README.md +21 -9
- package/adapters/_shared/codex-assets.cjs +24 -342
- package/adapters/_shared/handbook.cjs +4 -3
- package/adapters/_shared/runtime-assets.cjs +24 -0
- package/adapters/_shared/tests/handbook.test.cjs +4 -0
- package/adapters/_shared/tests/runtime-assets.test.cjs +11 -4
- package/adapters/claude.js +28 -5
- package/adapters/kimi.js +15 -138
- package/adapters/opencode.js +22 -49
- package/adapters/tests/claude.test.cjs +22 -8
- package/adapters/tests/codex.test.cjs +21 -8
- package/adapters/tests/kimi-hook.test.cjs +1 -1
- package/adapters/tests/kimi.test.cjs +11 -11
- package/adapters/tests/opencode.test.cjs +47 -8
- package/agents/code-reviewer.md +24 -85
- package/agents/debugger.md +30 -132
- package/agents/review-code.md +24 -104
- package/agents/review-comments.md +20 -83
- package/agents/review-coordinator.md +40 -137
- package/agents/review-design.md +21 -118
- package/agents/review-errors.md +22 -70
- package/agents/review-spec.md +36 -0
- package/agents/review-tests.md +20 -76
- package/agents/tdd-runner.md +26 -84
- package/commands/learn.md +5 -36
- package/commands/ultra-change.md +5 -43
- package/commands/ultra-deliver.md +4 -46
- package/commands/ultra-dev.md +4 -48
- package/commands/ultra-doctor.md +4 -30
- package/commands/ultra-init.md +5 -47
- package/commands/ultra-plan.md +5 -48
- package/commands/ultra-research.md +5 -54
- package/commands/ultra-status.md +5 -44
- package/commands/ultra-test.md +5 -45
- package/commands/ultra-think.md +5 -40
- package/docs/AGENT-CONTEXT.md +16 -8
- package/docs/ARCHITECTURE.md +32 -5
- package/docs/PLAN.zh-CN.md +8 -6
- package/docs/ROADMAP.md +5 -3
- package/docs/RUNTIME-COMPAT-MATRIX.md +8 -5
- package/docs/SKILL-AUTHORING.md +75 -0
- package/docs/STATE-DB-ACCESS-POLICY.md +17 -11
- package/docs/USER-HANDBOOK-CONTRACT.md +8 -5
- package/hooks/README.md +4 -3
- package/hooks/adapters/codex.py +1 -1
- package/hooks/adapters/kimi.py +1 -1
- package/hooks/context_spine.py +120 -16
- package/hooks/health_check.py +11 -0
- package/hooks/pre_stop_check.py +6 -5
- package/mcp-server/lib/baseline-workflow.cjs +415 -0
- package/mcp-server/lib/baseline-workflow.test.cjs +225 -0
- package/mcp-server/lib/change-workflow.cjs +24 -27
- package/mcp-server/lib/change-workflow.test.cjs +202 -6
- package/mcp-server/lib/context-spine.cjs +74 -9
- package/mcp-server/lib/context-spine.test.cjs +15 -0
- package/mcp-server/lib/doctor.cjs +14 -0
- package/mcp-server/lib/doctor.test.cjs +25 -1
- package/mcp-server/lib/init-project.cjs +49 -14
- package/mcp-server/lib/provider-refs.cjs +42 -0
- package/mcp-server/lib/spec-learning.test.cjs +5 -0
- package/mcp-server/lib/state-db.cjs +63 -4
- package/mcp-server/lib/state-db.test.cjs +8 -3
- package/mcp-server/server.cjs +48 -3
- package/mcp-server/tests/init-project.test.cjs +54 -8
- package/mcp-server/tests/server-contract.test.cjs +99 -2
- package/mcp-server/tests/state-db.test.cjs +11 -2
- package/package.json +3 -2
- package/skills/cc-collab/SKILL.md +16 -18
- package/skills/code-review-expert/SKILL.md +39 -114
- package/skills/code-review-expert/references/correctness-reliability.md +30 -0
- package/skills/code-review-expert/references/design-boundaries.md +26 -0
- package/skills/code-review-expert/references/removal-plan.md +17 -45
- package/skills/codex-collab/SKILL.md +23 -28
- package/skills/codex-collab/evals/evals.json +18 -23
- package/skills/integration-rules/SKILL.md +28 -67
- package/skills/learn/SKILL.md +46 -106
- package/skills/security-rules/SKILL.md +34 -56
- package/skills/testing-rules/SKILL.md +28 -52
- package/skills/ultra-change/SKILL.md +68 -114
- package/skills/ultra-deliver/SKILL.md +58 -86
- package/skills/ultra-dev/SKILL.md +46 -105
- package/skills/ultra-doctor/SKILL.md +45 -72
- package/skills/ultra-init/SKILL.md +62 -147
- package/skills/ultra-init/references/brownfield-adoption.md +65 -0
- package/skills/ultra-plan/SKILL.md +56 -89
- package/skills/ultra-research/SKILL.md +64 -152
- package/skills/ultra-research/references/architecture.md +38 -0
- package/skills/ultra-research/references/problem-product.md +39 -0
- package/skills/ultra-research/references/quality-delivery.md +34 -0
- package/skills/ultra-research/references/synthesis.md +38 -0
- package/skills/ultra-research/references/users-scope.md +40 -0
- package/skills/ultra-review/SKILL.md +54 -98
- package/skills/ultra-review/references/unified-schema.md +76 -101
- package/skills/ultra-review/scripts/review_wait.py +242 -77
- package/skills/ultra-status/SKILL.md +41 -56
- package/skills/ultra-test/SKILL.md +37 -72
- package/skills/ultra-think/SKILL.md +43 -102
- package/skills/ultra-verify/SKILL.md +44 -84
- package/skills/ultra-verify/evals/evals.json +24 -27
- package/spec/cli-protocol.md +4 -0
- package/spec/mcp-tools.yaml +223 -4
- package/spec/schemas/command-manifest.schema.json +7 -25
- package/spec/schemas/mcp-tools.schema.json +1 -1
- package/spec/schemas/skill-manifest.schema.json +9 -79
- package/spec/schemas/state-db.sql +33 -2
- package/ultra-tools/commands/status.cjs +20 -2
- package/ultra-tools/commands/task.cjs +4 -1
- package/ultra-tools/status-command.test.cjs +20 -0
- package/ultra-tools/system-command.test.cjs +5 -0
- package/skills/code-review-expert/references/code-quality-checklist.md +0 -112
- package/skills/code-review-expert/references/integration-checklist.md +0 -46
- package/skills/code-review-expert/references/security-checklist.md +0 -100
- package/skills/code-review-expert/references/solid-checklist.md +0 -65
- package/skills/ultra-research/steps/step-00-problem-validation.md +0 -154
- package/skills/ultra-research/steps/step-01-opportunity-discovery.md +0 -172
- package/skills/ultra-research/steps/step-02-market-assessment.md +0 -195
- package/skills/ultra-research/steps/step-03-competitive-landscape.md +0 -197
- package/skills/ultra-research/steps/step-04-product-strategy.md +0 -196
- package/skills/ultra-research/steps/step-05-assumptions-validation.md +0 -234
- package/skills/ultra-research/steps/step-10-user-personas.md +0 -169
- package/skills/ultra-research/steps/step-11-user-scenarios.md +0 -181
- package/skills/ultra-research/steps/step-20-user-stories.md +0 -156
- package/skills/ultra-research/steps/step-21-features-scope.md +0 -157
- package/skills/ultra-research/steps/step-22-success-metrics.md +0 -195
- package/skills/ultra-research/steps/step-30-architecture-context.md +0 -154
- package/skills/ultra-research/steps/step-31-solution-strategy.md +0 -172
- package/skills/ultra-research/steps/step-32-building-blocks.md +0 -188
- package/skills/ultra-research/steps/step-40-deployment.md +0 -123
- package/skills/ultra-research/steps/step-41-quality-risks.md +0 -135
- package/skills/ultra-research/steps/step-99-synthesis.md +0 -188
- package/skills/ultra-review/scripts/review_verdict_update.py +0 -99
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
# Code Quality Checklist
|
|
2
|
-
|
|
3
|
-
## Error Handling
|
|
4
|
-
|
|
5
|
-
### Anti-patterns to Flag
|
|
6
|
-
|
|
7
|
-
- **Swallowed exceptions**: Empty catch blocks or catch with only logging
|
|
8
|
-
```javascript
|
|
9
|
-
try { ... } catch (e) { } // Silent failure
|
|
10
|
-
try { ... } catch (e) { console.log(e) } // Log and forget
|
|
11
|
-
```
|
|
12
|
-
- **Overly broad catch**: Catching `Exception`/`Error` base class instead of specific types
|
|
13
|
-
- **Error information leakage**: Stack traces or internal details exposed to users
|
|
14
|
-
- **Missing error handling**: No try-catch around fallible operations (I/O, network, parsing)
|
|
15
|
-
- **Async error handling**: Unhandled promise rejections, missing `.catch()`, no error boundary
|
|
16
|
-
|
|
17
|
-
### Questions to Ask
|
|
18
|
-
- "What happens when this operation fails?"
|
|
19
|
-
- "Will the caller know something went wrong?"
|
|
20
|
-
- "Is there enough context to debug this error?"
|
|
21
|
-
|
|
22
|
-
---
|
|
23
|
-
|
|
24
|
-
## Performance & Caching
|
|
25
|
-
|
|
26
|
-
### CPU-Intensive Operations
|
|
27
|
-
- Expensive operations in hot paths: Regex compilation, JSON parsing, crypto in loops
|
|
28
|
-
- Blocking main thread: Sync I/O, heavy computation without worker/async
|
|
29
|
-
- Unnecessary recomputation: Same calculation done multiple times
|
|
30
|
-
- Missing memoization: Pure functions called repeatedly with same inputs
|
|
31
|
-
|
|
32
|
-
### Database & I/O
|
|
33
|
-
- **N+1 queries**: Loop that makes a query per item instead of batch
|
|
34
|
-
```javascript
|
|
35
|
-
// Bad: N+1
|
|
36
|
-
for (const id of ids) {
|
|
37
|
-
const user = await db.query('SELECT * FROM users WHERE id = ?', id)
|
|
38
|
-
}
|
|
39
|
-
// Good: Batch
|
|
40
|
-
const users = await db.query('SELECT * FROM users WHERE id IN (?)', ids)
|
|
41
|
-
```
|
|
42
|
-
- Missing indexes: Queries on unindexed columns
|
|
43
|
-
- Over-fetching: SELECT * when only few columns needed
|
|
44
|
-
- No pagination: Loading entire dataset into memory
|
|
45
|
-
|
|
46
|
-
### Caching Issues
|
|
47
|
-
- Missing cache for expensive operations: Repeated API calls, DB queries, computations
|
|
48
|
-
- Cache without TTL: Stale data served indefinitely
|
|
49
|
-
- Cache without invalidation strategy: Data updated but cache not cleared
|
|
50
|
-
- Cache key collisions: Insufficient key uniqueness
|
|
51
|
-
- Caching user-specific data globally: Security/privacy issue
|
|
52
|
-
|
|
53
|
-
### Memory
|
|
54
|
-
- Unbounded collections: Arrays/maps that grow without limit
|
|
55
|
-
- Large object retention: Holding references preventing GC
|
|
56
|
-
- String concatenation in loops: Use StringBuilder/join instead
|
|
57
|
-
- Loading large files entirely: Use streaming instead
|
|
58
|
-
|
|
59
|
-
### Questions to Ask
|
|
60
|
-
- "What's the time complexity of this operation?"
|
|
61
|
-
- "How does this behave with 10x/100x data?"
|
|
62
|
-
- "Is this result cacheable? Should it be?"
|
|
63
|
-
- "Can this be batched instead of one-by-one?"
|
|
64
|
-
|
|
65
|
-
---
|
|
66
|
-
|
|
67
|
-
## Boundary Conditions
|
|
68
|
-
|
|
69
|
-
### Null/Undefined Handling
|
|
70
|
-
- Missing null checks: Accessing properties on potentially null objects
|
|
71
|
-
- Truthy/falsy confusion: `if (value)` when `0` or `""` are valid
|
|
72
|
-
- Optional chaining overuse: `a?.b?.c?.d` hiding structural issues
|
|
73
|
-
- Null vs undefined inconsistency: Mixed usage without clear convention
|
|
74
|
-
|
|
75
|
-
### Empty Collections
|
|
76
|
-
- Empty array not handled: Code assumes array has items
|
|
77
|
-
- Empty object edge case: `for...in` or `Object.keys` on empty object
|
|
78
|
-
- First/last element access: `arr[0]` or `arr[arr.length-1]` without length check
|
|
79
|
-
|
|
80
|
-
### Numeric Boundaries
|
|
81
|
-
- Division by zero: Missing check before division
|
|
82
|
-
- Integer overflow: Large numbers exceeding safe integer range
|
|
83
|
-
- Floating point comparison: Using `===` instead of epsilon comparison
|
|
84
|
-
- Negative values: Index or count that shouldn't be negative
|
|
85
|
-
- Off-by-one errors: Loop bounds, array slicing, pagination
|
|
86
|
-
|
|
87
|
-
### String Boundaries
|
|
88
|
-
- Empty string: Not handled as edge case
|
|
89
|
-
- Whitespace-only string: Passes truthy check but is effectively empty
|
|
90
|
-
- Very long strings: No length limits causing memory/display issues
|
|
91
|
-
- Unicode edge cases: Emoji, RTL text, combining characters
|
|
92
|
-
|
|
93
|
-
### Common Dangerous Patterns
|
|
94
|
-
```javascript
|
|
95
|
-
// No null check
|
|
96
|
-
const name = user.profile.name
|
|
97
|
-
|
|
98
|
-
// Array access without check
|
|
99
|
-
const first = items[0]
|
|
100
|
-
|
|
101
|
-
// Division without check
|
|
102
|
-
const avg = total / count
|
|
103
|
-
|
|
104
|
-
// Truthy check excludes valid values
|
|
105
|
-
if (value) { ... } // fails for 0, "", false
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
### Questions to Ask
|
|
109
|
-
- "What if this is null/undefined?"
|
|
110
|
-
- "What if this collection is empty?"
|
|
111
|
-
- "What's the valid range for this number?"
|
|
112
|
-
- "What happens at the boundaries (0, -1, MAX_INT)?"
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
# Integration Checklist
|
|
2
|
-
|
|
3
|
-
## Entry Point Tracing
|
|
4
|
-
|
|
5
|
-
For every new module/service/class:
|
|
6
|
-
- **Ask**: "What entry point calls this code?"
|
|
7
|
-
- **If none**: Flag as orphan code (P1)
|
|
8
|
-
- **Trace**: handler → use case → domain → persistence (all layers reachable?)
|
|
9
|
-
|
|
10
|
-
## Contract Validation
|
|
11
|
-
|
|
12
|
-
For every boundary crossing:
|
|
13
|
-
- **Ask**: "Is there a shared interface/type that both sides use?"
|
|
14
|
-
- **If no shared type**: Flag missing contract (P2)
|
|
15
|
-
- **Ask**: "Is there a test validating the contract?"
|
|
16
|
-
- **If no contract test**: Flag missing contract test (P1)
|
|
17
|
-
|
|
18
|
-
## Vertical Slice Assessment
|
|
19
|
-
|
|
20
|
-
For the change as a whole:
|
|
21
|
-
- **Ask**: "Does this change deliver a working end-to-end path for at least one user scenario?"
|
|
22
|
-
- **If horizontal-only**: Flag as horizontal layer (P2)
|
|
23
|
-
- **Ask**: "Can a user exercise this change right now, or does it need unfinished work?"
|
|
24
|
-
- **If blocked by unfinished work**: Informational note (P3)
|
|
25
|
-
|
|
26
|
-
## Integration Test Coverage
|
|
27
|
-
|
|
28
|
-
| Boundary Type | Required Test | Common Mistake |
|
|
29
|
-
|---------------|---------------|----------------|
|
|
30
|
-
| HTTP endpoint | Real HTTP request/response | Testing handler function directly without HTTP layer |
|
|
31
|
-
| Database query | Testcontainers with real DB | InMemoryRepository or jest.mock |
|
|
32
|
-
| Queue/event | Real publish + consume | Mocking the event bus |
|
|
33
|
-
| External API | Test Double with rationale | No test at all |
|
|
34
|
-
|
|
35
|
-
## Data Flow Continuity
|
|
36
|
-
|
|
37
|
-
- **Ask**: "Does data flow from source to destination without gaps?"
|
|
38
|
-
- Check: Input validation → transformation → persistence → response
|
|
39
|
-
- **Flag**: Any link in the chain that exists in code but has no test proving data flows through it
|
|
40
|
-
|
|
41
|
-
## Key Questions
|
|
42
|
-
|
|
43
|
-
- "What happens if I deploy this change alone? Does anything work?"
|
|
44
|
-
- "Which entry point exercises this code path?"
|
|
45
|
-
- "Where does the data this component produces get consumed?"
|
|
46
|
-
- "Where does the data this component needs come from?"
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
# Security and Reliability Checklist
|
|
2
|
-
|
|
3
|
-
## Input/Output Safety
|
|
4
|
-
|
|
5
|
-
- **XSS**: Unsafe HTML injection, raw HTML rendering without sanitization, unescaped templates, innerHTML assignments
|
|
6
|
-
- **Injection**: SQL/NoSQL/command/GraphQL injection via string concatenation or template literals
|
|
7
|
-
- **SSRF**: User-controlled URLs reaching internal services without allowlist validation
|
|
8
|
-
- **Path traversal**: User input in file paths without sanitization (`../` attacks)
|
|
9
|
-
- **Prototype pollution**: Unsafe object merging in JavaScript (`Object.assign`, spread with user input)
|
|
10
|
-
|
|
11
|
-
## AuthN/AuthZ
|
|
12
|
-
|
|
13
|
-
- Missing tenant or ownership checks for read/write operations
|
|
14
|
-
- New endpoints without auth guards or RBAC enforcement
|
|
15
|
-
- Trusting client-provided roles/flags/IDs
|
|
16
|
-
- Broken access control (IDOR - Insecure Direct Object Reference)
|
|
17
|
-
- Session fixation or weak session management
|
|
18
|
-
|
|
19
|
-
## JWT & Token Security
|
|
20
|
-
|
|
21
|
-
- Algorithm confusion attacks (accepting `none` or `HS256` when expecting `RS256`)
|
|
22
|
-
- Weak or hardcoded secrets
|
|
23
|
-
- Missing expiration (`exp`) or not validating it
|
|
24
|
-
- Sensitive data in JWT payload (tokens are base64, not encrypted)
|
|
25
|
-
- Not validating `iss` (issuer) or `aud` (audience)
|
|
26
|
-
|
|
27
|
-
## Secrets and PII
|
|
28
|
-
|
|
29
|
-
- API keys, tokens, or credentials in code/config/logs
|
|
30
|
-
- Secrets in git history or environment variables exposed to client
|
|
31
|
-
- Excessive logging of PII or sensitive payloads
|
|
32
|
-
- Missing data masking in error messages
|
|
33
|
-
|
|
34
|
-
## Supply Chain & Dependencies
|
|
35
|
-
|
|
36
|
-
- Unpinned dependencies allowing malicious updates
|
|
37
|
-
- Dependency confusion (private package name collision)
|
|
38
|
-
- Importing from untrusted sources or CDNs without integrity checks
|
|
39
|
-
- Outdated dependencies with known CVEs
|
|
40
|
-
|
|
41
|
-
## CORS & Headers
|
|
42
|
-
|
|
43
|
-
- Overly permissive CORS (`Access-Control-Allow-Origin: *` with credentials)
|
|
44
|
-
- Missing security headers (CSP, X-Frame-Options, X-Content-Type-Options)
|
|
45
|
-
- Exposed internal headers or stack traces
|
|
46
|
-
|
|
47
|
-
## Runtime Risks
|
|
48
|
-
|
|
49
|
-
- Unbounded loops, recursive calls, or large in-memory buffers
|
|
50
|
-
- Missing timeouts, retries, or rate limiting on external calls
|
|
51
|
-
- Blocking operations on request path (sync I/O in async context)
|
|
52
|
-
- Resource exhaustion (file handles, connections, memory)
|
|
53
|
-
- ReDoS (Regular Expression Denial of Service)
|
|
54
|
-
|
|
55
|
-
## Cryptography
|
|
56
|
-
|
|
57
|
-
- Weak algorithms (MD5, SHA1 for security purposes)
|
|
58
|
-
- Hardcoded IVs or salts
|
|
59
|
-
- Using encryption without authentication (ECB mode, no HMAC)
|
|
60
|
-
- Insufficient key length
|
|
61
|
-
|
|
62
|
-
## Race Conditions
|
|
63
|
-
|
|
64
|
-
### Shared State Access
|
|
65
|
-
- Multiple threads/goroutines/async tasks accessing shared variables without synchronization
|
|
66
|
-
- Global state or singletons modified concurrently
|
|
67
|
-
- Lazy initialization without proper locking (double-checked locking issues)
|
|
68
|
-
- Non-thread-safe collections used in concurrent context
|
|
69
|
-
|
|
70
|
-
### Check-Then-Act (TOCTOU)
|
|
71
|
-
- `if (exists) then use` patterns without atomic operations
|
|
72
|
-
- `if (authorized) then perform` where authorization can change
|
|
73
|
-
- File existence check followed by file operation
|
|
74
|
-
- Balance check followed by deduction (financial operations)
|
|
75
|
-
- Inventory check followed by order placement
|
|
76
|
-
|
|
77
|
-
### Database Concurrency
|
|
78
|
-
- Missing optimistic locking (`version` column, `updated_at` checks)
|
|
79
|
-
- Missing pessimistic locking (`SELECT FOR UPDATE`)
|
|
80
|
-
- Read-modify-write without transaction isolation
|
|
81
|
-
- Counter increments without atomic operations (`UPDATE SET count = count + 1`)
|
|
82
|
-
- Unique constraint violations in concurrent inserts
|
|
83
|
-
|
|
84
|
-
### Distributed Systems
|
|
85
|
-
- Missing distributed locks for shared resources
|
|
86
|
-
- Leader election race conditions
|
|
87
|
-
- Cache invalidation races (stale reads after writes)
|
|
88
|
-
- Event ordering dependencies without proper sequencing
|
|
89
|
-
|
|
90
|
-
### Questions to Ask
|
|
91
|
-
- "What happens if two requests hit this code simultaneously?"
|
|
92
|
-
- "Is this operation atomic or can it be interrupted?"
|
|
93
|
-
- "What shared state does this code access?"
|
|
94
|
-
|
|
95
|
-
## Data Integrity
|
|
96
|
-
|
|
97
|
-
- Missing transactions, partial writes, or inconsistent state updates
|
|
98
|
-
- Weak validation before persistence (type coercion issues)
|
|
99
|
-
- Missing idempotency for retryable operations
|
|
100
|
-
- Lost updates due to concurrent modifications
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
# SOLID Smell Prompts
|
|
2
|
-
|
|
3
|
-
## SRP (Single Responsibility)
|
|
4
|
-
|
|
5
|
-
- File owns unrelated concerns (e.g., HTTP + DB + domain rules in one file)
|
|
6
|
-
- Large class/module with low cohesion or multiple reasons to change
|
|
7
|
-
- Functions that orchestrate many unrelated steps
|
|
8
|
-
- God objects that know too much about the system
|
|
9
|
-
- **Ask**: "What is the single reason this module would change?"
|
|
10
|
-
|
|
11
|
-
## OCP (Open/Closed)
|
|
12
|
-
|
|
13
|
-
- Adding a new behavior requires editing many switch/if blocks
|
|
14
|
-
- Feature growth requires modifying core logic rather than extending
|
|
15
|
-
- No plugin/strategy/hook points for variation
|
|
16
|
-
- **Ask**: "Can I add a new variant without touching existing code?"
|
|
17
|
-
|
|
18
|
-
## LSP (Liskov Substitution)
|
|
19
|
-
|
|
20
|
-
- Subclass checks for concrete type or throws for base method
|
|
21
|
-
- Overridden methods weaken preconditions or strengthen postconditions
|
|
22
|
-
- Subclass ignores or no-ops parent behavior
|
|
23
|
-
- **Ask**: "Can I substitute any subclass without the caller knowing?"
|
|
24
|
-
|
|
25
|
-
## ISP (Interface Segregation)
|
|
26
|
-
|
|
27
|
-
- Interfaces with many methods, most unused by implementers
|
|
28
|
-
- Callers depend on broad interfaces for narrow needs
|
|
29
|
-
- Empty/stub implementations of interface methods
|
|
30
|
-
- **Ask**: "Do all implementers use all methods?"
|
|
31
|
-
|
|
32
|
-
## DIP (Dependency Inversion)
|
|
33
|
-
|
|
34
|
-
- High-level logic depends on concrete IO, storage, or network types
|
|
35
|
-
- Hard-coded implementations instead of abstractions or injection
|
|
36
|
-
- Import chains that couple business logic to infrastructure
|
|
37
|
-
- **Ask**: "Can I swap the implementation without changing business logic?"
|
|
38
|
-
|
|
39
|
-
---
|
|
40
|
-
|
|
41
|
-
## Common Code Smells
|
|
42
|
-
|
|
43
|
-
| Smell | Signs |
|
|
44
|
-
|-------|-------|
|
|
45
|
-
| **Long method** | Function > 30 lines, multiple levels of nesting |
|
|
46
|
-
| **Feature envy** | Method uses more data from another class than its own |
|
|
47
|
-
| **Data clumps** | Same group of parameters passed together repeatedly |
|
|
48
|
-
| **Primitive obsession** | Using strings/numbers instead of domain types |
|
|
49
|
-
| **Shotgun surgery** | One change requires edits across many files |
|
|
50
|
-
| **Divergent change** | One file changes for many unrelated reasons |
|
|
51
|
-
| **Dead code** | Unreachable or never-called code |
|
|
52
|
-
| **Speculative generality** | Abstractions for hypothetical future needs |
|
|
53
|
-
| **Magic numbers/strings** | Hardcoded values without named constants |
|
|
54
|
-
|
|
55
|
-
---
|
|
56
|
-
|
|
57
|
-
## Refactor Heuristics
|
|
58
|
-
|
|
59
|
-
1. **Split by responsibility, not by size** - A small file can still violate SRP
|
|
60
|
-
2. **Introduce abstraction only when needed** - Wait for the second use case
|
|
61
|
-
3. **Keep refactors incremental** - Isolate behavior before moving
|
|
62
|
-
4. **Preserve behavior first** - Add tests before restructuring
|
|
63
|
-
5. **Name things by intent** - If naming is hard, the abstraction might be wrong
|
|
64
|
-
6. **Prefer composition over inheritance** - Inheritance creates tight coupling
|
|
65
|
-
7. **Make illegal states unrepresentable** - Use types to enforce invariants
|
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
# Step 00: Problem Validation
|
|
2
|
-
|
|
3
|
-
## MANDATORY EXECUTION RULES
|
|
4
|
-
|
|
5
|
-
- NEVER skip this step — unvalidated problems lead to wasted research
|
|
6
|
-
- DO NOT generate solutions — this step validates the PROBLEM only
|
|
7
|
-
- ASK questions ONE AT A TIME via AskUserQuestion — do not batch
|
|
8
|
-
- PUSH on vague answers — "interesting" is not validation, "paying for it" is
|
|
9
|
-
- WRITE output to spec file BEFORE presenting to user
|
|
10
|
-
- ALL output in English (spec files); conversation in Chinese
|
|
11
|
-
|
|
12
|
-
## PREREQUISITES
|
|
13
|
-
|
|
14
|
-
- `.ultra/specs/discovery.md` exists (created by /ultra-init)
|
|
15
|
-
- User has provided initial product idea or description
|
|
16
|
-
|
|
17
|
-
## CONTEXT BOUNDARIES
|
|
18
|
-
|
|
19
|
-
- Focus: Is this problem real, painful, and worth solving?
|
|
20
|
-
- NOT about solutions, features, or architecture
|
|
21
|
-
- NOT about market size (that's step-02)
|
|
22
|
-
- You are a skeptical advisor, not a cheerleader
|
|
23
|
-
|
|
24
|
-
## EXECUTION SEQUENCE
|
|
25
|
-
|
|
26
|
-
### 1. Detect Product Stage
|
|
27
|
-
|
|
28
|
-
Ask via AskUserQuestion to determine which forcing questions apply:
|
|
29
|
-
|
|
30
|
-
| Stage | Indicators | Questions |
|
|
31
|
-
|-------|-----------|-----------|
|
|
32
|
-
| Pre-product (idea, no users) | No existing product | Q1, Q2, Q3 |
|
|
33
|
-
| Has users (not paying) | Product exists, free users | Q2, Q4, Q5 |
|
|
34
|
-
| Has paying customers | Revenue exists | Q4, Q5, Q6 |
|
|
35
|
-
| Pure engineering/infra | Internal tool, no market | Q2, Q4 only |
|
|
36
|
-
|
|
37
|
-
### 2. Ask Forcing Questions (ONE AT A TIME)
|
|
38
|
-
|
|
39
|
-
For each applicable question, ask via AskUserQuestion. Push until you hear the "evidence" column — not the "red flags" column.
|
|
40
|
-
|
|
41
|
-
#### Q1: Demand Reality
|
|
42
|
-
**Ask**: "What is the strongest evidence someone actually wants this — not 'is interested,' but would be genuinely upset if it disappeared?"
|
|
43
|
-
- **Push until you hear**: Specific behavior — paying, expanding usage, panicking when it breaks
|
|
44
|
-
- **Red flags**: "People say it's interesting", waitlist signups, VC enthusiasm
|
|
45
|
-
|
|
46
|
-
#### Q2: Status Quo
|
|
47
|
-
**Ask**: "What are users doing RIGHT NOW to solve this — even badly? What does that workaround cost them?"
|
|
48
|
-
- **Push until you hear**: Specific workflow — hours wasted, dollars lost, tools duct-taped together
|
|
49
|
-
- **Red flags**: "Nothing — no solution exists" (if nobody is doing anything, the problem may not be painful enough)
|
|
50
|
-
|
|
51
|
-
#### Q3: Desperate Specificity
|
|
52
|
-
**Ask**: "Name the actual human who needs this most. Title? What gets them promoted? What gets them fired?"
|
|
53
|
-
- **Push until you hear**: A name, a role, a specific consequence they face
|
|
54
|
-
- **Red flags**: Category-level answers: "enterprises", "SMBs", "marketing teams"
|
|
55
|
-
|
|
56
|
-
#### Q4: Narrowest Wedge
|
|
57
|
-
**Ask**: "What is the smallest version someone would pay real money for — this week, not after you build the platform?"
|
|
58
|
-
- **Push until you hear**: One feature, one workflow, shippable in days
|
|
59
|
-
- **Red flags**: "Need full platform first", "can't strip it down"
|
|
60
|
-
|
|
61
|
-
#### Q5: Observation & Surprise
|
|
62
|
-
**Ask**: "Have you watched someone use this without helping them? What surprised you?"
|
|
63
|
-
- **Push until you hear**: A specific surprise that contradicted assumptions
|
|
64
|
-
- **Red flags**: "We sent a survey", "nothing surprising"
|
|
65
|
-
|
|
66
|
-
#### Q6: Future-Fit
|
|
67
|
-
**Ask**: "If the world looks meaningfully different in 3 years, does your product become more essential or less?"
|
|
68
|
-
- **Push until you hear**: Specific claim about how user's world changes and why that increases value
|
|
69
|
-
- **Red flags**: "Market growing 20% per year", "AI makes everything better"
|
|
70
|
-
|
|
71
|
-
### 3. Smart-Skip Rules
|
|
72
|
-
|
|
73
|
-
- If an earlier answer already covers a later question, skip it
|
|
74
|
-
- If user says "just do it" or provides a fully formed plan → fast-track with note
|
|
75
|
-
- Maximum 4 questions per session — prioritize by stage
|
|
76
|
-
|
|
77
|
-
### 4. Synthesize & Write Output
|
|
78
|
-
|
|
79
|
-
**WRITE IMMEDIATELY** to `.ultra/specs/discovery.md` §0:
|
|
80
|
-
|
|
81
|
-
```markdown
|
|
82
|
-
## §0 Problem Validation Summary
|
|
83
|
-
|
|
84
|
-
### Product Stage
|
|
85
|
-
- **Stage**: [Pre-product / Has users / Has paying customers / Engineering/Infra]
|
|
86
|
-
- **Evidence**: [What indicates this stage]
|
|
87
|
-
|
|
88
|
-
### Demand Signal
|
|
89
|
-
- **Strength**: [Strong / Moderate / Weak / Unvalidated]
|
|
90
|
-
- **Evidence**: [Specific behaviors observed]
|
|
91
|
-
- **Risk**: [What could invalidate this demand]
|
|
92
|
-
|
|
93
|
-
### Status Quo Analysis
|
|
94
|
-
- **Current solutions**: [What users do today]
|
|
95
|
-
- **Cost of workaround**: [Time, money, friction]
|
|
96
|
-
- **Switching motivation**: [Why they'd change]
|
|
97
|
-
|
|
98
|
-
### Target User Profile
|
|
99
|
-
- **Primary**: [Specific role/person description]
|
|
100
|
-
- **Stakes**: [What gets them promoted / fired]
|
|
101
|
-
- **Pain frequency**: [Daily / Weekly / Occasional]
|
|
102
|
-
|
|
103
|
-
### Narrowest Wedge
|
|
104
|
-
- **MVP scope**: [Single feature/workflow]
|
|
105
|
-
- **Willingness to pay**: [Evidence level]
|
|
106
|
-
- **Ship timeline**: [Days / Weeks / Months]
|
|
107
|
-
|
|
108
|
-
### Validation Confidence
|
|
109
|
-
- **Overall**: [X]%
|
|
110
|
-
- **Strongest signal**: [What gives most confidence]
|
|
111
|
-
- **Biggest risk**: [What could be wrong]
|
|
112
|
-
- **Recommended next step**: [Proceed / Investigate further / Pivot]
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
### 5. Present to User and Gate
|
|
116
|
-
|
|
117
|
-
Show the Problem Validation Summary to user.
|
|
118
|
-
|
|
119
|
-
Present assessment honestly — if the problem feels weak, say so. Better to catch it now.
|
|
120
|
-
|
|
121
|
-
```
|
|
122
|
-
[C] Continue — Problem validated, proceed to Opportunity Discovery
|
|
123
|
-
[R] Revise — Discuss specific concerns before proceeding
|
|
124
|
-
[P] Pivot — Problem is weak, explore different angle
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
**HALT — wait for user response before proceeding.**
|
|
128
|
-
|
|
129
|
-
### 6. Handle Response
|
|
130
|
-
|
|
131
|
-
- **[C]**: Load next step: `./step-01-opportunity-discovery.md`
|
|
132
|
-
- **[R]**: Discuss concerns, revise §0, re-present
|
|
133
|
-
- **[P]**: Help user reframe the problem, restart step-00
|
|
134
|
-
|
|
135
|
-
## SUCCESS METRICS
|
|
136
|
-
|
|
137
|
-
- Product stage correctly identified
|
|
138
|
-
- At least 2 forcing questions asked and answered with evidence
|
|
139
|
-
- Problem Validation Summary written to discovery.md §0
|
|
140
|
-
- Confidence assessment is honest (not inflated)
|
|
141
|
-
- User has explicitly confirmed [C] before proceeding
|
|
142
|
-
|
|
143
|
-
## FAILURE MODES
|
|
144
|
-
|
|
145
|
-
- Asking all 6 questions regardless of stage (wastes user time)
|
|
146
|
-
- Accepting vague answers without pushing ("people are interested" → push harder)
|
|
147
|
-
- Skipping this step because user seems confident
|
|
148
|
-
- Inflating confidence to keep user happy
|
|
149
|
-
- Not writing output before presenting to user
|
|
150
|
-
- Proceeding without explicit [C] confirmation
|
|
151
|
-
|
|
152
|
-
## NEXT STEP
|
|
153
|
-
|
|
154
|
-
After user selects [C], read and follow: `./step-01-opportunity-discovery.md`
|
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
# Step 01: Opportunity Discovery
|
|
2
|
-
|
|
3
|
-
## MANDATORY EXECUTION RULES
|
|
4
|
-
|
|
5
|
-
- WEB SEARCH REQUIRED — verify opportunities against real market data
|
|
6
|
-
- Frame opportunities from CUSTOMER perspective, not product perspective
|
|
7
|
-
- Generate multiple solutions per opportunity — never commit to the first idea
|
|
8
|
-
- WRITE output to spec file BEFORE presenting to user
|
|
9
|
-
- ALL output in English (spec files); conversation in Chinese
|
|
10
|
-
|
|
11
|
-
## PREREQUISITES
|
|
12
|
-
|
|
13
|
-
- Step 00 (Problem Validation) completed with [C]
|
|
14
|
-
- `.ultra/specs/discovery.md` §0 exists
|
|
15
|
-
|
|
16
|
-
## CONTEXT BOUNDARIES
|
|
17
|
-
|
|
18
|
-
- Focus: Map the opportunity space using Opportunity Solution Tree (Teresa Torres)
|
|
19
|
-
- Opportunities are CUSTOMER NEEDS, not features
|
|
20
|
-
- Frame as: "I struggle to..." / "I wish I could..." / "It frustrates me that..."
|
|
21
|
-
- Based on *Continuous Discovery Habits* methodology
|
|
22
|
-
|
|
23
|
-
## SEARCH STRATEGY (MANDATORY)
|
|
24
|
-
|
|
25
|
-
Execute these web searches in parallel:
|
|
26
|
-
|
|
27
|
-
```
|
|
28
|
-
Search: "{{product_domain}} user pain points complaints"
|
|
29
|
-
Search: "{{product_domain}} customer needs unmet"
|
|
30
|
-
Search: "{{product_domain}} market gaps opportunities"
|
|
31
|
-
Search: "{{product_domain}} user research findings"
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
Citation requirement: Every factual claim MUST include `Source: [URL]`
|
|
35
|
-
No-source claims → mark as `⚠️ Speculation`
|
|
36
|
-
|
|
37
|
-
## EXECUTION SEQUENCE
|
|
38
|
-
|
|
39
|
-
### 1. Define Desired Outcome
|
|
40
|
-
|
|
41
|
-
Ask user via AskUserQuestion:
|
|
42
|
-
"What single measurable business/product outcome are we pursuing? (e.g., 'Reduce customer onboarding time by 50%', 'Reach $1M ARR in 12 months')"
|
|
43
|
-
|
|
44
|
-
If user is unsure, help them formulate one from step-00 findings.
|
|
45
|
-
|
|
46
|
-
### 2. Map Opportunity Space
|
|
47
|
-
|
|
48
|
-
Using web search results + step-00 insights, identify 5-8 customer opportunities.
|
|
49
|
-
|
|
50
|
-
**Frame each opportunity from customer perspective:**
|
|
51
|
-
- BAD: "Add AI-powered search" (this is a solution)
|
|
52
|
-
- GOOD: "I struggle to find relevant results in large document collections" (this is an opportunity)
|
|
53
|
-
|
|
54
|
-
### 3. Prioritize Opportunities
|
|
55
|
-
|
|
56
|
-
Score each opportunity using Dan Olsen's Opportunity Score:
|
|
57
|
-
|
|
58
|
-
```
|
|
59
|
-
Opportunity Score = Importance × (1 - Satisfaction)
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
Where:
|
|
63
|
-
- **Importance** (1-10): How much does this matter to the target user?
|
|
64
|
-
- **Satisfaction** (0-1): How well do current solutions address this? (0 = not at all, 1 = perfectly)
|
|
65
|
-
|
|
66
|
-
Rank by score. Focus on top 2-3 opportunities.
|
|
67
|
-
|
|
68
|
-
### 4. Solution Brainstorm
|
|
69
|
-
|
|
70
|
-
For each top opportunity (top 2-3), generate 3+ solution approaches from different perspectives:
|
|
71
|
-
|
|
72
|
-
| Perspective | Approach |
|
|
73
|
-
|------------|---------|
|
|
74
|
-
| PM perspective | User workflow optimization |
|
|
75
|
-
| Designer perspective | Experience/interaction innovation |
|
|
76
|
-
| Engineer perspective | Technical capability leverage |
|
|
77
|
-
|
|
78
|
-
**Rule**: Never commit to the first idea. The best solution often emerges from comparing alternatives.
|
|
79
|
-
|
|
80
|
-
### 5. Write Output
|
|
81
|
-
|
|
82
|
-
**WRITE IMMEDIATELY** to `.ultra/specs/discovery.md` §1:
|
|
83
|
-
|
|
84
|
-
```markdown
|
|
85
|
-
## §1 Opportunity Space
|
|
86
|
-
|
|
87
|
-
### Desired Outcome
|
|
88
|
-
- **Outcome**: [Single measurable outcome]
|
|
89
|
-
- **Metric**: [How we measure it]
|
|
90
|
-
- **Timeline**: [When we expect to see movement]
|
|
91
|
-
|
|
92
|
-
### Opportunity Map
|
|
93
|
-
|
|
94
|
-
| # | Opportunity (Customer Framing) | Importance | Satisfaction | Score | Source |
|
|
95
|
-
|---|-------------------------------|-----------|-------------|-------|--------|
|
|
96
|
-
| O1 | "I struggle to..." | 9 | 0.2 | 7.2 | [URL] |
|
|
97
|
-
| O2 | "I wish I could..." | 8 | 0.3 | 5.6 | [URL] |
|
|
98
|
-
| O3 | "It frustrates me that..." | 7 | 0.4 | 4.2 | [URL] |
|
|
99
|
-
| O4 | ... | ... | ... | ... | ... |
|
|
100
|
-
| O5 | ... | ... | ... | ... | ... |
|
|
101
|
-
|
|
102
|
-
### Prioritized Opportunities (Top 3)
|
|
103
|
-
|
|
104
|
-
#### Opportunity 1: [Customer-framed description]
|
|
105
|
-
- **Importance**: [X]/10 — [Why this matters]
|
|
106
|
-
- **Current satisfaction**: [X] — [How users cope today]
|
|
107
|
-
- **Score**: [X]
|
|
108
|
-
- **Evidence**: [Source URL]
|
|
109
|
-
|
|
110
|
-
**Solution Approaches:**
|
|
111
|
-
1. **PM approach**: [Description] — Pros: [...] Cons: [...]
|
|
112
|
-
2. **Design approach**: [Description] — Pros: [...] Cons: [...]
|
|
113
|
-
3. **Engineering approach**: [Description] — Pros: [...] Cons: [...]
|
|
114
|
-
|
|
115
|
-
#### Opportunity 2: [Customer-framed description]
|
|
116
|
-
[Same structure]
|
|
117
|
-
|
|
118
|
-
#### Opportunity 3: [Customer-framed description]
|
|
119
|
-
[Same structure]
|
|
120
|
-
|
|
121
|
-
### Opportunities Deprioritized
|
|
122
|
-
| # | Opportunity | Score | Reason for Deprioritization |
|
|
123
|
-
|---|------------|-------|-----------------------------|
|
|
124
|
-
| O4 | ... | ... | [Why not now] |
|
|
125
|
-
| O5 | ... | ... | [Why not now] |
|
|
126
|
-
|
|
127
|
-
### Key Insight
|
|
128
|
-
[One paragraph: What is the non-obvious insight from this opportunity analysis?]
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
### 6. Present to User and Gate
|
|
132
|
-
|
|
133
|
-
Show the Opportunity Space summary. Highlight:
|
|
134
|
-
- The top 3 opportunities and why they ranked highest
|
|
135
|
-
- Any surprising findings from web research
|
|
136
|
-
- Which solution approaches seem most promising
|
|
137
|
-
|
|
138
|
-
```
|
|
139
|
-
[C] Continue — Opportunity space mapped, proceed to Market Assessment
|
|
140
|
-
[R] Revise — Adjust opportunity scoring or add missing opportunities
|
|
141
|
-
[D] Discuss — Explore specific opportunities in more depth
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
**HALT — wait for user response before proceeding.**
|
|
145
|
-
|
|
146
|
-
### 7. Handle Response
|
|
147
|
-
|
|
148
|
-
- **[C]**: Load next step: `./step-02-market-assessment.md`
|
|
149
|
-
- **[R]**: Revise scoring/opportunities, update discovery.md §1, re-present
|
|
150
|
-
- **[D]**: Deep-dive into specific opportunity, then re-present gate
|
|
151
|
-
|
|
152
|
-
## SUCCESS METRICS
|
|
153
|
-
|
|
154
|
-
- Desired outcome is specific and measurable
|
|
155
|
-
- At least 5 opportunities identified, framed from customer perspective
|
|
156
|
-
- Opportunity scores calculated with importance and satisfaction ratings
|
|
157
|
-
- Top 3 opportunities each have 3+ solution approaches
|
|
158
|
-
- All factual claims have source citations
|
|
159
|
-
- Output written to discovery.md §1
|
|
160
|
-
|
|
161
|
-
## FAILURE MODES
|
|
162
|
-
|
|
163
|
-
- Framing opportunities as features/solutions instead of customer needs
|
|
164
|
-
- Scoring without web research evidence
|
|
165
|
-
- Only generating 1 solution per opportunity
|
|
166
|
-
- Accepting user's first solution idea without exploring alternatives
|
|
167
|
-
- Missing citation sources for market claims
|
|
168
|
-
- Not writing output before presenting to user
|
|
169
|
-
|
|
170
|
-
## NEXT STEP
|
|
171
|
-
|
|
172
|
-
After user selects [C], read and follow: `./step-02-market-assessment.md`
|