Agent skill

API Surface Review

by polarsource in polarsource/polar

Review changes to Polar's API contract — Pydantic schemas, FastAPI endpoints, OpenAPI output and the generated SDKs.

MITAuto-check passedBackend & APIs

Install API Surface Review

skills CLI
$ npx skills add polarsource/polar --skill api-surface-review -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install polarsource/polar api-surface-review --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/polarsource/polar.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/api-surface-review .claude/skills/api-surface-review && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
api-surface-review
GitHub stars
10k
Token cost
~1.3k tokens
SKILL.md length
645 words
Files
1
Skills in repo
18
Repo updated
First seen
Licence
MIT

At a glance

Review changes to Polar's API contract — Pydantic schemas, FastAPI endpoints, OpenAPI output and the generated SDKs.

  • Works in 5 steps: Public or private → Schema shape → Naming → …
  • A diff touches schemas.py
  • SKILL.md covers Scope, Checks and Output
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

API Surface Review is an agent skill from polarsource/polar. Review changes to Polar's API contract — Pydantic schemas, FastAPI endpoints, OpenAPI output and the generated SDKs. Checks public vs private exposure, schema shape and naming, and whether the change breaks merchants or the generated clients. Use when a diff touches schemas.py, endpoints.py, docs/openapi.json or sdk/, or when the user asks whether an API change is breaking.

Its SKILL.md is about 1.3k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Backend & APIs, covering DataFrames, OpenAPI specifications and API design. It works with OpenAPI, FastAPI and Pydantic. The repository describes itself as: Polar — A billing platform for the intelligence era. The licence is MIT.

When your agent uses it

  • A diff touches schemas.py
  • Docs/openapi.json
  • The user asks whether an API change is breaking

Example prompts

  • “/api-surface-review”

Workflow steps

5 steps, taken from the step headings in SKILL.md.

  1. Public or private
  2. Schema shape
  3. Naming
  4. Breaking changes
  5. Route shape

What it can do on your machine

Read from SKILL.md and the folder at commit e4fc909. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

API Surface Review loads about 1.3k tokens when it runs. Until then it costs about 99 tokens; SKILL.md has 645 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~99
When it runs · the whole SKILL.md, loaded when a task matches
~1.3k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from polarsource/polar at commit e4fc909, republished under its MIT licence (© polarsource). 645 words, ~1,346 tokens.

Download SKILL.mdSave it as .claude/skills/api-surface-review/SKILL.md (or your agent's skills folder).
name
api-surface-review
description
Review changes to Polar's API contract — Pydantic schemas, FastAPI endpoints, OpenAPI output and the generated SDKs. Checks public vs private exposure, schema shape and naming, and whether the change breaks merchants or the generated clients. Use when a diff touches schemas.py, endpoints.py, docs/openapi.json or sdk/, or when the user asks whether an API change is breaking.
license
MIT
metadata.author
polar
metadata.version
1.0.0

API Surface Review (Polar)

The handle is the diff. The evidence is what this change does to the API contract, and whether any of it is breaking.

This is where Polar's most expensive review mistakes live. A schema change does not stay in the repo: it flows into docs/openapi.json, the generated TypeScript client, the Speakeasy SDKs under sdk/, and out to merchants who already wrote code against it.

Scope

Diffs touching **/schemas.py, **/endpoints.py, polar/openapi.py, docs/openapi.json, sdk/, clients/packages/client/.

CI already does part of this job. The OpenAPI Diff workflow posts the schema delta as a PR comment, and OpenAPI Client Regeneration Check fails if the client is stale. Do not recompute either by hand. Read the diff comment if it exists and judge whether the delta is acceptable; that judgement is the thing CI cannot make.

Owned elsewhere: ADR-0002 (status-coded PolarError), ADR-0007 (no default in output schemas) → adr-check. Endpoint conventions written in server/AGENTS.md — response_model and ORM returns, POST/PATCH/DELETE status codes, ListResource, responses=, the PolarRequestValidationError boundary → conventions-check. Existing shared types → reuse-check.

Checks

1. Public or private

APITag has two values, public and private (polar/openapi.py). Public means documented and in the SDKs.

  • Set it deliberately on every new router and route. Never hide something with include_in_schema=False; use tags=[APITag.private].
  • Tag the route, not the router, when only one route should change. The pattern: keep APITag.public on what stays, add APITag.private to the deprecated one.
  • Private endpoints (payouts are the standing example) are not in the SDK. Do not reason about them as public API.
  • On every new field, ask: does a merchant need to see this? Internal Organization settings keep leaking into the public API this way.
2. Schema shape
  • Output fields are required, nullable where needed. A default makes them optional in OpenAPI, which generates a wrongly-optional TS field. (ADR-0007 — name it, do not restate it.)
  • Type fields with their enum, not str.
  • Reuse a related resource's base schema rather than redefining its fields: class DisputeCustomer(CustomerBase): ....
  • A value that already exists as a model property is a plain field, not a reimplemented computed_field.
  • Descriptions are user-facing: no implementation detail, and write None not null.
  • Any field writing to a SQL INT column is Int32, so out-of-range input is rejected at validation instead of overflowing.
  • Constrain enums by listing allowed values (reason: Literal[RefundReason.foo, ...]) rather than a hand-rolled validator. Pydantic validates, OpenAPI documents.
  • Discriminated unions get a plain Discriminator plus SetSchemaReference, so the union lands in OpenAPI properly.
  • Do not over-constrain fields fed by a payment processor. "We'll never know what Stripe or other payment processor will send us."
Show full SKILL.md (221 more words)Show less
3. Naming

The union takes the clean name, the variants get qualified: CustomerCreate is the union, CustomerIndividualCreate and CustomerTeamCreate are members. Same for CustomerState.

Fields are snake_case. Prefer explicit over clever (payment_method_type, not payment_method). Do not overload an existing concept with a new meaning.

4. Breaking changes

Breaking = removing a field, flipping required/optional, changing a type, renaming anything, or changing a status code a client branches on.

Before removing a field or behaviour:

  1. Check Logfire for real usage. This is what François actually does. Merchants create things programmatically that nobody expects.
  2. If it is used, keep a compatibility layer and use SkipJsonSchema so runtime still accepts the value while it disappears from future SDKs.
  3. If it is genuinely breaking, say so plainly. That is a human decision, not something to wave through.
5. Route shape

Only the parts AGENTS.md does not already cover:

  • Trailing slash on root endpoints.
  • Errors on the same route need distinct status codes, or their schemas collide in the OpenAPI output.
  • A query parameter must act as a pure filter. If it changes the response shape, the resource is wrong and it wants its own route.
  • Removing an endpoint and updating its frontend caller in one PR is a deploy hazard → ship-safety owns the split.

Output

## API Surface

### 🔴 Blocking
- `file:line` — <what breaks, and for whom>. Fix: <fix>

### 🟠 Should fix
- `file:line` — <claim>. Fix: <fix>

### 🟡 Question
- `file:line` — <question>

### Notes
- public surface delta: <one line, or "see the OpenAPI Diff PR comment">

### Verdict
✅ Clean  |  ❌ n blocking, n should-fix

Anything blocking needs a human decision before merge.

© polarsource, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .agents/skills/api-surface-review of polarsource/polar.

Open the folder on GitHubat commit e4fc909

Compare with similar skills

API Surface Review next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

API Surface Review compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
API Surface Review this skillpolarsource/polar10k—~1.3kAutomated safety check: PassMIT
FastAPI ExpertJeffallan/claude-skills12k—~1.8kAutomated safety check: PassMIT
Python Fastapi Patternsaiskillstore/marketplace4301 repos~1.3kAutomated safety check: NotesNone
API Designericrisco/rsc-harness167—~3.1kAutomated safety check: PassMIT
Fastapi Patternsaffaan-m/ECC275k—~2.3kAutomated safety check: PassMIT
Fastapi Patternsaffaan-m/ECC275k—~2kAutomated safety check: PassMIT

Similar skills

  • FastAPI Expert

    Jeffallan/claude-skills

    Builds async Python APIs with FastAPI and Pydantic V2, covering endpoints, JWT authentication, async SQLAlchemy, WebSockets and pytest checks against the OpenAPI docs.

    12k GitHub stars~1.8k tokensUpdated 4 days ago
    Backend & APIsAuto-check passed
  • Python Fastapi Patterns

    aiskillstore/marketplace

    FastAPI web framework patterns. An agent skill from aiskillstore/marketplace.

    430 GitHub starsUsed in 1 repo~1.3k tokens
    Backend & APIsAuto-check: notes
  • API Design

    ericrisco/rsc-harness

    A skill your agent uses when settling the contract of an API you expose, before implementation: resources/URLs, REST vs GraphQL, versioning, one RFC 9457 error envelope, pagination, idempotency —…

    167 GitHub stars~3.1k tokensUpdated today
    Backend & APIsAuto-check passed
  • Fastapi Patterns

    affaan-m/ECC

    FastAPI patterns for async APIs, dependency injection, Pydantic request and response models, OpenAPI docs, tests, security, and production readiness.

    275k GitHub stars~2.3k tokensUpdated 3 days ago
    Backend & APIsAuto-check passed
  • Fastapi Patterns

    affaan-m/ECC

    非同期API、依存性注入、Pydanticのリクエスト・レスポンスモデル、OpenAPIドキュメント、テスト、セキュリティ、本番対応のためのFastAPIパターン。

    275k GitHub stars~2k tokensUpdated 3 days ago
    Backend & APIsAuto-check passed
  • API Docs Generator

    Mathews-Tom/armory

    Audits and enhances FastAPI and REST API documentation: missing descriptions, response codes, examples, docstrings, Pydantic models, OpenAPI spec.

    328 GitHub stars~1.7k tokensUpdated 2 days ago
    Backend & APIsAuto-check passed

More from polarsource/polar

All 18 skills in this repo
  • Polar Python SDK

    polarsource/polar

    Integrate Polar billing in server-side Python applications using the versioned Polar and PolarAsync clients.

    10k GitHub stars~1.8k tokensUpdated today
    Auto-check passed
  • Polar Typescript SDK

    polarsource/polar

    Integrate Polar billing in server-side TypeScript applications using the versioned createPolar and createPolarCore clients.

    10k GitHub stars~2k tokensUpdated today
    Auto-check passed
  • Adr Check

    polarsource/polar

    Check a code change against the repo's Accepted Architecture Decision Records (ADRs) in handbook/engineering/decisions/ and report violations with citations.

    10k GitHub stars~771 tokensUpdated today
    Auto-check passed
  • Billing Review

    polarsource/polar

    Review a diff that touches Polar's billing domain — subscriptions, cycles and crons, orders, billing entries, meters and usage, discounts, checkout, payments and dunning, refunds, disputes, payouts…

    10k GitHub stars~2.3k tokensUpdated today
    Auto-check passed
  • Interview Task

    polarsource/polar

    Prepare an interview task for a candidate, as part of our hiring process.

    10k GitHub stars~933 tokensUpdated today
    Auto-check passed
  • Open PR

    polarsource/polar

    Open or update a draft GitHub pull request after Polar-specific review and cubic CLI review.

    10k GitHub stars~586 tokensUpdated today
    Auto-check passed

Questions about API Surface Review

What does API Surface Review do?

Review changes to Polar's API contract — Pydantic schemas, FastAPI endpoints, OpenAPI output and the generated SDKs. API Surface Review is an agent skill from polarsource/polar. Review changes to Polar's API contract — Pydantic schemas, FastAPI endpoints, OpenAPI output and the generated SDKs.

When should I use API Surface Review?

API Surface Review fits situations like: A diff touches schemas.py; docs/openapi.json; the user asks whether an API change is breaking.

How do I install API Surface Review in Claude Code?

Run `npx skills add polarsource/polar --skill api-surface-review -a claude-code`. Or copy the skill folder (.agents/skills/api-surface-review in polarsource/polar) into .claude/skills/api-surface-review in your project. Claude Code loads it when a task matches its description.

How do I install API Surface Review in Codex?

Run `npx skills add polarsource/polar --skill api-surface-review -a codex`. Or copy the skill folder (.agents/skills/api-surface-review in polarsource/polar) into .agents/skills/api-surface-review in your project. Codex loads it when a task matches its description.

Can I use API Surface Review in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add polarsource/polar --skill api-surface-review -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/api-surface-review, .gemini/skills/api-surface-review, .github/skills/api-surface-review and .opencode/skills/api-surface-review in your project.

What does API Surface Review need to run?

SKILL.md names no scripts, command-line tools or credentials: API Surface Review is instructions for the agent only.

Does API Surface Review access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is API Surface Review safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does API Surface Review use?

API Surface Review is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does API Surface Review use?

About 1.3k tokens (SKILL.md is roughly 5.4k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to API Surface Review?

Skills that share tags, products or a category with API Surface Review: FastAPI Expert (Jeffallan/claude-skills, 12k stars), Python Fastapi Patterns (aiskillstore/marketplace, 430 stars), API Design (ericrisco/rsc-harness, 167 stars) and Fastapi Patterns (affaan-m/ECC, 275k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains API Surface Review?

polarsource (a GitHub organization) maintains it in polarsource/polar, which has 10,340 GitHub stars. The repository holds 18 skills in this directory. The repository was last updated on October 7, 2026.

Source: polarsource/polar on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.