cc-codeconductor 0.2.9 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. package/README.md +105 -25
  2. package/dist/index.js +662 -291
  3. package/package.json +1 -1
  4. package/presets/agy/AGENTS.md +365 -0
  5. package/presets/agy/README.md +47 -0
  6. package/presets/agy/hooks.json +30 -0
  7. package/presets/agy/mcp_config.json +3 -0
  8. package/presets/agy/rules/commit-style.md +1 -0
  9. package/presets/agy/rules/graphify.md +14 -0
  10. package/presets/agy/scripts/post-tool.sh +25 -0
  11. package/presets/agy/scripts/pre-tool.sh +56 -0
  12. package/presets/agy/settings.json +8 -0
  13. package/presets/agy/skills/cc-api-contract/SKILL.md +71 -0
  14. package/presets/agy/skills/cc-db-migration/SKILL.md +70 -0
  15. package/presets/agy/skills/cc-feature/SKILL.md +115 -0
  16. package/presets/agy/skills/cc-fix/SKILL.md +124 -0
  17. package/presets/agy/skills/cc-pagespeed/SKILL.md +101 -0
  18. package/presets/agy/skills/cc-refactor/SKILL.md +149 -0
  19. package/presets/agy/skills/cc-review/SKILL.md +142 -0
  20. package/presets/agy/skills/cc-tdd-cycle/SKILL.md +226 -0
  21. package/presets/agy/skills/cc-test-plan/SKILL.md +145 -0
  22. package/presets/agy/skills/commit/SKILL.md +5 -0
  23. package/presets/agy/workflows/cc-api-contract.md +71 -0
  24. package/presets/agy/workflows/cc-db-migration.md +70 -0
  25. package/presets/agy/workflows/cc-feature.md +115 -0
  26. package/presets/agy/workflows/cc-fix.md +124 -0
  27. package/presets/agy/workflows/cc-pagespeed.md +101 -0
  28. package/presets/agy/workflows/cc-refactor.md +149 -0
  29. package/presets/agy/workflows/cc-review.md +142 -0
  30. package/presets/agy/workflows/cc-tdd-cycle.md +226 -0
  31. package/presets/agy/workflows/cc-test-plan.md +145 -0
  32. package/presets/agy/workflows/commit.md +1 -0
  33. package/presets/claude/CLAUDE.md +47 -3
  34. package/presets/claude/claude.json +6 -0
  35. package/presets/claude/commands/cc/pagespeed.md +103 -0
  36. package/presets/claude/settings.json +249 -2
  37. package/presets/claude/skills/android/SKILL.md +119 -0
  38. package/presets/claude/skills/conductor-setup/SKILL.md +125 -0
  39. package/presets/claude/skills/find-skills/SKILL.md +142 -0
  40. package/presets/claude/skills/laravel-specialist/SKILL.md +264 -0
  41. package/presets/claude/skills/laravel-specialist/references/eloquent.md +351 -0
  42. package/presets/claude/skills/laravel-specialist/references/livewire.md +512 -0
  43. package/presets/claude/skills/laravel-specialist/references/queues.md +423 -0
  44. package/presets/claude/skills/laravel-specialist/references/routing.md +362 -0
  45. package/presets/claude/skills/laravel-specialist/references/testing.md +522 -0
  46. package/presets/claude/skills/multi-agent-orchestration/README.md +144 -0
  47. package/presets/claude/skills/multi-agent-orchestration/SKILL.md +579 -0
  48. package/presets/claude/skills/multi-agent-orchestration/examples/framework_implementations.py +362 -0
  49. package/presets/claude/skills/multi-agent-orchestration/examples/orchestration_patterns.py +411 -0
  50. package/presets/claude/skills/multi-agent-orchestration/scripts/agent_communication.py +334 -0
  51. package/presets/claude/skills/multi-agent-orchestration/scripts/benchmarking.py +341 -0
  52. package/presets/claude/skills/multi-agent-orchestration/scripts/workflow_management.py +334 -0
  53. package/presets/claude/skills/pagespeed-insights/SKILL.md +443 -0
  54. package/presets/claude/skills/pagespeed-insights/reference.md +50 -0
  55. package/presets/claude/skills/pagespeed-perf/SKILL.md +279 -0
  56. package/presets/claude/skills/php-pro/SKILL.md +208 -0
  57. package/presets/claude/skills/php-pro/references/async-patterns.md +412 -0
  58. package/presets/claude/skills/php-pro/references/laravel-patterns.md +377 -0
  59. package/presets/claude/skills/php-pro/references/modern-php-features.md +323 -0
  60. package/presets/claude/skills/php-pro/references/symfony-patterns.md +466 -0
  61. package/presets/claude/skills/php-pro/references/testing-quality.md +466 -0
  62. package/presets/claude/skills/workflow-orchestration-patterns/SKILL.md +98 -0
  63. package/presets/claude/skills/workflow-orchestration-patterns/references/details.md +223 -0
  64. package/presets/codex/AGENTS.md +38 -14
  65. package/presets/codex/skills/android/SKILL.md +119 -0
  66. package/presets/codex/skills/conductor-setup/SKILL.md +125 -0
  67. package/presets/codex/skills/find-skills/SKILL.md +142 -0
  68. package/presets/codex/skills/laravel-specialist/SKILL.md +264 -0
  69. package/presets/codex/skills/laravel-specialist/references/eloquent.md +351 -0
  70. package/presets/codex/skills/laravel-specialist/references/livewire.md +512 -0
  71. package/presets/codex/skills/laravel-specialist/references/queues.md +423 -0
  72. package/presets/codex/skills/laravel-specialist/references/routing.md +362 -0
  73. package/presets/codex/skills/laravel-specialist/references/testing.md +522 -0
  74. package/presets/codex/skills/multi-agent-orchestration/README.md +144 -0
  75. package/presets/codex/skills/multi-agent-orchestration/SKILL.md +579 -0
  76. package/presets/codex/skills/multi-agent-orchestration/examples/framework_implementations.py +362 -0
  77. package/presets/codex/skills/multi-agent-orchestration/examples/orchestration_patterns.py +411 -0
  78. package/presets/codex/skills/multi-agent-orchestration/scripts/agent_communication.py +334 -0
  79. package/presets/codex/skills/multi-agent-orchestration/scripts/benchmarking.py +341 -0
  80. package/presets/codex/skills/multi-agent-orchestration/scripts/workflow_management.py +334 -0
  81. package/presets/codex/skills/pagespeed-insights/SKILL.md +443 -0
  82. package/presets/codex/skills/pagespeed-insights/reference.md +50 -0
  83. package/presets/codex/skills/pagespeed-perf/SKILL.md +279 -0
  84. package/presets/codex/skills/php-pro/SKILL.md +208 -0
  85. package/presets/codex/skills/php-pro/references/async-patterns.md +412 -0
  86. package/presets/codex/skills/php-pro/references/laravel-patterns.md +377 -0
  87. package/presets/codex/skills/php-pro/references/modern-php-features.md +323 -0
  88. package/presets/codex/skills/php-pro/references/symfony-patterns.md +466 -0
  89. package/presets/codex/skills/php-pro/references/testing-quality.md +466 -0
  90. package/presets/codex/skills/workflow-orchestration-patterns/SKILL.md +98 -0
  91. package/presets/codex/skills/workflow-orchestration-patterns/references/details.md +223 -0
  92. package/presets/opencode/README.md +11 -10
  93. package/presets/opencode/agents/orchestrator.md +121 -1
  94. package/presets/opencode/agents/reviewer.md +31 -0
  95. package/presets/opencode/commands/cc-pagespeed.md +100 -0
  96. package/presets/opencode/prompts/v0.3.0/architect.md +221 -0
  97. package/presets/opencode/prompts/v0.3.0/docs.md +189 -0
  98. package/presets/opencode/prompts/v0.3.0/implementer.md +162 -0
  99. package/presets/opencode/prompts/v0.3.0/orchestrator.md +360 -0
  100. package/presets/opencode/prompts/v0.3.0/repo-explorer.md +110 -0
  101. package/presets/opencode/prompts/v0.3.0/reviewer.md +225 -0
  102. package/presets/opencode/prompts/v0.3.0/task-coach.md +155 -0
  103. package/presets/opencode/prompts/v0.3.0/tester.md +251 -0
  104. package/presets/opencode/skills/android/SKILL.md +119 -0
  105. package/presets/opencode/skills/conductor-setup/SKILL.md +125 -0
  106. package/presets/opencode/skills/find-skills/SKILL.md +142 -0
  107. package/presets/opencode/skills/laravel-specialist/SKILL.md +264 -0
  108. package/presets/opencode/skills/laravel-specialist/references/eloquent.md +351 -0
  109. package/presets/opencode/skills/laravel-specialist/references/livewire.md +512 -0
  110. package/presets/opencode/skills/laravel-specialist/references/queues.md +423 -0
  111. package/presets/opencode/skills/laravel-specialist/references/routing.md +362 -0
  112. package/presets/opencode/skills/laravel-specialist/references/testing.md +522 -0
  113. package/presets/opencode/skills/multi-agent-orchestration/README.md +144 -0
  114. package/presets/opencode/skills/multi-agent-orchestration/SKILL.md +579 -0
  115. package/presets/opencode/skills/multi-agent-orchestration/examples/framework_implementations.py +362 -0
  116. package/presets/opencode/skills/multi-agent-orchestration/examples/orchestration_patterns.py +411 -0
  117. package/presets/opencode/skills/multi-agent-orchestration/scripts/agent_communication.py +334 -0
  118. package/presets/opencode/skills/multi-agent-orchestration/scripts/benchmarking.py +341 -0
  119. package/presets/opencode/skills/multi-agent-orchestration/scripts/workflow_management.py +334 -0
  120. package/presets/opencode/skills/pagespeed-insights/SKILL.md +443 -0
  121. package/presets/opencode/skills/pagespeed-insights/reference.md +50 -0
  122. package/presets/opencode/skills/pagespeed-perf/SKILL.md +279 -0
  123. package/presets/opencode/skills/php-pro/SKILL.md +208 -0
  124. package/presets/opencode/skills/php-pro/references/async-patterns.md +412 -0
  125. package/presets/opencode/skills/php-pro/references/laravel-patterns.md +377 -0
  126. package/presets/opencode/skills/php-pro/references/modern-php-features.md +323 -0
  127. package/presets/opencode/skills/php-pro/references/symfony-patterns.md +466 -0
  128. package/presets/opencode/skills/php-pro/references/testing-quality.md +466 -0
  129. package/presets/opencode/skills/workflow-orchestration-patterns/SKILL.md +98 -0
  130. package/presets/opencode/skills/workflow-orchestration-patterns/references/details.md +223 -0
  131. package/presets/seo-hotel/commands/cc-seo-audit.md +17 -9
  132. package/presets/seo-hotel/settings.json +225 -0
  133. package/presets/seo-hotel/skills/find-skills/SKILL.md +142 -0
  134. package/presets/seo-hotel/skills/pagespeed-insights/SKILL.md +443 -0
  135. package/presets/seo-hotel/skills/pagespeed-insights/reference.md +50 -0
  136. package/src/presets/manifests/agy.yml +38 -3
  137. package/src/presets/manifests/claude.yml +8 -2
  138. package/src/presets/manifests/codex.yml +3 -2
  139. package/src/presets/manifests/cursor.yml +3 -2
  140. package/src/presets/manifests/gemini.yml +3 -2
  141. package/src/presets/manifests/opencode.yml +7 -2
  142. package/src/presets/models/agy.yml +16 -0
  143. package/src/presets/models/opencode.yml +6 -6
@@ -0,0 +1,223 @@
1
+ # workflow-orchestration-patterns — detailed patterns and worked examples
2
+
3
+ ## Critical Design Decision: Workflows vs Activities
4
+
5
+ **The Fundamental Rule** (Source: temporal.io/blog/workflow-engine-principles):
6
+
7
+ - **Workflows** = Orchestration logic and decision-making
8
+ - **Activities** = External interactions (APIs, databases, network calls)
9
+
10
+ ### Workflows (Orchestration)
11
+
12
+ **Characteristics:**
13
+
14
+ - Contain business logic and coordination
15
+ - **MUST be deterministic** (same inputs → same outputs)
16
+ - **Cannot** perform direct external calls
17
+ - State automatically preserved across failures
18
+ - Can run for years despite infrastructure failures
19
+
20
+ **Example workflow tasks:**
21
+
22
+ - Decide which steps to execute
23
+ - Handle compensation logic
24
+ - Manage timeouts and retries
25
+ - Coordinate child workflows
26
+
27
+ ### Activities (External Interactions)
28
+
29
+ **Characteristics:**
30
+
31
+ - Handle all external system interactions
32
+ - Can be non-deterministic (API calls, DB writes)
33
+ - Include built-in timeouts and retry logic
34
+ - **Must be idempotent** (calling N times = calling once)
35
+ - Short-lived (seconds to minutes typically)
36
+
37
+ **Example activity tasks:**
38
+
39
+ - Call payment gateway API
40
+ - Write to database
41
+ - Send emails or notifications
42
+ - Query external services
43
+
44
+ ### Design Decision Framework
45
+
46
+ ```
47
+ Does it touch external systems? → Activity
48
+ Is it orchestration/decision logic? → Workflow
49
+ ```
50
+
51
+ ## Core Workflow Patterns
52
+
53
+ ### 1. Saga Pattern with Compensation
54
+
55
+ **Purpose**: Implement distributed transactions with rollback capability
56
+
57
+ **Pattern** (Source: temporal.io/blog/compensating-actions-part-of-a-complete-breakfast-with-sagas):
58
+
59
+ ```
60
+ For each step:
61
+ 1. Register compensation BEFORE executing
62
+ 2. Execute the step (via activity)
63
+ 3. On failure, run all compensations in reverse order (LIFO)
64
+ ```
65
+
66
+ **Example: Payment Workflow**
67
+
68
+ 1. Reserve inventory (compensation: release inventory)
69
+ 2. Charge payment (compensation: refund payment)
70
+ 3. Fulfill order (compensation: cancel fulfillment)
71
+
72
+ **Critical Requirements:**
73
+
74
+ - Compensations must be idempotent
75
+ - Register compensation BEFORE executing step
76
+ - Run compensations in reverse order
77
+ - Handle partial failures gracefully
78
+
79
+ ### 2. Entity Workflows (Actor Model)
80
+
81
+ **Purpose**: Long-lived workflow representing single entity instance
82
+
83
+ **Pattern** (Source: docs.temporal.io/evaluate/use-cases-design-patterns):
84
+
85
+ - One workflow execution = one entity (cart, account, inventory item)
86
+ - Workflow persists for entity lifetime
87
+ - Receives signals for state changes
88
+ - Supports queries for current state
89
+
90
+ **Example Use Cases:**
91
+
92
+ - Shopping cart (add items, checkout, expiration)
93
+ - Bank account (deposits, withdrawals, balance checks)
94
+ - Product inventory (stock updates, reservations)
95
+
96
+ **Benefits:**
97
+
98
+ - Encapsulates entity behavior
99
+ - Guarantees consistency per entity
100
+ - Natural event sourcing
101
+
102
+ ### 3. Fan-Out/Fan-In (Parallel Execution)
103
+
104
+ **Purpose**: Execute multiple tasks in parallel, aggregate results
105
+
106
+ **Pattern:**
107
+
108
+ - Spawn child workflows or parallel activities
109
+ - Wait for all to complete
110
+ - Aggregate results
111
+ - Handle partial failures
112
+
113
+ **Scaling Rule** (Source: temporal.io/blog/workflow-engine-principles):
114
+
115
+ - Don't scale individual workflows
116
+ - For 1M tasks: spawn 1K child workflows × 1K tasks each
117
+ - Keep each workflow bounded
118
+
119
+ ### 4. Async Callback Pattern
120
+
121
+ **Purpose**: Wait for external event or human approval
122
+
123
+ **Pattern:**
124
+
125
+ - Workflow sends request and waits for signal
126
+ - External system processes asynchronously
127
+ - Sends signal to resume workflow
128
+ - Workflow continues with response
129
+
130
+ **Use Cases:**
131
+
132
+ - Human approval workflows
133
+ - Webhook callbacks
134
+ - Long-running external processes
135
+
136
+ ## State Management and Determinism
137
+
138
+ ### Automatic State Preservation
139
+
140
+ **How Temporal Works** (Source: docs.temporal.io/workflows):
141
+
142
+ - Complete program state preserved automatically
143
+ - Event History records every command and event
144
+ - Seamless recovery from crashes
145
+ - Applications restore pre-failure state
146
+
147
+ ### Determinism Constraints
148
+
149
+ **Workflows Execute as State Machines**:
150
+
151
+ - Replay behavior must be consistent
152
+ - Same inputs → identical outputs every time
153
+
154
+ **Prohibited in Workflows** (Source: docs.temporal.io/workflows):
155
+
156
+ - ❌ Threading, locks, synchronization primitives
157
+ - ❌ Random number generation (`random()`)
158
+ - ❌ Global state or static variables
159
+ - ❌ System time (`datetime.now()`)
160
+ - ❌ Direct file I/O or network calls
161
+ - ❌ Non-deterministic libraries
162
+
163
+ **Allowed in Workflows**:
164
+
165
+ - ✅ `workflow.now()` (deterministic time)
166
+ - ✅ `workflow.random()` (deterministic random)
167
+ - ✅ Pure functions and calculations
168
+ - ✅ Calling activities (non-deterministic operations)
169
+
170
+ ### Versioning Strategies
171
+
172
+ **Challenge**: Changing workflow code while old executions still running
173
+
174
+ **Solutions**:
175
+
176
+ 1. **Versioning API**: Use `workflow.get_version()` for safe changes
177
+ 2. **New Workflow Type**: Create new workflow, route new executions to it
178
+ 3. **Backward Compatibility**: Ensure old events replay correctly
179
+
180
+ ## Resilience and Error Handling
181
+
182
+ ### Retry Policies
183
+
184
+ **Default Behavior**: Temporal retries activities forever
185
+
186
+ **Configure Retry**:
187
+
188
+ - Initial retry interval
189
+ - Backoff coefficient (exponential backoff)
190
+ - Maximum interval (cap retry delay)
191
+ - Maximum attempts (eventually fail)
192
+
193
+ **Non-Retryable Errors**:
194
+
195
+ - Invalid input (validation failures)
196
+ - Business rule violations
197
+ - Permanent failures (resource not found)
198
+
199
+ ### Idempotency Requirements
200
+
201
+ **Why Critical** (Source: docs.temporal.io/activities):
202
+
203
+ - Activities may execute multiple times
204
+ - Network failures trigger retries
205
+ - Duplicate execution must be safe
206
+
207
+ **Implementation Strategies**:
208
+
209
+ - Idempotency keys (deduplication)
210
+ - Check-then-act with unique constraints
211
+ - Upsert operations instead of insert
212
+ - Track processed request IDs
213
+
214
+ ### Activity Heartbeats
215
+
216
+ **Purpose**: Detect stalled long-running activities
217
+
218
+ **Pattern**:
219
+
220
+ - Activity sends periodic heartbeat
221
+ - Includes progress information
222
+ - Timeout if no heartbeat received
223
+ - Enables progress-based retry
@@ -34,16 +34,17 @@ Skipping any step is not an optimization. It is a defect.
34
34
  Codex does not load custom slash commands from this preset. Use these natural
35
35
  language patterns to activate each workflow:
36
36
 
37
- | Workflow | Trigger phrase |
38
- | ------------ | ------------------------------------------------- |
39
- | Full feature | "Run the feature workflow for: [description]" |
40
- | Bug fix | "Run the fix workflow for: [description]" |
41
- | Refactor | "Run the refactor workflow for: [scope]" |
42
- | API contract | "Run the API contract workflow for: [change]" |
37
+ | Workflow | Trigger phrase |
38
+ | ------------ | -------------------------------------------------- |
39
+ | Full feature | "Run the feature workflow for: [description]" |
40
+ | Bug fix | "Run the fix workflow for: [description]" |
41
+ | Refactor | "Run the refactor workflow for: [scope]" |
42
+ | API contract | "Run the API contract workflow for: [change]" |
43
43
  | DB migration | "Run the database migration workflow for: [scope]" |
44
- | Code review | "Run a structured review of: [target]" |
45
- | Test plan | "Create a test plan for: [scope]" |
46
- | Task intake | "Help me define a Task Card for: [vague request]" |
44
+ | Code review | "Run a structured review of: [target]" |
45
+ | Test plan | "Create a test plan for: [scope]" |
46
+ | Task intake | "Help me define a Task Card for: [vague request]" |
47
+ | PageSpeed | "Run a PageSpeed audit for: [url]" |
47
48
 
48
49
  ---
49
50
 
@@ -373,15 +374,16 @@ designed. Minimal diff. No scope creep. No invented architecture.
373
374
  `npm run lint`, `uv run pytest`, `make tests`)
374
375
  - network: `deny`
375
376
 
376
- **Does not:** Design architecture. Force push. Declare done before running tests.
377
+ **Does not:** Design architecture. Force push. Declare done before running
378
+ tests.
377
379
 
378
380
  **Model:** `{{MODEL_CODEX}}`
379
381
 
380
382
  **Pre-implementation checklist:**
381
383
 
382
384
  0. Create a Git Worktree for this session before opening any file for editing:
383
- `git worktree add ../<branch>-session <branch>`
384
- All changes happen inside this worktree. Never modify the main working tree directly.
385
+ `git worktree add ../<branch>-session <branch>` All changes happen inside
386
+ this worktree. Never modify the main working tree directly.
385
387
  1. Read the Technical Plan completely.
386
388
  2. Read each file listed under "Files Affected."
387
389
  3. Understand existing patterns in those files.
@@ -391,7 +393,8 @@ designed. Minimal diff. No scope creep. No invented architecture.
391
393
  **Implementation rules:**
392
394
 
393
395
  - **Work in a worktree.** Create a session worktree before touching any file.
394
- All edits happen inside it. Include the worktree path in the Implementation Summary.
396
+ All edits happen inside it. Include the worktree path in the Implementation
397
+ Summary.
395
398
  - **Minimal diff.** Change only what the plan specifies.
396
399
  - **Follow existing patterns.** Match naming conventions, error handling, and
397
400
  module structure already present in the codebase.
@@ -590,7 +593,8 @@ incorrectly.
590
593
  - bash: `deny`
591
594
  - network: `deny`
592
595
 
593
- **Does not:** Write implementation code. Document behavior that was not implemented. Omit CHANGELOG entries.
596
+ **Does not:** Write implementation code. Document behavior that was not
597
+ implemented. Omit CHANGELOG entries.
594
598
 
595
599
  **Model:** `{{MODEL_CODEX}}`
596
600
 
@@ -815,6 +819,13 @@ Available skills:
815
819
  | `django-testing` | Django test patterns, tenant-aware testing |
816
820
  | `python-fastapi-stack` | FastAPI routers, endpoints, schemas |
817
821
  | `sqlalchemy` | SQLAlchemy models, sessions, Alembic migrations |
822
+ | `nextjs-typescript` | Next.js components, Server Actions, App Router |
823
+ | `astro` | Astro pages, islands, content collections |
824
+ | `android` | Android Kotlin, Jetpack Compose, Media3 components |
825
+ | `laravel-specialist` | Laravel models, routes, API resources, Livewire |
826
+ | `php-pro` | PHPStan static analysis, modern PHP 8.3+ features |
827
+ | `security` | Backend security, authorization, data validation |
828
+ | `a11y-debugging` | Debugging frontend accessibility and web standards |
818
829
 
819
830
  To activate a skill, include in your request:
820
831
 
@@ -827,6 +838,18 @@ or, in a combined setup:
827
838
 
828
839
  ---
829
840
 
841
+ ## Loop Agent & Monorepo Workspaces
842
+
843
+ ### Loop Agent Mode (Intense Workflows)
844
+ - If tests fail during verification, route the logs back to the Implementer.
845
+ - Run the cycle: Implementer (applies fix) -> Tester (verifies suite) up to 3 times.
846
+ - If still failing, stop and report back with findings.
847
+
848
+ ### Monorepo Workspaces
849
+ - Note that this is a monorepo. Focus operations strictly within the specified sub-package or workspace directory in the Task Card scope. Avoid modifying files or running commands outside this package directory.
850
+
851
+ ---
852
+
830
853
  ## Scorecard Format
831
854
 
832
855
  Every Deliverable should be evaluated against a Scorecard before it is accepted.
@@ -879,6 +902,7 @@ Contract version:** v0.1.0 **Date:** [YYYY-MM-DD] **Evaluator:** [human name or
879
902
  - Keep solutions simple and direct.
880
903
  - User instructions always override this file.
881
904
  - When using tools, be precise and minimal with context.
905
+ {{LANGUAGE_INSTRUCTIONS}}
882
906
 
883
907
  ## Context Budget
884
908
 
@@ -0,0 +1,119 @@
1
+ ---
2
+ id: android
3
+ version: 1.0.0
4
+ name: Android + Kotlin (Jetpack Compose & Media3)
5
+ description: >
6
+ Provides expert knowledge for building modern native Android apps using Kotlin, Jetpack Compose, Material Design 3, MVI architecture, Hilt dependency injection, and Media3/ExoPlayer.
7
+
8
+ user-invokable: true
9
+ license: MIT
10
+ metadata:
11
+ author: lgzarturo
12
+ category: mobile
13
+
14
+ compatibility:
15
+ tools: [claude, codex, gemini, agy, opencode]
16
+ stacks:
17
+ languages: [kotlin, java]
18
+ frameworks: [android]
19
+
20
+ risk:
21
+ level: medium
22
+ can_execute_shell: true
23
+ can_modify_files: true
24
+ requires_network: false
25
+
26
+ inputs: []
27
+
28
+ outputs: []
29
+
30
+ quality:
31
+ reviewed_by: codeconductor-core
32
+ version: 0.1.0
33
+ ---
34
+
35
+ # Android + Kotlin (Jetpack Compose & Media3)
36
+
37
+ This playbook defines the architecture, UI design system, performance guidelines, and testing strategy for native Android applications.
38
+
39
+ ---
40
+
41
+ ## 1. Lead Architect & Modularization
42
+
43
+ ### Architecture (MVI / MVVM with Clean Architecture)
44
+ - Prefer **MVI (Model-View-Intent)** for state management. Ensure a strict unidirectional data flow:
45
+ - **UiState**: Single source of truth for the UI state.
46
+ - **UiIntent**: Actions initiated by the user or system.
47
+ - **UiEffect**: One-time events (navigation, toasts, snackbars).
48
+ - Separate the project into clean logical modules:
49
+ - `app`: Application entry point, launcher activity, global dependency injection configuration.
50
+ - `core`: Shared resources, network layer, media playback logic (ExoPlayer/Media3), storage.
51
+ - `feature`: Individual business features (isolated and independent of other features).
52
+
53
+ ### Dependency Injection (Hilt)
54
+ - Annotate the Application class with `@HiltAndroidApp`.
55
+ - Annotate Activities and Fragments with `@AndroidEntryPoint`.
56
+ - Use constructor injection for ViewModels with `@HiltViewModel`.
57
+
58
+ ---
59
+
60
+ ## 2. Jetpack Compose UI/UX
61
+
62
+ ### Recomposition & State Management
63
+ - Consume `StateFlow` from ViewModels safely using `collectAsStateWithLifecycle()` to respect the activity lifecycle.
64
+ - Keep data models immutable. Mark configuration classes with `@Immutable` or `@Stable` to prevent redundant recompositions.
65
+ - Use `contentType` and `key` in `LazyColumn` and `LazyRow` to optimize item recycling and rendering performance.
66
+ - Avoid fixed hardcoded margins. Apply `WindowInsets` to support modern edge-to-edge screens.
67
+
68
+ ---
69
+
70
+ ## 3. Performance & Multimedia (Media3 / ExoPlayer)
71
+
72
+ ### Playback & Services
73
+ - Run `ExoPlayer` / `Media3` inside a robust `Foreground Service` (using `MediaSessionService`) to ensure playback continues when the app is in the background.
74
+ - Clean up resources: release player instances in `onDestroy` or when the service is stopped.
75
+ - Control wake locks strictly to avoid draining the user's battery when playback is paused.
76
+
77
+ ### Kotlin Coroutines & Threading
78
+ - Always inject `CoroutineDispatcher` instances instead of hardcoding them:
79
+ - `Dispatchers.IO`: Database access, network operations, file reading.
80
+ - `Dispatchers.Default`: CPU-intensive operations (parsing JSON, filtering large lists).
81
+ - `Dispatchers.Main`: UI modifications and light interactions.
82
+
83
+ ### R8 & Resource Optimization
84
+ - Enable shrinking and obfuscation in production builds:
85
+ - `isMinifyEnabled = true`
86
+ - `isShrinkResources = true`
87
+ - Convert all static images to the modern `WebP` format to minimize the application binary size.
88
+
89
+ ---
90
+
91
+ ## 4. Quality Assurance & Automated Testing
92
+
93
+ ### Unit Testing
94
+ - Use JUnit 5 and MockK for mocking dependencies.
95
+ - Test ViewModels and Reducers by asserting StateFlow updates. Use `Turbine` to easily test Kotlin Flows.
96
+ - Mock all multimedia/ExoPlayer components to avoid loading actual audio/video resources in unit tests.
97
+
98
+ ### UI Testing
99
+ - Create UI tests using Compose test rules: `createComposeRule()` or `createAndroidComposeRule<MainActivity>()`.
100
+ - Assert correct rendering, visibility states, and user interactions without executing real network calls.
101
+
102
+ ---
103
+
104
+ ## 5. Key Gradle & ADB Commands
105
+
106
+ Use these commands for building, checking code style, running tests, and profiling performance:
107
+
108
+ | Command | Action |
109
+ | ------- | ------ |
110
+ | `./gradlew init` | Initialize a new Gradle project structure. |
111
+ | `./gradlew app:dependencies` | List all dependencies of the application module. |
112
+ | `./gradlew assembleDebug` | Validate compilation and generate debug APK. |
113
+ | `./gradlew ktlintCheck` | Run KtLint check to enforce Kotlin style guidelines. |
114
+ | `./gradlew lintDebug` | Run Android Lint tool to inspect code quality and UI issues. |
115
+ | `./gradlew testDebugUnitTest` | Run unit tests for debug build variant. |
116
+ | `./gradlew connectedAndroidTest` | Run instrumented UI tests on connected emulator or device. |
117
+ | `./gradlew assembleRelease` | Generate release build variant with R8 optimizations. |
118
+ | `adb shell dumpsys batterystats` | Profile system battery consumption metrics. |
119
+ | `adb shell am dumpheap <package> heap.hprof` | Dump application heap memory file for profiling. |
@@ -0,0 +1,125 @@
1
+ ---
2
+ name: conductor-setup
3
+ description: Configure a Rails project to work with Conductor (parallel coding agents)
4
+ allowed-tools: Bash(chmod *), Bash(bundle *), Bash(npm *), Bash(script/server)
5
+ context: fork
6
+ risk: unknown
7
+ source: community
8
+ metadata:
9
+ author: Shpigford
10
+ version: "1.0"
11
+ ---
12
+
13
+ Set up this Rails project for Conductor, the Mac app for parallel coding agents.
14
+
15
+ ## When to Use
16
+ - You need to configure a Rails project so it runs correctly inside Conductor workspaces.
17
+ - The project should support parallel coding agents with isolated ports, Redis settings, and shared secrets.
18
+ - You want the standard `conductor.json`, `bin/conductor-setup`, and `script/server` scaffolding for a Rails repo.
19
+
20
+ # What to Create
21
+
22
+ ## 1. conductor.json (project root)
23
+
24
+ Create `conductor.json` in the project root if it doesn't already exist:
25
+
26
+ ```json
27
+ {
28
+ "scripts": {
29
+ "setup": "bin/conductor-setup",
30
+ "run": "script/server"
31
+ }
32
+ }
33
+ ```
34
+
35
+ ## 2. bin/conductor-setup (executable)
36
+
37
+ Create `bin/conductor-setup` if it doesn't already exist:
38
+
39
+ ```bash
40
+ #!/bin/bash
41
+ set -e
42
+
43
+ # Symlink .env from repo root (where secrets live, outside worktrees)
44
+ [ -f "$CONDUCTOR_ROOT_PATH/.env" ] && ln -sf "$CONDUCTOR_ROOT_PATH/.env" .env
45
+
46
+ # Symlink Rails master key
47
+ [ -f "$CONDUCTOR_ROOT_PATH/config/master.key" ] && ln -sf "$CONDUCTOR_ROOT_PATH/config/master.key" config/master.key
48
+
49
+ # Install dependencies
50
+ bundle install
51
+ npm install
52
+ ```
53
+
54
+ Make it executable with `chmod +x bin/conductor-setup`.
55
+
56
+ ## 3. script/server (executable)
57
+
58
+ Create the `script` directory if needed, then create `script/server` if it doesn't already exist:
59
+
60
+ ```bash
61
+ #!/bin/bash
62
+
63
+ # === Port Configuration ===
64
+ export PORT=${CONDUCTOR_PORT:-3000}
65
+ export VITE_RUBY_PORT=$((PORT + 1000))
66
+
67
+ # === Redis Isolation ===
68
+ if [ -n "$CONDUCTOR_WORKSPACE_NAME" ]; then
69
+ HASH=$(printf '%s' "$CONDUCTOR_WORKSPACE_NAME" | cksum | cut -d' ' -f1)
70
+ REDIS_DB=$((HASH % 16))
71
+ export REDIS_URL="redis://localhost:6379/${REDIS_DB}"
72
+ fi
73
+
74
+ exec bin/dev
75
+ ```
76
+
77
+ Make it executable with `chmod +x script/server`.
78
+
79
+ ## 4. Update Rails Config Files
80
+
81
+ For each of the following files, if they exist and contain Redis configuration, update them to use `ENV.fetch('REDIS_URL', ...)` or `ENV['REDIS_URL']` with a fallback:
82
+
83
+ ### config/initializers/sidekiq.rb
84
+ If this file exists and configures Redis, update it to use:
85
+ ```ruby
86
+ redis_url = ENV.fetch('REDIS_URL', 'redis://localhost:6379/0')
87
+ ```
88
+
89
+ ### config/cable.yml
90
+ If this file exists, update the development adapter to use:
91
+ ```yaml
92
+ development:
93
+ adapter: redis
94
+ url: <%= ENV.fetch('REDIS_URL', 'redis://localhost:6379/1') %>
95
+ ```
96
+
97
+ ### config/environments/development.rb
98
+ If this file configures Redis for caching, update to use:
99
+ ```ruby
100
+ config.cache_store = :redis_cache_store, { url: ENV.fetch('REDIS_URL', 'redis://localhost:6379/0') }
101
+ ```
102
+
103
+ ### config/initializers/rack_attack.rb
104
+ If this file exists and configures a Redis cache store, update to use:
105
+ ```ruby
106
+ Rack::Attack.cache.store = ActiveSupport::Cache::RedisCacheStore.new(url: ENV.fetch('REDIS_URL', 'redis://localhost:6379/0'))
107
+ ```
108
+
109
+ # Implementation Notes
110
+
111
+ - **Don't overwrite existing files**: Check if conductor.json, bin/conductor-setup, and script/server exist before creating them. If they exist, skip creation and inform the user.
112
+ - **Rails config updates**: Only modify Redis-related configuration. If a file doesn't exist or doesn't use Redis, skip it gracefully.
113
+ - **Create directories as needed**: Create `script/` directory if it doesn't exist.
114
+
115
+ # Verification
116
+
117
+ After creating the files:
118
+ 1. Confirm all Conductor files exist and scripts are executable
119
+ 2. Run `script/server` to verify it starts without errors
120
+ 3. Check that Rails configs properly reference `ENV['REDIS_URL']` or `ENV.fetch('REDIS_URL', ...)`
121
+
122
+ ## Limitations
123
+ - Use this skill only when the task clearly matches the scope described above.
124
+ - Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
125
+ - Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.