Skip to content

Calibrate python-best-practices to v1.3.0 (70 rules) - #2

Merged
nathan-gage merged 1 commit into
mainfrom
calibrate-v1.3.0
Apr 24, 2026
Merged

nathan-gage merged 1 commit into
mainfrom
calibrate-v1.3.0

Conversation

@nathan-gage

Copy link
Copy Markdown
Owner

Summary

Cleanup/calibration pass responding to external review. The skill was already close to the Vercel shape philosophically, but had doc drift, one materially wrong Python-version claim, and a few rules that over-reached on documented stdlib behavior. This PR fixes those issues and adds one high-signal rule to land at 70 rules.

  • Rule fixes. Drop the false typing.Sentinel("UNSET") 3.13 claim (PEP 661 is still Draft, targets 3.15). Soften perf-compile-regex-module-level to acknowledge the re module's internal cache for module-level calls. Remove the third-party toolz suggestion from perf-combine-iterations. Rewrite imports-scope-helpers-to-usage so it doesn't implicitly encourage nested-function clutter. Resolve the 2-vs-3-copy mismatch in simplify-extract-after-duplication.
  • New rule. error-log-exception-context — preserve tracebacks when logging handled exceptions (logger.exception(...) inside except, or exc_info=... outside one). Brings rule count to 70.
  • Docs harmonization. Root README.md and per-skill README.md now match SKILL.md and _sections.md on rule count (70), section order (Data, Error, Types, API, Simplification, Performance, Naming, Imports), and typical impact per section. Root AGENTS.md philosophy rewritten to the observational tone used in the per-skill template (no more "shortcut the agent is tempted to take"). Version bumped to 1.3.0.
  • Cross-references. data-explicit-variants ↔ data-discriminated-unions now link both directions (behavior split vs. data-shape split). api-model-cohesion links to data-derive-dont-store.

🤖 Generated with Claude Code

Cleanup/calibration pass responding to external review. Correct a
misstated Python version claim, soften rules that over-reach on
documented stdlib behavior, align root/per-skill docs with the
current rule count and section order, and add one new rule for
preserving tracebacks when logging handled exceptions.

Rule fixes:
- data-sentinel-when-none-is-valid: drop false typing.Sentinel 3.13
  claim (PEP 661 is Draft, targets 3.15); fix __repr__ to "UNSET";
  soften ban on object() sentinels since PEP 661 itself shows it.
- simplify-extract-after-duplication: rename to reflect drift-risk
  framing; resolve 2-vs-3-copy mismatch between SKILL.md and body.
- perf-compile-regex-module-level: acknowledge re module's internal
  cache for module-level calls; pitch is readability + hot-path
  lookup avoidance, not recompilation fear.
- perf-combine-iterations: drop third-party toolz suggestion;
  reference itertools stdlib building blocks instead.
- imports-scope-helpers-to-usage: rewrite to promote substantial
  logic to module scope rather than encouraging nested-function
  clutter.

New rule:
- error-log-exception-context: use logger.exception(...) inside
  except blocks; preserve tracebacks when recovering from failures.

Cross-references:
- data-explicit-variants <-> data-discriminated-unions link both
  directions (behavior split vs. data shape split).
- api-model-cohesion links to data-derive-dont-store.

Docs harmonization:
- Root README: "50+ rules" -> 70; current section order and typical
  impacts replace stale Critical tiers.
- Per-skill README: section order now matches SKILL.md and
  _sections.md; impact column added to section table.
- Root AGENTS.md philosophy: observational framing replaces
  "shortcut the agent is tempted to take," matching per-skill tone.
- SKILL.md + metadata.json bumped to 1.3.0 / 70 rules.
- Regenerated AGENTS.md and test-cases.json.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant