This file provides guidance to AI coding agents when working with code in this repository.
codespell is maintained by a small number of volunteers. Code is reviewed and maintained by humans, so interactions about it should be between humans, too.
Co-Authored-By: for Claude / Copilot / Cursor / any other tool) to commits, and do not use a bot as the commit author. The author takes full responsibility for the contents and must be able to explain and defend every line on request.A big diff is a cost, not an accomplishment. Aim for the smallest change that delivers the user-visible behavior; anything else can be added later, when something actually needs it.
codespell_lib/_codespell.py and build on it rather than adding a near-duplicate.codespell_lib/tests/test_basic.py that already sets up what you need, then add a new test function there, and only then consider a new file. A few compact assertions beat a long test that re-creates setup.pip install -e . --group dev # editable install with test/lint deps pre-commit install --install-hooks # ruff, mypy, codespell, file sorting, ... pytest codespell_lib/tests/test_basic.py -k write_changes # CLI tests make check-dictionaries # sort + validate dictionaries (test_dictionary.py) pre-commit run --all-files # all linters, auto-fixing where possible make check # everything CI checks: dictionaries, build, pytest, ruff
Pure Python (>= 3.9), no runtime dependencies.
codespell_lib/_codespell.py: the CLI (main()), option parsing, and file checking/fixing.codespell_lib/data/dictionary*.txt: the misspelling dictionaries, one per --builtin set.codespell_lib/tests/test_basic.py: CLI behavior tests, mostly calling cs.main(...) on files in tmp_path.codespell_lib/tests/test_dictionary.py: dictionary format and consistency checks.Dictionary entries are typo->fix; with more than one fix, end the line with a comma so none is applied automatically:
calulated->calculated fiel->feel, field, file, phial,
See “Dictionary format” in README.rst for the full rules.
pre-commit run --files <changed files> before handing work back..github/), pyproject.toml, or .pre-commit-config.yaml.dictionary_en_to_en-OX_AUTOGENERATED.txt (it is generated from dictionary_en-GB_to_en-US.txt by make), delete or weaken a failing test to make it pass, or commit secrets.