What problem does it solve?
Remove unreferenced Apex classes, unused methods, and orphaned LWC components while consolidating duplicate implementations to reduce technical debt and address high-severity static analysis findings safely.
Core Features & Use Cases
- Detection: Preferentially runs Salesforce Code Analyzer or PMD outputs for automated findings, with manual repository heuristics as a fallback to detect unreferenced classes, unused methods, and unused LWC components.
- Classification & Safety: Provides a safety taxonomy (SAFE, CAUTION, DANGER) and detailed checks for metadata references, Flow/Process Builder usage, managed-package exposures, and common annotations like @AuraEnabled and @InvocableMethod.
- Verification Workflow: Emphasizes one-at-a-time removals, running Apex tests and dry-run deployments after each change, and keeping checkpoints to enable safe reversions.
- Consolidation: Guides extracting shared logic into utility/service classes, updating callers, and validating with the full test suite.
- Use Cases: Cleaning a repo before security or AppExchange review, reducing commented-out or legacy code, and remediating high-severity PMD or Code Analyzer findings.
Quick Start
Use the refactor-clean skill to scan the repository for unreferenced Apex and LWC code, classify each finding by safety, remove one safe item at a time, run Apex tests, and perform a dry-run deployment after each change.