Sync, update, and validate the OpenAPI specification (backend/openapi.yml) against the Flask API routes. Use whenever endpoints have been added, changed, or removed, or when the user mentions API docs, swagger, OpenAPI, endpoint documentation, "update the spec", or has just added/modified a route or resource class. Also use when checking for drift between the code and the spec.
71
88%
Does it follow best practices?
Impact
—
No eval scenarios have been run
Passed
No known issues
You are responsible for keeping backend/openapi.yml in sync with the Flask API routes defined in backend/ops_api/ops/urls.py and their implementations.
Most resource classes live in backend/ops_api/ops/resources/, but some are in other locations:
backend/ops_api/ops/resources/*.py (33 files)backend/ops_api/ops/document/api.py (separate module with DocumentItemAPI, DocumentListAPI)backend/ops_api/ops/utils/version.pybackend/ops_api/ops/resources/health_check.pyWhen looking up a resource class, check views.py imports first — they'll tell you the exact module path.
Interpret $ARGUMENTS to decide what to sync:
$ARGUMENTS is a path like /agreements/ or lookups/agreement-typesbackend/ops_api/ops/urls.pyviews.py imports — may be in resources/, document/, or utils/)backend/openapi.yml$ARGUMENTS is --branch or empty/not providedgit diff main...HEAD --name-only to find files changed on this branchbackend/ops_api/ops/urls.py (route changes)backend/ops_api/ops/resources/ (endpoint implementation changes)backend/ops_api/ops/document/ (document API changes)backend/ops_api/ops/views.py (view registration changes)backend/ops_api/ops/schemas/ (schema changes that affect request/response shapes)backend/models/ (model changes that affect response schemas)backend/openapi.yml needs updating$ARGUMENTS is --all or --syncbackend/ops_api/ops/urls.pybackend/openapi.yml/portfolios/ vs /portfolios)For each endpoint that needs syncing, follow these steps:
Read backend/ops_api/ops/urls.py to find the URL rule, e.g.:
api_bp.add_url_rule("/agreements/<int:id>", view_func=AGREEMENT_ITEM_API_VIEW_FUNC)Read backend/ops_api/ops/views.py to find the view function and its resource class:
AGREEMENT_ITEM_API_VIEW_FUNC = AgreementItemAPI.as_view("agreements-item", Agreement)Read the resource class (usually in backend/ops_api/ops/resources/, but check the import in views.py — some live in document/api.py or utils/) to understand:
@is_authorized decorator)If the resource uses a model or schema, read it to understand the response shape:
backend/models/backend/ops_api/ops/schemas/Add or update the path entry in backend/openapi.yml following the existing conventions:
tags, operationId, description, parameters, responses$ref for shared schemas where they exist in the components section<int:id> to OpenAPI {id} format/agreements/ not /agreements)Flask route <int:id> maps to OpenAPI {id}. Match the parameter name used in the Flask route.
URL prefix /api/v1 is already defined in servers: - do NOT include it in paths.
Trailing slashes: Always check the actual Flask route in urls.py — some paths have trailing slashes and some don't. The openapi.yml path must match the Flask route exactly. Watch for existing inconsistencies (e.g., openapi.yml says /portfolios but urls.py says /portfolios/) and fix them when you encounter them.
After making changes, run the validation script:
./backend/validate_openapi.shReport the validation results to the user. If there are errors:
security section at the bottom applies globally - individual endpoints don't need it unless they differ.components/schemas section before defining inline schemas - reuse where possible.e2a9461
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.