Optimize Skill#

POST/v1/repos/{owner}/{repo}/optimize

Runs LLM-powered optimization on a SKILL.md file. Returns the original and optimized content with before/after quality scores. Rate limited to 5 requests per minute.

Path Parameters#

ParameterTypeDescription
ownerstringGitHub username or organization
repostringRepository name

Query Parameters#

ParameterTypeDescription
pathstringPath to the skill directory or SKILL.md file

Request Body#

Optional JSON body:

FieldTypeDescription
modelstring?LLM model override (default: server-configured)

Response#

Returns original_content, optimized_content, original_score, optimized_score, original_failures, optimized_failures, and usage (token counts).

example response
{ "owner": "owner", "repo": "repo", "path": "skills/my-skill/SKILL.md", "original_content": "---\nname: my-skill\n---\n...", "optimized_content": "---\nname: my-skill\n---\n...", "original_score": 72.5, "optimized_score": 95.0, "original_failures": 5, "optimized_failures": 1, "usage": { "model": "claude-haiku-4-5-20251001", "input_tokens": 2100, "output_tokens": 1800 } }

This endpoint calls an LLM and may take 10-30 seconds to respond. Results are cached per commit SHA and model — repeated requests for the same skill on the same commit return the cached response.

Errors#

StatusCause
404Repository or skill path not found
422LLM generation failed
429Rate limit exceeded
503Service not configured (missing API key)
504Operation timed out

Example#

bash
curl -X POST "https://api.skill-lab.dev/v1/repos/owner/repo/optimize?path=my-skill"
javascript
const res = await fetch("https://api.skill-lab.dev/v1/repos/owner/repo/optimize?path=my-skill", { method: "POST" });
const data = await res.json();
// data.optimized_score
python
import httpx

res = httpx.post("https://api.skill-lab.dev/v1/repos/owner/repo/optimize?path=my-skill")
data = res.json()
# data['optimized_score']