module

A command for creating a complete FastAPI backend module, including database models, data-transfer schemas, repositories, business services, HTTP routes, and tests. FastAPI is a Python framework for building web APIs.

In plain words
What is it for?
Use it to scaffold a named API module with its database model, create/read/update data schemas, storage access, service logic, routes, and module tests.
Why use it?
It avoids manually assembling the standard files and test structure needed for a backend feature.

Command

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 commands/ruslan-korneev/claude-plugins/module
Clone the repo
git clone --depth 1 https://github.com/ruslan-korneev/claude-plugins
Per session 21 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,539 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.02539
Opus 5 $0.00010 $0.01269
Sonnet 5 $0.00004 $0.00508
Haiku 4.5 $0.00002 $0.00254

Measured 2d ago against content hash 7aeee5d1ed17, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

module 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 2d ago.

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.

plugins/fastapi/commands/module.md · 407 lines

How it starts

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

Command /fastapi:module

Create a complete FastAPI module with best practices.

Module Structure

src/modules/{name}/
├── __init__.py
├── models.py       # SQLAlchemy model
├── dto.py          # Pydantic DTOs (Create, Read, Update)
├── repositories.py # Repository with generics
├── services.py     # Business logic
└── routers.py      # FastAPI endpoints

tests/modules/{name}/
├── __init__.py
├── conftest.py     # Module fixtures
├── test_services.py
└── test_routers.py

Instructions

Step 1: Create directories

mkdir -p src/modules/{{ name }}
mkdir -p tests/modules/{{ name }}

Step 2: Create module files

models.py
"""{{ name | capitalize }} models."""

from sqlalchemy import String, Boolean, Integer
from sqlalchemy.orm import Mapped, mapped_column

from src.core.database import Base


class {{ name | capitalize }}(Base):
    """{{ name | capitalize }} model."""

    __tablename__ = "{{ name }}"

    id: Mapped[int] = mapped_column(primary_key=True)
    # Add fields based on {{ fields }}

    def __repr__(self) -> str:
        return f"<{{ name | capitalize }}(id={self.id})>"
dto.py
"""{{ name | capitalize }} DTOs."""

from pydantic import BaseModel, ConfigDict


class {{ name | capitalize }}BaseDTO(BaseModel):
    """Base DTO with common fields."""

    model_config = ConfigDict(from_attributes=True, populate_by_name=True)

    # Common fields
    pass


class {{ name | capitalize }}CreateDTO({{ name | capitalize }}BaseDTO):
    """DTO for creating {{ name }}."""

    # Fields for creation (without id)
    pass


class {{ name | capitalize }}ReadDTO({{ name | capitalize }}BaseDTO):
    """DTO for reading {{ name }}."""

    id: int
    # All fields for reading


class {{ name | capitalize }}UpdateDTO(BaseModel):
    """DTO for updating {{ name }}."""

    model_config = ConfigDict(from_attributes=True)

    # Optional fields for update
    pass
repositories.py
"""{{ name | capitalize }} repository."""

from collections.abc import Sequence

from sqlalchemy import select
from sqlalchemy.ext.asyncio import AsyncSession

from src.core.repositories import BaseRepository
from .models import {{ name | capitalize }}
from .dto import {{ name | capitalize }}CreateDTO, {{ name | capitalize }}ReadDTO


class {{ name | capitalize }}Repository(
    BaseRepository[{{ name | capitalize }}, {{ name | capitalize }}CreateDTO, {{ name | capitalize }}ReadDTO]
):
    """Repository for {{ name }} operations."""

    def __init__(self, session: AsyncSession) -> None:
        super().__init__(session, {{ name | capitalize }})

    async def get_by_id(self, id: int) -> {{ name | capitalize }}ReadDTO | None:
        """Get {{ name }} by ID."""
        result = await self._session.execute(
            select({{ name | capitalize }}).where({{ name | capitalize }}.id == id)
        )
        entity = result.scalar_one_or_none()
        return {{ name | capitalize }}ReadDTO.model_validate(entity) if entity else None

    # Add specific methods

Read the full file on GitHub · 407 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. 2d ago First seen · 407 lines · 21 tokens per session scan A 7aeee5d1ed17

Subscribe to this mod's changes

module is a command published in the GitHub repository ruslan-korneev/claude-plugins (4 stars, last pushed 6mo ago), licensed MIT. It adds 21 tokens to every session and 2,539 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.