# Backend repo architecture

> Backend repo architecture is an open-source agent skill for developer tools. Gives agents a canonical Python/FastAPI backend layout and service conventions. 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/ajyadav013/claude-kit/tree/main/providers/codex/claude-kit/skills/backend-repo-architecture
- **Repository:** https://github.com/ajyadav013/claude-kit
- **GitHub stars:** 13
- **License:** MIT
- **Skill name:** backend-repo-architecture
- **Collection:** https://github.com/ajyadav013/claude-kit
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-12-03

## About

This skill documents a reference architecture for Python FastAPI backends drawn from several production services. It covers how the application factory is assembled, how routers are aggregated and versioned, how a shared connection manager hands out per-request database and Redis handles, and how a base data-access class handles pagination and soft deletes. It also describes a MODE-based entrypoint that switches between server, worker, consumer and cron processes.

The guidance is organized as a set of patterns the agent can follow when laying out a new service or reorganizing an existing one. It compares a flat domain layout with a versioned one and a monorepo variant with apps and packages, and it lists anti-patterns such as committing inside DAO methods, using non-async database calls in async routes, and wildcard CORS origins in production. Configuration follows pydantic-settings conventions, with separate patterns for a single settings module and a loaded-config singleton.

The skill ships as Markdown only, with no scripts. Supporting reference files cover directory trees, deployment and Kubernetes patterns, and troubleshooting. The agent is expected to work in a Python codebase using FastAPI, with SQLAlchemy for the database layer.

## When your agent uses it

> Canonical backend repository structure for Python/FastAPI — multi-mode entrypoint, app factory, ConnectionManager, BaseDao, flat vs versioned layout. Use when scaffolding or reorganizing a FastAPI service.

## What it can access

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

- [Instructions only, no scripts](https://github.com/ajyadav013/claude-kit/tree/HEAD/providers/codex/claude-kit/skills/backend-repo-architecture)
- [License: MIT](https://github.com/ajyadav013/claude-kit/tree/HEAD/providers/codex/claude-kit/skills/backend-repo-architecture)

## Features

- **Application factory pattern:** Describes how to construct the FastAPI app with lifespan, CORS, response class and router inclusion.
- **MODE-based entrypoint:** Explains dispatching server, consumer, worker and cron processes from one entrypoint file.
- **Connection management:** Covers a singleton connection manager and per-request handlers with lazy session and Redis access.
- **Base DAO conventions:** Outlines shared CRUD, pagination, soft-delete handling and transaction boundaries for data access.
- **Flat and versioned layouts:** Compares domain module layouts and the monorepo variant for organizing a service.
- **Configuration patterns:** Shows typed environment settings with pydantic-settings and optional YAML and env merging.

## Good for

- Scaffold a new FastAPI backend service with a standard structure
- Reorganize an existing FastAPI codebase into flat or versioned domain folders
- Add a MODE dispatcher so one image can run server and worker processes
- Set up a shared database session and Redis connection handling for FastAPI routes
- Review a FastAPI project for common async and transaction anti-patterns

## Install

### Claude Code

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

```sh
/plugin marketplace add ajyadav013/claude-kit
/plugin install claude-kit@claude-kit
```

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

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ajyadav013/claude-kit.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/backend-repo-architecture &&
cp -R "$tmp/providers/codex/claude-kit/skills/backend-repo-architecture" ~/.claude/skills/backend-repo-architecture &&
rm -rf "$tmp"
```

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

### Codex

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

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ajyadav013/claude-kit.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/backend-repo-architecture &&
cp -R "$tmp/providers/codex/claude-kit/skills/backend-repo-architecture" ~/.agents/skills/backend-repo-architecture &&
rm -rf "$tmp"
```

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

### Cursor

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

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ajyadav013/claude-kit.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/backend-repo-architecture &&
cp -R "$tmp/providers/codex/claude-kit/skills/backend-repo-architecture" ~/.cursor/skills/backend-repo-architecture &&
rm -rf "$tmp"
```

For one project only, put the folder in `.cursor/skills/backend-repo-architecture` 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/ajyadav013/claude-kit.git --path providers/codex/claude-kit/skills/backend-repo-architecture
```

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

### VS Code

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

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ajyadav013/claude-kit.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/backend-repo-architecture &&
cp -R "$tmp/providers/codex/claude-kit/skills/backend-repo-architecture" ~/.copilot/skills/backend-repo-architecture &&
rm -rf "$tmp"
```

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

### Other agents

Get the folder:

```sh
git clone --depth 1 https://github.com/ajyadav013/claude-kit.git
```

Then copy `claude-kit/providers/codex/claude-kit/skills/backend-repo-architecture` into your agent's skills folder as `backend-repo-architecture`. Agents that support SKILL.md read one folder per skill.

## FAQ

### What does Backend repo architecture need to run?

It is a Markdown skill with no scripts. It assumes a Python codebase using FastAPI, and its examples use SQLAlchemy and pydantic-settings.

### When does the agent load Backend repo architecture?

It loads when a task involves scaffolding or reorganizing a FastAPI service, as described in the skill's frontmatter.

### Does Backend repo architecture include executable tooling?

No. It contains no scripts, only instructions and reference files on structure, deployment and troubleshooting.

### Which layout should I choose?

The skill says to pick one layout per service, either flat or versioned, and not mix them.

### How do I install Backend repo architecture in Claude Code?

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

### Does Backend repo architecture 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 Backend repo architecture?

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 Backend repo architecture?

The closest alternatives to Backend repo architecture are Python backend, Fastapi router py, Async python patterns, Backend patterns and Backend patterns.

## Where this comes from

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

## Alternatives

- [Python backend](https://ai-powered.com/skills/python-backend): Python backend is an open-source agent skill for developer tools.
- [Fastapi router py](https://ai-powered.com/skills/fastapi-router-py): Fastapi router py is an open-source agent skill for developer tools.
- [Async python patterns](https://ai-powered.com/skills/async-python-patterns): Async python patterns is an open-source agent skill for developer tools.
- [Backend patterns](https://ai-powered.com/skills/backend-patterns-fmarzochi): Backend patterns is an open-source agent skill for developer tools.
- [Backend patterns](https://ai-powered.com/skills/backend-patterns-abdullayevtemurmalik): Backend patterns is an open-source agent skill for developer tools.
- [Testing conventions](https://ai-powered.com/skills/testing-conventions): Testing conventions is an open-source agent skill for developer tools.
- [API design](https://ai-powered.com/skills/api-design-abdullayevtemurmalik): API design is an open-source agent skill for developer tools.
- [API design](https://ai-powered.com/skills/api-design-fmarzochi): API design is an open-source agent skill for developer tools.

---
Source: https://ai-powered.com/skills/backend-repo-architecture
