opencode-swarm-plugin 0.12.20 → 0.12.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.beads/issues.jsonl +12 -1
- package/.github/workflows/ci.yml +26 -0
- package/bun.lock +21 -0
- package/dist/index.js +24951 -20070
- package/dist/plugin.js +24937 -20070
- package/examples/skills/beads-workflow/SKILL.md +165 -0
- package/examples/skills/skill-creator/SKILL.md +223 -0
- package/examples/skills/swarm-coordination/SKILL.md +148 -0
- package/global-skills/cli-builder/SKILL.md +344 -0
- package/global-skills/cli-builder/references/advanced-patterns.md +244 -0
- package/global-skills/code-review/SKILL.md +166 -0
- package/global-skills/debugging/SKILL.md +150 -0
- package/global-skills/skill-creator/LICENSE.txt +202 -0
- package/global-skills/skill-creator/SKILL.md +352 -0
- package/global-skills/skill-creator/references/output-patterns.md +82 -0
- package/global-skills/skill-creator/references/workflows.md +28 -0
- package/global-skills/swarm-coordination/SKILL.md +166 -0
- package/package.json +6 -5
- package/scripts/init-skill.ts +222 -0
- package/scripts/validate-skill.ts +204 -0
- package/src/agent-mail.ts +40 -4
- package/src/beads.ts +24 -0
- package/src/index.ts +49 -0
- package/src/schemas/bead.ts +21 -1
- package/src/skills.test.ts +408 -0
- package/src/skills.ts +1364 -0
- package/src/swarm.ts +282 -4
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: skill-creator
|
|
3
|
+
description: Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends Claude's capabilities with specialized knowledge, workflows, or tool integrations.
|
|
4
|
+
license: Complete terms in LICENSE.txt
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Skill Creator
|
|
8
|
+
|
|
9
|
+
This skill provides guidance for creating effective skills.
|
|
10
|
+
|
|
11
|
+
## About Skills
|
|
12
|
+
|
|
13
|
+
Skills are modular, self-contained packages that extend Claude's capabilities by providing
|
|
14
|
+
specialized knowledge, workflows, and tools. Think of them as "onboarding guides" for specific
|
|
15
|
+
domains or tasks—they transform Claude from a general-purpose agent into a specialized agent
|
|
16
|
+
equipped with procedural knowledge that no model can fully possess.
|
|
17
|
+
|
|
18
|
+
### What Skills Provide
|
|
19
|
+
|
|
20
|
+
1. Specialized workflows - Multi-step procedures for specific domains
|
|
21
|
+
2. Tool integrations - Instructions for working with specific file formats or APIs
|
|
22
|
+
3. Domain expertise - Company-specific knowledge, schemas, business logic
|
|
23
|
+
4. Bundled resources - Scripts, references, and assets for complex and repetitive tasks
|
|
24
|
+
|
|
25
|
+
## Core Principles
|
|
26
|
+
|
|
27
|
+
### Concise is Key
|
|
28
|
+
|
|
29
|
+
The context window is a public good. Skills share the context window with everything else Claude needs: system prompt, conversation history, other Skills' metadata, and the actual user request.
|
|
30
|
+
|
|
31
|
+
**Default assumption: Claude is already very smart.** Only add context Claude doesn't already have. Challenge each piece of information: "Does Claude really need this explanation?" and "Does this paragraph justify its token cost?"
|
|
32
|
+
|
|
33
|
+
Prefer concise examples over verbose explanations.
|
|
34
|
+
|
|
35
|
+
### Set Appropriate Degrees of Freedom
|
|
36
|
+
|
|
37
|
+
Match the level of specificity to the task's fragility and variability:
|
|
38
|
+
|
|
39
|
+
**High freedom (text-based instructions)**: Use when multiple approaches are valid, decisions depend on context, or heuristics guide the approach.
|
|
40
|
+
|
|
41
|
+
**Medium freedom (pseudocode or scripts with parameters)**: Use when a preferred pattern exists, some variation is acceptable, or configuration affects behavior.
|
|
42
|
+
|
|
43
|
+
**Low freedom (specific scripts, few parameters)**: Use when operations are fragile and error-prone, consistency is critical, or a specific sequence must be followed.
|
|
44
|
+
|
|
45
|
+
Think of Claude as exploring a path: a narrow bridge with cliffs needs specific guardrails (low freedom), while an open field allows many routes (high freedom).
|
|
46
|
+
|
|
47
|
+
### Anatomy of a Skill
|
|
48
|
+
|
|
49
|
+
Every skill consists of a required SKILL.md file and optional bundled resources:
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
skill-name/
|
|
53
|
+
├── SKILL.md (required)
|
|
54
|
+
│ ├── YAML frontmatter metadata (required)
|
|
55
|
+
│ │ ├── name: (required)
|
|
56
|
+
│ │ └── description: (required)
|
|
57
|
+
│ └── Markdown instructions (required)
|
|
58
|
+
└── Bundled Resources (optional)
|
|
59
|
+
├── scripts/ - Executable code (Python/Bash/etc.)
|
|
60
|
+
├── references/ - Documentation intended to be loaded into context as needed
|
|
61
|
+
└── assets/ - Files used in output (templates, icons, fonts, etc.)
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
#### SKILL.md (required)
|
|
65
|
+
|
|
66
|
+
Every SKILL.md consists of:
|
|
67
|
+
|
|
68
|
+
- **Frontmatter** (YAML): Contains `name` and `description` fields. These are the only fields that Claude reads to determine when the skill gets used, thus it is very important to be clear and comprehensive in describing what the skill is, and when it should be used.
|
|
69
|
+
- **Body** (Markdown): Instructions and guidance for using the skill. Only loaded AFTER the skill triggers (if at all).
|
|
70
|
+
|
|
71
|
+
#### Bundled Resources (optional)
|
|
72
|
+
|
|
73
|
+
##### Scripts (`scripts/`)
|
|
74
|
+
|
|
75
|
+
Executable code (Python/Bash/etc.) for tasks that require deterministic reliability or are repeatedly rewritten.
|
|
76
|
+
|
|
77
|
+
- **When to include**: When the same code is being rewritten repeatedly or deterministic reliability is needed
|
|
78
|
+
- **Example**: `scripts/rotate_pdf.py` for PDF rotation tasks
|
|
79
|
+
- **Benefits**: Token efficient, deterministic, may be executed without loading into context
|
|
80
|
+
- **Note**: Scripts may still need to be read by Claude for patching or environment-specific adjustments
|
|
81
|
+
|
|
82
|
+
##### References (`references/`)
|
|
83
|
+
|
|
84
|
+
Documentation and reference material intended to be loaded as needed into context to inform Claude's process and thinking.
|
|
85
|
+
|
|
86
|
+
- **When to include**: For documentation that Claude should reference while working
|
|
87
|
+
- **Examples**: `references/finance.md` for financial schemas, `references/mnda.md` for company NDA template, `references/policies.md` for company policies, `references/api_docs.md` for API specifications
|
|
88
|
+
- **Use cases**: Database schemas, API documentation, domain knowledge, company policies, detailed workflow guides
|
|
89
|
+
- **Benefits**: Keeps SKILL.md lean, loaded only when Claude determines it's needed
|
|
90
|
+
- **Best practice**: If files are large (>10k words), include grep search patterns in SKILL.md
|
|
91
|
+
- **Avoid duplication**: Information should live in either SKILL.md or references files, not both. Prefer references files for detailed information unless it's truly core to the skill—this keeps SKILL.md lean while making information discoverable without hogging the context window. Keep only essential procedural instructions and workflow guidance in SKILL.md; move detailed reference material, schemas, and examples to references files.
|
|
92
|
+
|
|
93
|
+
##### Assets (`assets/`)
|
|
94
|
+
|
|
95
|
+
Files not intended to be loaded into context, but rather used within the output Claude produces.
|
|
96
|
+
|
|
97
|
+
- **When to include**: When the skill needs files that will be used in the final output
|
|
98
|
+
- **Examples**: `assets/logo.png` for brand assets, `assets/slides.pptx` for PowerPoint templates, `assets/frontend-template/` for HTML/React boilerplate, `assets/font.ttf` for typography
|
|
99
|
+
- **Use cases**: Templates, images, icons, boilerplate code, fonts, sample documents that get copied or modified
|
|
100
|
+
- **Benefits**: Separates output resources from documentation, enables Claude to use files without loading them into context
|
|
101
|
+
|
|
102
|
+
#### What to Not Include in a Skill
|
|
103
|
+
|
|
104
|
+
A skill should only contain essential files that directly support its functionality. Do NOT create extraneous documentation or auxiliary files, including:
|
|
105
|
+
|
|
106
|
+
- README.md
|
|
107
|
+
- INSTALLATION_GUIDE.md
|
|
108
|
+
- QUICK_REFERENCE.md
|
|
109
|
+
- CHANGELOG.md
|
|
110
|
+
- etc.
|
|
111
|
+
|
|
112
|
+
The skill should only contain the information needed for an AI agent to do the job at hand. It should not contain auxilary context about the process that went into creating it, setup and testing procedures, user-facing documentation, etc. Creating additional documentation files just adds clutter and confusion.
|
|
113
|
+
|
|
114
|
+
### Progressive Disclosure Design Principle
|
|
115
|
+
|
|
116
|
+
Skills use a three-level loading system to manage context efficiently:
|
|
117
|
+
|
|
118
|
+
1. **Metadata (name + description)** - Always in context (~100 words)
|
|
119
|
+
2. **SKILL.md body** - When skill triggers (<5k words)
|
|
120
|
+
3. **Bundled resources** - As needed by Claude (Unlimited because scripts can be executed without reading into context window)
|
|
121
|
+
|
|
122
|
+
#### Progressive Disclosure Patterns
|
|
123
|
+
|
|
124
|
+
Keep SKILL.md body to the essentials and under 500 lines to minimize context bloat. Split content into separate files when approaching this limit. When splitting out content into other files, it is very important to reference them from SKILL.md and describe clearly when to read them, to ensure the reader of the skill knows they exist and when to use them.
|
|
125
|
+
|
|
126
|
+
**Key principle:** When a skill supports multiple variations, frameworks, or options, keep only the core workflow and selection guidance in SKILL.md. Move variant-specific details (patterns, examples, configuration) into separate reference files.
|
|
127
|
+
|
|
128
|
+
**Pattern 1: High-level guide with references**
|
|
129
|
+
|
|
130
|
+
```markdown
|
|
131
|
+
# PDF Processing
|
|
132
|
+
|
|
133
|
+
## Quick start
|
|
134
|
+
|
|
135
|
+
Extract text with pdfplumber:
|
|
136
|
+
[code example]
|
|
137
|
+
|
|
138
|
+
## Advanced features
|
|
139
|
+
|
|
140
|
+
- **Form filling**: See [FORMS.md](FORMS.md) for complete guide
|
|
141
|
+
- **API reference**: See [REFERENCE.md](REFERENCE.md) for all methods
|
|
142
|
+
- **Examples**: See [EXAMPLES.md](EXAMPLES.md) for common patterns
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Claude loads FORMS.md, REFERENCE.md, or EXAMPLES.md only when needed.
|
|
146
|
+
|
|
147
|
+
**Pattern 2: Domain-specific organization**
|
|
148
|
+
|
|
149
|
+
For Skills with multiple domains, organize content by domain to avoid loading irrelevant context:
|
|
150
|
+
|
|
151
|
+
```
|
|
152
|
+
bigquery-skill/
|
|
153
|
+
├── SKILL.md (overview and navigation)
|
|
154
|
+
└── reference/
|
|
155
|
+
├── finance.md (revenue, billing metrics)
|
|
156
|
+
├── sales.md (opportunities, pipeline)
|
|
157
|
+
├── product.md (API usage, features)
|
|
158
|
+
└── marketing.md (campaigns, attribution)
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
When a user asks about sales metrics, Claude only reads sales.md.
|
|
162
|
+
|
|
163
|
+
Similarly, for skills supporting multiple frameworks or variants, organize by variant:
|
|
164
|
+
|
|
165
|
+
```
|
|
166
|
+
cloud-deploy/
|
|
167
|
+
├── SKILL.md (workflow + provider selection)
|
|
168
|
+
└── references/
|
|
169
|
+
├── aws.md (AWS deployment patterns)
|
|
170
|
+
├── gcp.md (GCP deployment patterns)
|
|
171
|
+
└── azure.md (Azure deployment patterns)
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
When the user chooses AWS, Claude only reads aws.md.
|
|
175
|
+
|
|
176
|
+
**Pattern 3: Conditional details**
|
|
177
|
+
|
|
178
|
+
Show basic content, link to advanced content:
|
|
179
|
+
|
|
180
|
+
```markdown
|
|
181
|
+
# DOCX Processing
|
|
182
|
+
|
|
183
|
+
## Creating documents
|
|
184
|
+
|
|
185
|
+
Use docx-js for new documents. See [DOCX-JS.md](DOCX-JS.md).
|
|
186
|
+
|
|
187
|
+
## Editing documents
|
|
188
|
+
|
|
189
|
+
For simple edits, modify the XML directly.
|
|
190
|
+
|
|
191
|
+
**For tracked changes**: See [REDLINING.md](REDLINING.md)
|
|
192
|
+
**For OOXML details**: See [OOXML.md](OOXML.md)
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
Claude reads REDLINING.md or OOXML.md only when the user needs those features.
|
|
196
|
+
|
|
197
|
+
**Important guidelines:**
|
|
198
|
+
|
|
199
|
+
- **Avoid deeply nested references** - Keep references one level deep from SKILL.md. All reference files should link directly from SKILL.md.
|
|
200
|
+
- **Structure longer reference files** - For files longer than 100 lines, include a table of contents at the top so Claude can see the full scope when previewing.
|
|
201
|
+
|
|
202
|
+
## Skill Creation Process
|
|
203
|
+
|
|
204
|
+
Skill creation involves these steps:
|
|
205
|
+
|
|
206
|
+
1. Understand the skill with concrete examples
|
|
207
|
+
2. Plan reusable skill contents (scripts, references, assets)
|
|
208
|
+
3. Initialize the skill (use `skills_init` tool)
|
|
209
|
+
4. Edit the skill (implement resources and write SKILL.md)
|
|
210
|
+
5. Validate the skill (use `bun scripts/validate-skill.ts`)
|
|
211
|
+
6. Iterate based on real usage
|
|
212
|
+
|
|
213
|
+
Follow these steps in order, skipping only if there is a clear reason why they are not applicable.
|
|
214
|
+
|
|
215
|
+
### Step 1: Understanding the Skill with Concrete Examples
|
|
216
|
+
|
|
217
|
+
Skip this step only when the skill's usage patterns are already clearly understood. It remains valuable even when working with an existing skill.
|
|
218
|
+
|
|
219
|
+
To create an effective skill, clearly understand concrete examples of how the skill will be used. This understanding can come from either direct user examples or generated examples that are validated with user feedback.
|
|
220
|
+
|
|
221
|
+
For example, when building an image-editor skill, relevant questions include:
|
|
222
|
+
|
|
223
|
+
- "What functionality should the image-editor skill support? Editing, rotating, anything else?"
|
|
224
|
+
- "Can you give some examples of how this skill would be used?"
|
|
225
|
+
- "I can imagine users asking for things like 'Remove the red-eye from this image' or 'Rotate this image'. Are there other ways you imagine this skill being used?"
|
|
226
|
+
- "What would a user say that should trigger this skill?"
|
|
227
|
+
|
|
228
|
+
To avoid overwhelming users, avoid asking too many questions in a single message. Start with the most important questions and follow up as needed for better effectiveness.
|
|
229
|
+
|
|
230
|
+
Conclude this step when there is a clear sense of the functionality the skill should support.
|
|
231
|
+
|
|
232
|
+
### Step 2: Planning the Reusable Skill Contents
|
|
233
|
+
|
|
234
|
+
To turn concrete examples into an effective skill, analyze each example by:
|
|
235
|
+
|
|
236
|
+
1. Considering how to execute on the example from scratch
|
|
237
|
+
2. Identifying what scripts, references, and assets would be helpful when executing these workflows repeatedly
|
|
238
|
+
|
|
239
|
+
Example: When building a `pdf-editor` skill to handle queries like "Help me rotate this PDF," the analysis shows:
|
|
240
|
+
|
|
241
|
+
1. Rotating a PDF requires re-writing the same code each time
|
|
242
|
+
2. A `scripts/rotate_pdf.py` script would be helpful to store in the skill
|
|
243
|
+
|
|
244
|
+
Example: When designing a `frontend-webapp-builder` skill for queries like "Build me a todo app" or "Build me a dashboard to track my steps," the analysis shows:
|
|
245
|
+
|
|
246
|
+
1. Writing a frontend webapp requires the same boilerplate HTML/React each time
|
|
247
|
+
2. An `assets/hello-world/` template containing the boilerplate HTML/React project files would be helpful to store in the skill
|
|
248
|
+
|
|
249
|
+
Example: When building a `big-query` skill to handle queries like "How many users have logged in today?" the analysis shows:
|
|
250
|
+
|
|
251
|
+
1. Querying BigQuery requires re-discovering the table schemas and relationships each time
|
|
252
|
+
2. A `references/schema.md` file documenting the table schemas would be helpful to store in the skill
|
|
253
|
+
|
|
254
|
+
To establish the skill's contents, analyze each concrete example to create a list of the reusable resources to include: scripts, references, and assets.
|
|
255
|
+
|
|
256
|
+
### Step 3: Initializing the Skill
|
|
257
|
+
|
|
258
|
+
At this point, it is time to actually create the skill.
|
|
259
|
+
|
|
260
|
+
Skip this step only if the skill being developed already exists, and iteration or packaging is needed. In this case, continue to the next step.
|
|
261
|
+
|
|
262
|
+
When creating a new skill from scratch, use the `skills_init` tool. This generates a new template skill directory with everything a skill requires.
|
|
263
|
+
|
|
264
|
+
Usage:
|
|
265
|
+
|
|
266
|
+
```
|
|
267
|
+
skills_init(name: "my-skill", directory: ".opencode/skills")
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
Or from CLI:
|
|
271
|
+
```bash
|
|
272
|
+
bun scripts/init-skill.ts my-skill --path .opencode/skills
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
The tool:
|
|
276
|
+
|
|
277
|
+
- Creates the skill directory at the specified path
|
|
278
|
+
- Generates a SKILL.md template with proper frontmatter and TODO placeholders
|
|
279
|
+
- Creates `scripts/` and `references/` directories with examples
|
|
280
|
+
- Adds example files that can be customized or deleted
|
|
281
|
+
|
|
282
|
+
After initialization, customize or remove the generated SKILL.md and example files as needed.
|
|
283
|
+
|
|
284
|
+
### Step 4: Edit the Skill
|
|
285
|
+
|
|
286
|
+
When editing the (newly-generated or existing) skill, remember that the skill is being created for another instance of Claude to use. Include information that would be beneficial and non-obvious to Claude. Consider what procedural knowledge, domain-specific details, or reusable assets would help another Claude instance execute these tasks more effectively.
|
|
287
|
+
|
|
288
|
+
#### Learn Proven Design Patterns
|
|
289
|
+
|
|
290
|
+
Consult these helpful guides based on your skill's needs:
|
|
291
|
+
|
|
292
|
+
- **Multi-step processes**: See references/workflows.md for sequential workflows and conditional logic
|
|
293
|
+
- **Specific output formats or quality standards**: See references/output-patterns.md for template and example patterns
|
|
294
|
+
|
|
295
|
+
These files contain established best practices for effective skill design.
|
|
296
|
+
|
|
297
|
+
#### Start with Reusable Skill Contents
|
|
298
|
+
|
|
299
|
+
To begin implementation, start with the reusable resources identified above: `scripts/`, `references/`, and `assets/` files. Note that this step may require user input. For example, when implementing a `brand-guidelines` skill, the user may need to provide brand assets or templates to store in `assets/`, or documentation to store in `references/`.
|
|
300
|
+
|
|
301
|
+
Added scripts must be tested by actually running them to ensure there are no bugs and that the output matches what is expected. If there are many similar scripts, only a representative sample needs to be tested to ensure confidence that they all work while balancing time to completion.
|
|
302
|
+
|
|
303
|
+
Any example files and directories not needed for the skill should be deleted. The initialization script creates example files in `scripts/`, `references/`, and `assets/` to demonstrate structure, but most skills won't need all of them.
|
|
304
|
+
|
|
305
|
+
#### Update SKILL.md
|
|
306
|
+
|
|
307
|
+
**Writing Guidelines:** Always use imperative/infinitive form.
|
|
308
|
+
|
|
309
|
+
##### Frontmatter
|
|
310
|
+
|
|
311
|
+
Write the YAML frontmatter with `name` and `description`:
|
|
312
|
+
|
|
313
|
+
- `name`: The skill name
|
|
314
|
+
- `description`: This is the primary triggering mechanism for your skill, and helps Claude understand when to use the skill.
|
|
315
|
+
- Include both what the Skill does and specific triggers/contexts for when to use it.
|
|
316
|
+
- Include all "when to use" information here - Not in the body. The body is only loaded after triggering, so "When to Use This Skill" sections in the body are not helpful to Claude.
|
|
317
|
+
- Example description for a `docx` skill: "Comprehensive document creation, editing, and analysis with support for tracked changes, comments, formatting preservation, and text extraction. Use when Claude needs to work with professional documents (.docx files) for: (1) Creating new documents, (2) Modifying or editing content, (3) Working with tracked changes, (4) Adding comments, or any other document tasks"
|
|
318
|
+
|
|
319
|
+
Do not include any other fields in YAML frontmatter.
|
|
320
|
+
|
|
321
|
+
##### Body
|
|
322
|
+
|
|
323
|
+
Write instructions for using the skill and its bundled resources.
|
|
324
|
+
|
|
325
|
+
### Step 5: Validating the Skill
|
|
326
|
+
|
|
327
|
+
Before sharing, validate the skill to ensure it meets requirements:
|
|
328
|
+
|
|
329
|
+
```bash
|
|
330
|
+
bun scripts/validate-skill.ts .opencode/skills/my-skill
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
The validator checks:
|
|
334
|
+
|
|
335
|
+
- YAML frontmatter format and required fields (name, description)
|
|
336
|
+
- Skill naming conventions match directory name
|
|
337
|
+
- Description completeness (no TODO placeholders, appropriate length)
|
|
338
|
+
- File organization (no extraneous README.md, etc.)
|
|
339
|
+
- Placeholder files that should be removed or customized
|
|
340
|
+
|
|
341
|
+
Fix any validation errors before sharing or committing the skill.
|
|
342
|
+
|
|
343
|
+
### Step 6: Iterate
|
|
344
|
+
|
|
345
|
+
After testing the skill, users may request improvements. Often this happens right after using the skill, with fresh context of how the skill performed.
|
|
346
|
+
|
|
347
|
+
**Iteration workflow:**
|
|
348
|
+
|
|
349
|
+
1. Use the skill on real tasks
|
|
350
|
+
2. Notice struggles or inefficiencies
|
|
351
|
+
3. Identify how SKILL.md or bundled resources should be updated
|
|
352
|
+
4. Implement changes and test again
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# Output Patterns
|
|
2
|
+
|
|
3
|
+
Use these patterns when skills need to produce consistent, high-quality output.
|
|
4
|
+
|
|
5
|
+
## Template Pattern
|
|
6
|
+
|
|
7
|
+
Provide templates for output format. Match the level of strictness to your needs.
|
|
8
|
+
|
|
9
|
+
**For strict requirements (like API responses or data formats):**
|
|
10
|
+
|
|
11
|
+
```markdown
|
|
12
|
+
## Report structure
|
|
13
|
+
|
|
14
|
+
ALWAYS use this exact template structure:
|
|
15
|
+
|
|
16
|
+
# [Analysis Title]
|
|
17
|
+
|
|
18
|
+
## Executive summary
|
|
19
|
+
[One-paragraph overview of key findings]
|
|
20
|
+
|
|
21
|
+
## Key findings
|
|
22
|
+
- Finding 1 with supporting data
|
|
23
|
+
- Finding 2 with supporting data
|
|
24
|
+
- Finding 3 with supporting data
|
|
25
|
+
|
|
26
|
+
## Recommendations
|
|
27
|
+
1. Specific actionable recommendation
|
|
28
|
+
2. Specific actionable recommendation
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
**For flexible guidance (when adaptation is useful):**
|
|
32
|
+
|
|
33
|
+
```markdown
|
|
34
|
+
## Report structure
|
|
35
|
+
|
|
36
|
+
Here is a sensible default format, but use your best judgment:
|
|
37
|
+
|
|
38
|
+
# [Analysis Title]
|
|
39
|
+
|
|
40
|
+
## Executive summary
|
|
41
|
+
[Overview]
|
|
42
|
+
|
|
43
|
+
## Key findings
|
|
44
|
+
[Adapt sections based on what you discover]
|
|
45
|
+
|
|
46
|
+
## Recommendations
|
|
47
|
+
[Tailor to the specific context]
|
|
48
|
+
|
|
49
|
+
Adjust sections as needed for the specific analysis type.
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Examples Pattern
|
|
53
|
+
|
|
54
|
+
For skills where output quality depends on seeing examples, provide input/output pairs:
|
|
55
|
+
|
|
56
|
+
```markdown
|
|
57
|
+
## Commit message format
|
|
58
|
+
|
|
59
|
+
Generate commit messages following these examples:
|
|
60
|
+
|
|
61
|
+
**Example 1:**
|
|
62
|
+
Input: Added user authentication with JWT tokens
|
|
63
|
+
Output:
|
|
64
|
+
```
|
|
65
|
+
feat(auth): implement JWT-based authentication
|
|
66
|
+
|
|
67
|
+
Add login endpoint and token validation middleware
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
**Example 2:**
|
|
71
|
+
Input: Fixed bug where dates displayed incorrectly in reports
|
|
72
|
+
Output:
|
|
73
|
+
```
|
|
74
|
+
fix(reports): correct date formatting in timezone conversion
|
|
75
|
+
|
|
76
|
+
Use UTC timestamps consistently across report generation
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Follow this style: type(scope): brief description, then detailed explanation.
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Examples help Claude understand the desired style and level of detail more clearly than descriptions alone.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Workflow Patterns
|
|
2
|
+
|
|
3
|
+
## Sequential Workflows
|
|
4
|
+
|
|
5
|
+
For complex tasks, break operations into clear, sequential steps. It is often helpful to give Claude an overview of the process towards the beginning of SKILL.md:
|
|
6
|
+
|
|
7
|
+
```markdown
|
|
8
|
+
Filling a PDF form involves these steps:
|
|
9
|
+
|
|
10
|
+
1. Analyze the form (run analyze_form.py)
|
|
11
|
+
2. Create field mapping (edit fields.json)
|
|
12
|
+
3. Validate mapping (run validate_fields.py)
|
|
13
|
+
4. Fill the form (run fill_form.py)
|
|
14
|
+
5. Verify output (run verify_output.py)
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Conditional Workflows
|
|
18
|
+
|
|
19
|
+
For tasks with branching logic, guide Claude through decision points:
|
|
20
|
+
|
|
21
|
+
```markdown
|
|
22
|
+
1. Determine the modification type:
|
|
23
|
+
**Creating new content?** → Follow "Creation workflow" below
|
|
24
|
+
**Editing existing content?** → Follow "Editing workflow" below
|
|
25
|
+
|
|
26
|
+
2. Creation workflow: [steps]
|
|
27
|
+
3. Editing workflow: [steps]
|
|
28
|
+
```
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: swarm-coordination
|
|
3
|
+
description: Multi-agent coordination patterns for OpenCode swarm workflows. Use when working on complex tasks that benefit from parallelization, when coordinating multiple agents, or when managing task decomposition. Do NOT use for simple single-agent tasks.
|
|
4
|
+
tags:
|
|
5
|
+
- swarm
|
|
6
|
+
- multi-agent
|
|
7
|
+
- coordination
|
|
8
|
+
tools:
|
|
9
|
+
- swarm_decompose
|
|
10
|
+
- swarm_complete
|
|
11
|
+
- swarm_spawn_subtask
|
|
12
|
+
- agentmail_init
|
|
13
|
+
- agentmail_send
|
|
14
|
+
- agentmail_inbox
|
|
15
|
+
- agentmail_reserve
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
# Swarm Coordination Skill
|
|
19
|
+
|
|
20
|
+
This skill provides guidance for effective multi-agent coordination in OpenCode swarm workflows.
|
|
21
|
+
|
|
22
|
+
## When to Use Swarm Coordination
|
|
23
|
+
|
|
24
|
+
Use swarm coordination when:
|
|
25
|
+
|
|
26
|
+
- A task has multiple independent subtasks that can run in parallel
|
|
27
|
+
- The task requires different specializations (e.g., frontend + backend + tests)
|
|
28
|
+
- Work can be divided by file/module boundaries
|
|
29
|
+
- Time-to-completion matters and parallelization helps
|
|
30
|
+
|
|
31
|
+
Do NOT use swarm coordination when:
|
|
32
|
+
|
|
33
|
+
- The task is simple and can be done by one agent
|
|
34
|
+
- Subtasks have heavy dependencies on each other
|
|
35
|
+
- The overhead of coordination exceeds the benefit
|
|
36
|
+
|
|
37
|
+
## Task Decomposition Strategy
|
|
38
|
+
|
|
39
|
+
### 1. Analyze the Task
|
|
40
|
+
|
|
41
|
+
Before decomposing, understand:
|
|
42
|
+
|
|
43
|
+
- What are the distinct units of work?
|
|
44
|
+
- Which parts can run in parallel vs sequentially?
|
|
45
|
+
- What are the file/module boundaries?
|
|
46
|
+
- Are there shared resources that need coordination?
|
|
47
|
+
|
|
48
|
+
### 2. Choose a Decomposition Strategy
|
|
49
|
+
|
|
50
|
+
**Parallel Strategy** - For independent subtasks:
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
Parent Task: "Add user authentication"
|
|
54
|
+
├── Subtask 1: "Create auth API endpoints" (backend)
|
|
55
|
+
├── Subtask 2: "Build login/signup forms" (frontend)
|
|
56
|
+
├── Subtask 3: "Write auth integration tests" (testing)
|
|
57
|
+
└── Subtask 4: "Add auth documentation" (docs)
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
**Sequential Strategy** - When order matters:
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
Parent Task: "Migrate database schema"
|
|
64
|
+
├── Step 1: "Create migration files"
|
|
65
|
+
├── Step 2: "Update model definitions"
|
|
66
|
+
├── Step 3: "Run migrations"
|
|
67
|
+
└── Step 4: "Verify data integrity"
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
**Hybrid Strategy** - Mixed dependencies:
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
Parent Task: "Add feature X"
|
|
74
|
+
├── Phase 1 (parallel):
|
|
75
|
+
│ ├── Subtask A: "Design API"
|
|
76
|
+
│ └── Subtask B: "Design UI mockups"
|
|
77
|
+
├── Phase 2 (sequential, after Phase 1):
|
|
78
|
+
│ └── Subtask C: "Implement based on designs"
|
|
79
|
+
└── Phase 3 (parallel):
|
|
80
|
+
├── Subtask D: "Write tests"
|
|
81
|
+
└── Subtask E: "Update docs"
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## File Reservation Protocol
|
|
85
|
+
|
|
86
|
+
When multiple agents work on the same codebase:
|
|
87
|
+
|
|
88
|
+
1. **Reserve files before editing** - Use `agentmail_reserve` to claim files
|
|
89
|
+
2. **Respect reservations** - Don't edit files reserved by other agents
|
|
90
|
+
3. **Release when done** - Files auto-release on task completion
|
|
91
|
+
4. **Coordinate on shared files** - If you must edit a reserved file, send a message to the owning agent
|
|
92
|
+
|
|
93
|
+
## Communication Patterns
|
|
94
|
+
|
|
95
|
+
### Broadcasting Updates
|
|
96
|
+
|
|
97
|
+
```
|
|
98
|
+
agentmail_send(to: ["all"], subject: "API Complete", body: "Completed API endpoints, ready for frontend integration")
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Direct Coordination
|
|
102
|
+
|
|
103
|
+
```
|
|
104
|
+
agentmail_send(to: ["frontend-agent"], subject: "Auth API Ready", body: "Auth API is at /api/auth/*, here's the spec...")
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Checking for Messages
|
|
108
|
+
|
|
109
|
+
```
|
|
110
|
+
# Check inbox for updates (context-safe: max 5, no bodies)
|
|
111
|
+
agentmail_inbox()
|
|
112
|
+
|
|
113
|
+
# Read specific message when needed
|
|
114
|
+
agentmail_read_message(message_id: 123)
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Best Practices
|
|
118
|
+
|
|
119
|
+
1. **Small, focused subtasks** - Each subtask should be completable in one agent session
|
|
120
|
+
2. **Clear boundaries** - Define exactly what files/modules each subtask touches
|
|
121
|
+
3. **Explicit handoffs** - When one task enables another, communicate clearly
|
|
122
|
+
4. **Graceful failures** - If a subtask fails, don't block the whole swarm
|
|
123
|
+
5. **Progress updates** - Use beads to track subtask status
|
|
124
|
+
|
|
125
|
+
## Common Patterns
|
|
126
|
+
|
|
127
|
+
### Feature Development
|
|
128
|
+
|
|
129
|
+
```yaml
|
|
130
|
+
decomposition:
|
|
131
|
+
strategy: hybrid
|
|
132
|
+
phases:
|
|
133
|
+
- name: design
|
|
134
|
+
parallel: true
|
|
135
|
+
subtasks: [api-design, ui-design]
|
|
136
|
+
- name: implement
|
|
137
|
+
parallel: true
|
|
138
|
+
subtasks: [backend, frontend]
|
|
139
|
+
- name: validate
|
|
140
|
+
parallel: true
|
|
141
|
+
subtasks: [tests, docs, review]
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### Bug Fix Swarm
|
|
145
|
+
|
|
146
|
+
```yaml
|
|
147
|
+
decomposition:
|
|
148
|
+
strategy: sequential
|
|
149
|
+
subtasks:
|
|
150
|
+
- reproduce-bug
|
|
151
|
+
- identify-root-cause
|
|
152
|
+
- implement-fix
|
|
153
|
+
- add-regression-test
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### Refactoring
|
|
157
|
+
|
|
158
|
+
```yaml
|
|
159
|
+
decomposition:
|
|
160
|
+
strategy: parallel
|
|
161
|
+
subtasks:
|
|
162
|
+
- refactor-module-a
|
|
163
|
+
- refactor-module-b
|
|
164
|
+
- update-imports
|
|
165
|
+
- run-full-test-suite
|
|
166
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-swarm-plugin",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.22",
|
|
4
4
|
"description": "Multi-agent swarm coordination for OpenCode with learning capabilities, beads integration, and Agent Mail",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
"scripts": {
|
|
21
21
|
"build": "bun build ./src/index.ts --outdir ./dist --target node && bun build ./src/plugin.ts --outfile ./dist/plugin.js --target node",
|
|
22
22
|
"dev": "bun --watch src/index.ts",
|
|
23
|
-
"test": "bun test src/schemas/",
|
|
24
|
-
"test:watch": "bun test --watch",
|
|
25
|
-
"test:integration": "
|
|
26
|
-
"test:all": "bun test",
|
|
23
|
+
"test": "bun test src/schemas src/skills",
|
|
24
|
+
"test:watch": "bun test --watch src/schemas src/skills",
|
|
25
|
+
"test:integration": "vitest run --config vitest.integration.config.ts",
|
|
26
|
+
"test:all": "bun test src/schemas src/skills && vitest run --config vitest.integration.config.ts",
|
|
27
27
|
"typecheck": "tsc --noEmit",
|
|
28
28
|
"clean": "rm -rf dist",
|
|
29
29
|
"release": "npm run build && npm version patch && git push && npm run publish:otp",
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@clack/prompts": "^0.11.0",
|
|
36
36
|
"@opencode-ai/plugin": "^1.0.134",
|
|
37
|
+
"gray-matter": "^4.0.3",
|
|
37
38
|
"ioredis": "^5.4.1",
|
|
38
39
|
"zod": "4.1.8"
|
|
39
40
|
},
|