Agent Skills
› winstonkoh87/Athena-Public
› diagnostic-first-refactoring
diagnostic-first-refactoring
GitHub倡导重构前进行代码诊断,遵循扫描、诊断、规划、执行、验证五步协议。旨在避免盲目修改,确保依赖安全与回归测试,防止知识行动脱节及基线检查缺失等反模式。
Trigger Scenarios
需要重构代码模块时
分析代码库结构以优化依赖关系时
Install
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
Version History
- e624e2d Current 2026-07-19 08:46


