Agent Skills
› winstonkoh87/Athena-Public
› diagnostic-first-refactoring
diagnostic-first-refactoring
GitHub一种代码重构方法论,强调在执行变更前先全面扫描代码结构、依赖关系及测试覆盖情况。通过诊断耦合度和死代码,制定安全的重构计划并逐步执行验证,避免盲目修改导致的回归问题。
触发场景
需要对现有模块进行结构性调整
重构前需评估代码健康度与依赖风险
安装
npx skills add winstonkoh87/Athena-Public --skill diagnostic-first-refactoring -g -y
SKILL.md
Frontmatter
{
"how": "1. Map file structure → 2. Identify dependencies → 3. Check test coverage → 4. Plan changes → 5. Execute with verification",
"who": "Any AI coding agent",
"why": "Prevents blind edits that break unknown dependencies",
"name": "diagnostic-first-refactoring",
"what": "Read-only workspace scan before executing refactoring changes",
"when": "Before any \/refactor or structural code change",
"where": "Target codebase or module",
"description": "Analyze codebase structure before making changes — the \"Surgeon's Scan\" pattern"
}
Diagnostic-First Refactoring (Surgeon's Scan)
Core Principle: Understand before you cut.
Protocol
- Scan: Map the target module's file structure and dependencies
- Diagnose: Identify coupling, dead code, and test coverage gaps
- Plan: Design the refactoring sequence (dependency-safe order)
- Execute: Apply changes with verification at each step
- Verify: Run tests, check for regressions
Anti-Patterns
- ❌ Editing files without reading them first
- ❌ Refactoring multiple modules simultaneously
- ❌ Skipping the dependency scan
- ❌ Not running tests after each change
Related Protocols
- DIAG-001: Knowledge-Action Gap
- DIAG-002: Baseline Check
- DIAG-003: Frame Collision
版本历史
- e624e2d 当前 2026-07-19 08:46


