Token导航 LogoToken导航TokenDH.com
研究检索需要联网github未标认证来源可访问clear审计通过

ai-code-cleanupai 代码清理

Agent Skill

ai-code-cleanup 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

1,259

周安装

53

GitHub Stars

4

下载量

441
CodexClaudeCursorGemini CLI

安装说明

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

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

请帮我安装这个 Agent Skill:ai-code-cleanup(ai 代码清理)
来源仓库:https://github.com/89jobrien/steve
仓库路径:skills/ai-code-cleanup
安装命令:
npx skills add https://github.com/89jobrien/steve --skill ai-code-cleanup
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/89jobrien/steve --skill ai-code-cleanup

简介

用于查找、检索和筛选相关信息。

  • 适合在 Codex、Claude、Cursor、Gemini CLI 中根据关键词、任务场景或来源线索快速定位候选结果。
  • 可结合来源仓库、安装命令和原始 README 继续核验具体用法。
  • 安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。
  • ai-code-cleanup 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

AI Code Cleanup

This skill identifies and removes AI-generated artifacts that degrade code quality, including defensive bloat, unnecessary comments, type casts, and style inconsistencies.

When to Use This Skill

  • After AI-assisted coding sessions
  • Before code reviews or merging branches
  • When cleaning up code that feels "over-engineered"
  • When removing unnecessary defensive code
  • When standardizing code style after AI generation
  • When preparing code for production

What This Skill Does

  1. Identifies AI Artifacts: Detects patterns typical of AI-generated code
  2. Removes Bloat: Eliminates unnecessary defensive code and comments
  3. Fixes Type Issues: Removes unnecessary type casts and workarounds
  4. Standardizes Style: Ensures consistency with project conventions
  5. Preserves Functionality: Maintains code behavior while improving quality
  6. Validates Changes: Ensures code still compiles and tests pass

How to Use

Clean Up Branch

Remove AI slop from this branch
Clean up the code in this pull request

Specific Cleanup

Remove unnecessary comments and defensive code from src/

Slop Patterns to Remove

1. Unnecessary Comments

Patterns:

  • Comments explaining obvious code
  • Comments inconsistent with file's documentation style
  • Redundant comments that restate the code
  • Over-documentation of simple operations

Example:

// ❌ AI-generated: Obvious comment
// Set the user's name
user.name = name;

// ✅ Clean: Self-documenting code
user.name = name;

2. Defensive Bloat

Patterns:

  • Extra try/catch blocks abnormal for that codebase
  • Defensive null/undefined checks on trusted paths
  • Redundant input validation when callers already validate
  • Error handling that can never trigger

Example:

// ❌ AI-generated: Unnecessary defensive code
function processUser(user) {
  try {
    if (user && user.name && typeof user.name === 'string') {
      return user.name.toUpperCase();
    }
    return null;
  } catch (error) {
    console.error(error);
    return null;
  }
}

// ✅ Clean: Trust the input, handle real errors
function processUser(user) {
  return user.name.toUpperCase();
}

3. Type Workarounds

Patterns:

  • Casts to any to bypass type issues
  • Unnecessary type assertions (as X)
  • @ts-ignore or @ts-expect-error without legitimate reason
  • Overly complex generic constraints

Example:

// ❌ AI-generated: Type workaround
const data = response.data as any;
const result = processData(data as ProcessedData);

// ✅ Clean: Proper typing
const data = response.data;
const result = processData(data);

4. Style Inconsistencies

Patterns:

  • Naming conventions different from rest of file
  • Formatting that doesn't match surrounding code
  • Import organization inconsistent with file patterns
  • Variable declarations inconsistent with file style

Example:

// ❌ AI-generated: Inconsistent style
const UserData = fetchUser();
var processedData = process(UserData);
let FinalResult = format(processedData);

// ✅ Clean: Consistent style
const userData = fetchUser();
const processedData = process(userData);
const finalResult = format(processedData);

5. AI Tells

Patterns:

  • Unnecessary emoji usage in code or comments
  • Overly verbose variable names
  • Redundant intermediate variables
  • "Just in case" code with no actual use case

Cleanup Process

1. Get the Diff

git diff $(git merge-base HEAD main)..HEAD --name-only

2. Analyze Each File

For each changed file:

  • Read the full file to understand existing style
  • Identify patterns from slop categories
  • Make surgical edits to remove slop
  • Preserve functionality

3. Verification

  • Ensure code still compiles/runs
  • Changes should reduce code, not add more
  • Run tests to verify behavior
  • Check for any regressions

Examples

Example 1: Comment Cleanup

Input: Remove unnecessary comments from src/auth.js

Output:

## AI Code Cleanup: src/auth.js

### Removed
- 12 redundant comments explaining obvious code
- 3 comments inconsistent with file style
- 5 over-documented simple operations

### Changes

// Before // Function to validate user email // Takes email string as input // Returns boolean indicating validity function validateEmail(email) { // Check if email is not empty if (!email) { return false; // Return false if empty } // Return regex test result return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email); }

// After function validateEmail(email) { if (!email) return false; return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email); }


### Result

- Lines reduced: 12 → 4
- Functionality preserved
- Tests pass

Example 2: Defensive Bloat Removal

Input: Remove defensive bloat from src/api/users.js

Output:

## AI Code Cleanup: src/api/users.js

### Removed
- 3 unnecessary try/catch blocks
- 8 redundant null checks on validated inputs
- 2 error handlers that can never trigger

### Changes

// Before async function getUser(userId) { try { if (!userId || typeof userId !== 'string') { throw new Error('Invalid userId'); } const user = await db.users.findById(userId); if (user && user.id) { return user; } return null; } catch (error) { console.error(error); throw error; } }

// After async function getUser(userId) { const user = await db.users.findById(userId); return user || null; }


### Result

- Code reduced: 15 lines → 3 lines
- Functionality preserved
- Error handling appropriate for context

Reference Files

  • references/REFACTORING_PLAN.template.md - Refactoring plan template with code smells, before/after metrics, and rollback strategy

Best Practices

Cleanup Guidelines

  1. Preserve Functionality: Only remove code that doesn't affect behavior
  2. Maintain Style: Follow existing project conventions
  3. Keep Real Errors: Don't remove legitimate error handling
  4. Test After Changes: Always verify code still works
  5. Incremental: Make changes incrementally, test as you go

What to Keep

  • Legitimate error handling
  • Necessary type assertions
  • Helpful comments that add context
  • Defensive code for untrusted inputs
  • Style that matches the codebase

What to Remove

  • Obvious comments
  • Unnecessary defensive code
  • Type workarounds
  • Style inconsistencies
  • AI-generated artifacts

Related Use Cases

  • Post-AI coding cleanup
  • Code review preparation
  • Code quality improvement
  • Style standardization
  • Removing technical debt

适合场景

01

用户想查找某类 Agent Skill 时

02

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

03

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

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

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

能力 4

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

能力 5

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

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

平台分布

Claude Code

26.33%
按下载量换算116

OpenCode

21.75%
按下载量换算96

Codex

19.91%
按下载量换算88

Antigravity

13.05%
按下载量换算58

Cursor

8.06%
按下载量换算36

Gemini CLI

3.27%
按下载量换算14

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

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

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。

来源信息

继续浏览同类 Skills