Agent Skillskdlbs/kandev › simplify

simplify

GitHub

用于在代码变更后进行简化重构,通过内联单用抽象、移除推测性代码、减少嵌套及消除噪音来提升代码可读性。仅在显式请求或PR审查时执行,确保行为不变。

.agents/skills/simplify/SKILL.md kdlbs/kandev

Trigger Scenarios

用户显式请求简化代码 PR审查中需要修复代码复杂度问题

Install

npx skills add kdlbs/kandev --skill simplify -g -y
More Options

Non-standard path

npx skills add https://github.com/kdlbs/kandev/tree/main/.agents/skills/simplify -g -y

Use without installing

npx skills use kdlbs/kandev@simplify

指定 Agent (Claude Code)

npx skills add kdlbs/kandev --skill simplify -a claude-code -g -y

安装 repo 全部 skill

npx skills add kdlbs/kandev --all -g -y

预览 repo 内 skill

npx skills add kdlbs/kandev --list

SKILL.md

Frontmatter
{
    "name": "simplify",
    "description": "Simplify recently changed code — inline one-off abstractions, remove speculative code, reduce nesting, replace cleverness with clarity. Use only on explicit request or PR-review remediation."
}

Simplify

Post-implementation simplification pass. Review recently changed code and actively simplify it while preserving all behavior.

Planner Entry

Run /simplify only on explicit request or when an actionable PR finding calls for it. It is not a default post-implementation or pre-PR pass.

The best code is code you don't have to write. The second best is code anyone can read.

Steps

1. Identify what to simplify

Run git diff --name-only (or git diff origin/<base>...HEAD --name-only for a branch) to get the changed files. Read each one.

2. Apply simplifications

Work through each changed file. Preserve behavior by inspection; defer broad test suites, lint, typecheck, and full verification until after this pass. Report any verification concerns and the focused task check to run next.

Inline one-off abstractions:

  • Helper functions with a single call site — inline them
  • Wrapper types that add no behavior — remove the wrapper
  • Interfaces with a single implementation and no test mock — remove the interface

Remove speculative code:

  • Unused function parameters or return values
  • Config options that are parsed but never read
  • "Reserved for future" scaffolding, empty extension points
  • Feature flags with no toggle mechanism

Reduce nesting:

  • Replace nested if/else with early returns (guard clauses)
  • Replace nested ternaries with if/else or switch
  • Extract deeply nested blocks into named functions

Replace cleverness with clarity:

  • Dense one-liners that hide intent — expand to readable multi-line
  • Overly generic code where a concrete implementation is simpler
  • Abstractions that add indirection without reducing duplication

Remove noise:

  • Comments that restate code (// increment counter above counter++)
  • Redundant type annotations where inference works
  • Empty error handlers, unused catch variables
  • Leftover debug logging

3. Validate

After the simplification pass, run the focused task check affected by the change. If anything breaks, the simplification changed behavior and must be corrected before continuing. Broad suites remain deferred unless the task or user explicitly requires them.

4. Summary

Report what was simplified:

  • Files modified
  • What was removed/inlined/simplified
  • Lines removed (net)
  • Verification concerns or recommended focused checks

Version History

  • 1578843 Current 2026-08-16 08:48

    移除了对verify worker的依赖描述,改为独立执行验证检查;明确了不运行完整测试套件,仅关注受影响的焦点任务检查。

  • b4239d8 2026-07-24 17:33

Same Skill Collection

.agents/skills/acp-debug/SKILL.md
.agents/skills/add-integration/SKILL.md
.agents/skills/clean-branches/SKILL.md
.agents/skills/code-review/SKILL.md
.agents/skills/commit/SKILL.md
.agents/skills/context-engineering/SKILL.md
.agents/skills/create-kandev-plugin/SKILL.md
.agents/skills/debug/SKILL.md
.agents/skills/docs-maintainer/SKILL.md
.agents/skills/e2e/SKILL.md
.agents/skills/fix/SKILL.md
.agents/skills/harness-improvement/SKILL.md
.agents/skills/interview-me/SKILL.md
.agents/skills/plan/SKILL.md
.agents/skills/planner-orchestration/SKILL.md
.agents/skills/playwright-cli/SKILL.md
.agents/skills/pr-fixup/SKILL.md
.agents/skills/pr/SKILL.md
.agents/skills/product-demo-seeding/SKILL.md
.agents/skills/product-video-capture/SKILL.md
.agents/skills/push/SKILL.md
.agents/skills/qa/SKILL.md
.agents/skills/release/SKILL.md
.agents/skills/runtime-feature-flags/SKILL.md
.agents/skills/spec-driven-development/SKILL.md
.agents/skills/spec/SKILL.md
.agents/skills/tdd/SKILL.md
.agents/skills/using-agent-skills/SKILL.md
.agents/skills/verify/SKILL.md
.agents/skills/mobile-parity/SKILL.md
.agents/skills/record/SKILL.md

Metadata

Files
0
Version
1578843
Hash
6f7b53c4
Indexed
2026-07-24 17:33

inicio - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-16 20:11
浙ICP备14020137号-1 $mapa de visitantes$