diff --git a/.github/skills/code-review/SKILL.md b/.github/skills/code-review/SKILL.md index 31725125cb84..59750a682849 100644 --- a/.github/skills/code-review/SKILL.md +++ b/.github/skills/code-review/SKILL.md @@ -33,6 +33,14 @@ suggest the fix — never just "rejected". - [ ] Descriptive variable and function names (no single letters where a word helps). - [ ] Code is formatted and lint-clean (`ruff`, `pre-commit`). +> **Optional hint:** When a PR hand-writes a simple class that is mostly a +> bundle of fields (a manual `__init__` plus `__repr__`/`__eq__`), it is worth +> **suggesting** `from typing import NamedTuple` or +> `from dataclasses import dataclass` where they would simplify the code. These +> are underutilized tools that our contributors would benefit from using where +> they make sense. Offer it as an optional improvement, not a blocker — do not +> request changes solely because a class was written the longhand way. + #### When a PR fails `ruff check` Don't just report the failure — try the mechanical fixes and recommend the one diff --git a/.github/skills/new-pull-request/SKILL.md b/.github/skills/new-pull-request/SKILL.md index a1588d2635a6..427ae306c9bf 100644 --- a/.github/skills/new-pull-request/SKILL.md +++ b/.github/skills/new-pull-request/SKILL.md @@ -41,6 +41,11 @@ Always check at least one Markdown checkbox in the pull request description (the - [ ] Public functions/classes have **type hints**. - [ ] Public functions have **doctests that actually pass**. - [ ] Descriptive variable and function names (no single letters where a word helps). +- [ ] For a simple class that is mostly a bundle of fields, **consider** + `from typing import NamedTuple` or `from dataclasses import dataclass` + instead of a hand-written `__init__`/`__repr__`/`__eq__`. These are + underutilized tools that make simple classes shorter and clearer — use + them where they genuinely simplify the code, not everywhere. - [ ] Code is formatted and lint-clean (`ruff`, `pre-commit`). - [ ] `DIRECTORY.md` and `README.md` are **not hand-edited** — the `algorithms-keeper` bot regenerates them automatically after merge.