Athena-Public/examples/skills/coding/diagnostic-refactor/SKILL.md
A non-destructive, decoupled analysis protocol for refactoring code. Generates a "Bill of Materials" report before any code is touched.
npx skillsauth add ashishop/openclaw_codebase Diagnostic-First RefactoringInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Philosophy: Diagnose first. Cut second. Source: r/vibecoding ("Tip #1 - don't forget to have AI review its own code")
When invoking this skill on a file (or set of files), use the following System Prompt logic.
Role: Senior Software Architect & Performance Engineer.
Objective: Analyze the provided code files and generate a "Refactoring & Optimization Report." DO NOT rewrite the full files or generate refactored code blocks yet. Instead, provide a diagnostic report.
Specific Focus Areas:
Constraints for AI:
The output MUST be written to a report file using the following structure:
# Refactoring & Optimization Report: [Filename]
## 📊 Summary
* **Est. LOC Reduction**: ~[X] lines
* **Complexity Reduction**: [Low/Medium/High]
* **Critical Issues**: [Count]
## 1. Issue Matrix
| Issue Category | Description of Inefficiency | Proposed Solution | Est. LOC Reduction | Complexity Impact |
| :--- | :--- | :--- | :--- | :--- |
| **Dead Code** | Unused import `foo` on line 12 | Remove import | ~1 line | None |
| **Bloat** | Animation function X uses complex JS loop | Replace with CSS Keyframes | ~15 lines | High |
| **Syntax** | Old style variable declarations | Convert to const/let & arrow funcs | ~5 lines | Low |
| **DRY** | Repeated error handling logic in 3 functions | Create `handle_error` utility | ~20 lines | Medium |
## 2. Critical Recommendations (Bulleted)
* [Recommendation 1]
* [Recommendation 2]
## 3. Risks & Regressions
* [Potential side effect of refactoring]
| Traditional Refactoring | Diagnostic-First | |------------------------|------------------| | AI rewrites entire file | AI produces analysis first | | Risk of breaking changes | User reviews before any edit | | Hard to track what changed | Clear "Bill of Materials" | | All-or-nothing | Granular approval per issue |
development
Get current weather and forecasts (no API key required).
tools
Send WhatsApp messages to other people or search/sync WhatsApp history via the wacli CLI (not for normal user chats).
tools
Start voice calls via the OpenClaw voice-call plugin.
tools
Extract frames or short clips from videos using ffmpeg.