MCAF: SOLID Maintainability
Trigger On
- files, classes, or functions are too large or too coupled
- maintainability limits in
AGENTS.md need to be added or tightened
- a change needs a justified temporary exception
Value
- produce a concrete project delta: code, docs, config, tests, CI, or review artifact
- reduce ambiguity through explicit planning, verification, and final validation skills
- leave reusable project context so future tasks are faster and safer
Do Not Use For
- writing architecture docs without touching code structure or policy
- cosmetic formatting-only edits
Inputs
- the nearest
AGENTS.md
- the code under change
- current testing seams and dependency boundaries
Quick Start
- Read the nearest
AGENTS.md and confirm scope and constraints.
- Run this skill's
Workflow through the Ralph Loop until outcomes are acceptable.
- Return the
Required Result Format with concrete artifacts and verification evidence.
Workflow
- Read the active values for:
file_max_loc
type_max_loc
function_max_loc
max_nesting_depth
exception_policy
- Evaluate the change through SOLID:
- single responsibility
- explicit dependencies
- composition before inheritance
- boundaries that are easy to test
- Remove hardcoded values and inline string literals from implementation code by moving them into named constants, enums, configuration, or dedicated types.
- Split by responsibility, not by arbitrary line count alone.
- If a limit must be exceeded temporarily, document the exception exactly where
exception_policy requires it.
Deliver
- smaller, more cohesive code
- updated maintainability policy when repo rules changed
- explicit exception records when a temporary breach is justified
Validate
- size limits are respected or explicitly waived
- responsibilities are clearer after the change
- the refactor improves testability instead of only moving lines around
- literals that matter are named once and reused instead of repeated inline
- no numeric limit was moved into framework prose or skill metadata
Ralph Loop
Use the Ralph Loop for every task, including docs, architecture, testing, and tooling work.
- Plan first (mandatory):
- analyze current state
- define target outcome, constraints, and risks
- write a detailed execution plan
- list final validation skills to run at the end, with order and reason
- Execute one planned step and produce a concrete delta.
- Review the result and capture findings with actionable next fixes.
- Apply fixes in small batches and rerun the relevant checks or review steps.
- Update the plan after each iteration.
- Repeat until outcomes are acceptable or only explicit exceptions remain.
- If a dependency is missing, bootstrap it or return
status: not_applicable with explicit reason and fallback path.
Required Result Format
status: complete | clean | improved | configured | not_applicable | blocked
plan: concise plan and current iteration step
actions_taken: concrete changes made
validation_skills: final skills run, or skipped with reasons
verification: commands, checks, or review evidence summary
remaining: top unresolved items or none
For setup-only requests with no execution, return status: configured and exact next commands.
Load References
- read
references/limits-and-exceptions.md first
- open
references/maintainability.md for broader design guidance
- open
references/exception-handling.md when documenting a temporary breach
Example Requests
- "Split this 700-line service into cohesive parts."
- "Add maintainability limits to AGENTS."
- "Refactor this class to follow SOLID and document the one exception."
Guardrails
- numeric limits belong in
AGENTS.md, not in the framework guide or skill metadata
- a justified exception is a debt record, not a permanent escape hatch
1---2name: mcaf-solid-maintainability3description: Apply SOLID, SRP, cohesion, composition-over-inheritance, and small-file discipline to code changes. Use when refactoring large files or classes, setting maintainability limits in `AGENTS.md`, documenting justified exceptions, or reviewing design quality.4---56# MCAF: SOLID Maintainability78## Trigger On910- files, classes, or functions are too large or too coupled11- maintainability limits in `AGENTS.md` need to be added or tightened12- a change needs a justified temporary exception1314## Value1516- produce a concrete project delta: code, docs, config, tests, CI, or review artifact17- reduce ambiguity through explicit planning, verification, and final validation skills18- leave reusable project context so future tasks are faster and safer1920## Do Not Use For2122- writing architecture docs without touching code structure or policy23- cosmetic formatting-only edits2425## Inputs2627- the nearest `AGENTS.md`28- the code under change29- current testing seams and dependency boundaries3031## Quick Start32331. Read the nearest `AGENTS.md` and confirm scope and constraints.342. Run this skill's `Workflow` through the `Ralph Loop` until outcomes are acceptable.353. Return the `Required Result Format` with concrete artifacts and verification evidence.3637## Workflow38391. Read the active values for:40 - `file_max_loc`41 - `type_max_loc`42 - `function_max_loc`43 - `max_nesting_depth`44 - `exception_policy`452. Evaluate the change through SOLID:46 - single responsibility47 - explicit dependencies48 - composition before inheritance49 - boundaries that are easy to test503. Remove hardcoded values and inline string literals from implementation code by moving them into named constants, enums, configuration, or dedicated types.514. Split by responsibility, not by arbitrary line count alone.525. If a limit must be exceeded temporarily, document the exception exactly where `exception_policy` requires it.5354## Deliver5556- smaller, more cohesive code57- updated maintainability policy when repo rules changed58- explicit exception records when a temporary breach is justified5960## Validate6162- size limits are respected or explicitly waived63- responsibilities are clearer after the change64- the refactor improves testability instead of only moving lines around65- literals that matter are named once and reused instead of repeated inline66- no numeric limit was moved into framework prose or skill metadata6768## Ralph Loop6970Use the Ralph Loop for every task, including docs, architecture, testing, and tooling work.71721. Plan first (mandatory):73 - analyze current state74 - define target outcome, constraints, and risks75 - write a detailed execution plan76 - list final validation skills to run at the end, with order and reason772. Execute one planned step and produce a concrete delta.783. Review the result and capture findings with actionable next fixes.794. Apply fixes in small batches and rerun the relevant checks or review steps.805. Update the plan after each iteration.816. Repeat until outcomes are acceptable or only explicit exceptions remain.827. If a dependency is missing, bootstrap it or return `status: not_applicable` with explicit reason and fallback path.8384### Required Result Format8586- `status`: `complete` | `clean` | `improved` | `configured` | `not_applicable` | `blocked`87- `plan`: concise plan and current iteration step88- `actions_taken`: concrete changes made89- `validation_skills`: final skills run, or skipped with reasons90- `verification`: commands, checks, or review evidence summary91- `remaining`: top unresolved items or `none`9293For setup-only requests with no execution, return `status: configured` and exact next commands.9495## Load References9697- read `references/limits-and-exceptions.md` first98- open `references/maintainability.md` for broader design guidance99- open `references/exception-handling.md` when documenting a temporary breach100101## Example Requests102103- "Split this 700-line service into cohesive parts."104- "Add maintainability limits to AGENTS."105- "Refactor this class to follow SOLID and document the one exception."106107## Guardrails108109- numeric limits belong in `AGENTS.md`, not in the framework guide or skill metadata110- a justified exception is a debt record, not a permanent escape hatch