@zenobius/opencode-skillful 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +221 -94
- package/dist/index.js +3 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,9 +5,52 @@ An interpretation of the [Anthropic Agent Skills Specification](https://github.c
|
|
|
5
5
|
Differentiators include:
|
|
6
6
|
|
|
7
7
|
- Conversationally the agent uses `skill_find words, words words` to discover skills
|
|
8
|
-
- The agent uses `skill_use
|
|
8
|
+
- The agent uses `skill_use "skill_name"` and,
|
|
9
9
|
- The agent can use `skill_resource skill_relative/resource/path` to read reference material
|
|
10
10
|
|
|
11
|
+
## Table of Contents
|
|
12
|
+
|
|
13
|
+
- [Quick Start](#quick-start) - Get started in 2 minutes
|
|
14
|
+
- [Installation](#installation) - Set up the plugin
|
|
15
|
+
- [Key Differences from Built-in OpenCode](#key-differences-from-built-in-opencode) - Why choose opencode-skillful
|
|
16
|
+
- [Three Core Tools](#three-core-tools) - Overview of skill_find, skill_use, skill_resource
|
|
17
|
+
- [Running Skill Scripts](#running-skill-scripts) - How agents execute skill scripts
|
|
18
|
+
- [Usage Examples](#usage-examples) - Real-world scenarios
|
|
19
|
+
- [Plugin Tools](#plugin-tools) - Detailed tool documentation
|
|
20
|
+
- [Configuration](#configuration) - Advanced setup
|
|
21
|
+
- [Architecture](#architecture) - How it works internally
|
|
22
|
+
- [Creating Skills](#creating-skills) - Build your own skills
|
|
23
|
+
|
|
24
|
+
## Quick Start
|
|
25
|
+
|
|
26
|
+
Get up and running with three common tasks:
|
|
27
|
+
|
|
28
|
+
### 1. Find Skills by Keyword
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
skill_find "git commit"
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Searches for skills related to writing git commits. Returns matching skills sorted by relevance.
|
|
35
|
+
|
|
36
|
+
### 2. Load a Skill into Your Chat
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
skill_use "experts_writing_git_commits"
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Loads the skill into your chat context. The AI agent can now reference it when giving advice.
|
|
43
|
+
|
|
44
|
+
### 3. Read a Skill's Reference Document
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
skill_resource skill_name="experts_writing_git_commits" relative_path="references/guide.md"
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Access specific documentation or templates from a skill without loading the entire skill.
|
|
51
|
+
|
|
52
|
+
**Next steps:** See [Usage Examples](#usage-examples) for real-world scenarios, or jump to [Plugin Tools](#plugin-tools) for detailed documentation.
|
|
53
|
+
|
|
11
54
|
## Installation
|
|
12
55
|
|
|
13
56
|
Create or edit your OpenCode configuration file (typically `~/.config/opencode/config.json`):
|
|
@@ -18,53 +61,162 @@ Create or edit your OpenCode configuration file (typically `~/.config/opencode/c
|
|
|
18
61
|
}
|
|
19
62
|
```
|
|
20
63
|
|
|
21
|
-
##
|
|
64
|
+
## Key Differences from Built-in OpenCode
|
|
22
65
|
|
|
23
|
-
|
|
66
|
+
This plugin takes a different approach than OpenCode's built-in skills implementation:
|
|
24
67
|
|
|
25
|
-
|
|
26
|
-
|
|
68
|
+
| Aspect | Built-in OpenCode | opencode-skillful |
|
|
69
|
+
| ------------------------ | ----------------------------------------------- | --------------------------------------------- |
|
|
70
|
+
| **Skill Loading** | All skills pre-loaded into context by default | Skills loaded on-demand only |
|
|
71
|
+
| **Memory Overhead** | All skills consume tokens in every conversation | Only loaded skills consume tokens |
|
|
72
|
+
| **Format Configuration** | Fixed format (usually markdown) | Per-model configuration (JSON, XML, Markdown) |
|
|
73
|
+
| **Skill Discovery** | Limited, built-in set | Extensible, custom skills in any directory |
|
|
74
|
+
| **Resource Access** | Direct filesystem (less secure) | Pre-indexed resources (security-first) |
|
|
27
75
|
|
|
28
|
-
|
|
29
|
-
2. Load the most relevant skill using skill_use
|
|
30
|
-
3. Apply the loaded skill guidance to write my commit message
|
|
31
|
-
```
|
|
76
|
+
### On-Demand Skill Injection
|
|
32
77
|
|
|
33
|
-
**
|
|
78
|
+
Unlike built-in skills that load automatically, opencode-skillful uses **lazy loading**:
|
|
34
79
|
|
|
35
|
-
-
|
|
36
|
-
-
|
|
37
|
-
-
|
|
80
|
+
- Skills are discovered at initialization but not injected until you explicitly request them
|
|
81
|
+
- Only the skills you use consume tokens in your conversation
|
|
82
|
+
- Reduces context bloat and improves efficiency with large skill libraries
|
|
83
|
+
- Perfect for workflows with 50+ skills where you might use 2-3 per conversation
|
|
38
84
|
|
|
39
|
-
###
|
|
85
|
+
### Provider-Model Specific Format Configuration
|
|
40
86
|
|
|
41
|
-
|
|
42
|
-
What skills are available? Show me everything under the "experts" category.
|
|
87
|
+
Different LLM providers prefer different formats. Configure which format each model receives:
|
|
43
88
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
89
|
+
```json
|
|
90
|
+
{
|
|
91
|
+
"promptRenderer": "xml",
|
|
92
|
+
"modelRenderers": {
|
|
93
|
+
"claude-3-5-sonnet": "xml",
|
|
94
|
+
"gpt-4": "json",
|
|
95
|
+
"gpt-4-turbo": "json",
|
|
96
|
+
"llama-2-70b": "md"
|
|
97
|
+
}
|
|
98
|
+
}
|
|
47
99
|
```
|
|
48
100
|
|
|
49
|
-
|
|
101
|
+
This allows you to optimize skill injection for each model without creating duplicate skill documentation.
|
|
50
102
|
|
|
51
|
-
|
|
52
|
-
- Path prefix filtering (e.g., "experts", "superpowers/writing")
|
|
53
|
-
- Hierarchical skill organization
|
|
103
|
+
## Running Skill Scripts
|
|
54
104
|
|
|
55
|
-
|
|
105
|
+
Skills can include executable scripts in their `scripts/` directory. When a skill is loaded with `skill_use`, the agent receives the full inventory of available scripts and can be instructed to run them.
|
|
56
106
|
|
|
57
|
-
|
|
58
|
-
Find testing-related skills but exclude anything about performance testing.
|
|
107
|
+
**How it works:**
|
|
59
108
|
|
|
60
|
-
|
|
61
|
-
|
|
109
|
+
1. Skills reference scripts in their SKILL.md like: `./scripts/setup.sh`
|
|
110
|
+
2. When you load a skill with `skill_use`, the agent sees all available scripts in the resource inventory
|
|
111
|
+
3. You instruct the agent: "Run the setup script from this skill"
|
|
112
|
+
4. The agent determines the script path and executes it
|
|
113
|
+
|
|
114
|
+
**Example:**
|
|
115
|
+
|
|
116
|
+
Your skill's SKILL.md includes: `./scripts/generate-changelog.sh`
|
|
117
|
+
|
|
118
|
+
You ask: "Can you run the changelog generator from the build-utils skill?"
|
|
119
|
+
|
|
120
|
+
The agent:
|
|
121
|
+
|
|
122
|
+
- Loads the skill with `skill_use`
|
|
123
|
+
- Sees the script in the resource inventory
|
|
124
|
+
- Determines the path: `scripts/generate-changelog.sh`
|
|
125
|
+
- Runs the script with appropriate context
|
|
126
|
+
|
|
127
|
+
**Why this approach?**
|
|
128
|
+
|
|
129
|
+
Rather than a dedicated script execution tool, agents have full visibility into all skill resources and can intelligently decide when and how to run them based on your instructions and the task context. Scripts are referenced naturally in skill documentation (e.g., "Run `./scripts/setup.sh` to initialize") and agents can work out the paths and execution from context.
|
|
130
|
+
|
|
131
|
+
## Three Core Tools
|
|
132
|
+
|
|
133
|
+
The plugin provides three simple but powerful tools:
|
|
134
|
+
|
|
135
|
+
| Tool | Purpose | When to Use |
|
|
136
|
+
| ------------------ | ------------------------------- | -------------------------------------------------- |
|
|
137
|
+
| **skill_find** | Discover skills by keyword | You want to search for relevant skills |
|
|
138
|
+
| **skill_use** | Load skills into chat | You want the AI to reference a skill |
|
|
139
|
+
| **skill_resource** | Read specific files from skills | You need a template, guide, or script from a skill |
|
|
140
|
+
|
|
141
|
+
See [Plugin Tools](#plugin-tools) for complete documentation.
|
|
142
|
+
|
|
143
|
+
## Usage Examples
|
|
144
|
+
|
|
145
|
+
These real-world scenarios show how to use the three tools together:
|
|
146
|
+
|
|
147
|
+
### Scenario 1: Writing Better Git Commits
|
|
148
|
+
|
|
149
|
+
**You want:** The AI to help you write a commit message following best practices.
|
|
150
|
+
|
|
151
|
+
**Steps:**
|
|
152
|
+
|
|
153
|
+
1. Search for relevant skills:
|
|
154
|
+
|
|
155
|
+
```
|
|
156
|
+
skill_find "git commit"
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
2. Load the skill into your chat:
|
|
160
|
+
|
|
161
|
+
```
|
|
162
|
+
skill_use "experts_writing_git_commits"
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
3. Ask the AI: "Help me write a commit message for refactoring the auth module"
|
|
62
166
|
|
|
63
|
-
|
|
167
|
+
The AI now has the skill's guidance and can apply best practices to your request.
|
|
64
168
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
169
|
+
### Scenario 2: Finding and Exploring a Specific Skill's Resources
|
|
170
|
+
|
|
171
|
+
**You want:** Access a specific template or guide from a skill without loading the entire skill.
|
|
172
|
+
|
|
173
|
+
**Steps:**
|
|
174
|
+
|
|
175
|
+
1. Find skills in a category:
|
|
176
|
+
|
|
177
|
+
```
|
|
178
|
+
skill_find "testing"
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
2. Once you've identified a skill, read its resources:
|
|
182
|
+
```
|
|
183
|
+
skill_resource skill_name="testing-skill" relative_path="references/test-template.md"
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
This is useful when you just need a template or specific document, not full AI guidance.
|
|
187
|
+
|
|
188
|
+
### Scenario 3: Browsing and Discovering Skills
|
|
189
|
+
|
|
190
|
+
**You want:** See what skills are available under a specific category.
|
|
191
|
+
|
|
192
|
+
**Steps:**
|
|
193
|
+
|
|
194
|
+
1. List all skills:
|
|
195
|
+
|
|
196
|
+
```
|
|
197
|
+
skill_find "*"
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
2. Filter by category:
|
|
201
|
+
|
|
202
|
+
```
|
|
203
|
+
skill_find "experts"
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
3. Search with exclusions:
|
|
207
|
+
```
|
|
208
|
+
skill_find "testing -performance"
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
This searches for testing-related skills but excludes performance testing.
|
|
212
|
+
|
|
213
|
+
### Query Syntax Quick Reference
|
|
214
|
+
|
|
215
|
+
- `*` or empty: List all skills
|
|
216
|
+
- `keyword1 keyword2`: AND logic (all terms must match)
|
|
217
|
+
- `-term`: Exclude results matching this term
|
|
218
|
+
- `"exact phrase"`: Match exact phrase
|
|
219
|
+
- `experts`, `superpowers/writing`: Path prefix matching
|
|
68
220
|
|
|
69
221
|
## Features
|
|
70
222
|
|
|
@@ -214,10 +366,10 @@ When loading skills, use the full identifier:
|
|
|
214
366
|
|
|
215
367
|
```
|
|
216
368
|
# Load a skill by its identifier
|
|
217
|
-
skill_use
|
|
369
|
+
skill_use "experts_ai_agentic_engineer"
|
|
218
370
|
|
|
219
371
|
# Load multiple skills
|
|
220
|
-
skill_use
|
|
372
|
+
skill_use "experts_ai_agentic_engineer", "superpowers_writing_code_review"
|
|
221
373
|
```
|
|
222
374
|
|
|
223
375
|
### Reading Skill Resources
|
|
@@ -243,23 +395,9 @@ But when writing your skills, there's nothing stopping you from using `skill_res
|
|
|
243
395
|
|
|
244
396
|
(Just be aware that exotic file types might need special tooling to handle them properly.)
|
|
245
397
|
|
|
246
|
-
### Executing Skill Scripts
|
|
247
|
-
|
|
248
|
-
```
|
|
249
|
-
|
|
250
|
-
# Execute a script without arguments
|
|
251
|
-
|
|
252
|
-
skill_exec skill_name="build-utils" relative_path="scripts/generate-changelog.sh"
|
|
253
|
-
|
|
254
|
-
# Execute a script with arguments
|
|
255
|
-
|
|
256
|
-
skill_exec skill_name="code-generator" relative_path="scripts/gen.py" args=["--format", "json", "--output", "schema.json"]
|
|
257
|
-
|
|
258
|
-
```
|
|
259
|
-
|
|
260
398
|
## Plugin Tools
|
|
261
399
|
|
|
262
|
-
The plugin provides
|
|
400
|
+
The plugin provides three core tools implemented in `src/tools/`:
|
|
263
401
|
|
|
264
402
|
### `skill_find` (SkillFinder.ts)
|
|
265
403
|
|
|
@@ -300,6 +438,12 @@ Search for skills using natural query syntax with intelligent ranking by relevan
|
|
|
300
438
|
</SkillSearchResults>
|
|
301
439
|
```
|
|
302
440
|
|
|
441
|
+
Then load it with:
|
|
442
|
+
|
|
443
|
+
```
|
|
444
|
+
skill_use "experts_writing_git_commits"
|
|
445
|
+
```
|
|
446
|
+
|
|
303
447
|
### `skill_use` (SkillUser.ts)
|
|
304
448
|
|
|
305
449
|
Load one or more skills into the chat context with full resource metadata.
|
|
@@ -335,7 +479,7 @@ Read a specific resource file from a skill's directory and inject silently into
|
|
|
335
479
|
|
|
336
480
|
- Load specific reference documents or templates from a skill
|
|
337
481
|
- Access supporting files without loading the entire skill
|
|
338
|
-
- Retrieve examples, guides,
|
|
482
|
+
- Retrieve examples, guides, configuration templates, or scripts
|
|
339
483
|
- Most commonly used after loading a skill with `skill_use` to access its resources
|
|
340
484
|
|
|
341
485
|
**Parameters:**
|
|
@@ -343,6 +487,14 @@ Read a specific resource file from a skill's directory and inject silently into
|
|
|
343
487
|
- `skill_name`: The skill containing the resource (by toolName/FQDN or short name)
|
|
344
488
|
- `relative_path`: Path to the resource relative to the skill directory
|
|
345
489
|
|
|
490
|
+
**Resource Types:**
|
|
491
|
+
|
|
492
|
+
Can read any of the three resource types:
|
|
493
|
+
|
|
494
|
+
- `references/` - Documentation, guides, and reference materials
|
|
495
|
+
- `assets/` - Templates, images, binary files, and configuration files
|
|
496
|
+
- `scripts/` - Executable scripts (shell, Python, etc.) for viewing or analysis
|
|
497
|
+
|
|
346
498
|
**Returns:**
|
|
347
499
|
|
|
348
500
|
- MIME type of the resource
|
|
@@ -354,48 +506,36 @@ Read a specific resource file from a skill's directory and inject silently into
|
|
|
354
506
|
- Resolves relative paths within skill directory (e.g., `references/guide.md`, `assets/template.html`, `scripts/setup.sh`)
|
|
355
507
|
- Supports any text or binary file type
|
|
356
508
|
|
|
357
|
-
**Example
|
|
509
|
+
**Example Responses:**
|
|
510
|
+
|
|
511
|
+
Reference document:
|
|
358
512
|
|
|
359
513
|
```
|
|
360
514
|
Load Skill Resource
|
|
361
515
|
|
|
362
516
|
skill: experts/writing-git-commits
|
|
363
|
-
resource:
|
|
517
|
+
resource: references/commit-guide.md
|
|
364
518
|
type: text/markdown
|
|
365
519
|
```
|
|
366
520
|
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
Execute scripts from skill resources with optional arguments.
|
|
370
|
-
|
|
371
|
-
**Parameters:**
|
|
372
|
-
|
|
373
|
-
- `skill_name`: The skill containing the script (by toolName/FQDN or short name)
|
|
374
|
-
- `relative_path`: Path to the script file relative to the skill directory
|
|
375
|
-
- `args`: Optional array of string arguments to pass to the script
|
|
376
|
-
|
|
377
|
-
**Returns:**
|
|
378
|
-
|
|
379
|
-
- Exit code of the script execution
|
|
380
|
-
- Standard output (stdout)
|
|
381
|
-
- Standard error (stderr)
|
|
382
|
-
- Formatted text representation
|
|
521
|
+
Script file:
|
|
383
522
|
|
|
384
|
-
|
|
523
|
+
```
|
|
524
|
+
Load Skill Resource
|
|
385
525
|
|
|
386
|
-
|
|
387
|
-
-
|
|
388
|
-
|
|
389
|
-
|
|
526
|
+
skill: build-utils
|
|
527
|
+
resource: scripts/generate-changelog.sh
|
|
528
|
+
type: text/plain
|
|
529
|
+
```
|
|
390
530
|
|
|
391
|
-
|
|
531
|
+
Asset file:
|
|
392
532
|
|
|
393
533
|
```
|
|
394
|
-
|
|
534
|
+
Load Skill Resource
|
|
395
535
|
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
536
|
+
skill: brand-guidelines
|
|
537
|
+
resource: assets/logo-usage.html
|
|
538
|
+
type: text/html
|
|
399
539
|
```
|
|
400
540
|
|
|
401
541
|
## Error Handling
|
|
@@ -435,20 +575,6 @@ Resource loading failures occur when:
|
|
|
435
575
|
|
|
436
576
|
The tool returns an error message indicating which skill or resource path was problematic.
|
|
437
577
|
|
|
438
|
-
### skill_exec Errors
|
|
439
|
-
|
|
440
|
-
Script execution includes exit codes and error output:
|
|
441
|
-
|
|
442
|
-
```
|
|
443
|
-
Executed script from skill "build-utils": scripts/generate-changelog.sh
|
|
444
|
-
|
|
445
|
-
Exit Code: 1
|
|
446
|
-
STDOUT: (partial output)
|
|
447
|
-
STDERR: Permission denied: scripts/generate-changelog.sh
|
|
448
|
-
```
|
|
449
|
-
|
|
450
|
-
Non-zero exit codes indicate script failures. Always check STDERR and the exit code when troubleshooting.
|
|
451
|
-
|
|
452
578
|
## Configuration
|
|
453
579
|
|
|
454
580
|
The plugin loads configuration from **bunfig**, supporting both project-local and global configuration files:
|
|
@@ -599,6 +725,7 @@ The plugin uses a **layered, modular architecture** with clear separation of con
|
|
|
599
725
|
│ Plugin Entry Point (index.ts) │
|
|
600
726
|
│ - Defines 3 core tools: skill_find, skill_use, │
|
|
601
727
|
│ skill_resource │
|
|
728
|
+
│ - NOT including skill_exec (removed) │
|
|
602
729
|
│ - Initializes API factory and config │
|
|
603
730
|
│ - Manages message injection (XML serialization) │
|
|
604
731
|
└──────────────────────────────────────────────────────┘
|
|
@@ -946,8 +1073,8 @@ Skill resources are automatically discovered and categorized:
|
|
|
946
1073
|
- Useful for providing templates and examples to the AI
|
|
947
1074
|
- **Scripts** (`scripts/` directory): Executable scripts that perform actions
|
|
948
1075
|
- Shell scripts (.sh), Python scripts (.py), or other executables
|
|
949
|
-
-
|
|
950
|
-
- Useful for automation, code generation, or
|
|
1076
|
+
- Can be accessed via `skill_resource` for reading as files
|
|
1077
|
+
- Useful for providing automation scripts, code generation, or templates
|
|
951
1078
|
|
|
952
1079
|
## Considerations
|
|
953
1080
|
|
package/dist/index.js
CHANGED
|
@@ -17768,11 +17768,11 @@ import path from "path";
|
|
|
17768
17768
|
// src/services/SkillResourceResolver.ts
|
|
17769
17769
|
function createSkillResourceResolver(provider) {
|
|
17770
17770
|
const resolveResourceMap = (skill, type) => {
|
|
17771
|
-
if (type === "script") {
|
|
17771
|
+
if (type === "script" || type === "scripts") {
|
|
17772
17772
|
return skill.scripts;
|
|
17773
|
-
} else if (type === "asset") {
|
|
17773
|
+
} else if (type === "asset" || type === "assets") {
|
|
17774
17774
|
return skill.assets;
|
|
17775
|
-
} else if (type === "reference") {
|
|
17775
|
+
} else if (type === "reference" || type === "references") {
|
|
17776
17776
|
return skill.references;
|
|
17777
17777
|
} else {
|
|
17778
17778
|
throw new Error(`Unknown resource type: ${type}`);
|
|
@@ -17804,21 +17804,12 @@ function createSkillResourceResolver(provider) {
|
|
|
17804
17804
|
};
|
|
17805
17805
|
}
|
|
17806
17806
|
|
|
17807
|
-
// src/types.ts
|
|
17808
|
-
var ResourceTypes = ["script", "asset", "reference"];
|
|
17809
|
-
var assertIsValidResourceType = (type) => {
|
|
17810
|
-
if (!ResourceTypes.includes(type)) {
|
|
17811
|
-
throw new Error(`Invalid resource type: ${type}`);
|
|
17812
|
-
}
|
|
17813
|
-
};
|
|
17814
|
-
|
|
17815
17807
|
// src/tools/SkillResourceReader.ts
|
|
17816
17808
|
function createSkillResourceReader(provider) {
|
|
17817
17809
|
const skillResourceResolver = createSkillResourceResolver(provider);
|
|
17818
17810
|
return async (args) => {
|
|
17819
17811
|
await provider.controller.ready.whenReady();
|
|
17820
17812
|
const [type, ...restPath] = args.relative_path.split("/");
|
|
17821
|
-
assertIsValidResourceType(type);
|
|
17822
17813
|
const resource = await skillResourceResolver({
|
|
17823
17814
|
skill_name: args.skill_name,
|
|
17824
17815
|
type,
|