Software DevelopmentOfficial · getsentry

Document Api Endpoint skill for Claude

Document and type a Sentry API endpoint. Write or fix @extend_schema decorators, specify response TypedDicts, type request parameters, correct type drift between the declared schema and the runtime response, and validate the generated spec.

When Claude uses it

Use when asked to "document an endpoint", "add OpenAPI docs", "add/fix @extend_schema", "type an endpoint response", "fix the response type", "fix type drift", "reuse a response type", "split an overloaded endpoint", "specify the response schema", "add a TypedDict response", "migrate a legacy api-docs path", "fix a parameter type", or "make an endpoint public" / "promote an endpoint" (promotion is one section here).

Document Api Endpoint SKILL.md

The full skill file from getsentry/skills (Apache-2.0).

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'

2. Reuse the canonical response type

Match the codebase's XxxResponseOptional(TypedDict, total=False) mixin (main class declares required fields). Nullable-vs-absent: T | None = key always present, value may be null; NotRequired[T] = key only set under a condition (e.g. an expand query param). Reuse the existing canonical type instead of re-declaring a second or third copy in a *_types.py. If there's no clean canonical type to reuse (e.g. a payload proxied from another service like vroom/profiling), type it dict[str, Any] rather than inventing a new mirror, and confirm the shape from the owning service's repo, not just the serializer.

3. Infer the type. Avoid cast and # type: ignore

When a serializer returns a base type plus extra fields, refactor the producing code so the response type is inferred rather than forced.

4. Legacy doc migration is all-or-nothing per path

Delete the api-docs/paths/**/*.json file AND its $ref in api-docs/openapi.json. drf-spectacular's APPEND_PATHS does not merge HTTP methods, so once any method on a path uses @extend_schema, all legacy methods on that path vanish — migrate every method on the path in one commit.

Promoting to PUBLIC

Do the workflow above, then on the concrete endpoint only (leave siblings PRIVATE):

  • Bump publish_status[<METHOD>] → PUBLIC and set owner = ApiOwner.<TEAM>.
  • Remove the method from API_OWNERSHIP_ALLOWLIST_DONT_MODIFY in the same change as the flip.
  • If the endpoint is redundant or being renamed, delete or deprecate the old version in its own change first, then stack the publish on top.
  • Note in the PR if scopes widen (event:read → event:{admin,read,write}) — that's drf-spectacular regenerating from permission_classes, documentation-only.

The change reaches the @sentry/api SDK / MCP with the next api@ release of getsentry/sentry's static/packages/api, which openapi.yml cuts on master when the spec changes.

Validate

make build-api-docs
pnpm run validate-api-examples
.venv/bin/pytest -q --reuse-db tests/apidocs/endpoints/<area>/test_<name>.py
.venv/bin/prek run -q --files <changed paths>

How to install Document Api Endpoint

Claude Code

Copy the skill into your personal skills folder (or into .claude/skills/ inside a project):

npx degit getsentry/skills/skills/document-api-endpoint#main ~/.claude/skills/document-api-endpoint

Codex

npx degit getsentry/skills/skills/document-api-endpoint#main ~/.codex/skills/document-api-endpoint

Claude.ai and Claude Desktop

Download the skill folder from GitHub, zip it, and upload it under Settings → Capabilities → Skills.

Frequently asked questions

+What does the Document Api Endpoint skill do?

Document and type a Sentry API endpoint. Write or fix @extend_schema decorators, specify response TypedDicts, type request parameters, correct type drift between the declared schema and the runtime response, and validate the generated spec. Use when asked to "document an endpoint", "add OpenAPI docs", "add/fix @extend_schema", "type an endpoint response", "fix the response type", "fix type drift", "reuse a response type", "split an overloaded endpoint", "specify the response schema", "add a TypedDict response", "migrate a legacy api-docs path", "fix a parameter type", or "make an endpoint public" / "promote an endpoint" (promotion is one section here).

+How do I install Document Api Endpoint in Claude Code?

Copy the skill folder into ~/.claude/skills/document-api-endpoint, for example with "npx degit getsentry/skills/skills/document-api-endpoint#main ~/.claude/skills/document-api-endpoint". Claude Code loads it automatically and uses it when a task matches.

+Does Document Api Endpoint work with ChatGPT or Codex?

Yes. Document Api Endpoint uses the open SKILL.md format. In Codex, put the folder in ~/.codex/skills/document-api-endpoint. In Claude.ai, zip the folder and upload it under Settings → Capabilities → Skills.

+Is Document Api Endpoint free?

Document Api Endpoint is published on GitHub by getsentry under the Apache-2.0 license, which allows free use.

Related software development skills

  1. Code Review

    Review the changes since a fixed point (commit, branch, tag, or merge-base) along two axes: Standards (does the code follow this repo's…

    mattpocock/skills★ 327k
  2. Using Agent Skills

    Discovers and invokes agent skills. Use when starting a session, or when you need to decide which skill or workflow applies to the piece of…

    addyosmani/agent-skills★ 119k
  3. Build

    Fully automate a coding task with make-plan, do, and babysit.

    thedotmack/claude-mem★ 118k
  4. Pr Link Issue

    Official

    Append a GitHub issue link and its Linear ticket to the current PR's description.

    getsentry/skills★ 1.2k
  5. Secret Serialization

    Official

    Finds secrets, tokens, passwords, and API keys that can leak through generated serialization: Python dataclass repr and asdict, attrs,…

    getsentry/skills★ 1.2k
  6. Typing Exclusion Worker

    Official

    Python typing exclusion worker: remove assigned mypy exclusion modules in small scoped batches, fix typing issues, run validation, and…

    getsentry/skills★ 1.2k
  7. Youtube Api

    Reach for this when YouTube data is needed and Google's Data API is the obstacle: no quota units, no OAuth consent screens, one Bearer key.

    artemchuikin/youtube-skills★ 275
  8. Mongodb Atlas Stream Processing

    Official

    Manages MongoDB Atlas Stream Processing (ASP) workflows. Handles workspace provisioning, data source/sink connections, processor lifecycle…

    mongodb/agent-skills★ 206
  9. Mongodb Connection

    Official

    Optimize MongoDB client connection configuration (pools, timeouts, patterns) for any supported driver language.

    mongodb/agent-skills★ 206

See all software development skills →

More skills from getsentry

  1. Find Bugs

    Official

    Find bugs, security vulnerabilities, and code quality issues in local branch changes.

    getsentry/skills★ 1.2k
  2. Gh Review Requests

    Official

    Fetch unread GitHub notifications for open PRs where review is requested from a specified team or opened by a team member.

    getsentry/skills★ 1.2k
  3. Gha Security Review

    Official

    GitHub Actions security review for workflow exploitation vulnerabilities.

    getsentry/skills★ 1.2k

All skills by getsentry →

Give your whole team an AI agent with skills

Cody runs managed AI agents your team can message in Slack, Teams, WhatsApp and the web, with 50+ business integrations, scheduled tasks and memory. No terminal required.