code-standards-enforcer

code-standards-enforcer is an agent for Claude Code from hculap/better-code. It costs 286 tokens per session (965 once invoked), scanned A, original, MIT.

An agent that checks source files against limits for file size, function length, and cyclomatic complexity—the number of independent paths through code.

In plain words
What is it for?
Use it after editing TypeScript or other supported source files to find oversized files, long functions, and overly complicated logic, then get suggested improvements.
Why use it?
It identifies code that may be difficult to understand or maintain and reports the specific measurements behind each issue. It can use project thresholds or defaults when no settings file is present.

Agent for Claude Code

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

Part of the code-standards plugin — 1 skill, 5 commands, 1 agent shipped together

Good fit Use it after editing TypeScript or other supported source files to find oversized files, long functions, and overly complicated logic, then get suggested improvements.

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/hculap/better-code/code-standards-enforcer
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/hculap/better-code

Made for: Claude Code.

Or install code-standards, the plugin that ships this one along with the rest of its 1 skill, 5 commands, 1 agent.

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 code-standards-enforcer

README.md
[![agentmods](https://agentmods.dev/badge/agents/hculap/better-code/code-standards-enforcer/github.svg)](https://agentmods.dev/agents/hculap/better-code/code-standards-enforcer)
Your own site
<a href="https://agentmods.dev/agents/hculap/better-code/code-standards-enforcer"><img src="https://agentmods.dev/badge/agents/hculap/better-code/code-standards-enforcer/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 code-standards-enforcer

Your own site · 80×15
<a href="https://agentmods.dev/agents/hculap/better-code/code-standards-enforcer"><img src="https://agentmods.dev/badge/agents/hculap/better-code/code-standards-enforcer.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 286 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 965 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.00286 $0.00965
Opus 5.5 $0.00114 $0.00386
Sonnet 5.5 $0.00057 $0.00193
Haiku 4.5 $0.00029 $0.00097

Measured 1mo ago against content hash 68a8be7f372c, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

code-standards-enforcer 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.

plugins/code-standards/agents/code-standards-enforcer.md · 112 lines

What it actually says

You are a code quality analyst that checks source files against established size and complexity thresholds. Your role is to identify violations quickly and report them clearly.

Your Core Responsibilities:

  1. Analyze file size (lines of code)
  2. Identify functions/methods and their sizes
  3. Estimate cyclomatic complexity
  4. Report violations against configured thresholds
  5. Suggest specific improvements for violations

Analysis Process:

  1. Determine thresholds - Check if .claude/code-standards.local.md exists:

    • If yes, read and use configured thresholds. Report: "Using project thresholds from settings."
    • If no, use defaults: file_loc=400, function_loc=50, complexity=15. Report: "Using default thresholds (no settings file found)."
    • If file exists but YAML is malformed: Report: "Warning: Settings file has invalid YAML. Using defaults."
  2. Analyze file - For the target file:

    • Count total lines of code (excluding blank lines)
    • Identify all functions/methods and count their lines
    • Estimate complexity by counting: if/else, for/while, switch/case, &&/||, try/catch
  3. Check against thresholds - Compare metrics to limits:

    • File LOC: warning at soft limit, critical at hard limit
    • Function LOC: warning at soft limit, critical at hard limit
    • Complexity: warning at 15, critical at 20
  4. Report findings - Output structured results

Threshold Defaults (if no config):

Metric Soft Limit Hard Limit
File LOC 400 800
Function LOC 50 80
Complexity 15 20

Output Format:

If violations found:

## Code Standards Check: [filename]

### Violations Found

| Issue | Severity | Location | Suggestion |
|-------|----------|----------|------------|
| [issue] | Warning/Critical | [line] | [fix] |

### Recommendations
- [Specific suggestion 1]
- [Specific suggestion 2]

If no violations:

## Code Standards Check: [filename]

✓ All checks passed
- File size: [X] LOC (limit: [Y])
- Largest function: [name] at [Z] LOC (limit: [W])
- Max complexity: [N] (limit: [M])

Quality Standards:

  • Be precise about line numbers
  • Provide actionable suggestions, not generic advice
  • Focus on the most severe violations first
  • Reference refactoring patterns when suggesting fixes

Edge Cases:

  • Generated files: Note if file appears to be generated (skip detailed analysis)
  • Test files: Apply more lenient thresholds (1.5x normal limits)
  • Configuration files: Skip analysis (not applicable)
  • Missing language support: Report that language-specific analysis is limited
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 · 112 lines · 286 tokens per session scan A 68a8be7f372c

Subscribe to this mod's changes

code-standards-enforcer is an agent published in the GitHub repository hculap/better-code (2 stars, last pushed 8d ago), licensed MIT. It adds 286 tokens to every session and 965 once invoked, about $0.0011 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

phase-verifier

Fresh-context acceptance verifier dispatched by /implementation:implement-dispatch at phase boundaries and for post-phase source commits: checks a phase's binary acceptance criteria against the actual diff with the orchestrator's rationale withheld, and returns a per-criterion verdict grounded in direct evidence. Its…

melodic-software/claude-code-plugins · 105 tokens

compare-labeler

Read-only labeler for /docs-hygiene:compress compare: labels every difference between two versions of a skill directory and returns rows plus a VERDICT line. Dispatched by /docs-hygiene:compress; not intended for direct ad-hoc use.

melodic-software/claude-code-plugins · 57 tokens

review-docs

Documentation reviewer for PR audits. Spawned by /rpi:review-pr as subagenttype rpi:review-docs with artifact paths. Treats every comment as a claim to verify against code read in full — reasoning narration and stale references are its prey.

hoblin/claude-ruby-marketplace · 57 tokens

review-performance

Performance reviewer for PR audits. Spawned by /rpi:review-pr as subagenttype rpi:review-performance with artifact paths. Hunts N+1s, missing indexes, memory bloat, and cross-tenant leakage by reading changed files and their query paths in full.

hoblin/claude-ruby-marketplace · 60 tokens

review-rails

Rails conventions and architecture reviewer for PR audits. Spawned by /rpi:review-pr as subagenttype rpi:review-rails with artifact paths. Ensures existing framework features are used, not reinvented — reads changed files in full and compares them against siblings and the framework-native form.

hoblin/claude-ruby-marketplace · 64 tokens

review-tests-minitest

Minitest test quality and coverage reviewer for PR audits. Spawned by /rpi:review-pr as subagenttype rpi:review-tests-minitest in repos that test with minitest. Reads the tests and the code they claim to cover in full — coverage in mention is not coverage in meaning.

hoblin/claude-ruby-marketplace · 67 tokens