去冗余

diegosouzapw2026-10-28查看 1626复制 1702

在移除 AI 生成的冗余内容、清理冗长代码或移除不必要的防御性检查时使用。触发词为 "remove slop"、"clean up AI code"、"deslop"。

Download (.md)

📘如何使用这个技能

  1. 1
    复制技能内容·点击上方「Copy SKILL.md」复制全部内容,或 Download 下载到本地
  2. 2
    打开你的 AI 客户端·支持 Claude Code、Trae、Cursor、ChatGPT、DeepSeek、Kimi 等任意 AI 助手
  3. 3
    粘贴为系统提示/知识文件·Claude Code:放入 .claude/skills/ 目录;普通对话:作为首条消息发送并说「请严格按这份技能文档执行」
  4. 4
    直接提出你的需求·AI 会按技能定义的工作流、格式和约束来处理,无需再解释背景

💡 提示:技能生效后,每次对话只需一句需求,AI 会按 SKILL.md 的流程执行。

SKILL.md1617 chars
---
name: deslop
description: Use when removing AI-generated slop, cleaning up verbose code, or removing unnecessary defensive checks. Triggers on "remove slop", "clean up AI code", "deslop".
allowed-tools:
  - Bash
  - Read
  - Edit
  - Grep
---

# Remove AI Code Slop

Check the diff against main and remove all AI-generated slop introduced in this branch.

## Usage

```
/deslop
```

## What It Removes

- **Extra comments** that a human wouldn't add or are inconsistent with the rest of the file
- **Extra defensive checks** or try/catch blocks that are abnormal for that area of the codebase (especially if called by trusted/validated codepaths)
- **Casts to `any`** to get around type issues
- **Over-engineered patterns** that don't match the file's existing style
- **Unnecessary type annotations** on obvious types
- **Verbose error handling** where simpler patterns exist
- **Redundant null checks** in already-validated paths
- **Excessive logging** beyond what's normal for the codebase

## What It Preserves

- Actual bug fixes and intended functionality
- Comments that provide genuine value
- Defensive code at trust boundaries (user input, external APIs)
- Type annotations that improve clarity

## Process

1. Gets diff between current branch and main
2. Reviews each changed file for AI slop patterns
3. Removes slop while preserving intended changes
4. Reports a 1-3 sentence summary of what was changed

## Output

A brief summary like:
> "Removed 3 unnecessary try/catch blocks in `query.py`, deleted 5 redundant comments in `handler.ts`, and removed 2 `any` casts that were hiding type issues."
来源:skillsdirectory

评论0

登录后参与评论

还没有评论,来抢沙发吧