flask/AGENTS.md
rharper105 5b9396a197 docs: add AGENTS.md for AI coding agent context
Adds an AGENTS.md file with project conventions, constraints, hub files,
and build commands. Helps AI coding agents (Claude Code, Cursor, Codex)
understand project patterns before making changes.

Generated with: npx sourcebook init
Review and edit — the best context comes from human + machine together.
2026-04-09 17:57:23 -04:00

2 KiB

AGENTS.md

Agent instructions for this repository. Generated by sourcebook. Review and edit — the best context comes from human + machine together.

Constraints

These constraints MUST be followed when modifying this codebase:

  • Project structure: This is a publishable library, not an application. Focus changes on the public API surface. Avoid breaking changes to exported types and function signatures.
  • Core modules: Hub files (most depended on): src/flask/globals.py (imported by 24 files); src/flask/helpers.py (imported by 24 files); src/flask/signals.py (imported by 20 files); src/flask/init.py (imported by 9 files); src/flask/sansio/scaffold.py (imported by 9 files). Changes here have the widest blast radius.
  • Circular dependencies: Circular import chains detected: flask/init.py; flask/init.py → app.py; flask/init.py → app.py → ctx.py. Avoid adding to these cycles.

Stack

Flask

Core Modules (by structural importance)

  • src/flask/globals.py
  • src/flask/helpers.py
  • src/flask/signals.py
  • src/flask/__init__.py
  • src/flask/json/__init__.py

Conventions

  • Testing: Tests live in a separate test/ directory, mirroring src/ structure. New tests go there, not next to source files.
  • Python conventions: Uses init.py as barrel exports. Import from the package, not from internal modules.
  • Dominant patterns: API endpoints use Flask routes. Follow this pattern for new routes.
  • Dominant patterns: Tests use pytest. Test utilities in: tests/test_helpers.py.

Additional Context

  • Most active areas in the last 30 days: .github/ (6 changes). Expect ongoing changes here.

What to Add Manually

The most valuable context is what only you know. Add:

  • Architectural decisions and why they were made
  • Past incidents that shaped current conventions
  • Deprecated patterns to avoid in new code
  • Domain-specific rules or terminology
  • Environment setup beyond what .env.example shows