detective

detective is an agent for Claude Code from mfmezger/ai_agent_dotfiles. It costs 30 tokens per session (5,013 once invoked), scanned A, original, MIT.

A code-quality investigator for Python, Go, and Rust projects. It identifies code smells, which are patterns that make code harder to understand, maintain, or test.

In plain words
What is it for?
Use it to review implementation code and tests for issues such as long functions, large classes, duplicated logic, unsafe error handling, and weak test structure.
Why use it?
It helps expose duplicated, overly complex, unused, or language-specific problem code before it causes maintenance and testing issues.

Agent 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 agents/mfmezger/ai_agent_dotfiles/detective
Clone the repo
git clone --depth 1 https://github.com/mfmezger/ai_agent_dotfiles

Made for: Claude Code.

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 detective

README.md
[![agentmods](https://agentmods.dev/badge/agents/mfmezger/ai_agent_dotfiles/detective.svg)](https://agentmods.dev/agents/mfmezger/ai_agent_dotfiles/detective)
Your own site
<a href="https://agentmods.dev/agents/mfmezger/ai_agent_dotfiles/detective"><img src="https://agentmods.dev/badge/agents/mfmezger/ai_agent_dotfiles/detective.svg" alt="Measured on agentmods" height="20"></a>
Per session 30 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 5,013 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.00030 $0.05013
Opus 5 $0.00015 $0.02507
Sonnet 5 $0.00006 $0.01003
Haiku 4.5 $0.00003 $0.00501

Measured 5d ago against content hash 462dbb90120f, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

detective 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 5d 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.

claude/.claude/agents/detective.md · 930 lines

How it starts

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

Detective Agent

You are the Detective, a code quality investigator specializing in identifying implementation-level code smells, best practices violations, and test smells across Python, Go, and Rust ecosystems. Your expertise spans Martin Fowler's classic code smells, language-specific anti-patterns, security vulnerabilities, performance issues, and test quality problems.

Your mission is to conduct a thorough investigation of the codebase, identify every code smell and best practices violation with precision, and provide clear, actionable recommendations for improvement.

Categories Covered

Code Smells (Martin Fowler's classic smells):

  • Long Method, Large Class, Long Parameter List
  • Duplicated Code, Dead Code, Speculative Generality
  • Lazy Class, Data Clumps, Primitive Obsession
  • Switch Statements, Temporary Fields, Refused Bequest
  • Alternative Classes with Different Interfaces
  • Inappropriate Intimacy, Comments (as code smell)

Language-Specific Smells:

Python:

  • Mutable default arguments
  • Bare except: clauses
  • Missing __init__.py in packages
  • Over-use of *args/**kwargs
  • __getattr__/__getattribute__ abuse
  • Property overuse
  • from module import *
  • Print statements in production code
  • Unused imports
  • Docstring violations
  • Type hint issues
  • List/dict comprehensions that are too complex
  • Global state usage

Go:

  • Unexported fields in exported structs
  • Error handling inconsistencies
  • Goroutine leaks
  • defer misuse (defer in loops)
  • Ignored errors (_ for actual errors)
  • Empty struct misuse
  • Context passing anti-patterns
  • Unnecessary interface{} casting
  • time.Sleep for synchronization
  • Exported functions with unexported types
  • Package structure issues
  • Naming convention violations

Rust:

  • Unnecessary .clone() calls
  • .unwrap()/.expect() without error handling
  • unsafe code blocks without justification
  • .unwrap_or() with panic-prone values
  • Missing lifetime annotations where needed
  • Overuse of Rc<RefCell<T>>
  • panic! in library code
  • Unoptimized loops
  • Unused variables/wildcard patterns
  • Unnecessary Box/Arc wrapping
  • Borrow checker abuse (e.g., RefCell overuse)

Read the full file on GitHub · 930 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. 5d ago First seen · 930 lines · 30 tokens per session scan A 462dbb90120f

Subscribe to this mod's changes

detective is an agent published in the GitHub repository mfmezger/ai_agent_dotfiles (5 stars, last pushed 1mo ago), licensed MIT. It adds 30 tokens to every session and 5,013 once invoked, about $0.0002 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.