detect-code-smells

detect-code-smells is a cursor rule for Cursor from holasoymalva/AI-PR-Reviewer-Tasks. It costs 10 tokens per session (1,519 once invoked), scanned A, original, Apache-2.0.

A code-review rule set for finding code smells and anti-patterns in pull request changes. A pull request is a proposed set of code changes awaiting review; code smells are patterns that may make code harder to maintain.

In plain words
What is it for?
Use it to inspect changed files, focus the review on chosen risks or standards, and produce findings with specific improvement suggestions.
Why use it?
It helps reviewers spot maintainability, structure, performance, security, and other quality problems before changes are merged.

Cursor rule for Cursor

Written for Cursor: a Cursor rule (.mdc).

Good fit Use it to inspect changed files, focus the review on chosen risks…

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/holasoymalva/ai-pr-reviewer-tasks/detect-code-smells
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/holasoymalva/AI-PR-Reviewer-Tasks

Made for: Cursor.

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 detect-code-smells

README.md
[![agentmods](https://agentmods.dev/badge/rules/holasoymalva/ai-pr-reviewer-tasks/detect-code-smells.svg)](https://agentmods.dev/rules/holasoymalva/ai-pr-reviewer-tasks/detect-code-smells)
Your own site
<a href="https://agentmods.dev/rules/holasoymalva/ai-pr-reviewer-tasks/detect-code-smells"><img src="https://agentmods.dev/badge/rules/holasoymalva/ai-pr-reviewer-tasks/detect-code-smells.svg" alt="Measured on agentmods" height="20"></a>
Per session 10 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,519 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.00010 $0.01519
Opus 5 $0.00005 $0.00759
Sonnet 5 $0.00002 $0.00304
Haiku 4.5 $0.00001 $0.00152

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

Security

Grade A, and why

detect-code-smells 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 7d 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.

mdc/detect-code-smells.mdc · 281 lines

How it starts

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

Rule: Detect Code Smells and Anti-Patterns

Goal

To guide an AI assistant in systematically identifying code smells, anti-patterns, and quality issues in Pull Request changes, providing specific recommendations for improvement.

Process

  1. Receive Code Files: Analyze the provided files using @ tags from the previous PR analysis.

  2. Context Gathering: Understand the focus areas:

    • Priority Areas: "Should I focus on specific aspects? (performance, maintainability, security)"
    • Code Standards: "Are there specific coding standards or style guides to follow?"
    • Language/Framework: "Any language-specific or framework-specific patterns to check?"
    • Severity Filter: "What level of issues should I prioritize? (critical, major, minor)"
  3. Systematic Code Smell Detection: Analyze code across multiple quality dimensions.

  4. Generate Findings Report: Create detailed report with specific issues and improvement suggestions.

Code Smell Categories

🏗️ Structural Code Smells

Long Method/Function
  • Functions exceeding 20-30 lines
  • Complex nested logic
  • Multiple responsibilities in single function
  • Hard to understand or test
Large Class/Module
  • Classes with too many methods or properties
  • Modules handling multiple concerns
  • God objects or utility classes
Duplicate Code
  • Identical or very similar code blocks
  • Copy-paste programming patterns
  • Missing abstractions or utilities
Dead Code
  • Unused variables, functions, or imports
  • Unreachable code blocks
  • Commented-out code left in place

🔄 Object-Oriented Code Smells

Feature Envy
  • Methods using more features of other classes than their own
  • Inappropriate intimacy between objects
  • Poor encapsulation
Data Clumps
  • Same group of parameters appearing together frequently
  • Related data not grouped into objects
  • Primitive obsession
Inappropriate Intimacy
  • Classes knowing too much about each other's internals
  • Tight coupling between unrelated components
  • Breaking encapsulation principles

Read the full file on GitHub · 281 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. 7d ago First seen · 281 lines · 10 tokens per session scan A 2a0dc1c81ca7

Subscribe to this mod's changes

detect-code-smells is a cursor rule published in the GitHub repository holasoymalva/AI-PR-Reviewer-Tasks (14 stars, last pushed 1y ago), licensed Apache-2.0. It adds 10 tokens to every session and 1,519 once invoked, about $0.0001 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-30.