python

A set of Python and FastAPI rules for structuring backend code. FastAPI is a Python framework for building web APIs, while dependency injection supplies services to routes instead of creating them directly.

In plain words
What is it for?
It helps write or extend FastAPI routes, backend services, repositories, and other core server code according to the repository's architecture.
Why use it?
It prevents routes, services, and repositories from being wired together inconsistently as the project grows.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/aps08/fullstack-clean-architecture/python
Any agent
npx skills add aps08/fullstack-clean-architecture --skill python
Clone the repo
git clone --depth 1 https://github.com/aps08/fullstack-clean-architecture

Made for: Claude Code, Codex.

Per session 21 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,145 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00021 $0.01145
Opus 5 $0.00010 $0.00573
Sonnet 5 $0.00004 $0.00229
Haiku 4.5 $0.00002 $0.00114

Measured yesterday against content hash c5870f6fad3b, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

python scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.agents/skills/python/SKILL.md · 136 lines

How it starts

The opening of the file, as written. The whole thing — 136 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Python & FastAPI Coding & Architecture Guidelines

Use this skill when extending the Python backend, writing routes, services, or repositories, or working with core server logic.


1. FastAPI & Dependency Injection

We use dependency-injector for wiring application components together.

  • Wiring: The container is defined in server/app/core/container.py and wired in server/app/main.py.

  • Dependency injection in Routes:

    • Decorate endpoints with @inject (from dependency_injector.wiring).

    • Create clean dependency type aliases using Annotated and Depends(Provide[Container.service_name]).

    • Example:

      TodoServiceDep = Annotated[TodoService, Depends(Provide[Container.todo_service])]
      
      @router.get("/todos/")
      @inject
      async def list_todos(service: TodoServiceDep):
          ...
      
  • No Direct Instantiation: Do not manually instantiate services or repositories; resolve them via the container.


2. FastAPI Route & Handler Best Practices

Use Annotated

Always prefer the Annotated style for parameter and dependency declarations.

from typing import Annotated
from fastapi import Path, Query

@router.get("/items/{item_id}")
async def read_item(
    item_id: Annotated[UUID, Path(description="The item ID")],
    q: Annotated[str | None, Query(max_length=50)] = None,
):
    ...

Return Types & response_model

  • Specify explicit return type annotations (-> Model) for FastAPI validation, filtering, and serialization (running Pydantic's Rust-based serialization).
  • If the returned object differs from the API response contract (e.g. returning a database model that needs filtering/serialization to a public schema), use response_model on the router decorator instead:
@router.get("/todos/{todo_id}", response_model=Todo)
async def get_todo(todo_id: UUID) -> Any:
    ...

No Ellipsis (...) for Required Fields

Do not use ... as a default value for required fields or query parameters.

Read the full file on GitHub · 136 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 136 lines · 21 tokens per session scan A c5870f6fad3b

Subscribe to this mod's changes

python is a skill published in the GitHub repository aps08/fullstack-clean-architecture (2 stars, last pushed 3mo ago), licensed Apache-2.0. It adds 21 tokens to every session and 1,145 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.