opencodekit 0.20.7 → 0.20.8

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 (41) hide show
  1. package/dist/index.js +1 -1
  2. package/dist/template/.opencode/AGENTS.md +48 -0
  3. package/dist/template/.opencode/agent/build.md +3 -2
  4. package/dist/template/.opencode/agent/explore.md +14 -14
  5. package/dist/template/.opencode/agent/general.md +1 -1
  6. package/dist/template/.opencode/agent/plan.md +1 -1
  7. package/dist/template/.opencode/agent/review.md +1 -1
  8. package/dist/template/.opencode/agent/vision.md +0 -9
  9. package/dist/template/.opencode/memory.db +0 -0
  10. package/dist/template/.opencode/memory.db-shm +0 -0
  11. package/dist/template/.opencode/memory.db-wal +0 -0
  12. package/dist/template/.opencode/opencode.json +0 -5
  13. package/dist/template/.opencode/package.json +1 -1
  14. package/dist/template/.opencode/pnpm-lock.yaml +791 -9
  15. package/dist/template/.opencode/skill/api-and-interface-design/SKILL.md +162 -0
  16. package/dist/template/.opencode/skill/beads/SKILL.md +10 -9
  17. package/dist/template/.opencode/skill/beads/references/MULTI_AGENT.md +10 -10
  18. package/dist/template/.opencode/skill/ci-cd-and-automation/SKILL.md +202 -0
  19. package/dist/template/.opencode/skill/code-search-patterns/SKILL.md +253 -0
  20. package/dist/template/.opencode/skill/code-simplification/SKILL.md +211 -0
  21. package/dist/template/.opencode/skill/condition-based-waiting/SKILL.md +12 -0
  22. package/dist/template/.opencode/skill/defense-in-depth/SKILL.md +16 -6
  23. package/dist/template/.opencode/skill/deprecation-and-migration/SKILL.md +189 -0
  24. package/dist/template/.opencode/skill/development-lifecycle/SKILL.md +12 -48
  25. package/dist/template/.opencode/skill/documentation-and-adrs/SKILL.md +220 -0
  26. package/dist/template/.opencode/skill/incremental-implementation/SKILL.md +191 -0
  27. package/dist/template/.opencode/skill/performance-optimization/SKILL.md +236 -0
  28. package/dist/template/.opencode/skill/receiving-code-review/SKILL.md +11 -0
  29. package/dist/template/.opencode/skill/security-and-hardening/SKILL.md +296 -0
  30. package/dist/template/.opencode/skill/structured-edit/SKILL.md +10 -0
  31. package/dist/template/.opencode/skill/swarm-coordination/SKILL.md +66 -1
  32. package/package.json +1 -1
  33. package/dist/template/.opencode/skill/beads-bridge/SKILL.md +0 -321
  34. package/dist/template/.opencode/skill/code-navigation/SKILL.md +0 -130
  35. package/dist/template/.opencode/skill/mqdh/SKILL.md +0 -171
  36. package/dist/template/.opencode/skill/obsidian/SKILL.md +0 -192
  37. package/dist/template/.opencode/skill/obsidian/mcp.json +0 -22
  38. package/dist/template/.opencode/skill/pencil/SKILL.md +0 -72
  39. package/dist/template/.opencode/skill/ralph/SKILL.md +0 -296
  40. package/dist/template/.opencode/skill/tilth-cli/SKILL.md +0 -207
  41. package/dist/template/.opencode/skill/tool-priority/SKILL.md +0 -299
@@ -0,0 +1,162 @@
1
+ ---
2
+ name: api-and-interface-design
3
+ description: Use when designing REST/GraphQL APIs, SDK interfaces, or public module boundaries — covers contract-first design, versioning, error shapes, and backward compatibility
4
+ version: 1.0.0
5
+ tags: [architecture, code-quality]
6
+ dependencies: []
7
+ ---
8
+
9
+ # API & Interface Design
10
+
11
+ > **Replaces** ad-hoc API creation where endpoints, error shapes, and versioning are afterthoughts
12
+
13
+ ## When to Use
14
+
15
+ - Designing a new API endpoint, SDK method, or public module interface
16
+ - Reviewing or extending an existing API for backward compatibility
17
+ - Defining error responses, pagination, or authentication contracts
18
+
19
+ ## When NOT to Use
20
+
21
+ - Internal-only helper functions that no external code calls
22
+ - Prototyping where the API shape will change frequently (use after stabilization)
23
+
24
+ ## Overview
25
+
26
+ APIs are contracts. Once published, they're hard to change without breaking consumers. Design the contract first, implement second.
27
+
28
+ **Core principle:** Define the contract (types, errors, versioning) before writing implementation. Make breaking changes impossible through careful interface design.
29
+
30
+ ## Contract-First Process
31
+
32
+ ```
33
+ 1. DEFINE — Write TypeScript types / OpenAPI schema for request & response
34
+ 2. REVIEW — Check backward compatibility, error coverage, naming consistency
35
+ 3. IMPLEMENT — Code against the contract, not the other way around
36
+ 4. VERIFY — Validate implementation matches contract exactly
37
+ ```
38
+
39
+ ## API Design Checklist
40
+
41
+ ### Naming
42
+
43
+ - [ ] Resource-oriented URLs (nouns, not verbs): `/users/{id}` not `/getUser`
44
+ - [ ] Consistent casing (camelCase for JSON fields, kebab-case for URLs)
45
+ - [ ] Plural collection names: `/users` not `/user`
46
+ - [ ] Avoid abbreviations — `configuration` not `config` in public APIs
47
+
48
+ ### Request Design
49
+
50
+ - [ ] Use appropriate HTTP methods (GET reads, POST creates, PUT replaces, PATCH updates, DELETE removes)
51
+ - [ ] Validate all input with schemas (zod, JSON Schema) at the boundary
52
+ - [ ] Accept only what you need — reject unknown fields
53
+ - [ ] Use query params for filtering/pagination, body for creation/mutation
54
+
55
+ ### Response Design
56
+
57
+ - [ ] Consistent envelope: `{ data, error, meta }` or flat depending on convention
58
+ - [ ] Include pagination metadata: `{ total, page, pageSize, hasMore }`
59
+ - [ ] Return created/updated resource in mutation responses
60
+ - [ ] Use ISO 8601 for dates, UTC always
61
+
62
+ ### Error Design
63
+
64
+ ```typescript
65
+ // Consistent error shape
66
+ interface ApiError {
67
+ code: string; // machine-readable: "VALIDATION_ERROR", "NOT_FOUND"
68
+ message: string; // human-readable description
69
+ details?: unknown; // field-level errors, context
70
+ requestId?: string; // correlation ID for debugging
71
+ }
72
+ ```
73
+
74
+ - [ ] Use standard HTTP status codes correctly (400 vs 422 vs 500)
75
+ - [ ] Never expose stack traces or internal errors to clients
76
+ - [ ] Include actionable error messages
77
+ - [ ] Document all possible error codes per endpoint
78
+
79
+ ### Versioning
80
+
81
+ | Strategy | When | Example |
82
+ | ------------- | ---------------------------------- | ------------------------------------- |
83
+ | URL prefix | Breaking changes to resources | `/v1/users`, `/v2/users` |
84
+ | Header | Breaking changes, same URL desired | `Accept: application/vnd.api.v2+json` |
85
+ | Query param | Simple, low-ceremony | `/users?version=2` |
86
+ | No versioning | Internal APIs, single consumer | Direct updates |
87
+
88
+ **Default:** URL prefix versioning for public APIs, no versioning for internal.
89
+
90
+ ### Backward Compatibility Rules
91
+
92
+ | Safe (Non-Breaking) | Unsafe (Breaking) |
93
+ | ------------------------- | ------------------------ |
94
+ | Add optional fields | Remove or rename fields |
95
+ | Add new endpoints | Change field types |
96
+ | Add new enum values | Remove enum values |
97
+ | Widen input validation | Tighten input validation |
98
+ | Add optional query params | Change URL structure |
99
+
100
+ ## Common Rationalizations
101
+
102
+ | Excuse | Rebuttal |
103
+ | -------------------------------- | ------------------------------------------------------------------------ |
104
+ | "It's just an internal API" | Internal APIs become external. Design the contract now. |
105
+ | "We can change it later" | Every consumer you add makes changes harder. Get it right early. |
106
+ | "The frontend team will adapt" | Consumers shouldn't break because you didn't plan the interface. |
107
+ | "Error handling is boilerplate" | Inconsistent errors cause more debugging than any boilerplate saves. |
108
+ | "Versioning is overkill for now" | Adding versioning later requires migrating all consumers simultaneously. |
109
+
110
+ ## TypeScript Patterns
111
+
112
+ ### Strict Input/Output Types
113
+
114
+ ```typescript
115
+ // ✅ Separate input and output types
116
+ interface CreateUserInput {
117
+ name: string;
118
+ email: string;
119
+ }
120
+
121
+ interface User {
122
+ id: string;
123
+ name: string;
124
+ email: string;
125
+ createdAt: string; // ISO 8601
126
+ }
127
+
128
+ // ✅ Validate at boundary
129
+ const createUserSchema = z.object({
130
+ name: z.string().min(1).max(100),
131
+ email: z.string().email(),
132
+ });
133
+ ```
134
+
135
+ ### Discriminated Unions for Results
136
+
137
+ ```typescript
138
+ type ApiResult<T> = { success: true; data: T } | { success: false; error: ApiError };
139
+ ```
140
+
141
+ ## Red Flags — STOP
142
+
143
+ - Endpoint returns different shapes depending on internal state
144
+ - Error responses have no consistent structure
145
+ - URL contains verbs (`/createUser`, `/deleteItem`)
146
+ - No input validation at the API boundary
147
+ - Response includes internal database IDs or implementation details
148
+ - Breaking change deployed without version bump
149
+
150
+ ## Verification
151
+
152
+ - [ ] All endpoints have typed request/response schemas
153
+ - [ ] Error responses follow the consistent error shape
154
+ - [ ] Breaking changes increment the API version
155
+ - [ ] Input validation rejects invalid/extra fields
156
+ - [ ] Response matches documented contract exactly
157
+
158
+ ## See Also
159
+
160
+ - **defense-in-depth** — Validation at every layer, not just the API boundary
161
+ - **incremental-implementation** — Build API endpoints as thin vertical slices
162
+ - **test-driven-development** — Write API contract tests before implementation
@@ -13,6 +13,7 @@ dependencies: []
13
13
  # Beads Workflow - Multi-Agent Task Coordination
14
14
 
15
15
  > **Replaces** ad-hoc task tracking with sticky notes, TODO comments, or mental checklists that lose state between sessions
16
+
16
17
  ## When to Use
17
18
 
18
19
  - Coordinating multi-session work with dependencies, blockers, or file locking needs
@@ -98,7 +99,7 @@ See: `references/EXAMPLES.md` for complete usage examples.
98
99
 
99
100
  ## Multi-Agent Coordination (Summary)
100
101
 
101
- For parallel execution with multiple subagents, use the **beads-bridge** skill.
102
+ For parallel execution with multiple subagents, use the **swarm-coordination** skill.
102
103
 
103
104
  See: `references/MULTI_AGENT.md` for swarm tool usage and examples.
104
105
 
@@ -113,13 +114,13 @@ See: `references/MULTI_AGENT.md` for swarm tool usage and examples.
113
114
 
114
115
  ## Anti-Patterns
115
116
 
116
- | Anti-Pattern | Why It Fails | Instead |
117
- | --- | --- | --- |
118
- | Claiming a bead without reading its current state first (`br show`) | Misses dependencies, blockers, and prior context | Run `br show <id>` before `br update <id> --status in_progress` |
119
- | Closing a bead without verification evidence | Marks incomplete or broken work as done | Run verification commands and capture output before `br close` |
120
- | Working on blocked beads (dependencies not met) | Wastes time and causes out-of-order delivery | Use `br ready` and confirm dependencies in `br show <id>` |
121
- | Modifying bead state without user confirmation | Violates workflow expectations and can surprise collaborators | Ask before changing bead status, especially close/sync actions |
122
- | Using `br sync` without `--flush-only` (can cause conflicts) | May write unexpected state and increase sync conflict risk | Always use `br sync --flush-only` then commit `.beads/` manually |
117
+ | Anti-Pattern | Why It Fails | Instead |
118
+ | ------------------------------------------------------------------- | ------------------------------------------------------------- | ---------------------------------------------------------------- |
119
+ | Claiming a bead without reading its current state first (`br show`) | Misses dependencies, blockers, and prior context | Run `br show <id>` before `br update <id> --status in_progress` |
120
+ | Closing a bead without verification evidence | Marks incomplete or broken work as done | Run verification commands and capture output before `br close` |
121
+ | Working on blocked beads (dependencies not met) | Wastes time and causes out-of-order delivery | Use `br ready` and confirm dependencies in `br show <id>` |
122
+ | Modifying bead state without user confirmation | Violates workflow expectations and can surprise collaborators | Ask before changing bead status, especially close/sync actions |
123
+ | Using `br sync` without `--flush-only` (can cause conflicts) | May write unexpected state and increase sync conflict risk | Always use `br sync --flush-only` then commit `.beads/` manually |
123
124
 
124
125
  ## Verification
125
126
 
@@ -178,4 +179,4 @@ MAINTENANCE:
178
179
  ## See Also
179
180
 
180
181
  - `verification-before-completion`
181
- - `beads-bridge`
182
+ - `swarm-coordination`
@@ -1,26 +1,26 @@
1
1
  # Multi-Agent Coordination (Swarm Mode)
2
2
 
3
- For parallel execution with multiple subagents, use the **beads-bridge** skill:
3
+ For parallel execution with multiple subagents, use the **swarm-coordination** skill:
4
4
 
5
5
  ```typescript
6
- skill({ name: "beads-bridge" });
6
+ skill({ name: "swarm-coordination" });
7
7
  ```
8
8
 
9
- **beads-bridge** provides (via unified `swarm` tool):
9
+ **swarm-coordination** provides (via unified `swarm` tool):
10
10
 
11
11
  - `swarm({ operation: "sync" })` - Sync Beads tasks to OpenCode todos for subagent visibility
12
12
  - `swarm({ operation: "monitor" })` - Real-time progress tracking and visualization
13
13
  - `swarm({ operation: "plan" })` - Task classification and dependency analysis
14
14
  - `swarm({ operation: "delegate" })` - Create delegation packets for workers
15
15
 
16
- **When to use beads vs beads-bridge:**
16
+ **When to use beads vs swarm-coordination:**
17
17
 
18
- | Scenario | Use |
19
- | ------------------------------ | -------------------------------- |
20
- | Single agent, linear work | `beads` skill only |
21
- | Multiple agents in parallel | `beads-bridge` + `beads` |
22
- | Need subagents to see tasks | `beads-bridge` (swarm sync push) |
23
- | Track worker progress visually | `beads-bridge` (swarm monitor) |
18
+ | Scenario | Use |
19
+ | ------------------------------ | -------------------------------------- |
20
+ | Single agent, linear work | `beads` skill only |
21
+ | Multiple agents in parallel | `swarm-coordination` + `beads` |
22
+ | Need subagents to see tasks | `swarm-coordination` (swarm sync push) |
23
+ | Track worker progress visually | `swarm-coordination` (swarm monitor) |
24
24
 
25
25
  **Example swarm workflow:**
26
26
 
@@ -0,0 +1,202 @@
1
+ ---
2
+ name: ci-cd-and-automation
3
+ description: Use when setting up CI/CD pipelines, GitHub Actions workflows, automated testing in CI, or deployment automation — covers pipeline design, caching, secrets management, and release workflows
4
+ version: 1.0.0
5
+ tags: [devops, workflow]
6
+ dependencies: []
7
+ ---
8
+
9
+ # CI/CD & Automation
10
+
11
+ > **Replaces** manual deployment checklists and ad-hoc scripts with repeatable, auditable automation pipelines
12
+
13
+ ## When to Use
14
+
15
+ - Setting up or modifying CI/CD pipelines (GitHub Actions, GitLab CI, etc.)
16
+ - Adding automated testing, linting, or type-checking to a repository
17
+ - Configuring deployment automation or release workflows
18
+ - Optimizing CI performance (caching, parallelism, conditional runs)
19
+
20
+ ## When NOT to Use
21
+
22
+ - Local development scripts (use Makefile or package.json scripts)
23
+ - One-time migration scripts that don't repeat
24
+ - Infrastructure provisioning (use infrastructure-as-code tools directly)
25
+
26
+ ## Overview
27
+
28
+ CI/CD pipelines are the quality gates between code and production. A well-designed pipeline catches problems early, runs fast, and deploys safely.
29
+
30
+ **Core principle:** Every step that a human does manually before merging or deploying should be automated in the pipeline. If it can be automated, it must be.
31
+
32
+ ## Pipeline Design
33
+
34
+ ### Verification Pipeline (PR/Push)
35
+
36
+ ```yaml
37
+ # Ordered by speed: fastest gates first
38
+ steps:
39
+ 1. Lint # seconds — catches formatting/style issues
40
+ 2. Typecheck # seconds — catches type errors
41
+ 3. Unit tests # seconds-minutes — catches logic bugs
42
+ 4. Build # minutes — catches compilation issues
43
+ 5. Integration # minutes — catches integration bugs
44
+ 6. E2E tests # minutes — catches user-facing bugs (optional per-PR)
45
+ ```
46
+
47
+ **Fail-fast rule:** Run cheapest checks first. Don't waste 10 minutes on E2E tests if linting fails in 5 seconds.
48
+
49
+ ### Deployment Pipeline (Main/Release)
50
+
51
+ ```
52
+ 1. All verification steps pass
53
+ 2. Build production artifacts
54
+ 3. Deploy to staging
55
+ 4. Run smoke tests against staging
56
+ 5. Deploy to production (manual gate or auto)
57
+ 6. Run smoke tests against production
58
+ 7. Monitor error rates for rollback window
59
+ ```
60
+
61
+ ## GitHub Actions Patterns
62
+
63
+ ### Basic PR Verification
64
+
65
+ ```yaml
66
+ name: verify
67
+ on: [pull_request]
68
+ jobs:
69
+ check:
70
+ runs-on: ubuntu-latest
71
+ steps:
72
+ - uses: actions/checkout@v4
73
+ - uses: actions/setup-node@v4
74
+ with:
75
+ node-version-file: ".node-version"
76
+ cache: "pnpm"
77
+ - run: pnpm install --frozen-lockfile
78
+ - run: pnpm lint
79
+ - run: pnpm typecheck
80
+ - run: pnpm test
81
+ - run: pnpm build
82
+ ```
83
+
84
+ ### Caching Strategy
85
+
86
+ | What | Cache Key | Restore Key | Impact |
87
+ | ------------ | ----------------- | ----------- | ------------ |
88
+ | Dependencies | `lockfile hash` | `os-deps-` | 30-60s saved |
89
+ | Build output | `source hash` | `os-build-` | 1-5min saved |
90
+ | Test cache | `test files hash` | `os-test-` | Variable |
91
+
92
+ ```yaml
93
+ - uses: actions/cache@v4
94
+ with:
95
+ path: ~/.pnpm-store
96
+ key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
97
+ restore-keys: ${{ runner.os }}-pnpm-
98
+ ```
99
+
100
+ ### Parallel Jobs
101
+
102
+ ```yaml
103
+ jobs:
104
+ lint:
105
+ runs-on: ubuntu-latest
106
+ steps: [checkout, setup, "pnpm lint"]
107
+
108
+ typecheck:
109
+ runs-on: ubuntu-latest
110
+ steps: [checkout, setup, "pnpm typecheck"]
111
+
112
+ test:
113
+ runs-on: ubuntu-latest
114
+ steps: [checkout, setup, "pnpm test"]
115
+
116
+ build:
117
+ needs: [lint, typecheck, test] # Only build after all checks pass
118
+ runs-on: ubuntu-latest
119
+ steps: [checkout, setup, "pnpm build"]
120
+ ```
121
+
122
+ ## Secrets Management
123
+
124
+ | Rule | Reason |
125
+ | ------------------------------------------ | --------------------------------------------- |
126
+ | Never echo secrets in CI logs | Logs are often accessible to all contributors |
127
+ | Use GitHub Secrets / environment variables | Encrypted at rest, masked in logs |
128
+ | Rotate secrets on exposure | Assume compromised if ever logged |
129
+ | Separate secrets per environment | Staging keys ≠ production keys |
130
+ | Use OIDC for cloud providers | No long-lived credentials needed |
131
+
132
+ ## Release Automation
133
+
134
+ ### Semantic Versioning
135
+
136
+ ```
137
+ MAJOR.MINOR.PATCH
138
+ │ │ └── Bug fixes (backward compatible)
139
+ │ └──────── New features (backward compatible)
140
+ └─────────────── Breaking changes
141
+ ```
142
+
143
+ ### Tag-Based Release
144
+
145
+ ```yaml
146
+ on:
147
+ push:
148
+ tags: ["v*"]
149
+ jobs:
150
+ release:
151
+ steps:
152
+ - uses: actions/checkout@v4
153
+ - run: pnpm build
154
+ - run: pnpm publish # or deploy
155
+ - uses: softprops/action-gh-release@v2
156
+ with:
157
+ generate_release_notes: true
158
+ ```
159
+
160
+ ## Common Rationalizations
161
+
162
+ | Excuse | Rebuttal |
163
+ | ----------------------------------- | --------------------------------------------------------------------------------- |
164
+ | "CI is slow, I'll test locally" | Local tests miss environment-specific issues. Optimize CI instead of skipping it. |
165
+ | "We can add CI later" | Every merged PR without CI is a potential regression. Set up day one. |
166
+ | "The pipeline is too complex" | Complexity means you're catching real issues. Simplify steps, not coverage. |
167
+ | "Manual deploy is faster" | Until someone deploys the wrong branch. Automation prevents human error. |
168
+ | "Caching is premature optimization" | 5 minutes saved per PR × 20 PRs/week = 100 minutes/week. Cache from day one. |
169
+
170
+ ## CI Performance Optimization
171
+
172
+ | Technique | Savings | Effort |
173
+ | ---------------------- | ------------------------- | ---------------------- |
174
+ | Dependency caching | 30-60s per run | Low — add cache action |
175
+ | Parallel jobs | 50-70% of sequential time | Low — split into jobs |
176
+ | Conditional runs | Skip unchanged paths | Medium — path filters |
177
+ | Build artifact caching | 1-5min per run | Medium — cache config |
178
+ | Self-hosted runners | Faster hardware | High — infrastructure |
179
+
180
+ ## Red Flags — STOP
181
+
182
+ - CI pipeline takes >15 minutes for a PR check
183
+ - Secrets hardcoded in workflow files
184
+ - No caching configured despite slow builds
185
+ - Tests skipped in CI "to save time"
186
+ - Manual deployment steps in the release process
187
+ - No rollback mechanism for failed deployments
188
+
189
+ ## Verification
190
+
191
+ - [ ] All verification steps run on every PR
192
+ - [ ] Pipeline fails fast (cheapest checks first)
193
+ - [ ] Dependencies are cached
194
+ - [ ] Secrets are never printed in logs
195
+ - [ ] Release process is tag-triggered and automated
196
+ - [ ] Rollback procedure is documented and tested
197
+
198
+ ## See Also
199
+
200
+ - **verification-gates** — Detecting project type and running appropriate checks
201
+ - **git-workflow-and-versioning** — Branch strategy and commit conventions
202
+ - **security-and-hardening** — Secrets management and supply chain security