Token导航 LogoToken导航TokenDH.com
效率需要联网clawhub未标认证来源可访问clear审计通过

code-smell-analyzer代码气味分析器

Agent Skill

code-smell-analyzer 用于记录任务执行中的错误、用户纠正、经验和能力缺口,适合在 OpenClaw 中希望让 Agent 持续沉淀问题、修正和最佳实践时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

4,742

周安装

190

GitHub Stars

公开资料未说明

下载量

1,535
OpenClaw

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

MIT-0

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:code-smell-analyzer(代码气味分析器)
来源仓库:https://github.com/ksky521/code-smell-analyzer
安装命令:
openclaw skills install code-smell-analyzer
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 OpenClaw 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

ClawHubOpenClaw
openclaw skills install code-smell-analyzer

简介

分析代码气味和设计模式的改进工具,提升代码可维护性。

  • 适用于重构项目或优化遗留系统的技术债务治理。code-smell-analyzer 属于效率类 Skill,可作为该场景下的辅助能力补充。
  • 自动识别坏味道并提供重构建议和模式替换方案。
  • 结果仅供参考,需结合业务逻辑判断修改必要性。
  • 建议与开发规范文档联动使用形成完整标准体系。

SKILL.md

name
code-smell-analyzer
description
Analyzes code for improvements including code smells, design patterns, and best practices. Invoke when user asks for code analysis, code review, or suggestions to improve code quality.
version
1.0.0

Code Smell Analyzer

Analyzes code files for potential improvements including code smells, design patterns, and best practices. Provides suggestions for enhancing readability, maintainability, and performance while preserving functionality.

When to Use

Invoke this skill when:

  • User asks for code analysis or code review
  • User wants suggestions to improve code quality
  • User mentions "code smells", "refactoring", or "best practices"
  • User wants to optimize code structure without changing functionality

Analysis Framework

1. Code Smells

Identify any code smells such as:

  • Long Methods: Methods exceeding 20-30 lines should be broken down
  • Large Classes: Classes with too many responsibilities
  • Duplicate Code: Repeated code blocks that should be extracted
  • Complex Conditionals: Deeply nested if/else statements
  • Magic Numbers: Hard-coded values without explanation
  • Dead Code: Unused variables, methods, or imports
  • Long Parameter Lists: Methods with more than 3-4 parameters
  • Feature Envy: Methods that use another class more than their own

2. Design Patterns

Suggest appropriate design patterns that could improve the code structure:

  • Creational: Factory, Builder, Singleton, Prototype
  • Structural: Adapter, Decorator, Facade, Composite
  • Behavioral: Strategy, Observer, Command, State, Template Method

3. Best Practices

Check adherence to language-specific best practices:

  • Naming Conventions: Clear, descriptive names for variables, functions, classes
  • DRY Principle: Don't Repeat Yourself
  • SOLID Principles: Single Responsibility, Open/Closed, Liskov Substitution, Interface Segregation, Dependency Inversion
  • Error Handling: Proper exception handling and error messages
  • Documentation: Adequate comments and documentation
  • Testing: Testability of the code

4. Readability

Evaluate code clarity:

  • Naming: Are names self-documenting?
  • Structure: Is the code well-organized?
  • Comments: Are complex sections explained?
  • Formatting: Is indentation and spacing consistent?
  • Abstraction Level: Is the code at the right level of abstraction?

5. Maintainability

Assess how easy the code would be to modify and extend:

  • Coupling: Are components loosely coupled?
  • Cohesion: Are related functionalities grouped together?
  • Modularity: Can parts be changed independently?
  • Configuration: Are hard-coded values externalized?
  • Logging: Is there adequate logging for debugging?

6. Performance

Identify potential performance optimizations:

  • Algorithm Complexity: O(n) vs O(n^2) considerations
  • Memory Usage: Unnecessary object creation, memory leaks
  • I/O Operations: Database queries, file operations, network calls
  • Caching: Opportunities for caching repeated computations
  • Lazy Loading: Defer expensive operations until needed

Output Format

For each suggestion, provide:

Issue Description

Clear explanation of the issue or improvement opportunity.

Current Code

// Show the problematic code

Suggested Improvement

// Show the improved code

Rationale

Explain why the change would be beneficial.

Priority

  • High: Critical issues affecting functionality, security, or major performance
  • Medium: Important improvements for maintainability and readability
  • Low: Minor enhancements or nice-to-have improvements

Example Analysis

Issue: Long Method with Multiple Responsibilities

Priority: High

Current Code:

function processOrder(order) {
    // Validate order
    if (!order.items || order.items.length === 0) {
        throw new Error('Order has no items');
    }
    if (!order.customer) {
        throw new Error('Customer is required');
    }

    // Calculate totals
    let subtotal = 0;
    for (const item of order.items) {
        subtotal += item.price * item.quantity;
    }
    const tax = subtotal * 0.1;
    const total = subtotal + tax;

    // Apply discount
    if (order.discountCode) {
        total = total * 0.9;
    }

    // Save to database
    db.orders.insert({
        ...order,
        subtotal,
        tax,
        total,
        createdAt: new Date(),
    });

    // Send confirmation email
    emailService.send(order.customer.email, 'Order Confirmed', total);

    return {orderId: order.id, total};
}

Suggested Improvement:

function processOrder(order) {
    validateOrder(order);
    const pricing = calculatePricing(order);
    saveOrder(order, pricing);
    sendConfirmation(order, pricing.total);
    return {orderId: order.id, total: pricing.total};
}

function validateOrder(order) {
    if (!order.items?.length) throw new Error('Order has no items');
    if (!order.customer) throw new Error('Customer is required');
}

function calculatePricing(order) {
    const subtotal = order.items.reduce((sum, item) => sum + item.price * item.quantity, 0);
    const tax = subtotal * 0.1;
    let total = subtotal + tax;

    if (order.discountCode) {
        total *= 0.9;
    }

    return {subtotal, tax, total};
}

function saveOrder(order, pricing) {
    db.orders.insert({
        ...order,
        ...pricing,
        createdAt: new Date(),
    });
}

function sendConfirmation(order, total) {
    emailService.send(order.customer.email, 'Order Confirmed', total);
}

Rationale:

  • Single Responsibility: Each function has one clear purpose
  • Testability: Each function can be tested independently
  • Readability: Main function reads like a high-level overview
  • Maintainability: Changes to pricing logic don't affect validation

Language-Specific Considerations

JavaScript/TypeScript

  • Use const/let instead of var
  • Prefer arrow functions for callbacks
  • Use optional chaining (?.) and nullish coalescing (??)
  • Avoid any type in TypeScript

Python

  • Follow PEP 8 style guide
  • Use list comprehensions appropriately
  • Leverage context managers (with statements)
  • Type hints for better documentation

Java

  • Use streams for collection operations
  • Prefer composition over inheritance
  • Use Optional instead of null
  • Follow Java naming conventions

WeChat Mini Program

  • Use Service layer for all HTTP requests
  • Avoid storing redundant data in Page data
  • Use wx:key for list rendering
  • Follow the project's AGENTS.md guidelines

Notes

  • Always preserve existing functionality
  • Consider the project's existing conventions
  • Prioritize changes by impact and effort
  • Provide actionable, specific suggestions
  • Consider backward compatibility

适合场景

01

OpenClaw 用户查找和安装 Skill 时

02

用户想查找某类 Agent Skill 时

03

需要根据任务场景推荐可安装能力包时

04

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

OpenClaw

90.27%
按下载量换算1,386

安全审计

VirusTotal

通过

ClawScan

通过

Static analysis

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills