@nano-step/skill-manager 4.0.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 +218 -0
- package/bin/cli.js +9 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +34 -0
- package/dist/install.d.ts +1 -0
- package/dist/install.js +35 -0
- package/dist/remove.d.ts +1 -0
- package/dist/remove.js +32 -0
- package/dist/update.d.ts +1 -0
- package/dist/update.js +53 -0
- package/dist/utils.d.ts +30 -0
- package/dist/utils.js +154 -0
- package/package.json +47 -0
- package/templates/agent.json +11 -0
- package/templates/command-refresh.md +100 -0
- package/templates/command-workflow.md +188 -0
- package/templates/skill/SKILL.md +284 -0
- package/templates/skill/assets/tools-template.json +140 -0
- package/templates/skill/assets/workflow-schema.json +81 -0
- package/templates/skill/assets/workflow-templates.json +112 -0
- package/templates/skill/references/error-handling.md +260 -0
- package/templates/skill/references/result-handling.md +242 -0
- package/templates/skill/references/tool-categories.md +247 -0
- package/templates/skill/references/tool-execution.md +347 -0
- package/templates/skill/references/workflows.md +233 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# /agent-skill-refresh
|
|
2
|
+
|
|
3
|
+
Re-index and categorize all available MCP tools for intelligent routing.
|
|
4
|
+
|
|
5
|
+
## Purpose
|
|
6
|
+
|
|
7
|
+
Create a semantic tool index in `.opencode/agent-skill-tools.json` by analyzing **all available tools** in the current agent context. Categorization is AI-only and based on tool names + descriptions (no prefixes).
|
|
8
|
+
|
|
9
|
+
## When to Run
|
|
10
|
+
|
|
11
|
+
- First time setup (cache doesn't exist)
|
|
12
|
+
- After adding/removing MCP servers or tools
|
|
13
|
+
- When routing seems incorrect or tools are missing
|
|
14
|
+
- Periodically to keep index fresh
|
|
15
|
+
|
|
16
|
+
## Auto-Refresh Triggers
|
|
17
|
+
|
|
18
|
+
The agent-skill-manager will suggest running `/agent-skill-refresh` automatically when:
|
|
19
|
+
|
|
20
|
+
- **Tool not found**: A requested tool doesn't exist in the cache
|
|
21
|
+
- **Cache missing**: The `.opencode/agent-skill-tools.json` file doesn't exist
|
|
22
|
+
- **Cache stale**: The cache is older than 24 hours
|
|
23
|
+
- **Tool count mismatch**: Available tools differ from cached count
|
|
24
|
+
|
|
25
|
+
When you see a suggestion to refresh, run this command to update the cache.
|
|
26
|
+
|
|
27
|
+
## Execution Steps
|
|
28
|
+
|
|
29
|
+
### Step 1: Enumerate All Tools (Introspection)
|
|
30
|
+
|
|
31
|
+
List every tool available to the agent in its current context (functions/tools list). For each tool, extract:
|
|
32
|
+
|
|
33
|
+
- `tool_id` (exact tool name)
|
|
34
|
+
- `description` (tool description text)
|
|
35
|
+
|
|
36
|
+
Produce a full list; do not skip any tools.
|
|
37
|
+
|
|
38
|
+
### Step 2: Semantic Categorization (Single Holistic Pass)
|
|
39
|
+
|
|
40
|
+
Use the following prompt to categorize **all tools at once**:
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
You have access to the following tools. Analyze each tool's name and description,
|
|
44
|
+
then group them into semantic categories based on what they DO (not where they come from).
|
|
45
|
+
|
|
46
|
+
Tools:
|
|
47
|
+
- tool_id_1: "description 1"
|
|
48
|
+
- tool_id_2: "description 2"
|
|
49
|
+
...
|
|
50
|
+
|
|
51
|
+
For each category, provide:
|
|
52
|
+
1. name: Short identifier (lowercase, hyphenated)
|
|
53
|
+
2. description: One sentence describing the category's purpose
|
|
54
|
+
3. keywords: 5-10 words for routing user requests to this category
|
|
55
|
+
4. tools: List of tool IDs belonging to this category
|
|
56
|
+
|
|
57
|
+
Output as JSON.
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Step 3: Write Cache File (v2.0.0)
|
|
61
|
+
|
|
62
|
+
Write `.opencode/agent-skill-tools.json` with this schema:
|
|
63
|
+
|
|
64
|
+
```json
|
|
65
|
+
{
|
|
66
|
+
"version": "2.0.0",
|
|
67
|
+
"generated_at": "2026-01-27T03:00:00Z",
|
|
68
|
+
"tool_count": 75,
|
|
69
|
+
"categories": {
|
|
70
|
+
"browser-automation": {
|
|
71
|
+
"name": "Browser Automation",
|
|
72
|
+
"description": "Web page interaction, screenshots, DOM manipulation",
|
|
73
|
+
"keywords": ["screenshot", "click", "navigate", "page", "browser", "element"],
|
|
74
|
+
"tools": ["MetaMCP_chrome-devtools__take_screenshot", "MetaMCP_chrome-devtools__click"]
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
"tools": {
|
|
78
|
+
"MetaMCP_chrome-devtools__take_screenshot": {
|
|
79
|
+
"category": "browser-automation",
|
|
80
|
+
"description": "Take a screenshot of the page or element"
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Step 4: Report Summary
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
Agent Skill Tools Index Refreshed:
|
|
90
|
+
|
|
91
|
+
Categories:
|
|
92
|
+
- browser-automation: 25 tools
|
|
93
|
+
- docs: 4 tools
|
|
94
|
+
- github: 15 tools
|
|
95
|
+
|
|
96
|
+
Summary:
|
|
97
|
+
- Total tools: 75
|
|
98
|
+
- Categories: 3
|
|
99
|
+
- Cache: .opencode/agent-skill-tools.json
|
|
100
|
+
```
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
# /agent-skill-workflow
|
|
2
|
+
|
|
3
|
+
Manage workflow rules that define prerequisite steps before tool execution.
|
|
4
|
+
|
|
5
|
+
## Purpose
|
|
6
|
+
|
|
7
|
+
Create, list, edit, and remove workflow definitions that automatically execute prerequisite steps when certain tools are triggered. For example, always inspect database structure before running queries.
|
|
8
|
+
|
|
9
|
+
## Subcommands
|
|
10
|
+
|
|
11
|
+
### List Workflows
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
/agent-skill-workflow list
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Display all defined workflows with their status, triggers, and prerequisite count.
|
|
18
|
+
|
|
19
|
+
**Output format:**
|
|
20
|
+
```
|
|
21
|
+
Workflows (3 defined):
|
|
22
|
+
|
|
23
|
+
✓ database-safe-query [enforce]
|
|
24
|
+
Triggers: category=database, keywords=[query, select]
|
|
25
|
+
Prerequisites: 4 steps
|
|
26
|
+
|
|
27
|
+
✓ browser-safe-interaction [enforce]
|
|
28
|
+
Triggers: category=browser
|
|
29
|
+
Prerequisites: 1 step
|
|
30
|
+
|
|
31
|
+
○ github-pr-review [disabled]
|
|
32
|
+
Triggers: tools=[merge_pull_request]
|
|
33
|
+
Prerequisites: 3 steps
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Add Workflow (Interactive)
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
/agent-skill-workflow add <name>
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Create a new workflow interactively. The agent will prompt for:
|
|
43
|
+
|
|
44
|
+
1. **Description**: What does this workflow do?
|
|
45
|
+
2. **Triggers**:
|
|
46
|
+
- Category (optional): Which tool category triggers this?
|
|
47
|
+
- Tools (optional): Which specific tools trigger this?
|
|
48
|
+
- Keywords (optional): Which words in the task trigger this?
|
|
49
|
+
3. **Prerequisites**: For each step:
|
|
50
|
+
- Tool name
|
|
51
|
+
- Description (why this step is needed)
|
|
52
|
+
- Required? (yes/no)
|
|
53
|
+
4. **Mode**: enforce, warn, or suggest
|
|
54
|
+
|
|
55
|
+
**Example session:**
|
|
56
|
+
```
|
|
57
|
+
> /agent-skill-workflow add api-safety
|
|
58
|
+
|
|
59
|
+
Description: Check API schema before making requests
|
|
60
|
+
Trigger category (or skip): api
|
|
61
|
+
Trigger tools (comma-separated, or skip): execute_request, post_request
|
|
62
|
+
Trigger keywords (comma-separated, or skip): api call, request
|
|
63
|
+
|
|
64
|
+
Prerequisite 1:
|
|
65
|
+
Tool: get_schema
|
|
66
|
+
Description: Fetch API schema
|
|
67
|
+
Required? yes
|
|
68
|
+
|
|
69
|
+
Add another prerequisite? yes
|
|
70
|
+
|
|
71
|
+
Prerequisite 2:
|
|
72
|
+
Tool: list_endpoints
|
|
73
|
+
Description: List available endpoints
|
|
74
|
+
Required? no
|
|
75
|
+
|
|
76
|
+
Add another prerequisite? no
|
|
77
|
+
|
|
78
|
+
Mode (enforce/warn/suggest): warn
|
|
79
|
+
|
|
80
|
+
✓ Workflow 'api-safety' created with 2 prerequisites
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Add from Template
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
/agent-skill-workflow add --template <template-name>
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Create a workflow from a built-in template. Available templates:
|
|
90
|
+
|
|
91
|
+
| Template | Description | Prerequisites |
|
|
92
|
+
|----------|-------------|---------------|
|
|
93
|
+
| `database` | Safe database queries | list_databases → list_tables → inspect_table → get_indexes |
|
|
94
|
+
| `browser` | Safe browser interaction | take_snapshot |
|
|
95
|
+
| `github-pr` | PR review workflow | get_pull_request → get_files → get_status |
|
|
96
|
+
| `graphql` | Schema-aware GraphQL | get_schema → filter_types |
|
|
97
|
+
|
|
98
|
+
**Example:**
|
|
99
|
+
```
|
|
100
|
+
> /agent-skill-workflow add --template database
|
|
101
|
+
|
|
102
|
+
✓ Created workflow 'database-safe-query' from template
|
|
103
|
+
Mode: enforce
|
|
104
|
+
Prerequisites: 4 steps
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
To list available templates:
|
|
108
|
+
```
|
|
109
|
+
/agent-skill-workflow add --template
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Edit Workflow
|
|
113
|
+
|
|
114
|
+
```
|
|
115
|
+
/agent-skill-workflow edit <name>
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Modify an existing workflow. Shows current values and allows changing any field.
|
|
119
|
+
|
|
120
|
+
### Remove Workflow
|
|
121
|
+
|
|
122
|
+
```
|
|
123
|
+
/agent-skill-workflow remove <name>
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Delete a workflow after confirmation.
|
|
127
|
+
|
|
128
|
+
```
|
|
129
|
+
> /agent-skill-workflow remove api-safety
|
|
130
|
+
|
|
131
|
+
Remove workflow 'api-safety'? This cannot be undone. (yes/no): yes
|
|
132
|
+
|
|
133
|
+
✓ Workflow 'api-safety' removed
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Enable/Disable Workflow
|
|
137
|
+
|
|
138
|
+
```
|
|
139
|
+
/agent-skill-workflow enable <name>
|
|
140
|
+
/agent-skill-workflow disable <name>
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Toggle a workflow's enabled status without removing it.
|
|
144
|
+
|
|
145
|
+
```
|
|
146
|
+
> /agent-skill-workflow disable database-safe-query
|
|
147
|
+
|
|
148
|
+
✓ Workflow 'database-safe-query' disabled
|
|
149
|
+
(Prerequisites will not run until re-enabled)
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## Workflow Modes
|
|
153
|
+
|
|
154
|
+
| Mode | Behavior |
|
|
155
|
+
|------|----------|
|
|
156
|
+
| `enforce` | Prerequisites run automatically before main action |
|
|
157
|
+
| `warn` | Warning shown, user can skip prerequisites |
|
|
158
|
+
| `suggest` | Prerequisites mentioned but don't block execution |
|
|
159
|
+
|
|
160
|
+
## Storage
|
|
161
|
+
|
|
162
|
+
Workflows are stored in `.opencode/agent-skill-tools.json` under the `workflows` key. They persist across sessions and are preserved when running `/agent-skill-refresh`.
|
|
163
|
+
|
|
164
|
+
## Session State
|
|
165
|
+
|
|
166
|
+
Completed prerequisites are tracked in `.opencode/.agent-skill-session.json`. Within a session, prerequisites only run once per workflow (unless the session expires after 24 hours).
|
|
167
|
+
|
|
168
|
+
## Examples
|
|
169
|
+
|
|
170
|
+
### Create a custom workflow for file operations
|
|
171
|
+
```
|
|
172
|
+
/agent-skill-workflow add file-safety
|
|
173
|
+
```
|
|
174
|
+
Then define triggers for file tools and prerequisites like "list directory" before "delete file".
|
|
175
|
+
|
|
176
|
+
### Use database template and customize
|
|
177
|
+
```
|
|
178
|
+
/agent-skill-workflow add --template database
|
|
179
|
+
/agent-skill-workflow edit database-safe-query
|
|
180
|
+
```
|
|
181
|
+
Modify the default database workflow to fit your needs.
|
|
182
|
+
|
|
183
|
+
### Temporarily disable a workflow
|
|
184
|
+
```
|
|
185
|
+
/agent-skill-workflow disable browser-safe-interaction
|
|
186
|
+
# ... do some quick browser tasks without snapshots ...
|
|
187
|
+
/agent-skill-workflow enable browser-safe-interaction
|
|
188
|
+
```
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: agent-skill-management
|
|
3
|
+
description: >-
|
|
4
|
+
Agent skill routing and execution. Enables efficient routing of MCP tools
|
|
5
|
+
with token-saving isolation. Uses semantic AI categorization to support ANY
|
|
6
|
+
MCP configuration. Cache at .opencode/agent-skill-tools.json for fast tool discovery.
|
|
7
|
+
compatibility: "OpenCode with any MCP server"
|
|
8
|
+
metadata:
|
|
9
|
+
author: Sisyphus
|
|
10
|
+
version: "4.0.0"
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Agent Skill Management Skill
|
|
14
|
+
|
|
15
|
+
**Version**: 4.0.0 | **Architecture**: 3-Tier Progressive Disclosure | **Categorization**: Semantic AI
|
|
16
|
+
|
|
17
|
+
## Overview
|
|
18
|
+
|
|
19
|
+
This skill enables the agent-skill-manager agent to efficiently route and execute MCP (Model Context Protocol) tools. By isolating MCP tool definitions in a dedicated subagent context, we reduce main agent token usage by 80-95%.
|
|
20
|
+
|
|
21
|
+
## When to Use This Skill
|
|
22
|
+
|
|
23
|
+
| Trigger | Category | Example |
|
|
24
|
+
|---------|----------|---------|
|
|
25
|
+
| Browser automation | `browser` | "Take a screenshot", "Click the login button" |
|
|
26
|
+
| GitHub operations | `github` | "Get PR #123 details", "List open issues" |
|
|
27
|
+
| GraphQL queries | `graphql` | "Get the schema", "List available mutations" |
|
|
28
|
+
| Documentation lookup | `docs` | "How do I use useState?", "Find React docs" |
|
|
29
|
+
| Complex reasoning | `reasoning` | "Analyze this step by step" |
|
|
30
|
+
|
|
31
|
+
## Quick Reference
|
|
32
|
+
|
|
33
|
+
### Tool Categories (AI-Generated)
|
|
34
|
+
|
|
35
|
+
Categories are generated by `/agent-skill-refresh` using semantic AI analysis. Common categories include:
|
|
36
|
+
|
|
37
|
+
| Category | Description | Example Tools |
|
|
38
|
+
|----------|-------------|---------------|
|
|
39
|
+
| browser-automation | Web interaction, screenshots, DOM | click, screenshot, navigate |
|
|
40
|
+
| version-control | Git, PRs, issues, code review | get_pull_request, list_issues |
|
|
41
|
+
| documentation | Library docs, API references | query-docs, resolve-library-id |
|
|
42
|
+
| communication | Messaging, notifications | post_message, list_channels |
|
|
43
|
+
| database | SQL queries, data operations | query, insert, update |
|
|
44
|
+
|
|
45
|
+
**Note**: Your actual categories depend on your MCP configuration. Run `/agent-skill-refresh` to generate.
|
|
46
|
+
|
|
47
|
+
### Most Common Tools
|
|
48
|
+
|
|
49
|
+
| Task | Tool | Category |
|
|
50
|
+
|------|------|----------|
|
|
51
|
+
| Screenshot | `take_screenshot` | browser |
|
|
52
|
+
| Click element | `click` | browser |
|
|
53
|
+
| Fill form | `fill`, `fill_form` | browser |
|
|
54
|
+
| Navigate | `navigate_page` | browser |
|
|
55
|
+
| Get page content | `take_snapshot` | browser |
|
|
56
|
+
| Get PR details | `get_pull_request` | github |
|
|
57
|
+
| List issues | `list_issues` | github |
|
|
58
|
+
| Search code | `search_code` | github |
|
|
59
|
+
| Query docs | `query-docs` | docs |
|
|
60
|
+
| Step-by-step analysis | `sequentialthinking` | reasoning |
|
|
61
|
+
|
|
62
|
+
## Routing Decision Tree
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
Task received
|
|
66
|
+
│
|
|
67
|
+
├─ Contains '__' (exact tool name)?
|
|
68
|
+
│ └─ YES → DIRECT PASSTHROUGH: Execute immediately
|
|
69
|
+
│
|
|
70
|
+
├─ Starts with 'BATCH:'?
|
|
71
|
+
│ └─ YES → Parse JSON array, execute sequentially
|
|
72
|
+
│
|
|
73
|
+
├─ Starts with 'CHAIN:'?
|
|
74
|
+
│ └─ YES → Parse chain, execute with variable passing
|
|
75
|
+
│
|
|
76
|
+
├─ Matches workflow trigger?
|
|
77
|
+
│ └─ YES → Check prerequisites, execute if needed
|
|
78
|
+
│
|
|
79
|
+
├─ Explicit tool name mentioned?
|
|
80
|
+
│ └─ YES → Use that tool directly
|
|
81
|
+
│
|
|
82
|
+
├─ Read .opencode/agent-skill-tools.json cache
|
|
83
|
+
│ └─ Match task keywords against category keywords
|
|
84
|
+
│
|
|
85
|
+
├─ Multiple categories match?
|
|
86
|
+
│ └─ YES → Prefer category with more keyword matches
|
|
87
|
+
│
|
|
88
|
+
└─ No match?
|
|
89
|
+
└─ Search tool descriptions or ask for clarification
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Advanced Features
|
|
93
|
+
|
|
94
|
+
### Direct Passthrough
|
|
95
|
+
|
|
96
|
+
When you know the exact tool name (contains `__`), skip routing entirely:
|
|
97
|
+
|
|
98
|
+
```
|
|
99
|
+
Task: "Use MetaMCP_chrome-devtools__take_screenshot"
|
|
100
|
+
→ Executes directly without category lookup
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Batch Operations
|
|
104
|
+
|
|
105
|
+
Execute multiple tools in one request using `BATCH:` prefix:
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
BATCH: [
|
|
109
|
+
{"tool": "take_screenshot", "params": {}},
|
|
110
|
+
{"tool": "get_title", "params": {}}
|
|
111
|
+
]
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
- Maximum 10 tools per batch
|
|
115
|
+
- Returns array of results in execution order
|
|
116
|
+
- Partial failures reported per-tool
|
|
117
|
+
|
|
118
|
+
### Tool Chaining
|
|
119
|
+
|
|
120
|
+
Chain tools with output passing using `CHAIN:` prefix:
|
|
121
|
+
|
|
122
|
+
```
|
|
123
|
+
CHAIN: [
|
|
124
|
+
{"tool": "get_element", "params": {"selector": "#btn"}, "output_as": "el"},
|
|
125
|
+
{"tool": "click", "params": {"element": "$el"}}
|
|
126
|
+
]
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
- Use `$varname` to reference previous outputs
|
|
130
|
+
- Maximum 5 tools per chain
|
|
131
|
+
- Chain aborts on first failure
|
|
132
|
+
|
|
133
|
+
### Retry Mechanism
|
|
134
|
+
|
|
135
|
+
All tool executions automatically retry on failure:
|
|
136
|
+
|
|
137
|
+
- Up to 3 attempts
|
|
138
|
+
- Delays: 0s → 1s → 2s
|
|
139
|
+
- Failure report if all attempts fail:
|
|
140
|
+
```json
|
|
141
|
+
{"tool": "name", "attempts": 3, "errors": [...], "suggestion": "..."}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Workflows
|
|
145
|
+
|
|
146
|
+
Define prerequisite steps that automatically execute before certain tool operations.
|
|
147
|
+
|
|
148
|
+
### What are Workflows?
|
|
149
|
+
|
|
150
|
+
Workflows enforce best practices by requiring prerequisite steps before tool execution. For example:
|
|
151
|
+
- Always inspect database structure before running queries
|
|
152
|
+
- Take a page snapshot before clicking elements
|
|
153
|
+
- Review PR details before merging
|
|
154
|
+
|
|
155
|
+
### Quick Start
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
# Add a workflow from template
|
|
159
|
+
/agent-skill-workflow add --template database
|
|
160
|
+
|
|
161
|
+
# List active workflows
|
|
162
|
+
/agent-skill-workflow list
|
|
163
|
+
|
|
164
|
+
# Disable temporarily
|
|
165
|
+
/agent-skill-workflow disable database-safe-query
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### Built-in Templates
|
|
169
|
+
|
|
170
|
+
| Template | Triggers | Prerequisites |
|
|
171
|
+
|----------|----------|---------------|
|
|
172
|
+
| `database` | query, select, insert | list_databases → list_tables → inspect_table |
|
|
173
|
+
| `browser` | click, fill, submit | take_snapshot |
|
|
174
|
+
| `github-pr` | merge, review | get_pr → get_files → get_status |
|
|
175
|
+
|
|
176
|
+
### Workflow Modes
|
|
177
|
+
|
|
178
|
+
| Mode | Behavior |
|
|
179
|
+
|------|----------|
|
|
180
|
+
| `enforce` | Auto-run prerequisites (default) |
|
|
181
|
+
| `warn` | Show warning, allow skip |
|
|
182
|
+
| `suggest` | Mention only, don't block |
|
|
183
|
+
|
|
184
|
+
**Full documentation**: [workflows.md](references/workflows.md)
|
|
185
|
+
|
|
186
|
+
## Cache Usage
|
|
187
|
+
|
|
188
|
+
**Location**: `.opencode/agent-skill-tools.json`
|
|
189
|
+
|
|
190
|
+
### If Cache Exists
|
|
191
|
+
1. Read and parse JSON (v2.0.0 schema)
|
|
192
|
+
2. Use `categories` for keyword-based routing
|
|
193
|
+
3. Use `tools` map for O(1) tool lookup
|
|
194
|
+
4. Check `generated_at` - if >24h old, suggest `/agent-skill-refresh`
|
|
195
|
+
|
|
196
|
+
### If Cache Missing
|
|
197
|
+
1. Inform user: "Run `/agent-skill-refresh` to create tool cache"
|
|
198
|
+
2. Fall back to dynamic tool discovery (slower)
|
|
199
|
+
|
|
200
|
+
**Full cache schema**: [tool-execution.md](references/tool-execution.md#cache-schema)
|
|
201
|
+
|
|
202
|
+
## Execution Flow
|
|
203
|
+
|
|
204
|
+
1. **Parse Intent** → Extract keywords from task
|
|
205
|
+
2. **Match Category** → Find best category match
|
|
206
|
+
3. **Select Tool** → Choose specific tool within category
|
|
207
|
+
4. **Execute** → Call tool with mapped parameters
|
|
208
|
+
5. **Summarize** → Return concise result to main agent
|
|
209
|
+
|
|
210
|
+
**Detailed patterns**: [tool-execution.md](references/tool-execution.md)
|
|
211
|
+
|
|
212
|
+
## Result Handling
|
|
213
|
+
|
|
214
|
+
### Summarization Rules
|
|
215
|
+
|
|
216
|
+
| Result Type | Action |
|
|
217
|
+
|-------------|--------|
|
|
218
|
+
| Large (>1000 chars) | Extract key info only |
|
|
219
|
+
| File operations | "File X read/written successfully (N chars)" |
|
|
220
|
+
| Data queries | "Found N items. First 3: [...]" |
|
|
221
|
+
| Screenshots | "Screenshot saved to /path" |
|
|
222
|
+
| Errors | Include error + suggestions |
|
|
223
|
+
|
|
224
|
+
### Always Include
|
|
225
|
+
- Success/failure status
|
|
226
|
+
- Key identifiers (IDs, paths, URLs)
|
|
227
|
+
- Count of items (for lists)
|
|
228
|
+
- Actionable next steps
|
|
229
|
+
- Error details (if failed)
|
|
230
|
+
|
|
231
|
+
**Full patterns**: [result-handling.md](references/result-handling.md)
|
|
232
|
+
|
|
233
|
+
## Error Recovery
|
|
234
|
+
|
|
235
|
+
| Error | Recovery |
|
|
236
|
+
|-------|----------|
|
|
237
|
+
| Tool not found | Suggest similar tools |
|
|
238
|
+
| Execution failed | Include context + retry suggestions |
|
|
239
|
+
| Timeout | Report partial result + suggestions |
|
|
240
|
+
| Cache missing | Prompt `/agent-skill-refresh` |
|
|
241
|
+
|
|
242
|
+
**Full recovery procedures**: [error-handling.md](references/error-handling.md)
|
|
243
|
+
|
|
244
|
+
## Example Invocations
|
|
245
|
+
|
|
246
|
+
### Browser: Take Screenshot
|
|
247
|
+
```
|
|
248
|
+
Task: "Take a screenshot of the current page"
|
|
249
|
+
Tool: MetaMCP_chrome-devtools__take_screenshot
|
|
250
|
+
Result: "Screenshot saved to ./screenshot.png"
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
### GitHub: Get PR
|
|
254
|
+
```
|
|
255
|
+
Task: "Get details of PR #123 in owner/repo"
|
|
256
|
+
Tool: MetaMCP_github-zengaming__get_pull_request
|
|
257
|
+
Params: { owner: "owner", repo: "repo", pull_number: 123 }
|
|
258
|
+
Result: "PR #123: 'Fix bug' by @user, open, +50/-20, 3 files"
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
### Docs: Query Library
|
|
262
|
+
```
|
|
263
|
+
Task: "How do I use useState in React?"
|
|
264
|
+
1. MetaMCP_context7__resolve-library-id → "/facebook/react"
|
|
265
|
+
2. MetaMCP_context7__query-docs → Usage examples
|
|
266
|
+
Result: "useState returns [state, setState]. Example: ..."
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
## Reference Documentation
|
|
270
|
+
|
|
271
|
+
| Document | Content | When to Read |
|
|
272
|
+
|----------|---------|--------------|
|
|
273
|
+
| [tool-categories.md](references/tool-categories.md) | Full tool lists per category | Need specific tool |
|
|
274
|
+
| [tool-execution.md](references/tool-execution.md) | Routing algorithm, cache schema | Complex routing |
|
|
275
|
+
| [result-handling.md](references/result-handling.md) | Summarization patterns | Large results |
|
|
276
|
+
| [error-handling.md](references/error-handling.md) | Recovery procedures | Errors occur |
|
|
277
|
+
|
|
278
|
+
## Best Practices
|
|
279
|
+
|
|
280
|
+
1. **Prefer Cached Routing** - Always check cache first
|
|
281
|
+
2. **Batch Operations** - Execute related operations in sequence
|
|
282
|
+
3. **Summarize Aggressively** - Main agent needs actions, not data
|
|
283
|
+
4. **Fail Fast** - Ask for clarification rather than guessing
|
|
284
|
+
5. **Include Context** - Errors should be actionable
|