devdanzin/cext-review-toolkit
16 stars · Last commit 2026-04-22
A Claude Code plugin for reviewing CPython C extensions — finding API misuse, memory safety bugs, compatibility issues, and correctness problems.
README preview
# C Extension Review Toolkit A [Claude Code](https://docs.anthropic.com/en/docs/claude-code) plugin for reviewing CPython C extensions -- finding API misuse, memory safety bugs, compatibility issues, and correctness problems specific to code that *consumes* the Python/C API. Built for the specific concerns of C extension authors -- reference counting from the caller's perspective, borrowed reference lifetimes, module state management, type slot correctness, stable ABI compliance, and version compatibility -- not general-purpose C analysis. ## Why a Separate Tool? | Concern | CPython internals (cpython-review-toolkit) | C extensions (this toolkit) | |---------|-------------------------------------------|----------------------------| | **Perspective** | Code that *implements* the C API | Code that *calls* the C API | | **Parsing** | Regex (PEP 7 code is regular) | Tree-sitter (extension code varies wildly) | | **Top bug class** | Refcount leaks in runtime code | Borrowed refs held across callbacks | | **Module state** | N/A (CPython manages its own) | Core concern -- init style, global state | | **Type definitions** | Part of the runtime | Must follow slot contracts correctly | | **ABI** | Defines the ABI | Must comply with the ABI | | **Dependencies** | stdlib only | tree-sitter, tree-sitter-c | ## Installation