margaret-scan

margaret-scan is a skill for Claude Code from sofiahernandes/margaret. It costs 136 tokens per session (804 once invoked), scanned A, original, MIT.

A focused code review for finding unnecessary complexity and over-engineering in a change or an entire codebase.

In plain words
What is it for?
Use it to spot unnecessary dependencies, one-use abstractions, dead flexibility, duplicate built-in functionality, unused options, and custom code that can be removed.
Why use it?
It shows what can be deleted or replaced with simpler standard-library, platform, or existing-code solutions.

Skill for Claude Code

Written for Claude Code: argument-hint in frontmatter.

Part of the margaret plugin — 5 skills, 1 command shipped together

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 skills/sofiahernandes/margaret/margaret-scan
Any agent
npx skills add sofiahernandes/margaret --skill margaret-scan
Clone the repo
git clone --depth 1 https://github.com/sofiahernandes/margaret

Made for: Claude Code.

Or install margaret, the plugin that ships this one along with the rest of its 5 skills, 1 command.

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 margaret-scan

README.md
[![agentmods](https://agentmods.dev/badge/skills/sofiahernandes/margaret/margaret-scan.svg)](https://agentmods.dev/skills/sofiahernandes/margaret/margaret-scan)
Your own site
<a href="https://agentmods.dev/skills/sofiahernandes/margaret/margaret-scan"><img src="https://agentmods.dev/badge/skills/sofiahernandes/margaret/margaret-scan.svg" alt="Measured on agentmods" height="20"></a>
Per session 136 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 804 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.1 $0.00136 $0.00804
Opus 5 $0.00068 $0.00402
Sonnet 5 $0.00027 $0.00161
Haiku 4.5 $0.00014 $0.00080

Measured 6d ago against content hash 399aed50c75b, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

margaret-scan 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 6d 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.

skills/margaret-scan/SKILL.md · 58 lines

How it starts

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

Hunt exclusively for complexity that doesn't earn its keep. One finding per line: where it lives, what to remove, what stands in its place. Success looks like a smaller tree, not a longer report.

Two scopes:

  • diff (default): only the current change is in play.
  • repo (pass repo, or the user asks for an "audit"/"whole codebase"): walk the full tree instead, biggest win listed first. Look for: packages duplicating stdlib or platform behavior, interfaces with exactly one implementer, factories manufacturing a single product, pass-through wrappers that add no behavior, single-export files, unused flags/config, and homegrown reimplementations of stdlib functions.

Reporting shape

L<line>: <tag> <finding>. <fix>. — prefix with <file>: for anything spanning multiple files (diffs with several files, or a repo scan).

Tags:

  • cut: unreachable code, unused flexibility, a feature nobody asked for. Fix: remove it, nothing replaces it.
  • builtin: custom code duplicating what the standard library already ships. Name the stdlib call.
  • platform: a dependency or handwritten code standing in for a platform capability. Name the capability.
  • overbuilt: one-implementation interface, a config knob nobody flips, a layer with a single caller.
  • condense: identical behavior expressible in fewer lines. Show the shorter version.

Examples

❌ "This SlugGenerator class seems like it might be handling more cases than strictly necessary — worth double-checking whether every branch is needed?"

L18-45: builtin: 30-line slug class reimplementing string normalization. str.lower().replace(' ', '-') plus a regex strip, 2 lines.

L7: platform: left-pad package pulled in for one call. "x".padStart(5, "0"), 0 deps.

store.py:L61: overbuilt: PaymentGatewayInterface with one implementer (Stripe). Inline the Stripe class until a second gateway is real.

L40-58: cut: exponential backoff wrapper around a call that's already idempotent and fast. Nothing replaces it.

Read the full file on GitHub · 58 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. 6d ago First seen · 58 lines · 136 tokens per session scan A 399aed50c75b

Subscribe to this mod's changes

margaret-scan is a skill published in the GitHub repository sofiahernandes/margaret (2 stars, last pushed 22d ago), licensed MIT. It adds 136 tokens to every session and 804 once invoked, about $0.0007 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.