fastapi-control-plane
FastAPI service patterns for catalyst-api: router organization, pydantic v2 request/response models, construct-scoped path design, IAM auth middleware…
Skill by Cloud-Byte-Consulting
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/cloud-byte-consulting-fastapi-control-plane
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: design, backend, security
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/fastapi-control-plane
What's inside
- Skill name
fastapi-control-plane- Description
- FastAPI service patterns for catalyst-api: router organization, pydantic v2 request/response models, construct-scoped path design, IAM auth middleware, dependency injection, structured error responses, health endpoints, and OpenAPI generation. Use when building or modifying catalyst-api endpoints.
- License
- BSD-3-Clause
- Instructions
- 156 lines in SKILL.md · view on GitHub
Files (1)
- SKILL.md
SKILL.md (first lines)
<!-- Vendored from: platform-catalyst/skills/fastapi-control-plane/SKILL.md (BittahCriminal/platform-catalyst, BSD-3-Clause). Adapted for Catalyst: PLAN.md/CLAUDE.md/DECISIONS.md scrubbed; ADR-008->ADR-001, ADR-009->ADR-002. -->
# FastAPI control plane
## Role
You guide the design and implementation of `catalyst-api`, the FastAPI control plane running on ECS Fargate. You enforce async-first patterns, construct-scoped routing, and API-lifecycle discipline per *Enterprise API Management* (Weir, Ch 7: API lifecycle) and *Platform Engineering for Architects* (Korbiacher et al., Ch 6: developer self-service, auth, tenancy). For thin routers, SOLID boundaries, and maintainable handler cores, invoke `@clean-python-code`.
## Instructions
1. **Router organization** — one router module per domain, mounted under versioned prefixes:
```
services/catalyst-api/catalyst/
routers/
tenants.py # /v1/tenants/...
environments.py # /v1/tenants/{t}/environments/...
landing_zones.py # /v1/tenants/{t}/environments/{e}/landing-zones/...
projects.py # /v1/.../projects/...
applications.py # /v1/.../applications/...
deployments.py # /v1/.../deployments/...
services_catalog.py # /v1/.../services/...
health.py # /v1/health, /v1/openapi.json
models/
constructs.py # ConstructAddress, Tenant, Environment, ...
deployments.py # DeployRequest, DeployStatus, ...
common.py # PaginatedResponse, ErrorResponse, ...
middleware/
auth.py # IAM / OIDC token validation
trace.py # X-Ray trace_id + request_id injection
error_handler.py # Global exception → structured JSON
dependencies/
db.py # Aurora connection pool (asyncpg via aioboto3 IAM auth)
github.py # GitHub App client (httpx)
construct_scope.py # Extract + validate construct address from path
```
2. **Construct-scoped paths** — the construct hierarchy embeds in the URL:
```
/v1/tenants/{tenant_slug}
/v1/tenants/{tenant_slug}/environments/{env_slug}
/v1/tenants/{tenant_slug}/environments/{env_slug}/landing-zones/{lz_slug}
.../{lz_slug}/projects/{project_slug}/applications/{app_slug}
```
Use a shared `ConstructScope` dependency that parses the path params into a `ConstructAddress` pydantic model and validates the caller's permission at that scope level.
3. **Pydantic v2 models** — every request/response is typed:
```python
from pydantic import BaseModel, Field, ConfigDict
class TenantCreate(BaseModel):
model_config = ConfigDict(strict=True)
slug: str = Field(..., pattern=r"^[a-z0-9-]{2,40}$")
display_name: str = Field(..., min_length=1, max_length=120)
owner_email: str # validated as email by a field_validator
class TenantResponse(BaseModel):
model_config = ConfigDict(from_attributes=True)
slug: str
display_name: str
created_at: datetime
construct_address: str # e.g. "pharmacy"
```
Per *Enterprise API Management* Ch 5 (CRUD service pattern): keep request models minimal (what the caller provides) and response models rich (what the system knows).
4. **Auth middleware** — two layers:
- **Token validation**: OIDC JWT from GitHub Actions or API key from `catalyst` CLI; resolved to a principal with scoped permissions.
- **Construct-scope check**: the `ConstructScope` dependency asserts the principal has the required verb (`read`, `create`, `deploy`, etc.) at the resolved construct level. Deny by default; 403 or 404 (hide existence) as appropriate.
Per *Platform Engineering for Architects* Ch 6 (pp 207-217): authentication and tenancy are foundational — never optional, never deferred.
5. **Structured error responses** — all errors return consistent JSON:
```python
class ErrorResponse(BaseModel):
detail: str
code: str # e.g. "ILLEGAL_TRANSITION", "CONSTRUCT_NOT_FOUND"
trace_id: str | None = None
request_id: str | None = None
# Register as exception handlers in main.py
@app.exception_handler(ConstructNotFoundError)
async def construct_not_found(request, exc):
return JSONResponse(status_code=404, content=ErrorResponse(...).model_dump())
```
6. **Health and metadata endpoints**:
```
GET /v1/health → {"status": "ok", "version": "...", "aurora": "connected"}
GET /v1/openapi.json → generated OpenAPI 3.1 spec
```
Health checks Aurora connectivity and returns degraded if the pool is exhausted. Per *Enterprise API Management* Ch 7 (Observe phase): observability starts at the health endpoint.
7. **Pagination** — cursor-based, not offset:
```python
class PaginatedResponse(BaseModel, Generic[T]):
items: list[T]
next_cursor: str | None = None
total_count: int | None = None # only when cheap to compute
```
Per *Enterprise API Management* Ch 5 (payload pagination, p130): cursor pagination scales; offset does not.
8. **Dependency injection** — use FastAPI `Depends()` for:
- Database session (async context manager)
- GitHub client (httpx.AsyncClient from app state)
- Construct scope (parsed from path + validated)
- Current principal (from auth middleware)
- Structlog logger (bound with trace_id + request_id)
9. **Logging** — `structlog` only, never `print()`:From Cloud-Byte-Consulting/Catalyst, BSD-3-Clause.
More from Cloud-Byte-Consulting/Catalyst
- 0.474score
bedrock-converse-client
Cloud-Byte-Consulting
Bedrock runtime Converse/ConverseStream API patterns: message structure, model ID selection, token limits, system prompts, retry with tenacity, error…
SkillCFreshness: CClaude Code +9 - 0.474score
ai-observability
Cloud-Byte-Consulting
Observability for Bedrock AI calls: EMF metrics (BedrockTokensIn, BedrockTokensOut, BedrockLatencyMs), X-Ray subsegments per model call, cost dimension…
SkillCFreshness: CClaude Code +9 - 0.474score
ai-output-validation
Cloud-Byte-Consulting
Pydantic v2 schemas for AI model responses: FindingsReport, StyleReport, SynthesisReport, the parse-retry-drop pattern, confidence scoring, and structured…
SkillCFreshness: CClaude Code +9 - 0.474score
bedrock-binding
Cloud-Byte-Consulting
Bedrock model binding for the Catalyst PR reviewer pipeline, surfaced as a thin stdio MCP server with two tools: bedrock_invoke_converse and…
SkillCFreshness: CClaude Code +9 - 0.474score
encryption-patterns
Cloud-Byte-Consulting
KMS and encryption-at-rest patterns for Catalyst: CMK lifecycle, key policies, service grants, three-key strategy (data, logs, secrets), and encryption…
SkillCFreshness: CClaude Code +9 - 0.474score
git-commit-practices
Cloud-Byte-Consulting
Git commit and branch practices for Catalyst that satisfy the challenge's "good Git practices" requirement and the 10% docs/commit-history evaluation…
SkillCFreshness: CClaude Code +9 - 0.474score
async-orchestration
Cloud-Byte-Consulting
Event-driven orchestration patterns for Catalyst: SQS FIFO with dedup, EventBridge rules and schedules, DLQ strategies, Step Functions state machines, retry…
SkillCFreshness: CClaude Code +9 - 0.474score
adr-writer
Cloud-Byte-Consulting
MADR-format Architectural Decision Records: context, decision drivers, considered options with pros/cons, decision outcome, consequences, and the supersedes…
SkillCFreshness: CClaude Code +9 - 0.474score
checkov-cloud-image-static-analysis
Cloud-Byte-Consulting
Designs Checkov-based static analysis for Terraform/OpenTofu IaC and Dockerfile/container hardening in Catalyst.
SkillCFreshness: CClaude Code +9 - 0.474score
clean-python-code
Cloud-Byte-Consulting
Maintainable Python for Catalyst: tooling discipline, idiomatic patterns, separation of concerns, SOLID boundaries, thin decorators, pragmatic use of advanced…
SkillCFreshness: CClaude Code +9 - 0.474score
container-hardening
Cloud-Byte-Consulting
Multi-stage Dockerfiles, distroless final images, non-root USER, read-only root filesystem, health checks, no :latest tags, vulnerability scanning, and ECS…
SkillCFreshness: CClaude Code +9 - 0.474score
deployment-strategies
Cloud-Byte-Consulting
Blue/green ECS via CodeDeploy, Lambda weighted alias shifting (canary), rollback triggers (alarm-based), pre/post traffic hooks, bake periods, and the…
SkillCFreshness: CClaude Code +9
Signals
- Stars
- 0
- Forks
- 0
- Open issues
- 57
- Last commit (this folder)
- May 21, 2026 (5 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- BSD-3-Clause
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from Cloud-Byte-Consulting
- 0.474score
adr-writer
Cloud-Byte-Consulting
MADR-format Architectural Decision Records: context, decision drivers, considered options with pros/cons, decision outcome, consequences, and the supersedes…
SkillCFreshness: CClaude Code +9 - 0.474score
checkov-cloud-image-static-analysis
Cloud-Byte-Consulting
Designs Checkov-based static analysis for Terraform/OpenTofu IaC and Dockerfile/container hardening in Catalyst.
SkillCFreshness: CClaude Code +9 - 0.474score
bedrock-binding
Cloud-Byte-Consulting
Bedrock model binding for the Catalyst PR reviewer pipeline, surfaced as a thin stdio MCP server with two tools: bedrock_invoke_converse and…
SkillCFreshness: CClaude Code +9 - 0.474score
ai-observability
Cloud-Byte-Consulting
Observability for Bedrock AI calls: EMF metrics (BedrockTokensIn, BedrockTokensOut, BedrockLatencyMs), X-Ray subsegments per model call, cost dimension…
SkillCFreshness: CClaude Code +9 - 0.474score
ai-output-validation
Cloud-Byte-Consulting
Pydantic v2 schemas for AI model responses: FindingsReport, StyleReport, SynthesisReport, the parse-retry-drop pattern, confidence scoring, and structured…
SkillCFreshness: CClaude Code +9 - 0.474score
clean-python-code
Cloud-Byte-Consulting
Maintainable Python for Catalyst: tooling discipline, idiomatic patterns, separation of concerns, SOLID boundaries, thin decorators, pragmatic use of advanced…
SkillCFreshness: CClaude Code +9
Cite this page
fastapi-control-plane skill. Agent Mart. https://agentmart.dev/skills/cloud-byte-consulting-fastapi-control-plane (last updated 2026-10-24)