# Refactor Check

> Analyze code for SOLID violations, clean code issues, and architecture compliance

- Skill: `phel-lang/refactor-check` (Agent Skill)
- Install (CLI): `npx skillmds@latest add phel-lang/refactor-check`
- Raw SKILL.md: https://api.skillmd.com/api/skills/phel-lang/refactor-check/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: phel-lang (https://skillmd.com/u/phel-lang)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/phel-lang/refactor-check

---


# Refactor Check

Read and analyze the specified file(s) from `$ARGUMENTS`.

## SOLID Violations

| Principle | Key Symptoms |
|-----------|--------------|
| SRP | Class has many methods, hard to name without "And"/"Manager" |
| OCP | Switch/if-else chains that grow with features |
| LSP | `instanceof` checks, overridden methods that break behavior |
| ISP | Empty method implementations, "not implemented" exceptions |
| DIP | `new` in business logic, hard to test without file system |

## Clean Code Issues

- **Naming**: Descriptive and intention-revealing?
- **Functions**: Small (< 20 lines)? One responsibility? ≤ 3 args?
- **Comments**: Explain "why" not "what"? No commented-out code?
- **Errors**: Specific exceptions? Fail fast?

## Architecture Compliance

| Check | Rule |
|-------|------|
| Lang independence | `Lang/` has zero deps on other modules |
| Module boundaries | Cross-module access only via Facades |
| Shared scope | `Shared/` contains only genuinely cross-cutting code |
| Compiler phases | No phase skipping (Lexer → Parser → Analyzer → Emitter) |

## For Phel Source Files (`src/phel/`)

- kebab-case naming?
- `:doc` metadata present?
- `:see-also` references as strings?
- Clojure-aligned semantics?

## Output Format

```markdown
# Refactor Analysis: <file/directory>

## Summary
- **SOLID Violations:** X issues
- **Clean Code Issues:** X issues
- **Architecture Issues:** X issues

## Critical Issues (High Priority)
### [SRP] <Class> has multiple responsibilities
**File:** `src/php/Module/Class.php:10-50`
**Problem:** ...
**Suggestion:** ...

## Moderate Issues (Medium Priority)
...

## Minor Issues (Low Priority)
...

## Recommended Refactoring Steps
1. ...
```

