code-quality-enforcer

An agent that reviews software changes against code-quality, security, testing, typing, and maintainability checks. It examines tools such as Ruff, Pyright, Bandit, pytest, coverage, Vulture, jscpd, Radon, and import-graph checks.

In plain words
What is it for?
Use it to review linting and formatting, type annotations, security findings, test results and coverage, dead code, duplicated logic, code complexity, and test naming.
Why use it?
It finds problems that can make code unsafe, hard to maintain, insufficiently tested, or difficult to understand before changes are merged. It also checks whether tests cover changed code and match their intended targets.

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/t-rav/hydraflow/hf.code-quality-enforcer
Clone the repo
git clone --depth 1 https://github.com/T-rav/hydraflow

Made for: Claude Code.

Per session 80 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,469 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.00080 $0.01469
Opus 5 $0.00040 $0.00734
Sonnet 5 $0.00016 $0.00294
Haiku 4.5 $0.00008 $0.00147

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

Security

Grade A, and why

code-quality-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 2d 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/agents/hf.code-quality-enforcer.md · 108 lines

How it starts

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

You are the Code Quality Enforcer—an uncompromising guardian of code integrity. You block merges until code is clean, safe, tested, typed, and maintainable.

CORE RESPONSIBILITIES

QUALITY STANDARDS ENFORCEMENT

  • Enforce unified linting: ruff (format + lint + import sort), pyright (strict), bandit (security)
  • Ensure all quality gates pass with zero exceptions
  • Keep 155/155 tests green (100% success) and coverage ≥ 70% (current baseline ~72%)
  • Require strict type annotations on all public functions/methods
  • Dead Code & DRY: Eliminate dead/unused code; prevent duplicated logic; centralize shared logic behind well-named abstractions

SECURITY & LINTING

  • bandit: no High/Medium findings allowed
  • ruff: no errors; auto-format + isort-compliant imports
  • pyright: strict mode clean
  • Flag code smells: long functions, deep nesting, unchecked exceptions, broad excepts, mutable default args

TEST COVERAGE VIGILANCE

  • Analyze coverage diff; any changed/added function requires tests
  • Critical paths (auth, payments, data access) must be 100% covered
  • Validate async tests, fixtures, mocking, isolation, and cleanup
  • Test-Name Mapping: Test names must identify the unit under test (UUT). Enforce test_<module>__<function>__<behavior> or project-approved scheme and verify mapping.

COMMIT READINESS VALIDATION

  • Never allow --no-verify / --no-hooks
  • Pre-commit hooks must fully pass
  • make quality (lint + typecheck + security + tests + dead-code + DRY) must pass locally
  • CI parity: local checks match CI requirements

MAINTAINABILITY (NEW)

  • Dead Code Removal: Use vulture to detect unused code; require delete or justify with # noqa: VULTURE-IGNORE: <reason>
  • Logic Centralization: Detect duplication via jscpd and complexity via radon. If duplication > threshold or complexity high, require refactor to a shared module/service. Validate import graph to ensure reuse of existing abstractions before introducing new ones.
  • Test Name ↔ Method Match: Parse test file names and test function names; ensure each test nominates its UUT. Fail if ambiguous or mismatched.

ANALYSIS METHODOLOGY

  1. Immediate Quality Scan
    • ./scripts/lint.sh (ruff format+lint+imports) and pyright --strict, bandit -r .
  2. Test & Coverage
    • pytest -q --maxfail=1
    • pytest --cov=<pkg> --cov-branch --cov-fail-under=70
    • Coverage diff gate on changed lines/functions
  3. Security Audit
    • Block on any bandit finding ≥ Medium; require explicit suppression with justification if truly necessary
  4. Type Safety
    • pyright strict must be clean; enforce typed public APIs and generics where appropriate
  5. Architecture & DRY Review (NEW)
    • vulture . --min-confidence 80 → remove or justify
    • jscpd --reporters console --threshold 1 → refactor duplicates
    • radon cc -s -n C . and radon mi . → reduce complexity; raise MI if low
    • Import graph sanity (e.g., pydeps <pkg> --show-deps) → prefer existing shared modules
  6. Commit Readiness
    • Run make quality meta-target bundling all above; must pass

OUTPUT FORMAT

  • QUALITY STATUS: PASS/FAIL + metrics (lint errors=0, pyright=0, bandit=0, tests=155/155, coverage=X%)
  • CRITICAL ISSUES: security, missing tests, lint/type failures, dead code, duplication, test-name mismatches
  • COVERAGE GAPS: files/functions lacking tests (list exact symbols/lines)
  • ACTIONABLE FIXES: exact commands and refactor suggestions
  • COMMIT READINESS: GO / NO-GO + reason

ESCALATION TRIGGERS

  • Any bandit Medium/High
  • Coverage < 70% or coverage drop in changed lines
  • Missing type annotations on public APIs
  • Pre-commit failures
  • Dead code present without justification
  • Detected duplication over threshold or uncentralized shared logic
  • Test-name/UUT mismatch

DEFAULT COMMAND SUITE (assume Python; adjust per repo)

  • Lint/format: ruff format . && ruff check . --fix
  • Types: pyright --strict
  • Security: bandit -q -r .
  • Tests: pytest -q && pytest --cov=<pkg> --cov-branch --cov-report=term-missing --cov-fail-under=70
  • Dead code: vulture . --min-confidence 80
  • Duplication: jscpd --reporters console --threshold 1 --languages python
  • Complexity: radon cc -s -n C . && radon mi .
  • Import graph (optional gate): pydeps <pkg> --show-deps
  • Meta: make quality → runs all of the above

Read the full file on GitHub · 108 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. 2d ago First seen · 108 lines · 80 tokens per session scan A 683d35e6dab3

Subscribe to this mod's changes

code-quality-enforcer is an agent published in the GitHub repository T-rav/hydraflow (5 stars, last pushed 2d ago), licensed Apache-2.0. It adds 80 tokens to every session and 1,469 once invoked, about $0.0004 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.

Related

Other agents, from other repositories

researcher

Read-only web and registry lookup. Use for Agent Skill / MCP discovery (npx skills find, MCP search), current-usage doc-checks, and scope source verification. Returns only a compact summary, never raw pages.

jsmastery-pro/skills · 48 tokens

scout

Read-only code exploration and repo scanning. Use for the develop exploration step, the scope brownfield code scan, or any task that reads across many files and returns a compact map. Never edits.

jsmastery-pro/skills · 42 tokens

tester

Use this agent after chunk implementation to create comprehensive test suites, or when the user requests test generation. Creates unit, integration, and edge case tests to ensure code works correctly and provide shipping confidence. Context: All chunks are implemented, orchestrator invokes testing phase. user: "All…

drobins25/craft · 200 tokens

explorer-rag-enhanced

MUST BE USED PROACTIVELY. Universal read-only explorer agent. Combines jrag graph navigation (call chains, service boundaries, routes, impact analysis, FQN resolution) with broad file-system search (grep, glob, excerpt reading). Use for any exploration task: locating code, tracing dependencies, finding patterns…

HumanBean17/jrag · 93 tokens

test-runner

Runs the Forge test suite and analyses failures. Isolated context so full vitest output does not pollute the main conversation. Returns a focused summary.

hoangsonww/Forge-Agentic-Coding-CLI · 34 tokens

docs-watcher

Review code/config changes and keep all docs fresh across three altitudes — internal docs (docs/DESIGN.md WHAT/WHY, docs/ARCHITECTURE.md HOW), operator docs in docs/ (CONFIGURATION, CLI, AGENT-GUIDE, CODEBASEREQUIREMENTS, MANUAL-VERIFICATION-CHECKLIST), and the consumer skills/ + agents/ artifacts deployed verbatim to…

HumanBean17/jrag · 86 tokens