ultra-builder-pro-cli 0.5.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.
Files changed (206) hide show
  1. package/.ultra-template/delivery-report.json +9 -0
  2. package/.ultra-template/docs/research/README.md +53 -0
  3. package/.ultra-template/specs/architecture.md +250 -0
  4. package/.ultra-template/specs/discovery.md +248 -0
  5. package/.ultra-template/specs/product.md +223 -0
  6. package/.ultra-template/tasks/contexts/TEMPLATE.md +57 -0
  7. package/.ultra-template/tasks/tasks.json +33 -0
  8. package/.ultra-template/test-report.json +8 -0
  9. package/CHANGELOG.md +194 -0
  10. package/LICENSE +21 -0
  11. package/README.md +187 -0
  12. package/adapters/_shared/codex-assets.cjs +1128 -0
  13. package/adapters/_shared/codex-ultra-tools-entry.cjs +11 -0
  14. package/adapters/_shared/file-ops.cjs +115 -0
  15. package/adapters/_shared/frontmatter.cjs +52 -0
  16. package/adapters/_shared/handbook.cjs +144 -0
  17. package/adapters/_shared/md-to-toml.cjs +54 -0
  18. package/adapters/_shared/path-rewrite.cjs +79 -0
  19. package/adapters/_shared/rtk-detect.cjs +86 -0
  20. package/adapters/_shared/runtime-assets.cjs +70 -0
  21. package/adapters/_shared/settings-merge.cjs +76 -0
  22. package/adapters/_shared/tests/file-ops.test.cjs +54 -0
  23. package/adapters/_shared/tests/frontmatter.test.cjs +47 -0
  24. package/adapters/_shared/tests/handbook.test.cjs +86 -0
  25. package/adapters/_shared/tests/md-to-toml.test.cjs +48 -0
  26. package/adapters/_shared/tests/path-rewrite.test.cjs +60 -0
  27. package/adapters/_shared/tests/resolve-target.test.cjs +85 -0
  28. package/adapters/_shared/tests/rtk-detect.test.cjs +116 -0
  29. package/adapters/_shared/tests/runtime-assets.test.cjs +107 -0
  30. package/adapters/_shared/tests/settings-merge.test.cjs +85 -0
  31. package/adapters/_shared/tests/validate.test.cjs +30 -0
  32. package/adapters/_shared/validate.cjs +24 -0
  33. package/adapters/claude.js +182 -0
  34. package/adapters/codex.js +385 -0
  35. package/adapters/gemini.js +204 -0
  36. package/adapters/opencode.js +506 -0
  37. package/adapters/tests/claude.test.cjs +117 -0
  38. package/adapters/tests/codex-hook.test.cjs +90 -0
  39. package/adapters/tests/codex.test.cjs +356 -0
  40. package/adapters/tests/gemini.test.cjs +112 -0
  41. package/adapters/tests/opencode.test.cjs +246 -0
  42. package/agents/code-reviewer.md +102 -0
  43. package/agents/debugger.md +127 -0
  44. package/agents/review-code.md +125 -0
  45. package/agents/review-comments.md +98 -0
  46. package/agents/review-coordinator.md +146 -0
  47. package/agents/review-design.md +133 -0
  48. package/agents/review-errors.md +87 -0
  49. package/agents/review-tests.md +93 -0
  50. package/agents/tdd-runner.md +92 -0
  51. package/bin/handbook.js +54 -0
  52. package/bin/install.js +254 -0
  53. package/bin/orchestrator.js +214 -0
  54. package/commands/learn.md +41 -0
  55. package/commands/ultra-deliver.md +45 -0
  56. package/commands/ultra-dev.md +50 -0
  57. package/commands/ultra-init.md +51 -0
  58. package/commands/ultra-plan.md +49 -0
  59. package/commands/ultra-research.md +59 -0
  60. package/commands/ultra-status.md +46 -0
  61. package/commands/ultra-test.md +48 -0
  62. package/commands/ultra-think.md +45 -0
  63. package/docs/AGENT-CONTEXT.md +143 -0
  64. package/docs/ARCHITECTURE.md +197 -0
  65. package/docs/COMMIT-HASH-BACKFILL.md +101 -0
  66. package/docs/LEGACY-HERMES.md +1175 -0
  67. package/docs/PLAN.zh-CN.md +1683 -0
  68. package/docs/ROADMAP.md +102 -0
  69. package/docs/RUNTIME-COMPAT-MATRIX.md +98 -0
  70. package/docs/STATE-DB-ACCESS-POLICY.md +109 -0
  71. package/docs/USER-HANDBOOK-CONTRACT.md +61 -0
  72. package/hooks/README.md +24 -0
  73. package/hooks/active_task_context.py +44 -0
  74. package/hooks/adapters/codex.py +302 -0
  75. package/hooks/health_check.py +61 -0
  76. package/hooks/pre_stop_check.py +56 -0
  77. package/hooks/subagent_tracker.py +116 -0
  78. package/hooks/workflow_checkpoint.py +56 -0
  79. package/hooks/workflow_context.py +63 -0
  80. package/hooks/workflow_resume.py +50 -0
  81. package/mcp-server/lib/init-project.cjs +162 -0
  82. package/mcp-server/lib/llm-client.cjs +157 -0
  83. package/mcp-server/lib/llm-client.test.cjs +156 -0
  84. package/mcp-server/lib/plan-store.cjs +96 -0
  85. package/mcp-server/lib/plan-store.test.cjs +132 -0
  86. package/mcp-server/lib/prd-parser.cjs +110 -0
  87. package/mcp-server/lib/prd-parser.test.cjs +171 -0
  88. package/mcp-server/lib/pricing.cjs +53 -0
  89. package/mcp-server/lib/projector.cjs +158 -0
  90. package/mcp-server/lib/state-db.cjs +113 -0
  91. package/mcp-server/lib/state-db.test.cjs +116 -0
  92. package/mcp-server/lib/state-ops.cjs +725 -0
  93. package/mcp-server/lib/task-expander.cjs +123 -0
  94. package/mcp-server/lib/task-expander.test.cjs +253 -0
  95. package/mcp-server/lib/telemetry.cjs +72 -0
  96. package/mcp-server/lib/topo.cjs +131 -0
  97. package/mcp-server/lib/topo.test.cjs +158 -0
  98. package/mcp-server/server.cjs +482 -0
  99. package/mcp-server/tests/circuit-breaker.test.cjs +125 -0
  100. package/mcp-server/tests/commit-hash-flow.test.cjs +117 -0
  101. package/mcp-server/tests/concurrency-update.test.cjs +96 -0
  102. package/mcp-server/tests/concurrency.test.cjs +112 -0
  103. package/mcp-server/tests/db-ops.test.cjs +117 -0
  104. package/mcp-server/tests/init-project.test.cjs +141 -0
  105. package/mcp-server/tests/migrate.test.cjs +144 -0
  106. package/mcp-server/tests/projector.test.cjs +130 -0
  107. package/mcp-server/tests/server-contract.test.cjs +750 -0
  108. package/mcp-server/tests/staleness.test.cjs +190 -0
  109. package/mcp-server/tests/state-ops.test.cjs +286 -0
  110. package/mcp-server/tests/tagged-tasks.test.cjs +163 -0
  111. package/mcp-server/tests/telemetry.test.cjs +205 -0
  112. package/orchestrator/auto-merge.cjs +109 -0
  113. package/orchestrator/code-graph-watcher.cjs +121 -0
  114. package/orchestrator/daemon.cjs +112 -0
  115. package/orchestrator/dispatch-rules.cjs +93 -0
  116. package/orchestrator/parallel-orchestrator.cjs +195 -0
  117. package/orchestrator/planner/expand-prompt.cjs +62 -0
  118. package/orchestrator/planner/expand-prompt.test.cjs +52 -0
  119. package/orchestrator/planner/plan-builder.cjs +116 -0
  120. package/orchestrator/planner/plan-builder.test.cjs +165 -0
  121. package/orchestrator/planner/prd-prompt.cjs +44 -0
  122. package/orchestrator/planner/prd-prompt.test.cjs +30 -0
  123. package/orchestrator/recovery.cjs +70 -0
  124. package/orchestrator/session-runner.cjs +224 -0
  125. package/orchestrator/skill-miner.cjs +133 -0
  126. package/orchestrator/tests/auto-merge.test.cjs +216 -0
  127. package/orchestrator/tests/code-graph-watcher.test.cjs +183 -0
  128. package/orchestrator/tests/daemon.test.cjs +260 -0
  129. package/orchestrator/tests/dispatch-rules.test.cjs +122 -0
  130. package/orchestrator/tests/parallel-orchestrator.test.cjs +233 -0
  131. package/orchestrator/tests/phase-8b-gate.test.cjs +183 -0
  132. package/orchestrator/tests/recovery.test.cjs +190 -0
  133. package/orchestrator/tests/session-runner.test.cjs +314 -0
  134. package/orchestrator/tests/skill-miner.test.cjs +147 -0
  135. package/orchestrator/tests/worktree-manager.test.cjs +148 -0
  136. package/orchestrator/worktree-manager.cjs +131 -0
  137. package/output-styles/coding-vibes.md +67 -0
  138. package/output-styles/structural-thinking.md +61 -0
  139. package/package.json +109 -0
  140. package/settings.json +8 -0
  141. package/skills/cc-collab/SKILL.md +41 -0
  142. package/skills/code-review-expert/SKILL.md +118 -0
  143. package/skills/code-review-expert/references/code-quality-checklist.md +112 -0
  144. package/skills/code-review-expert/references/integration-checklist.md +46 -0
  145. package/skills/code-review-expert/references/removal-plan.md +52 -0
  146. package/skills/code-review-expert/references/security-checklist.md +100 -0
  147. package/skills/code-review-expert/references/solid-checklist.md +65 -0
  148. package/skills/codex-collab/SKILL.md +52 -0
  149. package/skills/codex-collab/evals/evals.json +40 -0
  150. package/skills/gemini-collab/SKILL.md +51 -0
  151. package/skills/gemini-collab/evals/evals.json +42 -0
  152. package/skills/integration-rules/SKILL.md +71 -0
  153. package/skills/learn/SKILL.md +117 -0
  154. package/skills/security-rules/SKILL.md +60 -0
  155. package/skills/testing-rules/SKILL.md +56 -0
  156. package/skills/ultra-deliver/SKILL.md +171 -0
  157. package/skills/ultra-dev/SKILL.md +324 -0
  158. package/skills/ultra-init/SKILL.md +148 -0
  159. package/skills/ultra-plan/SKILL.md +314 -0
  160. package/skills/ultra-research/SKILL.md +156 -0
  161. package/skills/ultra-research/steps/step-00-problem-validation.md +154 -0
  162. package/skills/ultra-research/steps/step-01-opportunity-discovery.md +172 -0
  163. package/skills/ultra-research/steps/step-02-market-assessment.md +195 -0
  164. package/skills/ultra-research/steps/step-03-competitive-landscape.md +197 -0
  165. package/skills/ultra-research/steps/step-04-product-strategy.md +196 -0
  166. package/skills/ultra-research/steps/step-05-assumptions-validation.md +234 -0
  167. package/skills/ultra-research/steps/step-10-user-personas.md +169 -0
  168. package/skills/ultra-research/steps/step-11-user-scenarios.md +181 -0
  169. package/skills/ultra-research/steps/step-20-user-stories.md +156 -0
  170. package/skills/ultra-research/steps/step-21-features-scope.md +157 -0
  171. package/skills/ultra-research/steps/step-22-success-metrics.md +195 -0
  172. package/skills/ultra-research/steps/step-30-architecture-context.md +154 -0
  173. package/skills/ultra-research/steps/step-31-solution-strategy.md +172 -0
  174. package/skills/ultra-research/steps/step-32-building-blocks.md +188 -0
  175. package/skills/ultra-research/steps/step-40-deployment.md +123 -0
  176. package/skills/ultra-research/steps/step-41-quality-risks.md +135 -0
  177. package/skills/ultra-research/steps/step-99-synthesis.md +188 -0
  178. package/skills/ultra-review/SKILL.md +437 -0
  179. package/skills/ultra-review/references/unified-schema.md +127 -0
  180. package/skills/ultra-review/scripts/review_verdict_update.py +99 -0
  181. package/skills/ultra-review/scripts/review_wait.py +120 -0
  182. package/skills/ultra-status/SKILL.md +162 -0
  183. package/skills/ultra-test/SKILL.md +195 -0
  184. package/skills/ultra-think/SKILL.md +109 -0
  185. package/skills/ultra-verify/SKILL.md +111 -0
  186. package/skills/ultra-verify/evals/evals.json +51 -0
  187. package/skills/ultra-verify/references/confidence-system.md +38 -0
  188. package/skills/ultra-verify/references/cross-verify-modes.md +73 -0
  189. package/skills/ultra-verify/scripts/verify_wait.py +131 -0
  190. package/spec/cli-protocol.md +118 -0
  191. package/spec/mcp-tools.yaml +658 -0
  192. package/spec/schemas/command-manifest.schema.json +47 -0
  193. package/spec/schemas/context-file.v4.5.schema.json +54 -0
  194. package/spec/schemas/mcp-tools.schema.json +136 -0
  195. package/spec/schemas/skill-manifest.schema.json +94 -0
  196. package/spec/schemas/state-db.sql +154 -0
  197. package/spec/schemas/tasks.v4.5.schema.json +66 -0
  198. package/ultra-tools/cli.cjs +121 -0
  199. package/ultra-tools/commands/db.cjs +175 -0
  200. package/ultra-tools/commands/legacy-memory.cjs +159 -0
  201. package/ultra-tools/commands/migrate.cjs +354 -0
  202. package/ultra-tools/commands/session.cjs +180 -0
  203. package/ultra-tools/commands/status.cjs +158 -0
  204. package/ultra-tools/commands/task.cjs +95 -0
  205. package/ultra-tools/legacy-memory.test.cjs +80 -0
  206. package/ultra-tools/status-command.test.cjs +132 -0
@@ -0,0 +1,46 @@
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?"
@@ -0,0 +1,52 @@
1
+ # Removal and Iteration Plan Template
2
+
3
+ ## Priority Levels
4
+
5
+ - **P0**: Immediate removal needed (security risk, significant cost, blocking other work)
6
+ - **P1**: Remove in current sprint
7
+ - **P2**: Backlog / next iteration
8
+
9
+ ---
10
+
11
+ ## Safe to Remove Now
12
+
13
+ ### Item: [Name/Description]
14
+
15
+ | Field | Details |
16
+ |-------|---------|
17
+ | **Location** | `path/to/file.ts:line` |
18
+ | **Rationale** | Why this should be removed |
19
+ | **Evidence** | Unused (no references), dead feature flag, deprecated API |
20
+ | **Impact** | None / Low - no active consumers |
21
+ | **Deletion steps** | 1. Remove code 2. Remove tests 3. Remove config |
22
+ | **Verification** | Run tests, check no runtime errors, monitor logs |
23
+
24
+ ---
25
+
26
+ ## Defer Removal (Plan Required)
27
+
28
+ ### Item: [Name/Description]
29
+
30
+ | Field | Details |
31
+ |-------|---------|
32
+ | **Location** | `path/to/file.ts:line` |
33
+ | **Why defer** | Active consumers, needs migration, stakeholder sign-off |
34
+ | **Preconditions** | Feature flag off for 2 weeks, telemetry shows 0 usage |
35
+ | **Breaking changes** | List any API/contract changes |
36
+ | **Migration plan** | Steps for consumers to migrate |
37
+ | **Timeline** | Target date or sprint |
38
+ | **Owner** | Person/team responsible |
39
+ | **Validation** | Metrics to confirm safe removal (error rates, usage counts) |
40
+ | **Rollback plan** | How to restore if issues found |
41
+
42
+ ---
43
+
44
+ ## Checklist Before Removal
45
+
46
+ - [ ] Searched codebase for all references (Grep)
47
+ - [ ] Checked for dynamic/reflection-based usage
48
+ - [ ] Verified no external consumers (APIs, SDKs, docs)
49
+ - [ ] Feature flag telemetry reviewed (if applicable)
50
+ - [ ] Tests updated/removed
51
+ - [ ] Documentation updated
52
+ - [ ] Team notified (if shared code)
@@ -0,0 +1,100 @@
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
@@ -0,0 +1,65 @@
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
@@ -0,0 +1,52 @@
1
+ ---
2
+ name: codex-collab
3
+ description: Ask Codex CLI for an explicitly requested, read-only second opinion on a bounded review, diagnosis, architecture, or comparison question.
4
+ ---
5
+
6
+ # Codex Collaboration
7
+
8
+ Claude Code remains primary and owns scope, evidence, edits, verification, and the final answer.
9
+ Codex is an untrusted read-only advisor. Use this skill only when the user explicitly requests a
10
+ Codex perspective; do not invoke it as a routine substitute for native review or subagents.
11
+
12
+ ## Preconditions
13
+
14
+ 1. Confirm `codex --version` and authentication.
15
+ 2. Fix the workspace, files or diff range, question, evidence standard, and expected response shape.
16
+ 3. Write the primary analysis first when independence matters.
17
+ 4. Never send secrets, unrelated files, or an unbounded home directory.
18
+
19
+ ## Modes
20
+
21
+ - `review`: findings against an exact diff or file set.
22
+ - `understand`: a bounded architecture or flow question.
23
+ - `opinion`: one decision with named constraints and alternatives.
24
+ - `compare`: independent answers to the same question.
25
+ - `free`: another tightly scoped read-only prompt.
26
+
27
+ ## Safe invocation
28
+
29
+ Create a session directory under `.ultra/collab/`, then run Codex without workspace-write or
30
+ danger-full-access:
31
+
32
+ ```bash
33
+ SESSION_PATH=".ultra/collab/$(date +%Y%m%d-%H%M%S)-codex-<mode>"
34
+ mkdir -p "${SESSION_PATH}"
35
+ codex exec -s read-only \
36
+ -o "${SESSION_PATH}/codex-output.md" \
37
+ "<bounded prompt>" \
38
+ 2> "${SESSION_PATH}/codex-error.log"
39
+ ```
40
+
41
+ Do not enable write-capable automation or permission bypass. This skill has no dependency on
42
+ another Codex plugin or slash command.
43
+
44
+ ## Synthesis
45
+
46
+ 1. Read the output only after the process exits and the file is non-empty.
47
+ 2. Verify consequential claims against the current checkout, tests, runtime, or primary docs.
48
+ 3. Separate agreement, useful dissent, and unsupported assertions.
49
+ 4. Return one Claude Code-owned conclusion; do not paste an unreviewed advisor transcript.
50
+
51
+ If Codex is missing, unauthenticated, times out, or returns empty output, report the degraded path
52
+ and continue with primary evidence. Never block the user's task solely on advisor failure.
@@ -0,0 +1,40 @@
1
+ {
2
+ "skill_name": "codex-collab",
3
+ "evals": [
4
+ {
5
+ "id": 1,
6
+ "prompt": "/codex-collab review",
7
+ "expected_output": "Claude delegates to /codex:review (official plugin), then adds its own perspective and presents a dual-AI synthesis report",
8
+ "assertions": [
9
+ "Delegates to /codex:review instead of invoking codex CLI directly",
10
+ "Does NOT run 'codex review --uncommitted' directly",
11
+ "After receiving Codex output, Claude adds its own review perspective",
12
+ "Presents a synthesis with Consensus and Divergent Views sections"
13
+ ]
14
+ },
15
+ {
16
+ "id": 2,
17
+ "prompt": "/codex-collab opinion 'Should we use a monorepo or polyrepo?'",
18
+ "expected_output": "Claude sends the question to Codex via exec mode with sandbox, reads output, and presents both opinions",
19
+ "assertions": [
20
+ "Uses 'codex exec' (not codex review) for opinion mode",
21
+ "Uses --sandbox read-only for analysis-only task",
22
+ "Uses -o (--output-last-message) to capture clean output",
23
+ "Does NOT reveal Claude's position in the prompt",
24
+ "Creates session directory under .ultra/collab/",
25
+ "Presents both opinions with trade-off analysis"
26
+ ]
27
+ },
28
+ {
29
+ "id": 3,
30
+ "prompt": "/codex-collab review --base main with a focus on security",
31
+ "expected_output": "Claude delegates to /codex:adversarial-review for security-focused review, then synthesizes",
32
+ "assertions": [
33
+ "Delegates to /codex:review or /codex:adversarial-review (official plugin)",
34
+ "Does NOT invoke codex CLI directly for review tasks",
35
+ "After receiving output, presents dual-AI synthesis",
36
+ "Reads output with Read tool, not Bash stdout"
37
+ ]
38
+ }
39
+ ]
40
+ }
@@ -0,0 +1,51 @@
1
+ ---
2
+ name: gemini-collab
3
+ description: Ask Gemini CLI for an explicitly requested, read-only second opinion on a bounded review, diagnosis, architecture, or comparison question.
4
+ ---
5
+
6
+ # Gemini Collaboration
7
+
8
+ Claude Code remains primary and owns scope, evidence, edits, verification, and the final answer.
9
+ Gemini is an untrusted read-only advisor. Use this skill only when the user explicitly requests a
10
+ Gemini perspective.
11
+
12
+ ## Preconditions
13
+
14
+ 1. Confirm `gemini --version` and authentication.
15
+ 2. Fix the workspace, files or diff range, question, evidence standard, and expected response shape.
16
+ 3. Write the primary analysis first when independence matters.
17
+ 4. Never send secrets, unrelated files, or an unbounded home directory.
18
+
19
+ ## Modes
20
+
21
+ - `review`: findings against an exact diff or file set.
22
+ - `understand`: a bounded architecture or flow question.
23
+ - `opinion`: one decision with named constraints and alternatives.
24
+ - `compare`: independent answers to the same question.
25
+ - `free`: another tightly scoped read-only prompt.
26
+
27
+ ## Safe invocation
28
+
29
+ Create a session directory under `.ultra/collab/`, then use Gemini's plan approval mode:
30
+
31
+ ```bash
32
+ SESSION_PATH=".ultra/collab/$(date +%Y%m%d-%H%M%S)-gemini-<mode>"
33
+ mkdir -p "${SESSION_PATH}"
34
+ gemini --approval-mode plan \
35
+ --output-format text \
36
+ -p "<bounded prompt>" \
37
+ > "${SESSION_PATH}/gemini-output.md" \
38
+ 2> "${SESSION_PATH}/gemini-error.log"
39
+ ```
40
+
41
+ Do not use auto-edit, YOLO, or permission bypass.
42
+
43
+ ## Synthesis
44
+
45
+ 1. Read the output only after the process exits and the file is non-empty.
46
+ 2. Verify consequential claims against the current checkout, tests, runtime, or primary docs.
47
+ 3. Separate agreement, useful dissent, and unsupported assertions.
48
+ 4. Return one Claude Code-owned conclusion; do not paste an unreviewed advisor transcript.
49
+
50
+ If Gemini is missing, unauthenticated, times out, or returns empty output, report the degraded path
51
+ and continue with primary evidence. Never block the user's task solely on advisor failure.
@@ -0,0 +1,42 @@
1
+ {
2
+ "skill_name": "gemini-collab",
3
+ "evals": [
4
+ {
5
+ "id": 1,
6
+ "prompt": "/gemini-collab review",
7
+ "expected_output": "Claude creates a session directory, invokes gemini CLI to review current changes, reads the output file, and presents a synthesis report",
8
+ "assertions": [
9
+ "Creates a session directory under .ultra/collab/ with gemini-review in the name",
10
+ "Uses 'gemini -p' with --yolo flag to invoke Gemini CLI",
11
+ "Does NOT use '-o text' flag (Gemini outputs to stdout by default)",
12
+ "Redirects output to a file (> output.md)",
13
+ "Uses Read tool to read the output file",
14
+ "Presents a synthesis with Consensus and Divergent Views sections"
15
+ ]
16
+ },
17
+ {
18
+ "id": 2,
19
+ "prompt": "/gemini-collab compare 'Should we use Redis or Memcached for our caching layer?'",
20
+ "expected_output": "Claude answers independently first, then sends the same question to Gemini, reads output, and presents a comparative synthesis",
21
+ "assertions": [
22
+ "Claude writes its own answer BEFORE invoking Gemini",
23
+ "Sends the question to Gemini without revealing Claude's position",
24
+ "Creates session directory under .ultra/collab/",
25
+ "Reads Gemini output with Read tool",
26
+ "Presents both analyses side by side with synthesis"
27
+ ]
28
+ },
29
+ {
30
+ "id": 3,
31
+ "prompt": "/gemini-collab understand",
32
+ "expected_output": "Claude invokes Gemini in sandbox mode to analyze the project, reads output, and synthesizes with its own understanding",
33
+ "assertions": [
34
+ "Uses --sandbox flag for read-only analysis",
35
+ "Uses gemini -p with a project analysis prompt",
36
+ "Installs from @google/gemini-cli (not @anthropic-ai/gemini-cli)",
37
+ "Redirects to file, reads with Read tool",
38
+ "Produces a unified project understanding report"
39
+ ]
40
+ }
41
+ ]
42
+ }
@@ -0,0 +1,71 @@
1
+ ---
2
+ name: integration-rules
3
+ description: Ultra Builder Pro system integration rules
4
+ user-invocable: false
5
+ ---
6
+
7
+ # Integration Rules
8
+
9
+ These rules are mandatory for all code review and development work involving multi-component systems.
10
+
11
+ ## Vertical Slice Principle
12
+
13
+ Every task MUST deliver a thin, working end-to-end path:
14
+
15
+ | Good (Vertical Slice) | Bad (Horizontal Layer) |
16
+ |------------------------|------------------------|
17
+ | "User can send message" (UI + API + LLM + response display) | "Create all database tables" |
18
+ | "Display product list" (API call + domain filter + UI render) | "Build all API endpoints" |
19
+ | "Process payment" (UI form + gateway + order update) | "Create all UI components" |
20
+
21
+ ## Walking Skeleton
22
+
23
+ The FIRST deliverable of any multi-component feature must be a walking skeleton:
24
+ - One request flows through ALL layers
25
+ - Returns real data (not hardcoded/mocked)
26
+ - Proves the architecture connects end-to-end
27
+ - Does NOT need to be feature-complete — just connected
28
+
29
+ ## Contract-First Development
30
+
31
+ When two components will communicate:
32
+
33
+ | Step | Action | Artifact |
34
+ |------|--------|----------|
35
+ | 1 | Define interface before implementation | TypeScript interface, OpenAPI schema, or protobuf |
36
+ | 2 | Both sides code against the contract | Import shared types or generated clients |
37
+ | 3 | Contract test validates both sides | Test that producer output matches consumer expectation |
38
+
39
+ ## Integration Test Requirements
40
+
41
+ | Boundary | Required Test |
42
+ |----------|---------------|
43
+ | HTTP API endpoint | Request with real HTTP client, validate response shape + status |
44
+ | Database operation | Testcontainers with real queries, validate data persisted |
45
+ | Message queue | Real producer + consumer, validate message delivered |
46
+ | External service | Test Double with `// Test Double rationale:` (only exception) |
47
+ | In-process module boundary | Real function call, validate input/output contract |
48
+
49
+ ## Orphan Detection
50
+
51
+ Code without a live entry point is dead-on-arrival.
52
+
53
+ **Valid entry points** (at least one required per new module):
54
+ - HTTP/WebSocket handler
55
+ - CLI command handler
56
+ - Event/message listener
57
+ - Scheduled job/cron handler
58
+ - Exported function called by a module that has an entry point
59
+
60
+ **Detection**: Trace from new code upward — if no path reaches an entry point, the code is an orphan.
61
+
62
+ ## Detection Checklist
63
+
64
+ When reviewing code, flag:
65
+ 1. New module/service without any caller (orphan code)
66
+ 2. Task structured as horizontal layer instead of vertical slice
67
+ 3. Two components communicating without shared interface/contract
68
+ 4. New boundary crossing without integration test
69
+ 5. Use case with DB/API dependency but only unit tests
70
+ 6. Component "works in isolation" but not wired to any entry point
71
+ 7. Interface defined but no contract test validating compatibility
@@ -0,0 +1,117 @@
1
+ ---
2
+ name: learn
3
+ description: "Extract one reusable pattern from the current session into a valid user skill, with explicit user approval before writing."
4
+ ---
5
+
6
+ # learn — Phase 3.6
7
+
8
+ Mine the current session for a reusable pattern and save it as a Speculation-
9
+ grade skill under `~/.claude/skills/learned-<name>-unverified/SKILL.md`. User
10
+ confirmation is mandatory before the write — never silently persist.
11
+
12
+ ## Trigger conditions
13
+
14
+ Run `/learn` after solving a non-trivial problem where the approach is
15
+ generalizable (not a one-off typo or outage-specific fix).
16
+
17
+ ## What to extract
18
+
19
+ | Kind | Example |
20
+ |------|---------|
21
+ | **Error resolution** | Root cause + fix that applies to similar errors |
22
+ | **Debugging technique** | Non-obvious steps, effective tool combos |
23
+ | **Workaround** | Library quirk / API limitation / version-specific fix |
24
+ | **Project-specific pattern** | Codebase convention / integration pattern discovered this session |
25
+
26
+ ## Workflow
27
+
28
+ ### Step 1 — Review session
29
+
30
+ Scan recent messages / tool outputs for extractable patterns. Prefer
31
+ patterns that saved meaningful time or would have, had they been known upfront.
32
+
33
+ ### Step 2 — Identify the highest-value candidate
34
+
35
+ Multiple candidates? Pick one. Keep skills focused — **one pattern per file**.
36
+
37
+ ### Step 3 — Draft skill body
38
+
39
+ Use the **learned-skill template** below. Mark confidence as `Speculation`
40
+ and append `-unverified` to the skill directory name.
41
+
42
+ ### Step 4 — User confirmation
43
+
44
+ Present a concise summary (pattern name, one-sentence description, trigger,
45
+ proposed filename) to the user and ask to approve the save. Options:
46
+ - A: "Save it" → Step 5
47
+ - B: "Edit first" → accept user revisions, re-confirm
48
+ - C: "Don't save" → abort
49
+
50
+ ### Step 5 — Write file
51
+
52
+ Path: `~/.claude/skills/learned-<pattern-slug>-unverified/SKILL.md`.
53
+ Never overwrite an existing learned skill directory — increment the slug
54
+ (`learned-pattern-slug-2-unverified/`) if it already exists.
55
+
56
+ ## Learned-skill template
57
+
58
+ ```markdown
59
+ ---
60
+ name: learned-<pattern-slug>-unverified
61
+ description: Use when <specific trigger for this reusable pattern>.
62
+ ---
63
+
64
+ # <Descriptive Pattern Name>
65
+
66
+ **Extracted**: <YYYY-MM-DD>
67
+ **Confidence**: Speculation (unverified)
68
+ **Context**: <one-sentence applicability>
69
+
70
+ ## Problem
71
+ <what problem does this pattern solve — be specific>
72
+
73
+ ## Solution
74
+ <the pattern / technique / workaround>
75
+
76
+ ## Example
77
+ <code example if applicable — else a transcribed command sequence>
78
+
79
+ ## Trigger Conditions
80
+ <what situations should activate this skill>
81
+
82
+ ## Verification Status
83
+ - [ ] Human review passed
84
+ - [ ] Multiple successful uses
85
+ ```
86
+
87
+ ## Verification upgrade path
88
+
89
+ 1. **Speculation** (this skill writes this level) — freshly extracted, unverified
90
+ 2. **Inference** — after human review passes, rename the directory to remove
91
+ `-unverified` and update the frontmatter name
92
+ 3. **Fact** — after multiple successful uses confirm the pattern
93
+
94
+ ## What NOT to extract
95
+
96
+ - Simple typo fixes
97
+ - One-time issues (API outage, transient CI flake)
98
+ - Patterns too project-specific to reuse (belongs in project docs, not a skill)
99
+ - Anything already captured in CLAUDE.md or equivalent project instructions
100
+
101
+ ## Approval boundary
102
+
103
+ Ask the user directly before writing. No Ultra MCP or legacy interaction wrapper is involved.
104
+
105
+ ## What this skill DOES NOT do
106
+
107
+ - Does NOT modify state.db
108
+ - Does NOT save without user approval
109
+ - Does NOT extract more than one pattern per run
110
+
111
+ ## Integration
112
+
113
+ | | |
114
+ |---|---|
115
+ | **Input** | current session transcript / recent tool outputs |
116
+ | **Output** | `~/.claude/skills/learned-<slug>-unverified/SKILL.md` |
117
+ | **Next** | user may promote after review; `/learn` again later when another pattern appears |