Code Review: 22 Code Smells

    1

    A standardized code review skill that diagnoses technical debt using Martin Fowler's 22 code smells.

    Free

    Security scanned

    Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIDeepSeekDeepSeekMuseMuse+22 more

    Code Review: 22 Code Smells

    Example session with this skill installed

    Review this OrderService.process method. It handles database saving, email notifications, and has a 10-case switch statement for shipping logic.

    • Read your context and instructions
    • Compiled the code review

    I have completed the structural diagnosis of OrderService.process. The method exhibits high divergent change and conditional complexity.

    🔍 代码审查报告

    一、 总体评价

    代码实现了基础业务功能,但存在局部圈复杂度过高、职责未分离的坏味道,建议按以下方案分步重构。

    二、 发现的坏味道与缺陷
    1. 【Major】3.5 Divergent Change (发散式变化)

      • 位置: OrderService.java 第 12-45 行
      • 问题: OrderService 既负责持久化逻辑,又处理邮件通知细节。当数据库架构或邮件模板改变时,该类都需要修改,违反了单一职责原则 (SRP)。
      • 推荐手法: 采用 Extract Class (7.3) 提炼出独立的 NotificationService 和 OrderRepository。
    2. 【Major】3.10 Switch Statements (条件分支惊悚现身)

      • 位置: calculateShipping() 内部
      • 问题: 使用 10 路 switch 语句根据运输类型计算费用。每当增加新的快递商时,必须修改此逻辑,容易引发回归错误。
      • 推荐手法: 采用 Replace Conditional with Polymorphism (9.6),将各运输逻辑抽象为策略子类。
    3. 【Minor】3.4 Long Parameter List (过长参数列)

      • 位置: saveOrder(id, name, addr, zip, city, country, phone, email)
      • 推荐手法: 采用 Introduce Parameter Object (10.9) 引入 ShippingAddress 和 CustomerContact 对象。

    Next steps

    1. Extract the database logic into a dedicated repository class.
    2. Apply the Strategy pattern to the shipping calculation switch statement.
    3. Group the address-related parameters into a single Data Transfer Object (DTO).

    Connects securely to your tools. The creator never sees your data.

    About this skill

    Manual code reviews often miss deep structural flaws, focusing instead on surface-level syntax. This skill implements a systematic diagnosis workflow based on Martin Fowler's 22 code smells to identify technical debt before it merges.

    What it does

    • Code Smell Detection scans source code for the 22 specific "bad smells" defined in the Refactoring standard, including God Objects and Shotgun Surgery.
    • Architectural Auditing evaluates adherence to Single Responsibility Principle (SRP), dependency health, and coupling issues like Feature Envy.
    • Testability Assessment identifies hidden side effects and global states that make unit testing difficult or impossible.
    • Structured Reporting generates categorized findings labeled by severity (Blocker, Major, Minor) with precise file and line references.
    • Refactoring Strategy maps every identified flaw to a specific remediation pattern, such as Extract Class or Replace Conditional with Polymorphism.

    How it works

    1. Input Phase accepts source code snippets or entire modules for quality evaluation.
    2. Diagnosis Phase executes a three-stage workflow covering code smells, design compliance, and severity grading.
    3. Synthesis Phase compiles findings into a standardized report template.
    4. Remediation Phase provides exact chapter-and-verse refactoring techniques for each detected issue.

    Frameworks & tools

    This skill is language-agnostic but optimized for object-oriented patterns in Java, C#, TypeScript, and Python. It follows the industry-standard methodologies established in Martin Fowler's "Refactoring: Improving the Design of Existing Code."

    Why this beats prompting it yourself

    Generic prompts often yield vague advice like "make this cleaner." This skill uses a formal checklist and a specific taxonomy of 22 smells, ensuring you get actionable, textbook-accurate refactoring patterns rather than subjective opinions.

    Use cases

    • Pre-Merge Audits to catch Divergent Change or Feature Envy before code hits the main branch.
    • Legacy Debt Diagnosis to identify the best entry points for refactoring a large, messy class.
    • Junior Mentorship by providing objective, standard-based feedback on pull requests.
    • Complexity Analysis for flattening nested Switch Statements and Long Parameter Lists.

    Known limitations

    Does not perform runtime performance profiling or security vulnerability scanning. Focuses strictly on maintainability and structural design.

    Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Code Quality & Review.

    Does not perform runtime performance profiling or security vulnerability scanning. Focuses strictly on maintainability and structural design.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before buying a skill.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Free to use

    No account required to browse

    Trust & safety

    Security scan

    Security scan passed 13 days ago

    • Free with an Agensi account

    Permissions

    Read Files
    Listed13 days ago

    What's inside

    Frequently Asked Questions

    This skill provides a rigorous audit based on Martin Fowler's 22 code smells, offering textbook-accurate refactoring patterns and architectural diagnostics rather than the surface-level syntax suggestions typical of generic AI prompts.

    The skill is language-agnostic but is specifically optimized for Object-Oriented Programming (OOP) patterns in Java, C#, Python, and TypeScript, where structural issues like 'God Objects' are most prevalent.

    No, this skill focuses exclusively on maintainability and structural design; it is not designed to detect runtime security vulnerabilities or perform penetration testing.

    You receive the standardized code review workflow, the diagnostic engine for the 22 code smells, and a library of specific remediation strategies mapped to every identified issue.

    Simply provide the skill with your source code snippets or module files; it will automatically trigger the diagnosis phase and output a structured report with severity ratings and refactoring steps.

    New in Code Quality & Review

    Free