Operational guide for agentic coding tools in this repository.
- Project type: Python CLI that generates a monthly Kindle Scribe planner PDF.
- Primary spec:
docs/plan/POC-PRD.md. - Main entrypoint:
main.py. - Core package:
planner/(cli.py,model.py,layout.py,navigation.py,generator.py). - Tests live in
tests/usingpytest.
Checked in this repo and currently not present:
.cursorrules.cursor/rules/.github/copilot-instructions.md
If any of these files appear later, treat them as higher-priority local instructions than this file.
- Prefer
docs/plan/POC-PRD.mdfor functional behavior and acceptance criteria. - If code and PRD conflict, follow PRD unless the user explicitly overrides it.
- Keep PoC scope intact: month overview + daily pages + internal PDF navigation.
python -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
pip install -r requirements.txtNotes:
requirements.txtincludes runtime deps andpytest.- If a future
requirements-dev.txtappears, install it too.
Primary artifact-generation command:
python main.py --year 2026 --month 3Custom output path example:
python main.py --year 2026 --month 3 --output output/2026-03-planner.pdfIf packaging metadata (pyproject.toml or setup.cfg) is added in the future:
python -m buildRun from repository root:
ruff check .
ruff format .
mypy .If only one file changed, use targeted checks first:
ruff check planner/generator.py
mypy planner/generator.pyRun full test suite:
pytestVerbose fail-fast run:
pytest -x -vvRun tests matching keyword expression:
pytest -k "leap and february"Run a single test file:
pytest tests/test_generator.pyRun a single test function (important for fast iteration):
pytest tests/test_generator.py::test_creates_expected_page_countRun a single test class:
pytest tests/test_cli.py::TestCLIIf the project ever switches to unittest, use:
python -m unittest discover -s tests -p "test_*.py"
python -m unittest tests.test_generator.TestPlanner.test_page_countTarget Python 3.11+ style and typing.
- Group imports: standard library, third-party, local package.
- Use absolute imports within
plannermodules. - Do not use wildcard imports.
- Remove unused imports and keep import lists minimal.
- Follow PEP 8 and rely on formatter behavior.
- Keep lines near 88-100 chars.
- Prefer readable, composable helper functions over long monolithic blocks.
- Keep diffs focused; do not do unrelated formatting churn.
- Add type hints for public functions and non-trivial internals.
- Prefer concrete built-ins like
list[str],dict[str, int]. - Use
dataclassorTypedDictfor structured payloads when appropriate. - Avoid
Anyunless required by a boundary (library API, dynamic data).
- Modules/files:
snake_case. - Functions/variables:
snake_case. - Classes:
PascalCase. - Constants:
UPPER_SNAKE_CASE. - Tests should describe behavior (e.g.,
test_first_day_has_no_prev_link).
- Validate CLI arguments early and fail with clear messages.
- Raise specific exceptions instead of broad
Exception. - Do not silently swallow errors.
- Convert expected user-facing failures into deterministic CLI output.
- Use
loggingin reusable modules when diagnostic detail is useful. - Keep CLI stdout concise and user-focused.
- Keep output deterministic so tests can assert reliably.
- Add or update tests for every behavior change.
- Cover month-length and leap-year edge cases.
- Verify navigation constraints (month/day links, first-day Prev, last-day Next).
- Prefer behavior assertions over implementation-detail assertions.
- All daily pages must share one consistent layout.
- Month page day cells must link to correct daily pages.
- Daily navigation links must never target missing destinations.
- Output should remain usable on Kindle Scribe portrait dimensions.
- Read
docs/plan/POC-PRD.mdbefore significant changes. - Keep changes scoped to the task; avoid speculative refactors.
- Run relevant lint/tests for touched code before finishing when possible.
- If a command fails due to missing environment/tooling, report command + error clearly.
- Do not modify unrelated files or generated artifacts unless requested.
- Update this file when tooling, workflow, or local rule files change.