agentsclimarketplace

Backend python

Skill FairMind-Gen-AI-Studio/fairmind-integration/skills/backend-python

Use when implementing backend features with Python, FastAPI, or Pydantic. This skill covers API design, data validation, async patterns, and testing strategies for Python backend applications.From its SKILL.md

Install
npx -y skills add FairMind-Gen-AI-Studio/fairmind-integration --skill backend-python

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

2 things to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
  • 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

3.4 KB, as published. Nobody here has run it

Backend Development with Python

Overview

This skill provides guidance for backend development using Python with FastAPI for APIs and Pydantic for data validation.

Announce at start: "I'm using the backend-python skill for this Python backend implementation."

When to Use

Use this skill when:

  • Creating FastAPI endpoints
  • Implementing Pydantic models for validation
  • Writing async Python code
  • Building REST APIs with Python
  • Implementing background tasks
  • Testing Python backend code

Core Workflow

Step 1: Understand API Requirements

Before implementing:

  1. Review the API contract from user story
  2. Identify data models and validation rules
  3. Plan async vs sync operations
  4. Design error handling strategy

Step 2: Design Data Models

  1. Define Pydantic models for request/response
  2. Plan validation rules and constraints
  3. Consider serialization needs
  4. Document model relationships

Step 3: Implement Endpoints

Follow this order:

  1. Models first - Define Pydantic schemas
  2. Dependencies - Create reusable dependencies
  3. Business logic - Implement service layer
  4. Endpoints - Create FastAPI routes
  5. Error handling - Handle all error cases

Step 4: Test and Document

  1. Write pytest tests for endpoints
  2. Verify error handling
  3. Test async behavior
  4. Generate OpenAPI docs

Reference Files

FileContentWhen to Use
references/fastapi-patterns.mdAPI design, dependenciesCreating endpoints
references/pydantic-models.mdData validation, schemasData modeling
references/async-patterns.mdAsync/await, concurrencyAsync operations
references/testing-patterns.mdPytest, fixturesTesting

Key Principles

API Design

  • Use appropriate HTTP methods
  • Return consistent response formats
  • Use dependency injection
  • Document with docstrings

Data Validation

  • Validate inputs with Pydantic
  • Use custom validators for complex rules
  • Handle validation errors gracefully
  • Provide meaningful error messages

Performance

  • Use async for I/O operations
  • Implement connection pooling
  • Cache expensive computations
  • Profile and optimize hot paths

Integration with Fairmind

When working on Fairmind tasks:

  1. Use fairmind-context skill to gather requirements
  2. Check work package for API specifications
  3. Reference architectural blueprints
  4. Update journal with decisions

Example Usage

# Example: User API endpoint
from fastapi import APIRouter, HTTPException, Depends
from pydantic import BaseModel, EmailStr
from typing import Optional

router = APIRouter(prefix="/users", tags=["users"])

class UserCreate(BaseModel):
    name: str
    email: EmailStr
    role: str = "user"

class UserResponse(BaseModel):
    id: str
    name: str
    email: str
    role: str

    class Config:
        from_attributes = True

@router.post("/", response_model=UserResponse, status_code=201)
async def create_user(user_data: UserCreate):
    """Create a new user."""
    user = await user_service.create(user_data)
    return user

Next Steps

After completing implementation:

  • Use fairmind-tdd skill for testing
  • Request code review
  • Document API endpoints

Keep looking

Skills are one crate of 607,533. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.