Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
eyadsibai avatar

Fastapi

  • 51 installs
  • 7 repo stars
  • Updated January 15, 2026
  • eyadsibai/ltk

Helps with backend & apis tasks.

About

fastapi is a Claude Code skill for backend & apis. It helps solo builders move faster with AI-assisted development.

  • fastapi
  • Backend & APIs
  • AI-coding skill

Fastapi by the numbers

  • 51 all-time installs (skills.sh)
  • Ranked #3,229 of 4,347 Backend & APIs skills by installs in the Skillselion catalog
  • Data as of Jul 30, 2026 (Skillselion catalog sync)
npx skills add https://github.com/eyadsibai/ltk --skill fastapi

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs51
repo stars7
Last updatedJanuary 15, 2026
Repositoryeyadsibai/ltk

What it does

Helps with backend & apis tasks.

Files

SKILL.mdMarkdownGitHub ↗

FastAPI Development

Guidance for building APIs with FastAPI following best practices.

---

Core Concepts

Route Decorators

DecoratorHTTP MethodUse Case
@app.get()GETRetrieve data
@app.post()POSTCreate resource
@app.put()PUTFull update
@app.patch()PATCHPartial update
@app.delete()DELETERemove resource

Response Status Codes

CodeMeaningWhen to Use
200OKSuccessful GET/PUT/PATCH
201CreatedSuccessful POST
204No ContentSuccessful DELETE
400Bad RequestInvalid input
401UnauthorizedAuthentication required
403ForbiddenNo permission
404Not FoundResource doesn't exist
422UnprocessableValidation failed

---

Dependency Injection

Key concept: Dependencies are functions that FastAPI calls before your route handler. Use yield for cleanup logic.

PatternUse Case
Simple functionGet config, compute values
Generator (yield)Database sessions, connections
Class-basedComplex dependencies with state
Nested dependenciesDependencies that depend on other dependencies

Common Dependencies

DependencyPurpose
get_dbDatabase session (yield for cleanup)
get_current_userAuthentication + user retrieval
get_settingsConfiguration singleton
rate_limiterRequest throttling

Key concept: Use Annotated[Type, Depends(func)] for cleaner type hints and reusability.

---

Pydantic Models

Model Patterns

PatternPurpose
Base modelShared fields
Create modelInput for POST (no id)
Update modelPartial updates (all Optional)
Response modelOutput (includes id, timestamps)
DB modelInternal with from_attributes = True

Validation Features

FeaturePurpose
Field(...)Required with constraints
Field(default=...)Optional with default
field_validatorCustom validation logic
model_validatorCross-field validation
pattern=Regex validation
ge=, le=Numeric bounds
min_length=, max_length=String/list length

---

Error Handling

ApproachUse Case
HTTPExceptionSimple errors with status code
Custom exception classStructured error responses
@app.exception_handlerGlobal error handling
RequestValidationErrorCustomize validation errors

Key concept: Create custom exception classes for consistent error response format across your API.

---

Router Organization

ConceptPurpose
APIRouterGroup related endpoints
prefixURL prefix for all routes
tagsOpenAPI documentation grouping
dependenciesRouter-level dependencies

Project Structure

DirectoryContents
routers/Route handlers by domain
models/SQLAlchemy/database models
schemas/Pydantic request/response models
services/Business logic
dependencies.pyShared dependencies
config.pySettings and configuration

---

Background Tasks

MethodUse Case
BackgroundTasksSimple async tasks (email, logging)
CeleryHeavy tasks, retries, scheduling
ARQAsync Redis queue

Key concept: BackgroundTasks run after response is sent—good for non-critical operations that shouldn't block the response.

---

Testing Patterns

ClientUse Case
TestClientSync tests (most common)
AsyncClient (httpx)Async tests, lifespan events

Dependency Override Pattern

1. Create test version of dependency 2. Set app.dependency_overrides[original] = test_version 3. Run tests 4. Clear overrides after

Key concept: Override get_db for test database, get_current_user for auth bypass.

---

Best Practices

PracticeWhy
Use response_modelControl output, hide internal fields
Use dependency injectionTestable, reusable code
Separate schemas from DB modelsDecouple API from database
Use routers for organizationMaintainable as API grows
Add OpenAPI descriptionsSelf-documenting API
Use async for I/OBetter concurrency

Resources

  • Docs: <https://fastapi.tiangolo.com/>
  • Tutorial: <https://fastapi.tiangolo.com/tutorial/>

Related skills

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.