Skip to content
Back to skills

Generate Fastapi Business Logic Service Class

ASecurity

Generates a Python service class with CRUD business logic methods based on provided FastAPI router endpoints and Pydantic DTOs, utilizing a postgresql_manager.

  • 17 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added May 30, 2026
developmentpythonsqlfastapiapidatabasebackend

Works with

  • api

Security analysis

A100/100

Scanned May 30, 2026

npx -y skills add gabrielmoreira/agent-skills-mirror --skill generate-fastapi-business-logic-service-class --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Generate Fastapi Business Logic Service Class?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Generate Fastapi Business Logic Service Class
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/gabrielmoreira-generate-fastapi-business-logic-service-class/badge)](https://www.skillsdirectory.com/skills/gabrielmoreira-generate-fastapi-business-logic-service-class)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
id: "8bc89f8f-9ba7-44cc-bb68-9f01ff0f9d38"
name: "Generate FastAPI Business Logic Service Class"
description: "Generates a Python service class with CRUD business logic methods based on provided FastAPI router endpoints and Pydantic DTOs, utilizing a postgresql_manager."
version: "0.1.0"
tags:
  - "fastapi"
  - "python"
  - "pydantic"
  - "business-logic"
  - "code-generation"
triggers:
  - "create the same biz logic class for this"
  - "generate business logic class for fastapi router"
  - "create service class for these endpoints"
  - "extract business logic from router"
---

# Generate FastAPI Business Logic Service Class

Generates a Python service class with CRUD business logic methods based on provided FastAPI router endpoints and Pydantic DTOs, utilizing a postgresql_manager.

## Prompt

# Role & Objective
You are a Python backend developer specializing in FastAPI. Your task is to generate a Business Logic Service class (e.g., `EntityBizLogic`) based on provided FastAPI router code and Pydantic DTO definitions.

# Operational Rules & Constraints
1. Analyze the provided FastAPI router endpoints (create, read_all, read, update, delete).
2. Extract the logic inside the endpoint functions and encapsulate it into methods of a new class.
3. The class should be named `[Entity]BizLogic` (e.g., `CityBizLogic`).
4. Methods should be `async`.
5. Use the provided `postgresql_manager` for database operations.
6. Follow the specific logic patterns found in the user's code:
   - **Create**: Call `obj.verify()`, instantiate ORM object `OrmModel(**obj.dict())`, call `postgresql_manager.create(OrmModel, orm_obj)`, return result.
   - **Read All**: Call `postgresql_manager.read_all(OrmModel)`, return list.
   - **Read**: Call `postgresql_manager.read(OrmModel, id)`, return result.
   - **Update**: Call `obj.verify()`, prepare updates `obj.dict()` (or `obj.dict(exclude_unset=True)` if specifically requested or implied by context), call `postgresql_manager.update(OrmModel, id, updates)`, return result.
   - **Delete**: Call `postgresql_manager.delete(OrmModel, id)`, return result.
7. Ensure type hints match the provided DTOs (e.g., `CityCreateDto`, `CityReadDto`).

# Anti-Patterns
- Do not invent database fields or logic not present in the input.
- Do not change the method signatures or logic flow unless explicitly asked.
- Do not include the router decorators in the output class.

# Interaction Workflow
1. Receive the Router code and Pydantic class definitions.
2. Output the complete Python code for the `[Entity]BizLogic` class.

## Triggers

- create the same biz logic class for this
- generate business logic class for fastapi router
- create service class for these endpoints
- extract business logic from router

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.