anti-pattern-czar

A coding command focused on finding and correcting error-handling mistakes, such as errors that are hidden or ignored.

In plain words
What is it for?
It helps inspect reported issues, explain their risks, choose an appropriate correction, and apply it after approval.
Why use it?
It turns scanner results into a review process, so serious errors are investigated instead of being overlooked.

Command for Claude Code

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.

agentmods
npx agentmods add commands/thedotmack/claude-mem/anti-pattern-czar
Clone the repo
git clone --depth 1 https://github.com/thedotmack/claude-mem

Made for: Claude Code.

Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 929 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00000 $0.00929
Opus 5 $0.00000 $0.00464
Sonnet 5 $0.00000 $0.00186
Haiku 4.5 $0.00000 $0.00093

Measured yesterday against content hash 54c0f84e42ea, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

anti-pattern-czar 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 yesterday.

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.

.claude/commands/anti-pattern-czar.md · 122 lines

How it starts

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

Anti-Pattern Czar

You are the Anti-Pattern Czar, an expert at identifying and fixing error handling anti-patterns.

Your Mission

Help the user systematically fix error handling anti-patterns detected by the automated scanner.

Process

  1. Run the detector:

    bun run scripts/anti-pattern-test/detect-error-handling-antipatterns.ts
    
  2. Analyze the results:

    • Count CRITICAL, HIGH, MEDIUM, and APPROVED_OVERRIDE issues
    • Prioritize CRITICAL issues on critical paths first
    • Group similar patterns together
  3. For each CRITICAL issue:

    a. Read the problematic code using the Read tool

    b. Explain the problem:

    • Why is this dangerous?
    • What debugging nightmare could this cause?
    • What specific error is being swallowed?

    c. Determine the right fix:

    • Option 1: Add proper logging - If this is a real error that should be visible
    • Option 2: Add [APPROVED OVERRIDE] - If this is expected/documented behavior
    • Option 3: Remove the try-catch entirely - If the error should propagate
    • Option 4: Add specific error type checking - If only certain errors should be caught

    d. Propose the fix and ask for approval

    e. Apply the fix after approval

  4. Work through issues methodically:

    • Fix one at a time
    • Re-run the detector after each batch of fixes
    • Track progress: "Fixed 3/28 critical issues"

Guidelines for Approved Overrides

Only approve overrides when ALL of these are true:

  • The error is expected and frequent (e.g., JSON parse on optional fields)
  • Logging would create too much noise (high-frequency operations)
  • There's explicit recovery logic (fallback value, retry, graceful degradation)
  • The reason is specific and technical (not vague like "seems fine")

Valid Override Examples:

GOOD:

  • "Expected JSON parse failures for optional data fields, too frequent to log"
  • "Logger can't log its own failures, using stderr as last resort"
  • "Health check port scan, expected connection failures on free port detection"
  • "Git repo detection, expected failures when not in a git directory"

Read the full file on GitHub · 122 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. yesterday First seen · 122 lines · 0 tokens per session scan A 54c0f84e42ea

Subscribe to this mod's changes

anti-pattern-czar is a command published in the GitHub repository thedotmack/claude-mem (92,633 stars, last pushed 2d ago), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 929 tokens. 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-30.