# Skill Classifier — Verification Toolkit

> **Purpose:** Teach an AI agent how to classify a SkillSlap skill by type, requirements, and risk level.
> This is the first step in the 3-pass verification pipeline.

---

## 1. Overview

The Skill Classifier analyzes a skill's markdown content and produces a structured classification that determines:

1. **What kind of skill it is** (documentation, API workflow, code generation, etc.)
2. **What it requires** to be properly verified (API access, sandbox, browser, specific tools)
3. **How risky it is** to execute (safe, moderate, high, critical)

This classification feeds into the verification pipeline to determine which checks to run.

---

## 2. Input

You receive a skill with:

```json
{
  "title": "string",
  "description": "string | null",
  "content": "string (markdown)",
  "tags": ["string"],
  "version": "string"
}
```

---

## 3. Classification Schema

### 3a. Skill Type

| Type | Description | Examples |
|------|-------------|----------|
| `documentation` | Reference material, guides, how-tos | API docs, tutorials, READMEs |
| `api_workflow` | Interacts with external APIs | REST clients, webhook handlers |
| `code_generation` | Generates or transforms code | Scaffolding tools, transpilers |
| `agent_instructions` | Instructions for an AI agent to follow | Prompt templates, agent workflows |
| `tool_config` | Configuration for tools, CLIs, environments | Docker configs, CI/CD pipelines |
| `mixed` | Combines multiple types | Full-stack guides with API + code |

### 3b. Requirements

| Requirement | When to Set True |
|------------|-----------------|
| `api_access` | Skill references HTTP endpoints, webhooks, or external services |
| `code_sandbox` | Skill includes executable code that should be run in isolation |
| `browser_rendering` | Skill produces HTML/CSS output that needs visual verification |
| `specific_tools` | List any CLI tools, runtimes, or libraries the skill requires |

### 3c. Risk Level

| Level | Criteria |
|-------|----------|
| `safe` | Read-only, no side effects, documentation only |
| `moderate` | Makes API calls but no destructive operations |
| `high` | Writes data, modifies state, or accesses credentials |
| `critical` | System-level operations, shell commands, or credential management |

---

## 4. Classification Process

1. **Read the skill content** carefully
2. **Identify the primary type** — what does the skill mostly do?
3. **Check for requirements** — does it need APIs? Code execution? A browser?
4. **Assess risk** — what could go wrong if an agent follows these instructions blindly?
5. **Provide reasoning** — 1-2 sentences explaining your classification

---

## 5. Output Format

```json
{
  "type": "api_workflow",
  "requirements": {
    "api_access": true,
    "code_sandbox": false,
    "browser_rendering": false,
    "specific_tools": ["curl", "jq"]
  },
  "risk_level": "moderate",
  "reasoning": "This skill instructs agents to make HTTP requests to external APIs with authentication headers. No destructive operations but does write data via POST requests."
}
```

---

## 6. Classification Heuristics

### Indicators of Type

- **documentation**: Headers like "Overview", "Reference", no executable blocks
- **api_workflow**: HTTP method blocks (`GET`, `POST`), URL patterns, `Authorization` headers
- **code_generation**: Code blocks with language tags, file output patterns, scaffolding steps
- **agent_instructions**: Imperative mood ("Do X", "Then Y"), decision trees, tool usage patterns
- **tool_config**: Config file formats (YAML, TOML, JSON), environment variables, setup steps
- **mixed**: Multiple indicators from different categories

### Indicators of Risk

- **safe**: "This guide explains...", no code blocks, no URLs
- **moderate**: API calls with read operations, query parameters
- **high**: `POST`/`PUT`/`DELETE` with bodies, file writes, database operations
- **critical**: `rm`, `sudo`, shell commands, credential storage, `eval`, system calls

---

## 7. Edge Cases

- **Skills with code examples** that are illustrative (not meant to be executed) → `documentation`, `safe`
- **Skills that teach security testing** → classify based on the operations described, not the topic
- **Skills referencing external tools without including them** → still note in `specific_tools`
- **Empty or minimal skills** → `documentation`, `safe`, note in reasoning

## Playground

<!DOCTYPE html><html><head><meta charset='utf-8'><style>*{box-sizing:border-box;margin:0;padding:0}body{background:#0d1117;color:#e6edf3;font-family:monospace;font-size:12px;height:100vh;display:flex;flex-direction:column;overflow:hidden}.header{background:#161b22;border-bottom:1px solid #30363d;padding:8px 14px;font-size:11px;color:#8b949e;display:flex;justify-content:space-between;align-items:center;flex-shrink:0}.title{color:#58a6ff;font-weight:bold;font-size:13px}.panels{display:flex;flex:1;overflow:hidden}.panel{flex:1;overflow:auto;padding:12px;border-right:1px solid #30363d}.panel:last-child{border-right:none}.label{font-size:10px;color:#8b949e;text-transform:uppercase;letter-spacing:.08em;margin-bottom:6px}pre{white-space:pre-wrap;word-break:break-word;line-height:1.5}</style></head><body><div class='header'><span class='title'>Skill Classifier</span><span>Example · SkillSlap</span></div><div class='panels'><div class='panel'><div class='label'>Input: Skill metadata</div><pre><span style='color:#8b949e'>title: SQL Query Builder</span>
<span style='color:#8b949e'>tags: sql, database, productivity</span>
<span style='color:#8b949e'>content excerpt:</span>
<span style='color:#8b949e'>  "Takes a natural-language</span>
<span style='color:#8b949e'>   description and writes a</span>
<span style='color:#8b949e'>   SQL SELECT query. Supports</span>
<span style='color:#8b949e'>   JOINs, aggregates, subqueries."</span>
<span style='color:#8b949e'>files: none</span></pre></div><div class='panel'><div class='label'>Output: Classification</div><pre><span style='color:#58a6ff'>{</span>
<span style='color:#3fb950'>  "type"</span><span style='color:#8b949e'>: </span><span style='color:#e3b341'>"agent_instructions"</span><span style='color:#8b949e'>,</span>
<span style='color:#3fb950'>  "invocation_type"</span><span style='color:#8b949e'>: </span><span style='color:#e3b341'>"agent"</span><span style='color:#8b949e'>,</span>
<span style='color:#3fb950'>  "render_mode"</span><span style='color:#8b949e'>: </span><span style='color:#e3b341'>"terminal"</span><span style='color:#8b949e'>,</span>
<span style='color:#3fb950'>  "requirements"</span><span style='color:#8b949e'>: {</span>
<span style='color:#3fb950'>    "api_access"</span><span style='color:#8b949e'>: false,</span>
<span style='color:#3fb950'>    "tools"</span><span style='color:#8b949e'>: []</span>
<span style='color:#8b949e'>  },</span>
<span style='color:#3fb950'>  "risk_level"</span><span style='color:#8b949e'>: </span><span style='color:#e3b341'>"low"</span><span style='color:#8b949e'>,</span>
<span style='color:#3fb950'>  "reasoning"</span><span style='color:#8b949e'>: </span><span style='color:#e3b341'>"Pure text transformation.</span>
<span style='color:#e3b341'>   No external access required."</span>
<span style='color:#58a6ff'>}</span></pre></div></div></body></html>