Skip to content
Ali Hasan
← Back to coding-agent specs

SKILL.md spec for a coding agent — a prompt pack, not a shipped product.

Quality Gatekeeper Code Quality Role: Code Reviewer

elevate-code

Interactive Clean Code Mentor & SOLID Architecture Gate

$ invoke_subagent('elevate-code')

The zip contains SKILL.md, the reference notes, and the scripts. Unzip it into the folder your agent loads skills from. For Grok, that is ~/.grok/skills/. Keep the folder name so SKILL.md stays at the top of that folder, then start a new chat and use the command above.

Trigger Scenarios (When Needed)
  • ✓ When a file, directory, or module needs a SOLID and clean-architecture pass. A GitHub diff review is /review.
  • ✓ When refactoring legacy spaghetti code into decoupled, testable design patterns.
  • ✓ When learning clean code principles through guided, hands-on interactive exercises.
  • ✓ When auditing software for security anti-patterns (injection vectors, hardcoded secrets).
Activation & Guardrails

Trigger: Activated when the user requests a clean code review, SOLID principle analysis, or interactive code quality mentoring.

Execution Rules:
• Must ask for scope (file, directory, full project) and mode (Tutorial Mode vs Auto-Apply Mode).
• Categorizes every finding strictly as [MUST-FIX] (security, severe coupling, bug) or [NICE-TO-HAVE] (naming, minor DRY).
• In tutorial mode, reveals one finding at a time, challenging the developer to fix it before demonstrating the design pattern.
• Never suggests disabling security features or test coverage thresholds to make code cleaner.
Example Prompt: "Review this service for SOLID principles and clean code violations."
Technical Architecture & Data Contracts
Execution Pattern

Interactive Socratic Mentorship & 12-Dimension Quality Analysis

Context Budget

No fixed token budget. Auto-apply commits each finding before the next edit.

State Management

Archives the audit to docs/reviews/review-[date].md and commits that file on its own.

Input Contracts
Source Code File, Directory, or Pull Request Diff Selected Mode: Tutorial Mode vs Auto-Apply Mode
Output Contracts
Refactored, Production-Grade Source Code Interactive Design Pattern Insights & Rationales docs/reviews/review-[date].md (Audit Trail)
Bundled Scripts & Reference Resources

Reference Specifications (`references/`)

analysis-checklist.md Review Checklist

12-dimension evaluation checklist covering SRP, OCP, LSP, ISP, DIP, DRY, and cyclomatic complexity.

teaching-flow.md Instructional Protocol

Detailed instructional workflows for both Tutorial Mode and Auto-Apply Mode.

review-report-template.md Audit Template

Standardized audit report markdown template saved to docs/reviews/.

Executive Overview

Linters catch syntax errors and formatting discrepancies, but they cannot evaluate whether a class violates the Single Responsibility Principle, whether tight coupling will break downstream tests, or whether an abstraction introduces dangerous side-effects.

elevate-code is an interactive clean code mentor and architectural quality gate. It analyzes code through 12 rigorous software design dimensions and operates in two distinct modes.


Dual Operating Modes

1. Tutorial Mode (The Mentor Approach)

Designed for active skill elevation and architectural learning:

  1. Presents the Smell: Identifies a specific violation (e.g., “This OrderService method handles both database transactions and third-party SMS dispatch”).
  2. Issues the Challenge: Asks the developer: “How would you decouple this notification logic using the Dependency Inversion Principle?”
  3. Evaluates & Teaches: Analyzes the developer’s attempt, explains the underlying OOP design pattern (e.g., Strategy or Observer), and presents the idiomatic solution.

2. Auto-Apply Mode (The Production Gatekeeper)

For a scoped module when the user asks to fix it:

  • Lists findings, [MUST-FIX] first. Nice-to-haves are applied only when asked.
  • Each applied finding is its own commit, made before the next edit. The review report is the last commit.
  • The message has a subject, How, and Why.
  • The report is docs/reviews/review-[date].md.

The 12-Dimension Quality Analysis Checklist

elevate-code audits code against 12 core engineering criteria:

  1. Single Responsibility Principle (SRP): Classes and functions must have only one reason to change.
  2. Open-Closed Principle (OCP): Open for extension, closed for modification via interfaces.
  3. Liskov Substitution Principle (LSP): Subtypes must be substitutable for base types without breaking behavior.
  4. Interface Segregation Principle (ISP): Clients must not be forced to depend on methods they do not use.
  5. Dependency Inversion Principle (DIP): Depend on abstractions, never on concrete implementations.
  6. Don’t Repeat Yourself (DRY): Eliminate logic duplication while avoiding premature abstraction.
  7. Naming Clarity & Intent: Self-documenting identifiers with zero ambiguous abbreviations.
  8. Cyclomatic Complexity: Flattens deeply nested conditionals and extracts guard clauses.
  9. Error Encapsulation: Replaces generic error throwing with typed domain exceptions (e.g., RFC 9457 Problem Details).
  10. Separation of Concerns: Strict isolation between persistence, business logic, and presentation.
  11. Security Anti-Patterns: Immediate flagging of SQL injection vectors, unsanitized inputs, and leaked tokens.
  12. Testability: Decoupled dependencies to allow friction-free unit test mocking.