{
  "openapi": "3.1.0",
  "info": {
    "title": "Agent Skills API",
    "version": "1.0.0",
    "description": "Public, read-only API for agentskills.codes — the open registry of agent skills (SKILL.md files) for AI coding assistants. No authentication required.",
    "license": {
      "name": "Open",
      "url": "https://agentskills.codes"
    }
  },
  "servers": [
    {
      "url": "https://agentskills.codes"
    }
  ],
  "paths": {
    "/api/v1/skills": {
      "get": {
        "operationId": "searchSkills",
        "summary": "Search and list agent skills",
        "description": "Returns a scored, paginated list of indexable agent skills. Omit `q` to browse by `sort`.",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "description": "Full-text query over name, author, category, and description.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "description": "Sort order when `q` is absent.",
            "schema": {
              "type": "string",
              "enum": [
                "popular",
                "installs",
                "views",
                "name"
              ],
              "default": "popular"
            }
          },
          {
            "name": "cat",
            "in": "query",
            "required": false,
            "description": "Comma-separated category filter.",
            "schema": {
              "type": "string",
              "enum": [
                "Coding",
                "Communication",
                "Data & Analytics",
                "Design",
                "Planning",
                "Productivity",
                "Research",
                "Security",
                "Writing"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Page size (1–100).",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 24
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "description": "Number of results to skip.",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of matching skills.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SkillSearchResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/skills/download/{id}": {
      "get": {
        "operationId": "downloadSkill",
        "summary": "Download a skill as a zip",
        "description": "Returns a zip containing the skill's SKILL.md (synthesized from catalog metadata when the upstream source is gone).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Numeric skill id (see `id` in the search response).",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Zip archive.",
            "content": {
              "application/zip": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Skill": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "slug": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "author": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "category": {
            "type": "string"
          },
          "views": {
            "type": "integer"
          },
          "installs": {
            "type": "integer"
          }
        },
        "required": [
          "id",
          "slug",
          "name",
          "author",
          "description",
          "category"
        ]
      },
      "SkillSearchResponse": {
        "type": "object",
        "properties": {
          "skills": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Skill"
            }
          },
          "total": {
            "type": "integer",
            "description": "Total matches before pagination."
          },
          "limit": {
            "type": "integer"
          },
          "offset": {
            "type": "integer"
          }
        },
        "required": [
          "skills",
          "total",
          "limit",
          "offset"
        ]
      }
    }
  }
}