# Python backend

> Python backend is an open-source agent skill for developer tools. Guides an agent through typed, testable Python service code with FastAPI or Django. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf, Goose
- **Website:** https://github.com/Nabwinsaud/forgeline/tree/main/skills/python-backend
- **Repository:** https://github.com/nabwinsaud/forgeline
- **GitHub stars:** 8
- **License:** MIT
- **Skill name:** python-backend
- **Collection:** https://github.com/Nabwinsaud/forgeline
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-12-02

## About

This skill gives the agent a set of conventions for Python backend work that is not tied to one framework. It covers how to lay out a service with thin routes and business logic in service modules, how to type public signatures and validate request and webhook data with pydantic schemas, and how to map domain errors to HTTP responses in one place. It also covers dependency injection so collaborators can be swapped in tests, async correctness such as avoiding blocking I/O inside async handlers and setting timeouts on outbound calls, and SQLAlchemy 2.0 and Alembic habits like avoiding N+1 queries and keeping raw SQL parameterized.

The skill also describes how the agent should test and check code. It suggests pytest fixtures and factories, real Postgres for integration tests with transactional rollback, and faking outbound HTTP. Its tooling section runs ruff, mypy, pytest with coverage and pip-audit, and tells the agent to fix code rather than loosen configuration to get a pass. Logging guidance covers structured output and avoiding sensitive data in logs.

The skill is written as a single SKILL.md with no bundled scripts. It expects a Python codebase and the tools it names, such as FastAPI or Django, pydantic, SQLAlchemy, Alembic, pytest, ruff and mypy. It defers to the repository's own framework and conventions where they differ from its defaults.

## When your agent uses it

> Framework-agnostic Python service patterns (FastAPI or Django) - strict typing, pydantic validation at the boundary, dependency injection, async correctness, SQLAlchemy and Alembic basics, pytest fixtures and factories, coverage, ruff and mypy. Use when writing or reviewing Python backend code.

## What it can access

From a static check of the files on GitHub; nothing was run.

- [Instructions only, no scripts](https://github.com/Nabwinsaud/forgeline/tree/HEAD/skills/python-backend)
- [License: MIT](https://github.com/Nabwinsaud/forgeline/tree/HEAD/skills/python-backend)

## Features

- **Service layout conventions:** Describes how to split routes, services, models, schemas and repositories so business logic stays out of HTTP handlers.
- **Boundary validation:** Shows how to validate request bodies and third-party payloads with strict pydantic schemas and keep identity fields out of input.
- **Typing and error mapping:** Covers strict typing expectations and a single exception handler that converts domain errors into HTTP status codes.
- **Async and dependency injection:** Explains safe async patterns, timeouts on outbound calls, and injecting collaborators so tests avoid monkeypatching.
- **Database and migration habits:** Covers SQLAlchemy 2.0 query style, transaction boundaries, avoiding N+1 queries and reviewing Alembic or Django migrations.
- **Pytest testing patterns:** Provides fixture scoping, factories, transactional test isolation and async test guidance for pytest.

## Good for

- Scaffold a new FastAPI service with typed settings and a services layer
- Review a Python backend pull request for async mistakes and unsafe SQL
- Add an Alembic migration and verify upgrade and downgrade locally
- Write pytest tests with fixtures and factories for an order endpoint
- Tighten pydantic validation on an existing request body

## Install

### Claude Code

This skill ships in the `forgeline` plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):

```sh
/plugin marketplace add Nabwinsaud/forgeline
/plugin install forgeline@forgeline
```

Or copy only this skill to `~/.claude/skills/python-backend`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/Nabwinsaud/forgeline.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/python-backend &&
cp -R "$tmp/skills/python-backend" ~/.claude/skills/python-backend &&
rm -rf "$tmp"
```

For one project only, put the folder in `.claude/skills/python-backend` inside it instead.

### Codex

Copy the skill folder to `~/.agents/skills/python-backend` to use it in every repository:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/Nabwinsaud/forgeline.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/python-backend &&
cp -R "$tmp/skills/python-backend" ~/.agents/skills/python-backend &&
rm -rf "$tmp"
```

For one repository only, put the folder in `.agents/skills/python-backend` inside it instead.

### Cursor

Copy the skill folder to `~/.cursor/skills/python-backend` to use it in every project:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/Nabwinsaud/forgeline.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/python-backend &&
cp -R "$tmp/skills/python-backend" ~/.cursor/skills/python-backend &&
rm -rf "$tmp"
```

For one project only, put the folder in `.cursor/skills/python-backend` inside it instead.

### Gemini CLI

Run in a terminal (add `--scope workspace` to install it for the current workspace only):

```sh
gemini skills install https://github.com/Nabwinsaud/forgeline.git --path skills/python-backend
```

Or copy the folder to `~/.gemini/skills/python-backend` yourself.

### VS Code

For GitHub Copilot in VS Code, copy the skill folder to `~/.copilot/skills/python-backend`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/Nabwinsaud/forgeline.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/python-backend &&
cp -R "$tmp/skills/python-backend" ~/.copilot/skills/python-backend &&
rm -rf "$tmp"
```

For one project only, put the folder in `.github/skills/python-backend` inside it instead.

### Other agents

Get the folder:

```sh
git clone --depth 1 https://github.com/Nabwinsaud/forgeline.git
```

Then copy `forgeline/skills/python-backend` into your agent's skills folder as `python-backend`. Agents that support SKILL.md read one folder per skill.

## FAQ

### Does Python backend work with both FastAPI and Django?

Yes. The skill is framework-agnostic and describes patterns for FastAPI (using Depends) and Django (passing collaborators into service functions), and tells the agent to follow the repository's own framework where it differs.

### Does Python backend run any scripts?

No scripts are bundled. It lists commands for ruff, mypy, pytest with coverage and pip-audit that the agent is expected to run in the project.

### When does the skill trigger?

According to its description, it is meant for writing or reviewing Python backend code.

### What does Python backend need installed?

The content names the tools it expects: ruff, mypy, pytest with pytest-cov, pip-audit, and the framework and libraries the project uses such as SQLAlchemy and Alembic.

### How do I install Python backend in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/python-backend to use it in all your projects, or to .claude/skills/python-backend in one project. Or install the forgeline plugin, which includes it: /plugin marketplace add Nabwinsaud/forgeline, then /plugin install forgeline@forgeline.

### Does Python backend run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

### Which AI agents can use Python backend?

Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.

### What are the best alternatives to Python backend?

The closest alternatives to Python backend are Go backend, Django patterns, Pytest skill, API design and Backend engineering edho ferdian.

## Where this comes from

- Description: from the skill's own SKILL.md.

## Alternatives

- [Go backend](https://ai-powered.com/skills/go-backend): Go backend is an open-source agent skill for developer tools.
- [Django patterns](https://ai-powered.com/skills/django-patterns): Django patterns is an open-source agent skill for developer tools.
- [Pytest skill](https://ai-powered.com/skills/pytest-skill): Pytest skill is an open-source agent skill for developer tools.
- [API design](https://ai-powered.com/skills/api-design): API design is an open-source agent skill for developer tools.
- [Backend engineering edho ferdian](https://ai-powered.com/skills/backend-engineering-edho-ferdian): Backend engineering edho ferdian is an open-source agent skill for developer tools.
- [Azure cosmos db py](https://ai-powered.com/skills/azure-cosmos-db-py): Azure cosmos db py is an open-source agent skill for cloud and infrastructure.
- [Python pypi package builder](https://ai-powered.com/skills/python-pypi-package-builder): Python pypi package builder is an open-source agent skill for developer tools.
- [Backend patterns](https://ai-powered.com/skills/backend-patterns): Backend patterns is an open-source agent skill for developer tools.

---
Source: https://ai-powered.com/skills/python-backend
