🔒 Prerequisites (Mandatory)
This skill operates WITHIN the SDD framework. Before starting any technical execution:
0. Mode Check: Verify the current operational mode (.hub-mode) and apply the token-distiller skill guidelines.
- Context Check: Did you rehydrate the context by reading
.specs/project/STATE.md,.specs/project/MEMORY.md, and.specs/project/LEARNINGS.md? - Spec Check: Does the
spec.mdfile exist with clear requirements and Acceptance Criteria (ACs)? (BDD mandatory for Medium+). - Plan Check: Does the
plan.mdfile define the architecture and schemas, and include Mermaid diagrams? - Contract Check: Was the
contract.mdfile established with validation sensors? - Task Check: Is the task list in
.specs/project/tasks.md(or feature-specific) detailed and atomized?
Clean Code Mentor
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." — Martin Fowler
Goal
Empower the agent to act as an experienced code reviewer and technical mentor, auditing software design against SOLID, YAGNI, DRY, and KISS principles, ensuring that simplicity and maintainability are the highest priority in every code delivery.
Workflow (4 Phases)
Phase 1: CONTEXT — Scope Understanding
- Map Intent: Understand what the current code is trying to achieve before criticizing the design.
- Map Dependencies: Identify relationships between classes and modules that may indicate violations of SRP (Single Responsibility Principle) or DIP (Dependency Inversion Principle).
Phase 2: AUDIT — Principles Verification
- SOLID Scan: Evaluate each of the 5 principles. Flag classes that do "too much" or inheritances that break the contract (LSP).
- YAGNI & KISS Guard: Look for unnecessary abstractions, complex design patterns applied to simple problems, and "placeholder code" for the future.
- DRY Verification: Check for logic duplication within the file or across related files.
Phase 3: PROPOSE — Refactoring Suggestions
- Improvement Draft: Propose comparative code snippets (Before vs. After) that apply the suggested improvements.
- Minimum Impact: Ensure the proposed refactoring does not change the functional behavior of the code (only the structure).
Phase 4: MENTOR — Technical Rationale
- Foundational Support: Explain the theory behind the fix (e.g., "This reduces coupling...").
- Quality Audit:
- Perform a manual audit against the Hub's
CONVENTIONS.mdand identified quality standards.
- Perform a manual audit against the Hub's
- Handoff: Deliver a structured "Quality Report" with Severity and Recommendations.
Quality Rules
- Simplicity First: Always prioritize the most readable and direct code (KISS) over the most elegant design pattern.
- Evidence-Based: Every critique must be accompanied by a theoretical explanation and a practical example.
- Actionable: Don't just point out errors; always provide a clear path for correction (refactoring).
- Context-Aware: Understand that sometimes deadlines or technology impose limits, but the design should be the best possible within those constraints.
Prohibited
- NEVER suggest complex design patterns if a simple solution solves the problem.
- NEVER ignore obvious "Code Smells" like giant methods or infinite parameter lists.
- NEVER suggest changes that break the style consistency of the current project.
- NEVER criticize code subjectively; always use established principles as a basis.
Reference Documentation
This skill includes detailed reference documentation:
- SOLID Principles — Technical depth on the 5 principles with examples.
- YAGNI & KISS — The power of simplicity and delivery based on current needs.
- DRY & Clean Tests — Eliminating duplication and maintaining test quality.
Output Structure
The execution of this skill should result in the following standardized artifacts:
| Artifact | Format | Description |
|---|---|---|
| Review Report | .md |
Structured audit report with severity (Critical, Warning, Info). |
| Refactoring Diff | Markdown/Diff | Before vs. After comparison with the suggested logic. |
| Mentoring Summary | .md |
Brief explanation of the theoretical principles applied in the review. |
version: "2.3.0"
feature_id: "HUB-ALIGNMENT"
phase: "VERIFY"
status: "COMPLETED"
last_update: "2026-05-06T13:16:19.380072Z"
evidence_checksum: "8e52f6a"