| name | mas-api-contract |
| description | Define backend API contract standards for FastAPI services. Use when adding or refactoring HTTP/WebSocket endpoints in app/api, designing request/response schemas in app/models/schema.py, standardizing status/error contracts, and maintaining backward compatibility for clients. |
MAS API Contract
Objective
Keep backend API interfaces stable, consistent, and easy to consume.
Global Constraints
Apply these constraints while using this skill.
- Make minimal necessary changes first; avoid broad refactors unless explicitly requested.
- Align with current code style and existing project conventions in the touched module.
- Avoid over-engineering, over-abstraction, and defensive programming that does not match existing code patterns.
- Study similar existing implementations deeply before coding and follow established local patterns.
Scope
Apply to:
- HTTP endpoints under
app/api/*.
- Request/response schema models in
app/models/schema.py.
- WebSocket message contracts used by backend services.
Current dev baseline:
- Keep FastAPI responses aligned with
OutBase-style envelopes used in app/models/schema.py.
- Keep WebSocket contracts aligned with current envelope conventions already used by
app/api/core.py and WS command routes.
Contract Principles
- Keep one clear contract per endpoint action.
- Keep request and response types explicit and version-safe.
- Keep error semantics predictable across endpoints.
- Keep compatibility-first behavior for public contract changes.
Endpoint Naming Rules
- Use resource-oriented prefixes: .