macro-hygiene-reviewer

macro-hygiene-reviewer is an agent for Claude Code from ReviewToolkits/cpython-review-toolkit. It costs 124 tokens per session (939 once invoked), scanned A, original, MIT.

A code-review agent for checking C preprocessor macros, which are text substitutions performed before C code is compiled.

In plain words
What is it for?
Use it to review C macros for missing parentheses, repeated argument evaluation, unsafe multi-line definitions, missing header guards, and overly broad scope.
Why use it?
It finds macro patterns that can cause incorrect calculations, repeated side effects, broken if/else blocks, naming problems, or header conflicts.

Agent for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: model in frontmatter.

Part of the cpython-review-toolkit plugin — 7 commands, 23 agents shipped together

Good fit Use it to review C macros for missing parentheses, repeated argument evaluation, unsafe multi-line definitions, missing header guards, and overly broad scope.

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/reviewtoolkits/cpython-review-toolkit/macro-hygiene-reviewer
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/ReviewToolkits/cpython-review-toolkit

Made for: Claude Code.

Or install cpython-review-toolkit, the plugin that ships this one along with the rest of its 7 commands, 23 agents.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for macro-hygiene-reviewer

README.md
[![agentmods](https://agentmods.dev/badge/agents/reviewtoolkits/cpython-review-toolkit/macro-hygiene-reviewer/github.svg)](https://agentmods.dev/agents/reviewtoolkits/cpython-review-toolkit/macro-hygiene-reviewer)
Your own site
<a href="https://agentmods.dev/agents/reviewtoolkits/cpython-review-toolkit/macro-hygiene-reviewer"><img src="https://agentmods.dev/badge/agents/reviewtoolkits/cpython-review-toolkit/macro-hygiene-reviewer/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for macro-hygiene-reviewer

Your own site · 80×15
<a href="https://agentmods.dev/agents/reviewtoolkits/cpython-review-toolkit/macro-hygiene-reviewer"><img src="https://agentmods.dev/badge/agents/reviewtoolkits/cpython-review-toolkit/macro-hygiene-reviewer.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 124 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 939 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00124 $0.00939
Opus 5 $0.00062 $0.00469
Sonnet 5 $0.00025 $0.00188
Haiku 4.5 $0.00012 $0.00094

Measured 9d ago against content hash 228d93bc8556, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

macro-hygiene-reviewer scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/cpython-review-toolkit/agents/macro-hygiene-reviewer.md · 89 lines

How it starts

The opening of the file, as written. The whole thing — 89 lines — stays where its author put it; the contents beside it link to each section on GitHub.

You are an expert in C preprocessor best practices, specializing in macro hygiene. Your mission is to find macro definitions that have common pitfalls leading to bugs.

Scope

Analyze the scope provided. Default: the entire project.

Analysis Strategy (No Script — Qualitative Analysis)

Search the codebase for macro definitions and review each for hygiene issues.

What to Check

  1. Missing parentheses around arguments:

    #define SQ(x) x*x        // BAD: SQ(a+1) → a+1*a+1
    #define SQ(x) ((x)*(x))  // GOOD
    
  2. Missing parentheses around result:

    #define ADD(a,b) a+b      // BAD: ADD(1,2)*3 → 1+2*3
    #define ADD(a,b) ((a)+(b))// GOOD
    
  3. Multiple evaluation of arguments:

    #define MAX(a,b) ((a)>(b)?(a):(b))  // BAD: MAX(i++,j) evaluates i++ twice
    
  4. Multi-statement macros without do-while:

    #define SWAP(a,b) { t=a; a=b; b=t; }        // BAD with if/else
    #define SWAP(a,b) do { t=a; a=b; b=t; } while(0)  // GOOD
    
  5. Naming: Macro names should be ALL_CAPS (exceptions for macro-as-function patterns in CPython)

  6. Header guards: All .h files should have #ifndef/#define guards

  7. Macro scope: Macros defined in .c files that should be #undef'd after use

Search Strategy

  1. Grep for #define directives across the scope
  2. For function-like macros, check parenthesization
  3. For multi-line macros, check do-while wrapping
  4. For .h files, check include guards

Output Format

## Macro Hygiene Review Results

### Summary
- Macros reviewed: N
- Hygiene issues: N

### Findings

#### [CONSIDER] Missing parentheses in SQ macro (file.h:line)
**What**: `#define SQ(x) x*x` — arguments not parenthesized.
**Risk**: `SQ(a+1)` expands to `a+1*a+1` due to operator precedence.
**Fix**: `#define SQ(x) ((x)*(x))`

#### [CONSIDER] Multiple evaluation in MAX macro (file.h:line)
**What**: `#define MAX(a,b) ((a)>(b)?(a):(b))` — arguments evaluated twice.
**Risk**: `MAX(i++, j)` increments `i` twice.
**Fix**: Use a statement expression (GCC) or inline function.

Read the full file on GitHub · 89 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 9d ago First seen · 89 lines · 0 tokens per session scan A 228d93bc8556

Subscribe to this mod's changes

macro-hygiene-reviewer is an agent published in the GitHub repository ReviewToolkits/cpython-review-toolkit (10 stars, last pushed 1mo ago), licensed MIT. It adds 124 tokens to every session and 939 once invoked, about $0.0006 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other agents, from other repositories

cpp-reviewer

Expert C++ code reviewer specializing in memory safety, modern C++ idioms, concurrency, and performance. Use for all C++ code changes. MUST BE USED for C++ projects.

affaan-m/ECC · 41 tokens

cpp-memory-review

Agent "cpp-memory-review" from Jorgejie/ai_scaffold, covering 1. {{t "cppmemoryreview.jnireftitle"}}, 2. {{t "cppmemoryreview.heaptitle"}}, 3. {{t "cppmemoryreview.buffertitle"}}, 4. {{t "cppmemoryreview.sensitivetitle"}} and 5. {{t "cppmemoryreview.rationalitytitle"}}.

Jorgejie/ai_scaffold · 8 tokens

c-complexity-analyzer

Use this agent to measure and analyze C code complexity in extension modules, identifying hotspots and suggesting simplifications.\n\n \nUser: What are the most complex functions in this extension?\nAgent: I will run the complexity measurement script, identify hotspots with score >= 5.0, assess inherent vs reducible…

ReviewToolkits/cext-review-toolkit · 89 tokens

generated-code-mapper

Use this agent FIRST in every cext-review-toolkit explore pipeline on a C extension that uses a code generator (Cython, pybind11, nanobind, custom codegen). It produces a project-orientation guide that downstream agents (refcount, error-path, GIL, etc.) consume to triage findings accurately. The orientation captures…

ReviewToolkits/cext-review-toolkit · 268 tokens

module-state-checker

Use this agent to audit module initialization and state management in C extension code, including single-phase vs multi-phase init and global state migration.\n\n \nUser: Review the module state management in my C extension.\nAgent: I will run the module state scanner, assess the init style, catalog global PyObject…

ReviewToolkits/cext-review-toolkit · 93 tokens

type-slot-checker

Use this agent to audit Python type definitions (PyTypeObject, PyTypeSpec) in C extension code for correctness of slots, dealloc, traverse, and GC integration.\n\n \nUser: Check the type definitions in my C extension.\nAgent: I will run the type slot scanner, verify dealloc/traverse/GC flag consistency, check…

ReviewToolkits/cext-review-toolkit · 98 tokens