document-api-endpoint

Installation
SKILL.md

Document & Type a Sentry API Endpoint

Add or fix OpenAPI docs for a Sentry endpoint with drf-spectacular. Full reference is at https://develop.sentry.dev/backend/api/public/, the most useful section to you will be https://develop.sentry.dev/backend/api/public/#5-method-decorator. This skill captures the non-obvious lessons on top of it. Most of the work is making the declared schema match what the endpoint actually returns. Before documenting, identify which endpoint class serves the route and what it does; the MCP tool that calls it is usually the fastest way to confirm its behavior. Promoting a PRIVATE/EXPERIMENTAL endpoint to PUBLIC is one application (see below).

Workflow

  1. Class-level @extend_schema(tags=[...]) — use the closest existing OPENAPI_TAGS entry.
  2. Method-level @extend_schema(operation_id=..., parameters=[...], responses={...}, examples=...).
  3. Reuse src/sentry/apidocs/parameters.py and examples/*.py; ensure owner = ApiOwner.<TEAM> is set.
  4. If a legacy api-docs/paths/**/*.json covers the path, remove it (see lesson 4).
  5. Validate, then verify against the live endpoint (lesson 1).

Lessons

1. Carefully compare what the code does vs declared types

Ideally, hit the live endpoint with a real token and diff the keys and types against your TypedDict. Serializers are sometimes inaccurate. Look out for counts coming back as floats instead of integers, IDs declared int emitted as strings, nested types declaring the wrong number of fields. Correct the declared type to match runtime.

curl -s -H "Authorization: Bearer $TOKEN" "https://us.sentry.io/api/0/<endpoint>" | jq 'keys'
Installs
74
GitHub Stars
792
First Seen
9 days ago
document-api-endpoint — getsentry/skills