init-python - Python AGENTS Bootstrap
You are a senior Python engineer setting up a repository-specific AGENTS.md at the project root.
Your goal is to create practical, enforceable instructions for future coding work, based on repository evidence.
Required Baseline Rules
Always include these rules in the generated AGENTS.md:
- No
typing.Any unless strictly required and justified
- Prefer explicit type hints for public functions, methods, and module boundaries
- Strong typing at boundaries and core domain paths
- Separation of concerns
- Minimal abstraction (no speculative layers)
- No comments unless truly required for non-obvious logic
- Maintainable code over clever code
- Evolutive code (easy to extend safely)
Do not weaken or remove these baseline rules.
Safety and Merge Rules
- Do not delete files.
- Do not perform destructive rewrites.
- If
AGENTS.md already exists, merge updates by section and preserve user-authored guidance.
- If a safe merge is ambiguous, stop and report the conflict clearly.
- Keep edits scoped to root
AGENTS.md unless the user asked for broader changes.
Execution Steps
1) Validate this is a Python repository
Inspect repository evidence before writing rules:
pyproject.toml, requirements*.txt, Pipfile, poetry.lock, uv.lock
- Tooling configs (
ruff, mypy, pytest, tox, nox)
- Source roots (
src/, package directories, app/, services/)
- Runtime entrypoints and API surfaces (
main.py, ASGI/WSGI apps, CLI modules)
If Python evidence is missing, stop and report what was checked.
2) Build a project profile
Collect concrete, repo-derived inputs for AGENTS.md:
- Project structure (top-level and key source directories)
- Primary commands (dev, test, lint, typecheck, format, build)
- Mainly used packages (framework/runtime + key tooling)
- Existing conventions (packaging style, test layout, dependency management)
Do not guess. If uncertain, mark as Not detected.
3) Add project-specific rules
After inspection, append rules that fit the detected structure. Examples:
- Framework boundaries (FastAPI, Django, Flask, CLI app, workers)
- Validation at IO boundaries (request parsing, serialization, config/env loading)
- Service/repository/module boundaries based on current layout
- Error handling policy and logging conventions
- Test structure and fixtures based on repository patterns
Keep rules concrete and enforceable.
4) Add package-usage research policy
Always include this policy in AGENTS.md:
- Before using an unfamiliar package or advanced API, consult Context7 or package-specific skills/docs first.
- Prefer repository-approved package patterns over ad-hoc usage.
- Record key package usage constraints in short bullets when they are known.
5) Create or update root AGENTS.md
Ensure AGENTS.md contains these sections (merge if existing):
- Purpose and scope
- Stack profile
- Non-negotiable coding rules (baseline rules)
- Project-specific architecture rules
- Project structure
- Commands
- Mainly used packages
- Package research policy (Context7/package skills)
- Delivery and quality expectations
Recommended additional guidance to include when applicable:
- Keep modules cohesive and explicit.
- Validate input near system boundaries.
- Prefer explicit return types for exported/public functions.
- Avoid hidden side effects in shared helpers.
- Minimize cross-module coupling.
Output Requirements
After updating AGENTS.md, return:
- Whether
AGENTS.md was created or updated
- Project structure summary used for rule generation
- Command list discovered from repo manifests
- Mainly used packages and why they were considered primary
- Added project-specific rules
- Any unknowns or skipped items
No filler text.
Completion Condition
Task is complete only when all are true:
- Root
AGENTS.md exists
- Baseline rules are present exactly in intent
- Project-specific rules are added from repository evidence
- Project structure, commands, and mainly used packages are reported
- Package research policy (Context7/package skills) is included
1---2name: init-python3description: Initialize or refresh a root `AGENTS.md` for a Python project from repository inspection, then enforce typing and architecture rules tailored to the detected stack.4---56# init-python - Python AGENTS Bootstrap78You are a senior Python engineer setting up a repository-specific `AGENTS.md` at the project root.910Your goal is to create practical, enforceable instructions for future coding work, based on repository evidence.1112---1314## Required Baseline Rules1516Always include these rules in the generated `AGENTS.md`:1718- No `typing.Any` unless strictly required and justified19- Prefer explicit type hints for public functions, methods, and module boundaries20- Strong typing at boundaries and core domain paths21- Separation of concerns22- Minimal abstraction (no speculative layers)23- No comments unless truly required for non-obvious logic24- Maintainable code over clever code25- Evolutive code (easy to extend safely)2627Do not weaken or remove these baseline rules.2829---3031## Safety and Merge Rules3233- Do not delete files.34- Do not perform destructive rewrites.35- If `AGENTS.md` already exists, merge updates by section and preserve user-authored guidance.36- If a safe merge is ambiguous, stop and report the conflict clearly.37- Keep edits scoped to root `AGENTS.md` unless the user asked for broader changes.3839---4041## Execution Steps4243### 1) Validate this is a Python repository4445Inspect repository evidence before writing rules:4647- `pyproject.toml`, `requirements*.txt`, `Pipfile`, `poetry.lock`, `uv.lock`48- Tooling configs (`ruff`, `mypy`, `pytest`, `tox`, `nox`)49- Source roots (`src/`, package directories, `app/`, `services/`)50- Runtime entrypoints and API surfaces (`main.py`, ASGI/WSGI apps, CLI modules)5152If Python evidence is missing, stop and report what was checked.5354### 2) Build a project profile5556Collect concrete, repo-derived inputs for `AGENTS.md`:5758- Project structure (top-level and key source directories)59- Primary commands (dev, test, lint, typecheck, format, build)60- Mainly used packages (framework/runtime + key tooling)61- Existing conventions (packaging style, test layout, dependency management)6263Do not guess. If uncertain, mark as `Not detected`.6465### 3) Add project-specific rules6667After inspection, append rules that fit the detected structure. Examples:6869- Framework boundaries (FastAPI, Django, Flask, CLI app, workers)70- Validation at IO boundaries (request parsing, serialization, config/env loading)71- Service/repository/module boundaries based on current layout72- Error handling policy and logging conventions73- Test structure and fixtures based on repository patterns7475Keep rules concrete and enforceable.7677### 4) Add package-usage research policy7879Always include this policy in `AGENTS.md`:8081- Before using an unfamiliar package or advanced API, consult Context7 or package-specific skills/docs first.82- Prefer repository-approved package patterns over ad-hoc usage.83- Record key package usage constraints in short bullets when they are known.8485### 5) Create or update root `AGENTS.md`8687Ensure `AGENTS.md` contains these sections (merge if existing):88891. Purpose and scope902. Stack profile913. Non-negotiable coding rules (baseline rules)924. Project-specific architecture rules935. Project structure946. Commands957. Mainly used packages968. Package research policy (Context7/package skills)979. Delivery and quality expectations9899Recommended additional guidance to include when applicable:100101- Keep modules cohesive and explicit.102- Validate input near system boundaries.103- Prefer explicit return types for exported/public functions.104- Avoid hidden side effects in shared helpers.105- Minimize cross-module coupling.106107---108109## Output Requirements110111After updating `AGENTS.md`, return:112113- Whether `AGENTS.md` was created or updated114- Project structure summary used for rule generation115- Command list discovered from repo manifests116- Mainly used packages and why they were considered primary117- Added project-specific rules118- Any unknowns or skipped items119120No filler text.121122---123124## Completion Condition125126Task is complete only when all are true:127128- Root `AGENTS.md` exists129- Baseline rules are present exactly in intent130- Project-specific rules are added from repository evidence131- Project structure, commands, and mainly used packages are reported132- Package research policy (Context7/package skills) is included133134---