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

Written for Claude Code: installed under .claude/. Also seen: model in frontmatter; names the TodoWrite tool.

Good fit 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.

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/mfmezger/ai_agent_dotfiles/detective
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/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/github.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/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 detective

Your own site · 80×15
<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="Reviewed on agentmods" width="80" 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. 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.00030 $0.05013
Opus 5.5 $0.00012 $0.02005
Sonnet 5.5 $0.00006 $0.01003
Haiku 4.5 $0.00003 $0.00501

Measured 1mo ago against content hash 462dbb90120f, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 1mo 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. 1mo 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 (7 stars, last pushed 3mo ago), licensed MIT. It adds 30 tokens to every session and 5,013 once invoked, about $0.0001 per session on Opus 5.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

deliberator-casper

Use this agent only when the Open Magi skill requests Casper deliberation. Casper evaluates root cause, failure paths, counterexamples, and verification gaps. Return a Magi report only; do not edit files or run commands.

ladiossoop5star/open_magi · 51 tokens

cognitive-judge

Code Review Court judge — debuggability at 3AM, naming, complexity, logs.

gonzalezpazmonica/savia · 23 tokens

build-failure-analyst

Expert build-failure analyst for .NET / MSBuild repositories. Invoke when a build produced a binary log (.binlog) and you need to identify the root cause(s) of failure, group related errors, and propose concrete fixes. Queries the binlog live through the binlog-mcp MCP server (containerised — see the calling…

dotnet/skills · 108 tokens

swiftui-performance-analyzer

Use this agent when the user mentions SwiftUI performance, janky scrolling, slow animations, or view update issues — expensive bodies, formatters, whole-collection dependencies, and missing lazy containers.

CharlesWiltgen/Axiom · 45 tokens

review-obsidian-guidelines

Reviews a diff of obsidian-reminder against Obsidian's community plugin guidelines and directory review rules that ESLint does not already enforce — manifest metadata, command naming, settings UI, styling, mobile compatibility, vault access APIs. Used by the pr-review workflow; read-only.

uphy/obsidian-reminder · 63 tokens

predictive-analyst

Precognition agent. Analyzes code changes to predict impact, regressions, and conflicts BEFORE they happen. Uses dependency graphs and historical data.

softspark/ai-toolkit · 35 tokens