A professional, batteries-included project template for Python projects. Built to work seamlessly with AI coding agents (Claude, Codex, Cursor) and human developers alike.
This template enforces a consistent, professional project structure across all your Python projects. It is specifically designed for vibe coding workflows β where AI agents (Claude, Codex, Cursor) do most of the heavy lifting β while keeping quality high and supervision low.
Goals:
- π€ Give AI agents clear, unambiguous instructions so they don't go off the rails
- β Enforce code quality automatically (lint, format, type check) before every commit
- π Automate versioning and releases via Conventional Commits
- ποΈ Maintain a clean 3-layer architecture from day one
| Tool | Purpose |
|---|---|
| Ruff | Lightning-fast linter (replaces flake8, isort, pyupgrade) |
| Black | Opinionated code formatter |
| Mypy | Static type checker |
| pre-commit | Runs ruff + black + mypy automatically before every commit |
| python-semantic-release | Auto version bumps, CHANGELOG, and GitHub Releases |
| pytest + pytest-cov | Test runner with coverage reporting |
| GitHub Actions | CI (lint + type check + tests) and CD (automated releases) |
| Dependabot | Weekly auto-updates for pip and GitHub Actions dependencies |
Makefile |
Shortcuts: make lint / make test / make fix / make all |
AGENTS.md |
Instructions for AI agents (Claude, Codex, Cursorβ¦) |
CLAUDE.md |
Claude-specific instructions with Karpathy principles |
CODEX.md |
Codex-specific instructions + Windows git fix |
STACK.md |
Project tech stack β read by agents before any change |
All projects using this template follow a strict 3-layer architecture:
src/ui/ β pages, components, views (display only)
β
src/services/ β business logic, calculations, decisions
β
src/repositories/ β DB queries, external API calls
Rules enforced in AGENTS.md:
- No business logic in UI files
- No DB/API access outside
repositories/ - No cross-layer calls (UI β repository is forbidden)
- Reuse existing services before creating new ones
Ruff handles linting (errors, warnings, imports, upgrades). Black handles formatting. They cover different concerns and are configured with matching line-length = 120 to avoid conflicts.
AI agents regularly generate untyped code. Mypy catches type errors before runtime and forces def func(x: int) -> str: annotations. Configured in pyproject.toml with disallow_untyped_defs = true.
CI catches errors after the push β pre-commit catches them before. Faster feedback loop, and it prevents bad commits from ever entering the history. Both run in this template.
Versioning should be a byproduct of good commit messages, not a manual step. With Conventional Commits, every feat: or fix: automatically determines the next version, updates the CHANGELOG, and creates a GitHub Release β no human action needed.
Each AI agent reads a different file at startup:
AGENTS.mdβ universal rules, read by all agentsCLAUDE.mdβ Claude-specific (read automatically by Claude Code)CODEX.mdβ Codex-specific (read automatically by OpenAI Codex)
Keeping them separate avoids token waste β each agent only loads what it needs.
Click "Use this template" on GitHub, or clone and re-init:
git clone https://github.com/MaximeFARRE/github-project-template.git my-project
cd my-project
git remote set-url origin https://github.com/YOUR_USERNAME/my-project.gita) Fill STACK.md with your project's tech stack, language, framework, DB, and commands. Agents read this before touching any code.
b) Update pyproject.toml β replace the project name and version:
[project]
name = "your-project-name"
version = "0.1.0"c) Update README.md β use README.example.md as a starting point.
d) Fill requirements.txt with your runtime dependencies.
# Create and activate a virtual environment
python -m venv .venv
.\.venv\Scripts\Activate.ps1 # Windows
source .venv/bin/activate # macOS / Linux
# Install all dev dependencies (ruff, black, mypy, pytest, pre-commit, semantic-releaseβ¦)
pip install -r requirements-dev.txt
# Install pre-commit hooks (runs ruff + black + mypy before every commit)
pre-commit installThese settings are required for CI and automated releases to work.
1. Enable write permissions for Actions
Settings β Actions β General β Workflow permissions
β Select "Read and write permissions"
β Check "Allow GitHub Actions to create and approve pull requests"
β Save
2. Protect the main branch
Settings β Branches β Add branch protection rule
β Branch name pattern: main (or master)
β β
Require a pull request before merging
β β
Require status checks to pass β add Lint & Format and Tests
β β
Do not allow bypassing the above settings
β Save
This template uses Conventional Commits to drive automatic versioning:
| Commit prefix | Version bump | Example |
|---|---|---|
feat: |
minor 0.1.0 β 0.2.0 |
feat: add user authentication |
fix: / perf: |
patch 0.1.0 β 0.1.1 |
fix: prevent duplicate records |
BREAKING CHANGE footer |
major 0.1.0 β 1.0.0 |
feat!: redesign API |
chore:, docs:, test: |
no bump | docs: update README |
On every push to main/master:
- GitHub Actions runs CI (lint + tests)
semantic-release versioncalculates the next version from commitspyproject.tomlis updated, a tag is created,CHANGELOG.mdis generated- A GitHub Release is published automatically
This template ships with ready-to-use instruction files for AI coding agents:
| File | Agent | Key rules |
|---|---|---|
AGENTS.md |
All agents | Architecture, code quality, commits, "never do" list |
CLAUDE.md |
Claude Code | Same rules, Claude-specific format |
CODEX.md |
OpenAI Codex | Same rules + git safe.directory fix for Windows |
STACK.md |
All agents | Fill this first β tech stack, commands, conventions |
PROMPTS.md |
You | Reusable prompt templates for common tasks |
For Codex on Windows: If Codex can't commit due to a git permission error, add this to
~/.codex/config.toml:setup_commands = ["git config --global --add safe.directory '*'"]
.
βββ .github/
β βββ workflows/
β β βββ ci.yml # Lint + type check + tests on every PR and push
β β βββ release.yml # Automated release on push to main
β βββ ISSUE_TEMPLATE/
β βββ pull_request_template.md
β βββ dependabot.yml # Weekly auto-updates for pip + GitHub Actions
βββ .githooks/
β βββ pre-commit # Blocks direct commits to main/master (Unix)
βββ src/
β βββ ui/ # Display and interaction only
β βββ services/ # Business logic
β βββ repositories/ # DB and API access
βββ tests/
β βββ conftest.py # Shared pytest fixtures
βββ docs/
β βββ ARCHITECTURE.md # Layered architecture rules and examples
βββ AGENTS.md # AI agent instructions (universal)
βββ CLAUDE.md # Claude-specific instructions + Karpathy principles
βββ CODEX.md # Codex-specific instructions + Windows git fix
βββ STACK.md # β Fill this for every project
βββ PROMPTS.md # Reusable prompts for AI tasks
βββ CONTRIBUTING.md
βββ CHANGELOG.md # Auto-generated by semantic-release
βββ Makefile # make lint / test / fix / all
βββ pyproject.toml # Ruff, black, mypy, pytest, semantic-release config
βββ .pre-commit-config.yaml # pre-commit hooks (ruff, black, whitespaceβ¦)
βββ .editorconfig # Consistent indent/charset across editors
βββ requirements.txt # Runtime dependencies
βββ requirements-dev.txt # Dev dependencies
MIT β see LICENSE.