48 lines
1.8 KiB
Markdown
48 lines
1.8 KiB
Markdown
---
|
||
name: create-skill
|
||
description: Guidelines for creating and defining new OpenCode agent skills.
|
||
compatibility: opencode
|
||
---
|
||
|
||
# Create Skill Skill
|
||
|
||
This skill provides the standardized process for developing reusable behavioral patterns (Skills) in OpenCode.
|
||
|
||
## Workflow
|
||
1. **Identify a Reusable Pattern**: Find a task that is performed repeatedly across sessions or projects (e.g., "Git Release Process", "API Documentation Generation").
|
||
2. **Create the Skill Directory**:
|
||
- Path: `.opencode/skills/<skill-name>/`
|
||
- Ensure `<skill-name>` follows naming rules: lowercase alphanumeric, single hyphens, no leading/trailing hyphens.
|
||
3. **Define the `SKILL.md` file**:
|
||
- Create a `SKILL.md` file inside the directory.
|
||
- **Frontmatter (Required)**:
|
||
- `name`: Must match the directory name exactly.
|
||
- `description`: A concise explanation of what the skill does and when to use it (1-1024 chars).
|
||
- `compatibility`: Optional, typically set to `opencode`.
|
||
- **Content**: Write detailed instructions, checklists, or examples that guide the agent's behavior.
|
||
4. **Testing & Validation**:
|
||
- Call the skill using the `skill` tool: `skill({ name: "<skill-name>" })`.
|
||
- Verify that the agent follows the guidelines defined in the content.
|
||
|
||
## Naming Constraints
|
||
- 1–64 characters.
|
||
- Regex: `^[a-z0-9]+(-[a-z0-9]+)*$`
|
||
|
||
## Example Implementation
|
||
**Directory**: `.opencode/skills/api-doc-gen/`
|
||
**File**: `SKILL.md`
|
||
```markdown
|
||
---
|
||
name: api-doc-gen
|
||
description: Generates standardized API documentation from source code analysis.
|
||
compatibility: opencode
|
||
---
|
||
|
||
# API Documentation Generation
|
||
|
||
## Steps
|
||
1. Analyze the existing endpoints and their request/response bodies.
|
||
2. Follow the project's format (e.g., OpenAPI 3.0).
|
||
3. Ensure all authentication requirements are documented.
|
||
```
|