---
description: Create custom skills for agents
argument-hint: "[skill-name or task-id]"
agent: build
---

# Create Skill: $ARGUMENTS

## For General Skill Creation (No Task)

**Proceed if:**

- Building reusable skill
- No task structure needed
- General purpose tool

Steps:

1. Define skill purpose and interface
2. Implement skill logic
3. Test skill
4. Document usage
5. Save to `.opencode/skills/`

---

## For Task-Constrained Skill Creation (With Task Files)

## Phase 1: Task Validation

### Check Task Exists

Check task exists via backlog_task_view({ id: "$ARGUMENTS" }), then verify files in `@backlog/tasks/$ARGUMENTS/`: prd.md + spec.md

**If missing:** Create with `/task-with-spec "$ARGUMENTS"` first.

### Load Skill Requirements from Task

From PRD:

- Skill purpose (goal)
- Skill scope (in-scope items)

From Spec:

- Technical constraints
- Naming conventions

## Phase 2: Task-Based Skill Planning

### Extract Skill Requirements from Task

**From PRD:**

- Skill purpose: [From PRD goal]
- Skill scope: [From PRD in-scope items]

**From Spec:**

- Technical constraints: [From spec constraints]
- Naming conventions: [From spec naming]

### Skill Boundaries (Task-Defined)

- **Functionality:** [From PRD goal]
- **Technical limits:** [From spec constraints]
- **Integration points:** [From spec architecture]
- **Success criteria:** [From PRD success criteria]

## Phase 3: Constrained Skill Creation

### Create Skill Within Task Specifications

```
Create skill for task $ARGUMENTS

ANTI-HALLUCINATION SKILL REQUIREMENTS:
1. Read $TASK_DIR/prd.md and spec.md FIRST
2. Create skill only for PRD-defined purpose
3. Follow all technical constraints from spec
4. Use naming conventions from spec
5. Implement only within PRD scope
6. Stop if any constraint violation detected
7. Complete review.md after work
8. Mark success criteria as completed

SKILL BOUNDARIES:
- Purpose: [From PRD goal]
- Scope: [From PRD scope]
- Constraints: [From spec constraints]
- Integration: [From spec architecture]

NO EXCEPTIONS: Skill must serve task requirements only
```

### Skill Creation Process:

1. **Analyze task requirements** from PRD+spec
2. **Design skill interface** for task-specific needs
3. **Implement skill logic** within spec constraints
4. **Test skill** against task success criteria
5. **Document skill** following spec patterns

## Phase 4: Skill Validation

### Task Compliance Check:

- [ ] Skill serves PRD goal only
- [ ] Implementation follows spec constraints
- [ ] Uses correct naming conventions
- [ ] Integrates with task architecture
- [ ] Meets all success criteria

### Technical Validation:

```
session({
  mode: "message",
  agent: "code-auditor",
  text: "Review skill for task $ARGUMENTS compliance"
})
```

## Phase 5: Skill Integration

### Install and Document

Save skill to `.opencode/skills/[skill-name]/` with:

- SKILL.md (purpose, constraints, integration)
- Implementation files
- Tests

For task-based skills, link to task files in documentation.

## Phase 6: Task Completion

Mark complete with `/complete-task $ARGUMENTS` if task-based.

---

**ANTI-HALLUCINATION: Task skills serve requirements; general skills are independent**
