refine
Simplify code + improve comments in uncommitted changes. Triggers: 'refine', 'clean up code', 'simplify changes'.
安装与使用
请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。
查看来源 ↗使用指南技能说明
Refine
Polish uncommitted changes: simplify code, improve comments.
Arguments
-
<file-pattern>— limit to matching files (glob or path)
Steps
1. Identify Files
- If
$ARGUMENTS: use as file pattern - Otherwise:
git diff --name-only+git diff --cached --name-only - Filter to code files (exclude config, lock, generated)
- No files → inform + exit
2. Read Files (parallel)
Read all identified files.
3. Analyze + Apply
For each file, find and fix:
Simplify code — apply standard simplification patterns (guard clauses, naming, single-responsibility, etc).
Improve comments:
- Remove code-restating comments ("increment counter", "loop through items", "return result")
- Remove contextless TODOs
- Keep: why-explanations, edge case warnings, business logic, perf constraints
- Update inaccurate/outdated comments (don't remove)
Doc comments (JSDoc, docstrings, GoDoc, RustDoc):
- Preserve by default — consumed by tools + IDEs
- Remove only if vacuous (empty, or restates signature with zero info)
- If inaccurate → update, don't remove
4. Verify
Check syntax after changes (linter/parser). Revert + note if verification fails.
5. Summary
Per file: simplifications applied, comments removed/improved.
Offer git diff to review.
Boundaries
Do NOT:
- Add features or change behavior
- Add error handling or abstractions
- Add comments to unchanged code
- Touch code outside the diff
- Refactor beyond uncommitted changes
使用示例
查看来源仓库中的使用示例与配置说明。
查看来源 ↗来源历史
- 收录时间
- 2026-03-11
- 索引更新时间
- 2026-03-11
- Branch
- main
收录与同步日期属于本站记录。源码修改历史请查看来源仓库。
GitHub ↗chat Comments (0)
Sign in to join the discussion and leave a comment.
No comments yet. Be the first to share your thoughts!