首页/ AI 技能 / @skilllib/skill-2014279418494005250
Skill站外收录 @skilllib/skill-2014279418494005250

simplify

在测试通过后对代码进行重构与优化,提升可读性和维护性,消除冗余并遵循项目规范,在不改变外部行为的前提下使代码更简洁清晰,适用于开发流程中的最后打磨阶段。

0.0 (0) 150 次安装 原作者 编程导航
收录于 2026-01-22
效率工具 AI 技能

Skills.MD

# /simplify Refactor and clean up code after tests pass. ## Usage ``` /simplify /simplify src/openenv/core/client.py ``` ## When to Use - After `/implement` makes tests pass - When code is correct but could be cleaner - Before creating a PR (optional polish step) ## When NOT to Use - Tests are failing (fix tests first) - You want to add new functionality (use `/write-tests` first) - Code is already clean and simple ## What It Does 1. Runs tests to ensure they pass (baseline) 2. Identifies opportunities for simplification 3. Refactors while keeping tests green 4. Runs tests after each change to verify nothing broke ## Philosophy This is TDD's third phase: Red → Green → **Refactor**. The goal is NOT to add features or change behavior. The goal is to make the code: - Easier to read - Easier to maintain - More consistent with project patterns - Less duplicated ## Guidelines ### Good Simplifications - Extract helper functions to reduce duplication - Rename variables for clarity - Remove dead code - Simplify complex conditionals - Use more Pythonic idioms ### NOT Simplifications (Avoid) - Adding new features - Changing public APIs - "Improving" code that works and is readable - Adding abstractions for hypothetical future needs ## Completion Criteria 1. All tests still pass 2. Code is cleaner/simpler than before 3. No new functionality was added 4. Changes follow project patterns (see PATTERNS.md) ## Integration with TDD Workflow ``` /write-tests → create failing tests (Red) ↓ /implement → make tests pass (Green) ↓ /simplify → clean up code (Refactor) ↓ /pre-submit-pr → validate before PR ```

评论 0

还没有评论,来抢沙发。