Skip to main content

HTTP Contract: Skills (Unified)

Audience: CAIPE UI, automation scripts, gateway consumers.
Auth: Existing session/JWT patterns via withAuth unless noted.

Principlesโ€‹

  • Catalog and persisted config are different resources (FR-002).
  • Breaking change: /api/agent-skills family removed after migration (FR-010).

Catalog (unchanged purpose)โ€‹

MethodPathDescription
GET/api/skillsMerged skill catalog for browse (not CRUD list of raw Mongo docs).

Query/response shape: unchanged from current implementation.

Persisted skill configurationโ€‹

MethodPathDescription
GET/api/skills/configsList/filter persisted configs (team/global as today).
POST/api/skills/configsCreate config.
GET/api/skills/configs?id={id}Get one (if supported today).
PUT/api/skills/configsUpdate (body includes id).
DELETE/api/skills/configs?id={id}Delete.

Request/response bodies: align with current AgentSkill, CreateAgentSkillInput, and UpdateAgentSkillInput types.

Legacy mapping: Same semantics as former /api/agent-skills.

Supporting routes (moved base path)โ€‹

MethodPathDescription
GET, POST/api/skills/seedTemplate seeding / preview (admin flows as today).
POST/api/skills/generateAI-assisted SKILL generation (dynamic-agents proxy).
POST/api/skills/import-githubGitHub ancillary import.

Template import (new)โ€‹

MethodPathDescription
POST/api/skills/templates/importImport selected packaged templates as system rows.

Request body (JSON):

{
"template_ids": ["incident-postmortem-report"],
"import_all": false
}
  • template_ids: optional list of template source ids.
  • import_all: if true, import all known packaged templates (use with care).

Response (illustrative):

{
"imported": [{ "id": "skill-incident-postmortem-report-a1b2c3", "template_source_id": "incident-postmortem-report" }],
"skipped": [{ "template_source_id": "incident-postmortem-report", "reason": "already_imported" }],
"errors": []
}

Exact envelope should match existing API success/error helpers.

Gateway artifactsโ€‹

MethodPathDescription
GET/api/skills/bootstrapBootstrap markdown / snippet for IDE hooks.
GET/api/skills/install.shShell installer (advanced bulk path documented second).

Supervisor (unchanged endpoints; called by UI)โ€‹

  • POST {SUPERVISOR}/skills/refresh?include_hubs=false โ€” after config writes.
  • POST {SUPERVISOR}/skills/scan-content โ€” optional scan on save.

These are not part of Next.js /api/skills but are part of the end-to-end skills feature.


Planned (not yet implemented): Scanner jobs, hub scan, quarantine (FR-011โ€“FR-016)โ€‹

These endpoints and query parameters are specified in spec.md for future implementation. They are documented here so clients and the 097 data model stay aligned.

MethodPathPurpose
GET/api/skills?scan_status=โ€ฆ&quarantine=โ€ฆFilter merged catalog by scan_status and quarantine policy (when implemented).
POST/api/skills/scan-jobsStart async hub or catalog scan job.
GET/api/skills/scan-jobs/:idPoll job status and summary.
POST/api/skills/scan-jobs/:id/cancelCancel a running job.
GET/api/skills/quarantine-policyRead effective quarantine policy.
PUT/api/skills/quarantine-policyUpdate policy (admin).
POST/api/skills/re-scanRe-run scan for a skill or hub subset.

Supervisor (planned): GET {SUPERVISOR}/skills/scan-jobs/:id, POST {SUPERVISOR}/skills/re-scan โ€” mirror or proxy as needed when jobs run server-side.

See also data-model.md ยง Scan jobs and Quarantine policy.