polishing

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Polishing

代码打磨

A comprehensive workflow for finalizing code changes before creating a PR. This skill ensures code quality, consistency with codebase patterns, and removes common AI-generated artifacts.
这是一套在创建PR前完成代码变更收尾工作的全面流程。该Skill确保代码质量、与代码库模式的一致性,并移除常见的AI生成冗余内容。

Workflow

工作流程

Step 1: Recover Branch Context

步骤1:恢复分支上下文

Use the Skill tool to invoke
recover-branch-context
to understand what the branch is trying to accomplish.
This provides essential context about:
  • The purpose and goals of the current branch
  • What changes have been made
  • The intended functionality being implemented
使用Skill工具调用
recover-branch-context
来理解当前分支的目标。
这将提供以下关键上下文信息:
  • 当前分支的目的与目标
  • 已完成的变更内容
  • 拟实现的预期功能

Step 2: Check Against Applicable Guidelines

步骤2:对照适用规范检查

Scan the
.agents/skills/
directory for skills that might have guidelines relevant to the changed files.
Match skills to the technologies used in the changed files. For example, if React components were changed, look for a React patterns skill; if an ORM was used, look for a relevant ORM skill.
For each applicable skill:
  1. Spawn a subagent to review the changed files against those skill's guidelines
  2. Report any deviations from the established patterns
  3. Fix deviations where appropriate, or note them for discussion
扫描
.agents/skills/
目录,查找可能与变更文件相关的规范Skill。
根据变更文件所使用的技术匹配对应的Skill。例如,若修改了React组件,则查找React模式相关Skill;若使用了ORM,则查找对应的ORM Skill。
针对每个适用的Skill:
  1. 启动子Agent(subagent)对照该Skill的规范评审变更文件
  2. 报告任何偏离既定模式的内容
  3. 酌情修正偏离内容,或记录下来供后续讨论

Step 3: Remove AI Slop

步骤3:移除AI生成冗余内容(AI slop)

Check the diff against the default branch, and remove all AI generated slop introduced in this branch.
This includes:
  • Extra comments that a human wouldn't add or is 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
  • Any other style that is inconsistent with the file
对比当前分支与默认分支的差异,移除本分支中引入的所有AI生成冗余内容。
这类内容包括:
  • 人类不会添加的、或与文件其余部分风格不一致的额外注释
  • 代码库该区域中不符合常规的额外防御性检查或try/catch块(尤其是在被可信/已验证代码路径调用的情况下)
  • 为绕过类型问题而使用的
    any
    类型转换
  • 任何与文件风格不一致的其他写法

Step 4: Final Review

步骤4:最终评审

Do a final review of the changes — read through the diff and flag anything that looks off.
对变更内容进行最终评审——通读差异内容,标记任何异常之处。

Step 5: Report

步骤5:生成报告

Provide a summary of:
  • Branch context recovered: What the branch is trying to accomplish
  • Guidelines checked and any deviations found: Which skills were applicable and what patterns were verified or corrected
  • Slop removed: What AI artifacts were cleaned up
  • Review results: Any issues surfaced by the final review
提供以下内容的总结:
  • 已恢复的分支上下文:当前分支的目标
  • 已检查的规范及发现的偏离:适用的Skill有哪些,验证或修正了哪些模式
  • 已移除的冗余内容:清理了哪些AI生成的冗余内容
  • 评审结果:最终评审中发现的任何问题