From 5c4ac70450af61ec1e48c4735527a115ae5dfcc3 Mon Sep 17 00:00:00 2001 From: Jeroen Schweitzer Date: Wed, 17 Dec 2025 18:46:15 +0100 Subject: [PATCH] Add AGENTS.md with project guidelines MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Documents coding standards, git discipline, release flow, and FastAPI architecture best practices. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- AGENTS.md | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 AGENTS.md diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..f22140e --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,72 @@ + +# AGENTS.md + +> **Start every session by reading this file.** +> This file outlines the operational protocols, coding standards, and architectural decisions for this FastAPI project. + +## 1. Agent Operational Protocols + +### 🧠 Work Patterns (Plan-Act-Reflect) +* **Plan:** Before writing code, briefly outline your plan. Identify which files you will touch and what the side effects might be. +* **Act:** Execute the changes in small, atomic steps. +* **Reflect:** After coding, verify your work. Did you break existing tests? Did you add new tests? + +### 🛡️ Git Discipline +* **NEVER commit to `main` or `master` directly.** Always create a feature branch: `feature/your-feature-name` or `fix/issue-description`. +* **Commit Messages:** Use the [Conventional Commits](https://www.conventionalcommits.org/) format. + * `feat: add user login endpoint` + * `fix: resolve database connection timeout` + * `refactor: split monolith dependency file` +* **Atomic Commits:** Keep commits small. One logical change = one commit. + +### 📝 Changelog Maintenance +* **Update `CHANGELOG.md`** with every user-facing change. +* Format: `## [Unreleased] - YYYY-MM-DD` followed by `### Added`, `### Changed`, or `### Fixed`. + +### 🚀 Release Flow +When changes are ready for deployment: + +1. **Ask user if deploy cycle is desired ** + +2. **Update version** in `pyproject.toml`: + - Bug fixes: bump patch version (1.8.3 → 1.8.4) + - New features: bump minor version (1.8.4 → 1.9.0) + +3. **Update CHANGELOG.md**: + - Move items from `[Unreleased]` to new version section + - Add release date: `## [1.8.4] - 2025-12-16` + +4. **Commit and tag**: + ```bash + git add -A + git commit -m "fix: description of changes" + git tag v1.8.4 + git push origin main --tags + ``` + +5. **CI/CD triggers automatically**: + - Gitea CI builds Docker image on new tag + - Watchtower pulls and deploys to production + - Verify deployment: `curl http://192.168.86.149:8000/health` + +--- + +## 2. FastAPI Architecture & Best Practices +*Reference: [FastAPI Best Practices](https://github.com/zhanymkanov/fastapi-best-practices)* + +### 📂 Project Structure (Directory-based, NOT File-type based) +Do **not** group files by type (e.g., one huge `routers` folder). Group by **domain/module** inside a `src/` directory. + +**Correct Structure:** +```text +src/ +├── auth/ +│ ├── router.py # Endpoints +│ ├── schemas.py # Pydantic models +│ ├── service.py # Business logic (CRUD, etc.) +│ ├── dependencies.py# Module-specific dependencies +│ └── config.py # Module-specific settings +├── posts/ +│ ├── router.py +│ └── ... +└── main.py # App entry point \ No newline at end of file