@fro.bot/systematic 1.14.0 → 1.16.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.
- package/README.md +29 -3
- package/package.json +4 -2
- package/skills/agent-browser/SKILL.md +1 -0
- package/skills/agent-native-architecture/SKILL.md +4 -4
- package/skills/agent-native-architecture/references/files-universal-interface.md +1 -1
- package/skills/agent-native-architecture/references/product-implications.md +1 -1
- package/skills/brainstorming/SKILL.md +1 -0
- package/skills/compound-docs/SKILL.md +14 -13
- package/skills/compound-docs/assets/critical-pattern-template.md +1 -1
- package/skills/compound-docs/assets/resolution-template.md +3 -3
- package/skills/compound-docs/references/yaml-schema.md +2 -2
- package/skills/create-agent-skills/SKILL.md +169 -192
- package/skills/create-agent-skills/references/api-security.md +24 -24
- package/skills/create-agent-skills/references/executable-code.md +1 -1
- package/skills/create-agent-skills/references/official-spec.md +74 -125
- package/skills/create-agent-skills/references/skill-structure.md +109 -329
- package/skills/create-agent-skills/workflows/add-reference.md +3 -3
- package/skills/create-agent-skills/workflows/add-script.md +2 -2
- package/skills/create-agent-skills/workflows/add-template.md +1 -1
- package/skills/create-agent-skills/workflows/add-workflow.md +5 -5
- package/skills/create-agent-skills/workflows/audit-skill.md +6 -6
- package/skills/create-agent-skills/workflows/create-domain-expertise-skill.md +8 -8
- package/skills/create-agent-skills/workflows/create-new-skill.md +8 -8
- package/skills/create-agent-skills/workflows/upgrade-to-router.md +5 -5
- package/skills/create-agent-skills/workflows/verify-skill.md +4 -4
- package/skills/document-review/SKILL.md +88 -0
- package/skills/file-todos/SKILL.md +3 -2
- package/skills/file-todos/assets/todo-template.md +1 -1
- package/skills/frontend-design/SKILL.md +43 -0
- package/skills/git-worktree/SKILL.md +23 -22
- package/skills/git-worktree/scripts/worktree-manager.sh +2 -10
- package/skills/orchestrating-swarms/SKILL.md +1718 -0
|
@@ -1,21 +1,35 @@
|
|
|
1
1
|
---
|
|
2
|
-
name:
|
|
3
|
-
description: Expert guidance for creating
|
|
2
|
+
name: create-agent-skills
|
|
3
|
+
description: Expert guidance for creating OpenCode skills and slash commands. Use when working with SKILL.md files, authoring new skills, improving existing skills, creating slash commands, or understanding skill structure and best practices.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# Creating
|
|
6
|
+
# Creating Skills & Commands
|
|
7
7
|
|
|
8
|
-
This skill teaches how to create effective
|
|
8
|
+
This skill teaches how to create effective OpenCode skills following the official specification from [code.claude.com/docs/en/skills](https://code.claude.com/docs/en/skills).
|
|
9
9
|
|
|
10
|
-
##
|
|
10
|
+
## Commands and Skills Are Now The Same Thing
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
Custom slash commands have been merged into skills. A file at `.opencode/commands/review.md` and a skill at `.opencode/skills/review/SKILL.md` both create `/review` and work the same way. Existing `.opencode/commands/` files keep working. Skills add optional features: a directory for supporting files, frontmatter to control invocation, and automatic context loading.
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
**If a skill and a command share the same name, the skill takes precedence.**
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
## When To Create What
|
|
17
17
|
|
|
18
|
-
Use
|
|
18
|
+
**Use a command file** (`commands/name.md`) when:
|
|
19
|
+
- Simple, single-file workflow
|
|
20
|
+
- No supporting files needed
|
|
21
|
+
- Task-oriented action (deploy, commit, triage)
|
|
22
|
+
|
|
23
|
+
**Use a skill directory** (`skills/name/SKILL.md`) when:
|
|
24
|
+
- Need supporting reference files, scripts, or templates
|
|
25
|
+
- Background knowledge Claude should auto-load
|
|
26
|
+
- Complex enough to benefit from progressive disclosure
|
|
27
|
+
|
|
28
|
+
Both use identical YAML frontmatter and markdown content format.
|
|
29
|
+
|
|
30
|
+
## Standard Markdown Format
|
|
31
|
+
|
|
32
|
+
Use YAML frontmatter + markdown body with **standard markdown headings**. Keep it clean and direct.
|
|
19
33
|
|
|
20
34
|
```markdown
|
|
21
35
|
---
|
|
@@ -35,265 +49,228 @@ Step-by-step procedures...
|
|
|
35
49
|
Concrete usage examples...
|
|
36
50
|
```
|
|
37
51
|
|
|
38
|
-
|
|
52
|
+
## Frontmatter Reference
|
|
39
53
|
|
|
40
|
-
|
|
54
|
+
All fields are optional. Only `description` is recommended.
|
|
41
55
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
56
|
+
| Field | Required | Description |
|
|
57
|
+
|-------|----------|-------------|
|
|
58
|
+
| `name` | No | Display name. Lowercase letters, numbers, hyphens (max 64 chars). Defaults to directory name. |
|
|
59
|
+
| `description` | Recommended | What it does AND when to use it. Claude uses this for auto-discovery. Max 1024 chars. |
|
|
60
|
+
| `argument-hint` | No | Hint shown during autocomplete. Example: `[issue-number]` |
|
|
61
|
+
| `disable-model-invocation` | No | Set `true` to prevent Claude auto-loading. Use for manual workflows like `/deploy`, `/commit`. Default: `false`. |
|
|
62
|
+
| `user-invocable` | No | Set `false` to hide from `/` menu. Use for background knowledge. Default: `true`. |
|
|
63
|
+
| `allowed-tools` | No | Tools Claude can use without permission prompts. Example: `Read, Bash(git *)` |
|
|
64
|
+
| `model` | No | Model to use. Options: `haiku`, `sonnet`, `opus`. |
|
|
65
|
+
| `context` | No | Set `fork` to run in isolated subagent context. |
|
|
66
|
+
| `agent` | No | Subagent type when `context: fork`. Options: `Explore`, `Plan`, `general-purpose`, or custom agent name. |
|
|
49
67
|
|
|
50
|
-
###
|
|
68
|
+
### Invocation Control
|
|
51
69
|
|
|
52
|
-
|
|
70
|
+
| Frontmatter | User can invoke | Claude can invoke | When loaded |
|
|
71
|
+
|-------------|----------------|-------------------|-------------|
|
|
72
|
+
| (default) | Yes | Yes | Description always in context, full content loads when invoked |
|
|
73
|
+
| `disable-model-invocation: true` | Yes | No | Description not in context, loads only when user invokes |
|
|
74
|
+
| `user-invocable: false` | No | Yes | Description always in context, loads when relevant |
|
|
75
|
+
|
|
76
|
+
**Use `disable-model-invocation: true`** for workflows with side effects: `/deploy`, `/commit`, `/triage-prs`, `/send-slack-message`. You don't want Claude deciding to deploy because your code looks ready.
|
|
77
|
+
|
|
78
|
+
**Use `user-invocable: false`** for background knowledge that isn't a meaningful user action: coding conventions, domain context, legacy system docs.
|
|
79
|
+
|
|
80
|
+
## Dynamic Features
|
|
81
|
+
|
|
82
|
+
### Arguments
|
|
83
|
+
|
|
84
|
+
Use `$ARGUMENTS` placeholder for user input. If not present in content, arguments are appended automatically.
|
|
53
85
|
|
|
54
|
-
**Good:**
|
|
55
86
|
```yaml
|
|
56
|
-
|
|
87
|
+
---
|
|
88
|
+
name: fix-issue
|
|
89
|
+
description: Fix a GitHub issue
|
|
90
|
+
disable-model-invocation: true
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
Fix GitHub issue $ARGUMENTS following our coding standards.
|
|
57
94
|
```
|
|
58
95
|
|
|
59
|
-
|
|
96
|
+
Access individual args: `$ARGUMENTS[0]` or shorthand `$0`, `$1`, `$2`.
|
|
97
|
+
|
|
98
|
+
### Dynamic Context Injection
|
|
99
|
+
|
|
100
|
+
The `` !`command` `` syntax runs shell commands before content is sent to Claude:
|
|
101
|
+
|
|
60
102
|
```yaml
|
|
61
|
-
|
|
62
|
-
|
|
103
|
+
---
|
|
104
|
+
name: pr-summary
|
|
105
|
+
description: Summarize changes in a pull request
|
|
106
|
+
context: fork
|
|
107
|
+
agent: Explore
|
|
108
|
+
---
|
|
63
109
|
|
|
64
|
-
##
|
|
110
|
+
## Context
|
|
111
|
+
- PR diff: !`gh pr diff`
|
|
112
|
+
- Changed files: !`gh pr diff --name-only`
|
|
65
113
|
|
|
66
|
-
|
|
114
|
+
Summarize this pull request...
|
|
115
|
+
```
|
|
67
116
|
|
|
68
|
-
|
|
69
|
-
|-------|----------|------------|-------------|
|
|
70
|
-
| `name` | Yes | 64 chars | Lowercase letters, numbers, hyphens only |
|
|
71
|
-
| `description` | Yes | 1024 chars | What it does AND when to use it |
|
|
72
|
-
| `allowed-tools` | No | - | Tools Claude can use without asking |
|
|
73
|
-
| `model` | No | - | Specific model to use |
|
|
117
|
+
### Running in a Subagent
|
|
74
118
|
|
|
75
|
-
|
|
119
|
+
Add `context: fork` to run in isolation. The skill content becomes the subagent's prompt. It won't have conversation history.
|
|
76
120
|
|
|
77
|
-
|
|
121
|
+
```yaml
|
|
122
|
+
---
|
|
123
|
+
name: deep-research
|
|
124
|
+
description: Research a topic thoroughly
|
|
125
|
+
context: fork
|
|
126
|
+
agent: Explore
|
|
127
|
+
---
|
|
78
128
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
129
|
+
Research $ARGUMENTS thoroughly:
|
|
130
|
+
1. Find relevant files
|
|
131
|
+
2. Analyze the code
|
|
132
|
+
3. Summarize findings
|
|
133
|
+
```
|
|
83
134
|
|
|
84
|
-
|
|
135
|
+
## Progressive Disclosure
|
|
85
136
|
|
|
86
|
-
|
|
137
|
+
Keep SKILL.md under 500 lines. Split detailed content into reference files:
|
|
87
138
|
|
|
88
|
-
|
|
139
|
+
```
|
|
140
|
+
my-skill/
|
|
141
|
+
├── SKILL.md # Entry point (required, overview + navigation)
|
|
142
|
+
├── reference.md # Detailed docs (loaded when needed)
|
|
143
|
+
├── examples.md # Usage examples (loaded when needed)
|
|
144
|
+
└── scripts/
|
|
145
|
+
└── helper.py # Utility script (executed, not loaded)
|
|
146
|
+
```
|
|
89
147
|
|
|
90
|
-
|
|
91
|
-
# Skill Name
|
|
148
|
+
Link from SKILL.md: `For API details, see [reference.md](reference.md).`
|
|
92
149
|
|
|
93
|
-
|
|
94
|
-
Fastest path to value...
|
|
150
|
+
Keep references **one level deep** from SKILL.md. Avoid nested chains.
|
|
95
151
|
|
|
96
|
-
##
|
|
97
|
-
Core guidance Claude follows...
|
|
152
|
+
## Effective Descriptions
|
|
98
153
|
|
|
99
|
-
|
|
100
|
-
Input/output pairs showing expected behavior...
|
|
154
|
+
The description enables skill discovery. Include both **what** it does and **when** to use it.
|
|
101
155
|
|
|
102
|
-
|
|
103
|
-
|
|
156
|
+
**Good:**
|
|
157
|
+
```yaml
|
|
158
|
+
description: Extract text and tables from PDF files, fill forms, merge documents. Use when working with PDF files or when the user mentions PDFs, forms, or document extraction.
|
|
159
|
+
```
|
|
104
160
|
|
|
105
|
-
|
|
106
|
-
|
|
161
|
+
**Bad:**
|
|
162
|
+
```yaml
|
|
163
|
+
description: Helps with documents
|
|
107
164
|
```
|
|
108
165
|
|
|
109
166
|
## What Would You Like To Do?
|
|
110
167
|
|
|
111
168
|
1. **Create new skill** - Build from scratch
|
|
112
|
-
2. **
|
|
113
|
-
3. **
|
|
114
|
-
4. **
|
|
169
|
+
2. **Create new command** - Build a slash command
|
|
170
|
+
3. **Audit existing skill** - Check against best practices
|
|
171
|
+
4. **Add component** - Add workflow/reference/example
|
|
172
|
+
5. **Get guidance** - Understand skill design
|
|
115
173
|
|
|
116
|
-
## Creating a New Skill
|
|
174
|
+
## Creating a New Skill or Command
|
|
117
175
|
|
|
118
176
|
### Step 1: Choose Type
|
|
119
177
|
|
|
120
|
-
|
|
121
|
-
- Under 500 lines
|
|
122
|
-
- Self-contained guidance
|
|
123
|
-
- No complex workflows
|
|
178
|
+
Ask: Is this a manual workflow (deploy, commit, triage) or background knowledge (conventions, patterns)?
|
|
124
179
|
|
|
125
|
-
**
|
|
126
|
-
-
|
|
127
|
-
-
|
|
128
|
-
- Scripts for utilities
|
|
180
|
+
- **Manual workflow** → command with `disable-model-invocation: true`
|
|
181
|
+
- **Background knowledge** → skill without `disable-model-invocation`
|
|
182
|
+
- **Complex with supporting files** → skill directory
|
|
129
183
|
|
|
130
|
-
### Step 2: Create
|
|
184
|
+
### Step 2: Create the File
|
|
131
185
|
|
|
186
|
+
**Command:**
|
|
132
187
|
```markdown
|
|
133
188
|
---
|
|
134
|
-
name:
|
|
135
|
-
description:
|
|
189
|
+
name: my-command
|
|
190
|
+
description: What this command does
|
|
191
|
+
argument-hint: [expected arguments]
|
|
192
|
+
disable-model-invocation: true
|
|
193
|
+
allowed-tools: Bash(gh *), Read
|
|
136
194
|
---
|
|
137
195
|
|
|
138
|
-
#
|
|
196
|
+
# Command Title
|
|
139
197
|
|
|
140
|
-
##
|
|
198
|
+
## Workflow
|
|
141
199
|
|
|
142
|
-
|
|
200
|
+
### Step 1: Gather Context
|
|
201
|
+
...
|
|
143
202
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
```
|
|
203
|
+
### Step 2: Execute
|
|
204
|
+
...
|
|
147
205
|
|
|
148
|
-
##
|
|
206
|
+
## Success Criteria
|
|
207
|
+
- [ ] Expected outcome 1
|
|
208
|
+
- [ ] Expected outcome 2
|
|
209
|
+
```
|
|
149
210
|
|
|
150
|
-
|
|
211
|
+
**Skill:**
|
|
212
|
+
```markdown
|
|
213
|
+
---
|
|
214
|
+
name: my-skill
|
|
215
|
+
description: What it does. Use when [trigger conditions].
|
|
216
|
+
---
|
|
151
217
|
|
|
152
|
-
|
|
218
|
+
# Skill Title
|
|
153
219
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
Output:
|
|
157
|
-
```
|
|
158
|
-
[result]
|
|
159
|
-
```
|
|
220
|
+
## Quick Start
|
|
221
|
+
[Immediate actionable example]
|
|
160
222
|
|
|
161
|
-
##
|
|
223
|
+
## Instructions
|
|
224
|
+
[Core guidance]
|
|
162
225
|
|
|
163
|
-
|
|
164
|
-
|
|
226
|
+
## Examples
|
|
227
|
+
[Concrete input/output pairs]
|
|
165
228
|
```
|
|
166
229
|
|
|
167
230
|
### Step 3: Add Reference Files (If Needed)
|
|
168
231
|
|
|
169
232
|
Link from SKILL.md to detailed content:
|
|
170
|
-
|
|
171
|
-
```markdown
|
|
172
|
-
For API reference, see [REFERENCE.md](REFERENCE.md).
|
|
173
|
-
For form filling guide, see [FORMS.md](FORMS.md).
|
|
174
|
-
```
|
|
175
|
-
|
|
176
|
-
Keep references **one level deep** from SKILL.md.
|
|
177
|
-
|
|
178
|
-
### Step 4: Add Scripts (If Needed)
|
|
179
|
-
|
|
180
|
-
Scripts execute without loading into context:
|
|
181
|
-
|
|
182
233
|
```markdown
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
Extract fields:
|
|
186
|
-
```bash
|
|
187
|
-
python scripts/analyze.py input.pdf > fields.json
|
|
188
|
-
```
|
|
234
|
+
For API reference, see [reference.md](reference.md).
|
|
235
|
+
For form filling guide, see [forms.md](forms.md).
|
|
189
236
|
```
|
|
190
237
|
|
|
191
|
-
### Step
|
|
238
|
+
### Step 4: Test With Real Usage
|
|
192
239
|
|
|
193
240
|
1. Test with actual tasks, not test scenarios
|
|
194
|
-
2.
|
|
195
|
-
3.
|
|
196
|
-
4.
|
|
197
|
-
|
|
198
|
-
## Auditing Existing Skills
|
|
241
|
+
2. Invoke directly with `/skill-name` to verify
|
|
242
|
+
3. Check auto-triggering by asking something that matches the description
|
|
243
|
+
4. Refine based on real behavior
|
|
199
244
|
|
|
200
|
-
|
|
245
|
+
## Audit Checklist
|
|
201
246
|
|
|
202
247
|
- [ ] Valid YAML frontmatter (name + description)
|
|
203
|
-
- [ ] Description includes trigger keywords
|
|
248
|
+
- [ ] Description includes trigger keywords and is specific
|
|
204
249
|
- [ ] Uses standard markdown headings (not XML tags)
|
|
205
250
|
- [ ] SKILL.md under 500 lines
|
|
206
|
-
- [ ]
|
|
251
|
+
- [ ] `disable-model-invocation: true` if it has side effects
|
|
252
|
+
- [ ] `allowed-tools` set if specific tools needed
|
|
253
|
+
- [ ] References one level deep, properly linked
|
|
207
254
|
- [ ] Examples are concrete, not abstract
|
|
208
|
-
- [ ]
|
|
209
|
-
- [ ] No time-sensitive information
|
|
210
|
-
- [ ] Scripts handle errors explicitly
|
|
211
|
-
|
|
212
|
-
## Common Patterns
|
|
213
|
-
|
|
214
|
-
### Template Pattern
|
|
215
|
-
|
|
216
|
-
Provide output templates for consistent results:
|
|
217
|
-
|
|
218
|
-
```markdown
|
|
219
|
-
## Report Template
|
|
220
|
-
|
|
221
|
-
```markdown
|
|
222
|
-
# [Analysis Title]
|
|
223
|
-
|
|
224
|
-
## Executive Summary
|
|
225
|
-
[One paragraph overview]
|
|
226
|
-
|
|
227
|
-
## Key Findings
|
|
228
|
-
- Finding 1
|
|
229
|
-
- Finding 2
|
|
230
|
-
|
|
231
|
-
## Recommendations
|
|
232
|
-
1. [Action item]
|
|
233
|
-
2. [Action item]
|
|
234
|
-
```
|
|
235
|
-
```
|
|
236
|
-
|
|
237
|
-
### Workflow Pattern
|
|
238
|
-
|
|
239
|
-
For complex multi-step tasks:
|
|
240
|
-
|
|
241
|
-
```markdown
|
|
242
|
-
## Migration Workflow
|
|
243
|
-
|
|
244
|
-
Copy this checklist:
|
|
245
|
-
|
|
246
|
-
```
|
|
247
|
-
- [ ] Step 1: Backup database
|
|
248
|
-
- [ ] Step 2: Run migration script
|
|
249
|
-
- [ ] Step 3: Validate output
|
|
250
|
-
- [ ] Step 4: Update configuration
|
|
251
|
-
```
|
|
252
|
-
|
|
253
|
-
**Step 1: Backup database**
|
|
254
|
-
Run: `./scripts/backup.sh`
|
|
255
|
-
...
|
|
256
|
-
```
|
|
257
|
-
|
|
258
|
-
### Conditional Pattern
|
|
259
|
-
|
|
260
|
-
Guide through decision points:
|
|
261
|
-
|
|
262
|
-
```markdown
|
|
263
|
-
## Choose Your Approach
|
|
264
|
-
|
|
265
|
-
**Creating new content?** Follow "Creation workflow" below.
|
|
266
|
-
**Editing existing?** Follow "Editing workflow" below.
|
|
267
|
-
```
|
|
255
|
+
- [ ] Tested with real usage
|
|
268
256
|
|
|
269
257
|
## Anti-Patterns to Avoid
|
|
270
258
|
|
|
271
|
-
- **XML tags in body** - Use markdown headings
|
|
259
|
+
- **XML tags in body** - Use standard markdown headings
|
|
272
260
|
- **Vague descriptions** - Be specific with trigger keywords
|
|
273
261
|
- **Deep nesting** - Keep references one level from SKILL.md
|
|
262
|
+
- **Missing invocation control** - Side-effect workflows need `disable-model-invocation: true`
|
|
274
263
|
- **Too many options** - Provide a default with escape hatch
|
|
275
|
-
- **
|
|
276
|
-
- **Punting to Claude** - Scripts should handle errors
|
|
277
|
-
- **Time-sensitive info** - Use "old patterns" section instead
|
|
264
|
+
- **Punting to Claude** - Scripts should handle errors explicitly
|
|
278
265
|
|
|
279
266
|
## Reference Files
|
|
280
267
|
|
|
281
268
|
For detailed guidance, see:
|
|
282
|
-
|
|
283
|
-
- [official-spec.md](references/official-spec.md) - Anthropic's official skill specification
|
|
269
|
+
- [official-spec.md](references/official-spec.md) - Official skill specification
|
|
284
270
|
- [best-practices.md](references/best-practices.md) - Skill authoring best practices
|
|
285
271
|
|
|
286
|
-
##
|
|
272
|
+
## Sources
|
|
287
273
|
|
|
288
|
-
|
|
289
|
-
- Has valid YAML frontmatter with descriptive name and description
|
|
290
|
-
- Uses standard markdown headings (not XML tags)
|
|
291
|
-
- Keeps SKILL.md under 500 lines
|
|
292
|
-
- Links to reference files for detailed content
|
|
293
|
-
- Includes concrete examples with input/output pairs
|
|
294
|
-
- Has been tested with real usage
|
|
295
|
-
|
|
296
|
-
Sources:
|
|
297
|
-
- [Agent Skills - Claude Code Docs](https://code.claude.com/docs/en/skills)
|
|
298
|
-
- [Skill authoring best practices](https://platform.claude.com/docs/en/agents-and-tools/agent-skills/best-practices)
|
|
274
|
+
- [Extend Claude with skills - Official Docs](https://code.claude.com/docs/en/skills)
|
|
299
275
|
- [GitHub - anthropics/skills](https://github.com/anthropics/skills)
|
|
276
|
+
|
|
@@ -14,23 +14,23 @@ When Claude executes this, the full command with expanded `$API_KEY` appears in
|
|
|
14
14
|
</the_problem>
|
|
15
15
|
|
|
16
16
|
<the_solution>
|
|
17
|
-
Use `~/.
|
|
17
|
+
Use `~/.config/opencode/scripts/secure-api.sh` - a wrapper that loads credentials internally.
|
|
18
18
|
|
|
19
19
|
<for_supported_services>
|
|
20
20
|
```bash
|
|
21
21
|
# ✅ GOOD - No credentials visible
|
|
22
|
-
~/.
|
|
22
|
+
~/.config/opencode/scripts/secure-api.sh <service> <operation> [args]
|
|
23
23
|
|
|
24
24
|
# Examples:
|
|
25
|
-
~/.
|
|
26
|
-
~/.
|
|
25
|
+
~/.config/opencode/scripts/secure-api.sh facebook list-campaigns
|
|
26
|
+
~/.config/opencode/scripts/secure-api.sh ghl search-contact "email@example.com"
|
|
27
27
|
```
|
|
28
28
|
</for_supported_services>
|
|
29
29
|
|
|
30
30
|
<adding_new_services>
|
|
31
31
|
When building a new skill that requires API calls:
|
|
32
32
|
|
|
33
|
-
1. **Add operations to the wrapper** (`~/.
|
|
33
|
+
1. **Add operations to the wrapper** (`~/.config/opencode/scripts/secure-api.sh`):
|
|
34
34
|
|
|
35
35
|
```bash
|
|
36
36
|
case "$SERVICE" in
|
|
@@ -67,14 +67,14 @@ yourservice)
|
|
|
67
67
|
;;
|
|
68
68
|
```
|
|
69
69
|
|
|
70
|
-
3. **Add credential placeholders to `~/.
|
|
70
|
+
3. **Add credential placeholders to `~/.config/opencode/.env`** using profile naming:
|
|
71
71
|
|
|
72
72
|
```bash
|
|
73
73
|
# Check if entries already exist
|
|
74
|
-
grep -q "YOURSERVICE_MAIN_API_KEY=" ~/.
|
|
75
|
-
echo -e "\n# Your Service - Main profile\nYOURSERVICE_MAIN_API_KEY=\nYOURSERVICE_MAIN_ACCOUNT_ID=" >> ~/.
|
|
74
|
+
grep -q "YOURSERVICE_MAIN_API_KEY=" ~/.config/opencode/.env 2>/dev/null || \
|
|
75
|
+
echo -e "\n# Your Service - Main profile\nYOURSERVICE_MAIN_API_KEY=\nYOURSERVICE_MAIN_ACCOUNT_ID=" >> ~/.config/opencode/.env
|
|
76
76
|
|
|
77
|
-
echo "Added credential placeholders to ~/.
|
|
77
|
+
echo "Added credential placeholders to ~/.config/opencode/.env - user needs to fill them in"
|
|
78
78
|
```
|
|
79
79
|
|
|
80
80
|
4. **Document profile workflow in your SKILL.md**:
|
|
@@ -88,12 +88,12 @@ echo "Added credential placeholders to ~/.claude/.env - user needs to fill them
|
|
|
88
88
|
|
|
89
89
|
1. **Check for saved profile:**
|
|
90
90
|
```bash
|
|
91
|
-
~/.
|
|
91
|
+
~/.config/opencode/scripts/profile-state get yourservice
|
|
92
92
|
```
|
|
93
93
|
|
|
94
94
|
2. **If no profile saved, discover available profiles:**
|
|
95
95
|
```bash
|
|
96
|
-
~/.
|
|
96
|
+
~/.config/opencode/scripts/list-profiles yourservice
|
|
97
97
|
```
|
|
98
98
|
|
|
99
99
|
3. **If only ONE profile:** Use it automatically and announce:
|
|
@@ -108,7 +108,7 @@ echo "Added credential placeholders to ~/.claude/.env - user needs to fill them
|
|
|
108
108
|
|
|
109
109
|
5. **Save user's selection:**
|
|
110
110
|
```bash
|
|
111
|
-
~/.
|
|
111
|
+
~/.config/opencode/scripts/profile-state set yourservice <selected_profile>
|
|
112
112
|
```
|
|
113
113
|
|
|
114
114
|
6. **Always announce which profile before calling API:**
|
|
@@ -118,7 +118,7 @@ echo "Added credential placeholders to ~/.claude/.env - user needs to fill them
|
|
|
118
118
|
|
|
119
119
|
7. **Make API call with profile:**
|
|
120
120
|
```bash
|
|
121
|
-
~/.
|
|
121
|
+
~/.config/opencode/scripts/secure-api.sh yourservice:<profile> list-items
|
|
122
122
|
```
|
|
123
123
|
|
|
124
124
|
## Secure API Calls
|
|
@@ -126,11 +126,11 @@ echo "Added credential placeholders to ~/.claude/.env - user needs to fill them
|
|
|
126
126
|
All API calls use profile syntax:
|
|
127
127
|
|
|
128
128
|
```bash
|
|
129
|
-
~/.
|
|
129
|
+
~/.config/opencode/scripts/secure-api.sh yourservice:<profile> <operation> [args]
|
|
130
130
|
|
|
131
131
|
# Examples:
|
|
132
|
-
~/.
|
|
133
|
-
~/.
|
|
132
|
+
~/.config/opencode/scripts/secure-api.sh yourservice:main list-items
|
|
133
|
+
~/.config/opencode/scripts/secure-api.sh yourservice:main get-item <ITEM_ID>
|
|
134
134
|
```
|
|
135
135
|
|
|
136
136
|
**Profile persists for session:** Once selected, use same profile for subsequent operations unless user explicitly changes it.
|
|
@@ -159,7 +159,7 @@ curl -s -X POST \
|
|
|
159
159
|
|
|
160
160
|
Usage:
|
|
161
161
|
```bash
|
|
162
|
-
echo '{"name":"value"}' | ~/.
|
|
162
|
+
echo '{"name":"value"}' | ~/.config/opencode/scripts/secure-api.sh service create-item
|
|
163
163
|
```
|
|
164
164
|
</post_with_json_body>
|
|
165
165
|
|
|
@@ -175,7 +175,7 @@ curl -s -X POST \
|
|
|
175
175
|
</pattern_guidelines>
|
|
176
176
|
|
|
177
177
|
<credential_storage>
|
|
178
|
-
**Location:** `~/.
|
|
178
|
+
**Location:** `~/.config/opencode/.env` (global for all skills, accessible from any directory)
|
|
179
179
|
|
|
180
180
|
**Format:**
|
|
181
181
|
```bash
|
|
@@ -191,7 +191,7 @@ OTHER_BASE_URL=https://api.other.com
|
|
|
191
191
|
**Loading in script:**
|
|
192
192
|
```bash
|
|
193
193
|
set -a
|
|
194
|
-
source ~/.
|
|
194
|
+
source ~/.config/opencode/.env 2>/dev/null || { echo "Error: ~/.config/opencode/.env not found" >&2; exit 1; }
|
|
195
195
|
set +a
|
|
196
196
|
```
|
|
197
197
|
</credential_storage>
|
|
@@ -199,8 +199,8 @@ set +a
|
|
|
199
199
|
<best_practices>
|
|
200
200
|
1. **Never use raw curl with `$VARIABLE` in skill examples** - always use the wrapper
|
|
201
201
|
2. **Add all operations to the wrapper** - don't make users figure out curl syntax
|
|
202
|
-
3. **Auto-create credential placeholders** - add empty fields to `~/.
|
|
203
|
-
4. **Keep credentials in `~/.
|
|
202
|
+
3. **Auto-create credential placeholders** - add empty fields to `~/.config/opencode/.env` immediately when creating the skill
|
|
203
|
+
4. **Keep credentials in `~/.config/opencode/.env`** - one central location, works everywhere
|
|
204
204
|
5. **Document each operation** - show examples in SKILL.md
|
|
205
205
|
6. **Handle errors gracefully** - check for missing env vars, show helpful error messages
|
|
206
206
|
</best_practices>
|
|
@@ -210,7 +210,7 @@ Test the wrapper without exposing credentials:
|
|
|
210
210
|
|
|
211
211
|
```bash
|
|
212
212
|
# This command appears in chat
|
|
213
|
-
~/.
|
|
213
|
+
~/.config/opencode/scripts/secure-api.sh facebook list-campaigns
|
|
214
214
|
|
|
215
215
|
# But API keys never appear - they're loaded inside the script
|
|
216
216
|
```
|
|
@@ -218,9 +218,9 @@ Test the wrapper without exposing credentials:
|
|
|
218
218
|
Verify credentials are loaded:
|
|
219
219
|
```bash
|
|
220
220
|
# Check .env exists
|
|
221
|
-
ls -la ~/.
|
|
221
|
+
ls -la ~/.config/opencode/.env
|
|
222
222
|
|
|
223
223
|
# Check specific variables (without showing values)
|
|
224
|
-
grep -q "YOUR_API_KEY=" ~/.
|
|
224
|
+
grep -q "YOUR_API_KEY=" ~/.config/opencode/.env && echo "API key configured" || echo "API key missing"
|
|
225
225
|
```
|
|
226
226
|
</testing>
|
|
@@ -45,7 +45,7 @@ skill-name/
|
|
|
45
45
|
**Reference pattern**: In SKILL.md, reference scripts using the `scripts/` path:
|
|
46
46
|
|
|
47
47
|
```bash
|
|
48
|
-
python ~/.
|
|
48
|
+
python ~/.config/opencode/skills/skill-name/scripts/analyze.py input.har
|
|
49
49
|
```
|
|
50
50
|
</scripts_directory>
|
|
51
51
|
</file_organization>
|