smithery.ai

api-endpoint

Add new API endpoints to the OpenGov SDK from an OpenAPI specification. Use when: (1) Adding a new resource module (e.g., fees.py, transactions.py) (2) Adding endpoints to an existing module (3) User provides an OpenAPI spec file path or asks to "add endpoints" or "implement API methods"

First seen Apr 26, 2026

Installation

$ npx skills add https://smithery.ai

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from smithery.ai · top by installs.

npx skills add https://smithery.ai

Browse all from smithery.ai

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 4,754 B
  • docs SUMMARY.md 403 B

History

  1. First seen on skills.sh
  2. First recorded snapshot · 2 installs

SKILL.md

OpenGov API Endpoint Generator

Generate SDK endpoints from OpenAPI specifications following project conventions.

Workflow

  1. Read the OpenAPI spec at the provided file path
  2. Extract attribute schemas - Use the schema extraction guide in [references/schema-extraction.md](references/schema-extraction.md) to:

- Locate the schema in the OpenAPI spec for each resource - Extract using jq command or Python script - Document all fields in a mapping table - Verify field types, required/optional status, and nullable flags - Verify field mappings before generating code

  1. Identify endpoints to implement from the spec
  2. Check existing code to understand current patterns and avoid duplicates
  3. Generate code following patterns in [references/patterns.md](references/patterns.md)
  4. Run tests and type checks to verify

Quick Reference

Files to Create/Modify

Component Location When
Endpoint module src/opengov_api/{resource}.py Always
Response models src/opengov_api/models/{resource}.py If typed responses needed
Params model src/opengov_api/models/params.py If list endpoint has filters
Enums src/opengov_api/models/enums.py If status/type enums needed
Model exports src/opengov_api/models/init.py When adding models
SDK exports src/opengov_api/init.py Always
Tests tests/test_{resource}.py Always
Common tests tests/testcommonendpoints.py Add to parametrized lists

OpenAPI to SDK Mapping

OpenAPI SDK
GET /{resource} list_{resource}() returning JSONAPIResponse[{Resource}Resource]
GET /{resource}/{id} get_{resource}(id) returning dict[str, Any]
POST /{resource} create_{resource}(data) returning dict[str, Any]
PATCH /{resource}/{id} update_{resource}(id, data) returning dict[str, Any]
DELETE /{resource}/{id} delete{resource}(id) or archive{resource}(id)
Nested GET /{parent}/{id}/{child} list{parent}{child}(parent_id)
Nested POST /{parent}/{id}/{child} add{parent}{child}(parent_id, data)

Filter Parameter Translation

OpenAPI Parameter SDK Param Name Model Field
filter[status] status filter_status
filter[createdAt] created_at filtercreatedat
filter[isEnabled] is_enabled filterisenabled
page[number] page_number page_number
page[size] page_size page_size

Detailed Patterns

See [references/patterns.md](references/patterns.md) for complete code examples including:

  • Full list endpoint with typed params/response
  • Iterator function pattern
  • Simple CRUD endpoints
  • Nested resource endpoints
  • Model definitions
  • Test patterns

Checklist

Before completing, verify:

Schema Extraction & Validation:

  • Schema extracted using jq/Python from OpenAPI spec (not inferred from memory)
  • All OpenAPI fields documented in mapping table
  • Field types match OpenAPI spec exactly (string/integer/number/boolean/array/object)
  • Required vs optional status matches spec (check required array)
  • Nullable fields handled correctly (nullable: true| None)
  • All camelCase fields have proper Field(alias=...) with exact casing
  • Field validators added only when needed (empty string → None, type coercion)
  • No extra fields beyond spec (unless intentionally added for SDK convenience)

Code Generation:

  • All endpoint functions have @handlerequesterrors decorator
  • All functions use with getclient() as client: pattern
  • List endpoints return JSONAPIResponse[{Resource}Resource]
  • Response models use Field(alias="camelCase") for JSON field mapping
  • Params model has toqueryparams() method
  • modelconfig = {"populateby_name": True} present in all attribute models

Integration:

  • Functions exported in init.py
  • Models exported in models/init.py
  • Tests created in tests/test_{resource}.py
  • List/Get endpoints added to testcommonendpoints.py parametrized lists

Verification:

  • uv run pytest passes
  • uv run pyright passes