Note: This file is also available as
CLAUDE.md(symlink) for Claude Code CLI users.You MUST read CONTRIBUTING.md before writing code. It contains coding standards, type annotation rules, design patterns, and commit message format. This file provides agent-specific quick reference only.
- Keep all written text concise and easy to understand — docstrings, comments, commit messages, PR descriptions, and documentation
- Add docstrings on all public functions and classes
- Use file-scoped commands for fast feedback (see below)
- Follow existing patterns — search codebase for similar code
- Chain exceptions:
raise ValueError(...) from err - Use
req_ctxvar_context()for per-requirement logging - Run
hatch run lint:fixto format code
- Don't run full test suite for small changes (use file-scoped)
- Don't create temporary helper scripts or workarounds
- Don't commit without running quality checks
- Don't make large speculative changes — ask first or propose a plan
- Don't update git config or force push to main
- Don't use bare
except:— always specify exception types - Don't invent new patterns — search the codebase for existing ones
hatch run lint:install-hooks # Pre-commit hooks for automatic formattinghatch run mypy:check <filepath> # Type check single file
hatch run lint:fix <filepath> # Format single file
hatch run test:test tests/test_<module>.py # Test specific file
hatch run test:test tests/test_<module>.py::test_name # Test specific function
hatch run test:test <filepath> --log-level DEBUG # Debug testhatch run lint:fix # Format all code
hatch run test:test # Full test suite (slow!)
hatch run mypy:check # Type check everything
hatch run lint:check # Final lint check
hatch run lint:precommit # All linters and pre-commit hooks- Read files, search codebase
- Run file-scoped linting, type checking, tests
- Edit existing files following established patterns
- Create test files
- Installing/updating packages in pyproject.toml
- Git commit or push operations
- Deleting files or entire modules
- Running full test suite
- Creating new modules or major refactors
- Making breaking changes
src/fromager/— Main package codetests/— Unit tests (mirrorsrc/structure)e2e/— End-to-end integration testsdocs/— Sphinx documentation
Look at these before writing code:
- Type annotations:
src/fromager/context.py - Pydantic models:
src/fromager/packagesettings.py - Logging with context:
src/fromager/resolver.py - Error handling:
src/fromager/commands.py - Testing patterns:
tests/test_context.py
Import rules: All imports at the top of the file, no local imports. See CONTRIBUTING.md for details.
Testing: Use Arrange/Act/Assert pattern, name functions test_<behavior>(). See tests/test_context.py for examples.
Follow Conventional Commits — see CONTRIBUTING.md for format, types, and examples.
When AI agents create or significantly modify code, add attribution:
feat(scope): short summary
Body explaining what and why.
Co-Authored-By: Claude <claude@anthropic.com>
Closes: #123
- Search codebase for similar patterns first
- Create a checklist for tracking progress
- Work through items one at a time
- Run file-scoped tests after each change
- Run full quality checks only at the end:
hatch run lint:fix && hatch run test:test && hatch run mypy:check && hatch run lint:check
See CONTRIBUTING.md for comprehensive standards, detailed examples, and design patterns.