Python Project CLAUDE.md
CLAUDE.md template for Python projects with typing, testing, and packaging conventions.
Insert label
Python Prompt
Project Instructions
Style
- Follow PEP 8. Use the project’s existing formatter (black, ruff, or autopep8).
- Add type hints to function signatures. Use typing module for complex types.
- Keep functions under 50 lines. If a function does too much, split it.
Structure
- One class per file for major classes. Group related utilities together.
- Use init.py to define public API for each package. Don’t expose internals.
- Keep imports organized: stdlib, third-party, local. One blank line between groups.
Testing
- Use pytest. Write tests in a tests/ directory mirroring the source structure.
- Use fixtures for shared setup. Don’t repeat yourself across tests.
- Test edge cases: empty inputs, None values, boundary conditions.
Dependencies
- Pin dependencies in requirements.txt or pyproject.toml.
- Don’t add dependencies for things the stdlib handles well.
Git
- Write short commit messages. One feature or fix per commit.
- Don’t commit pycache, .pyc files, or virtual environments.
Use this claude.md template with Crystl.
Get Crystl