refactor-comments-that-are-code-smells
仓库创建 2026年7月4日最近提交 22 天前SkillHot 收录 22 天前
▸ 精选理由
把“解释性注释”转成可复用、可测试的代码块提升可维护性。
这个 Skill 做什么
检测解释性注释并重构为动作或提取为方法。
扫描代码里那些“在注释里解释做了什么”的坏味注释,并把它们重构成可执行的动作或抽成方法,提升单一职责和可读性。写完或改完代码后跑一遍能自动把解释性注释放到实现里或提炼成函数。特点是遵循 action-pattern,把注释驱动的说明变成具体的代码单元,减少冗余注释。
▸ 展开 SKILL.md 英文原文
Scans code for comments that explain what code does and refactors them using the action pattern or extracting to methods. Use after writing or editing any code.
0
Stars
0
Forks
23
仓库内 Skill
+0
7 日增星
安装 / 使用
给你的 Agent 一句话(通用)
帮我安装这个 skill:https://raw.githubusercontent.com/ceilidhboy/skills/master/skills/refactor-comments-that-are-code-smells/SKILL.md或 curl 直取 SKILL.md
curl -fsSL "https://raw.githubusercontent.com/ceilidhboy/skills/master/skills/refactor-comments-that-are-code-smells/SKILL.md"SKILL.MD 节选查看完整文件 ↗
# Refactor Comments That Are Code Smells
## Detection
A comment is a code smell when it:
- Explains what the next code block does (`// Get authenticator...`)
- Is a numbered list (`// 1. Do this, // 2. Do that`)
- Explains complex logic that should be extracted
## Refactoring
### Primary: Split into Actions
Follow the action-pattern skill. Split methods into single-responsibility actions:
```php
// Before: one method with code-smell comments
public function execute(Client $client): array // Returns Contact
{
// 1. Search for existing contact
$connector = ...;
$response = $connector->send(new GetContactsRequest(...));
if ($contacts) return $contacts[0];
// 2. Creatvia SKILL·HOT · 数据来自 GitHub 公开信息 · 原文版权归作者所有