python-backend-fastapi
FastAPI + Pydantic v2 backend workflow: implement/modify API endpoints with thin handlers + service layer, add pytest tests, manage idempotent Alembic migrations, and implement streaming ETL/parsers with invalid-row CSV logging. Use this skill when working on Python backend APIs, schema changes, or ingestion/parsing pipelines.
What this skill does
# Python backend (FastAPI + Pydantic v2 + Alembic) ## Activation cues Use this skill when the task involves: 1) new or modified FastAPI endpoints, routers, dependencies, middleware 2) request/response validation, schema design, OpenAPI correctness (Pydantic v2) 3) database schema changes (Alembic revisions) 4) backend logging and request tracing 5) ETL / parsers / import pipelines with memory constraints and “bad rows” reporting ## Operating principles (agent workflow) 1) Start with a short plan before editing code. Prefer file-path-specific steps and repository-aligned patterns. 2) Ask up to 1–3 clarifying questions only if truly blocking. 3) Prefer verifiable goals: tests, migrations, reproducible API calls, and deterministic outputs. 4) For complex/high-risk changes, run an internal Chain-of-Verification (CoVe): draft → 3–5 verification questions → answer independently → revise; surface only final result + (optional) UNCERTAIN items and how to verify them. ## Standard implementation workflow ### 1) Context discovery (do not invent patterns) - Locate existing routers, dependency injection conventions, error handling, and response schema patterns. - Identify service layer boundaries (or create them if missing). - Find existing migration conventions and logging format. ### 2) API contract first (Pydantic v2) - Define/extend request & response models with Pydantic v2. - Ensure OpenAPI reflects reality (status codes, response shapes, optional fields). - Keep handlers thin: parse/validate, delegate to service, map service result to response. **Definition of “thin handler”:** - No business rules in the endpoint function beyond wiring + basic validation. - No direct DB logic in the handler unless the codebase already standardizes it there. ### 3) Service layer + tests (pytest) - Move business logic to a service module with unit tests. - Prefer tests that encode behavior and edge cases (happy path, validation, not found, conflicts). - Add/extend fixtures in line with repo conventions. ### 4) Dependency Injection (FastAPI Depends) - Use `Depends` for DI and request-scoped dependencies. - If a request-id is used in the project, propagate it through dependencies/services. ### 5) Alembic migrations (every schema change) - Create a new revision for each schema change. - Make migrations idempotent and safe: - avoid non-deterministic operations - provide both upgrade and downgrade - ensure ordering is correct with dependencies - If the change is data-destructive, clearly annotate risk and required operator steps. ### 6) Logging (stdlib logging) - Use Python stdlib `logging`. - Include request id (if available) and key fields relevant to the operation. - Avoid logging secrets/PII; log identifiers and high-level state transitions instead. ### 7) ETL / parsers (streaming, error CSV) When implementing ingestion/parsing: - Process input **file-by-file** (and ideally row-by-row) to avoid loading all data into memory. - For invalid records: - write a CSV containing: `timestamp`, `file`, `line`, `error`, `original_row` - keep `original_row` as close to raw input as possible (avoid “fixing” it before logging) - Logging must allow operators to reproduce and patch upstream data. ## Definition of done (backend changes) A change is “done” only if: 1) endpoint behavior matches contract (schemas + status codes) 2) tests exist and pass for new/changed logic 3) migrations exist for schema changes (upgrade + downgrade) 4) logging is present for operationally relevant paths 5) for new endpoints: provide example `curl` or `httpie` calls + expected responses ## Examples (template snippets) ### Example: endpoint acceptance checklist - Request model defined (Pydantic v2) - Response model defined (Pydantic v2) - Handler delegates to service - Tests cover core behavior + edge case - Example `curl` included in PR/plan notes ### Example: ETL error row - timestamp: ISO-8601 - file: input filename - line: input line number (1-based) - error: short human-readable description - original_row: raw row payload
Related in Backend & APIs
jfrog
IncludedInteract with the JFrog Platform via the JFrog CLI and REST/GraphQL APIs. Use this skill when the user wants to manage Artifactory repositories, upload or download artifacts, manage builds, configure permissions, manage users and groups, work with access tokens, configure JFrog CLI servers, search artifacts, manage properties, set up replication, manage JFrog Projects, run security audits or scans, look up CVE details, query exposures scan results from JFrog Advanced Security, manage release bundles and lifecycle operations, aggregate or export platform data, or perform any JFrog Platform administration task. Also use when the user mentions jf, jfrog, artifactory, xray, distribution, evidence, apptrust, onemodel, graphql, workers, mission control, curation, advanced security, exposures, or any JFrog product name.
cupynumeric-migration-readiness
IncludedPre-migration readiness assessor for porting NumPy to cuPyNumeric. Use BEFORE substantial porting work begins when the user asks whether code will scale on GPU, whether they should migrate to cuPyNumeric, which NumPy patterns transfer cleanly, what must be refactored before porting, or mentions pre-port assessment, scaling analysis, or refactor planning. Inspect the user's source code, look up NumPy usage, cross-reference the cuPyNumeric API support manifest, and distinguish distributed-scaling-friendly patterns from blockers such as unsupported APIs, scalar synchronization, host round-trips, Python/object-heavy control flow, shape/data-dependent branching, and in-place mutation hazards. Produce a verdict of READY, LIGHT REFACTOR, SIGNIFICANT REFACTOR, or NOT RECOMMENDED, with concrete refactor pointers.
alibabacloud-data-agent-skill
IncludedInvoke Alibaba Cloud Apsara Data Agent for Analytics via CLI to perform natural language-driven data analysis on enterprise databases. Data Agent for Analytics is an intelligent data analysis agent developed by Alibaba Cloud Database team for enterprise users. It automatically completes requirement analysis, data understanding, analysis insights, and report generation based on natural language descriptions. This tool supports: discovering data resources (instances/databases/tables) managed in DMS, initiating query or deep analysis sessions, real-time progress tracking, and retrieving analysis conclusions and generated reports. Use this Skill when users need to query databases, analyze data trends, generate data reports, ask questions in natural language, or mention "Data Agent", "data analysis", "database query", "SQL analysis", "data insights".
token-optimizer
IncludedReduce OpenClaw token usage and API costs through smart model routing, heartbeat optimization, budget tracking, and native 2026.2.15 features (session pruning, bootstrap size limits, cache TTL alignment). Use when token costs are high, API rate limits are being hit, or hosting multiple agents at scale. The 4 executable scripts (context_optimizer, model_router, heartbeat_optimizer, token_tracker) are local-only — no network requests, no subprocess calls, no system modifications. Reference files (PROVIDERS.md, config-patches.json) document optional multi-provider strategies that require external API keys and network access if you choose to use them. See SECURITY.md for full breakdown.
resend-cli
IncludedUse this skill when the task is specifically about operating Resend from an AI agent, terminal session, or CI job via the official resend CLI: installing/authenticating the CLI, sending/listing/updating/cancelling emails, batch sends, domains and DNS, webhooks and local listeners, inbound receiving, contacts, topics, segments, broadcasts, templates, API keys, profiles, or debugging Resend CLI/API failures. Trigger on mentions of Resend CLI, `resend`, `resend doctor`, `resend emails send`, `resend domains`, `resend webhooks listen`, `resend emails receiving`, or agent-friendly terminal automation.
alibabacloud-odps-maxframe-coding
IncludedUse this skill for MaxFrame SDK development and documentation navigation on Alibaba Cloud MaxCompute (ODPS). Helps answer MaxFrame API, concept, official example, and supported pandas API questions; create data processing programs; read/write MaxCompute tables; debug jobs (remote or local); and build custom DPE runtime images. Trigger when users mention MaxFrame, MaxCompute with MaxFrame, ODPS table processing, DPE runtime, MaxFrame docs/examples, DataFrame/Tensor operations, or GPU runtime setup. Works for both English and Chinese queries about Alibaba Cloud data processing with MaxFrame.