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.
- Brainstorm first (mandatory):
- analyze current state
- define the problem, target outcome, constraints, and risks
- generate options and think through trade-offs before committing
- capture the recommended direction and open questions
- Plan second (mandatory):
- write a detailed execution plan from the chosen direction
- 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-maintainability-33description: 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. Brainstorm first (mandatory):73 - analyze current state74 - define the problem, target outcome, constraints, and risks75 - generate options and think through trade-offs before committing76 - capture the recommended direction and open questions772. Plan second (mandatory):78 - write a detailed execution plan from the chosen direction79 - list final validation skills to run at the end, with order and reason803. Execute one planned step and produce a concrete delta.814. Review the result and capture findings with actionable next fixes.825. Apply fixes in small batches and rerun the relevant checks or review steps.836. Update the plan after each iteration.847. Repeat until outcomes are acceptable or only explicit exceptions remain.858. If a dependency is missing, bootstrap it or return `status: not_applicable` with explicit reason and fallback path.8687### Required Result Format8889- `status`: `complete` | `clean` | `improved` | `configured` | `not_applicable` | `blocked`90- `plan`: concise plan and current iteration step91- `actions_taken`: concrete changes made92- `validation_skills`: final skills run, or skipped with reasons93- `verification`: commands, checks, or review evidence summary94- `remaining`: top unresolved items or `none`9596For setup-only requests with no execution, return `status: configured` and exact next commands.9798## Load References99100- read `references/limits-and-exceptions.md` first101- open `references/maintainability.md` for broader design guidance102- open `references/exception-handling.md` when documenting a temporary breach103104## Example Requests105106- "Split this 700-line service into cohesive parts."107- "Add maintainability limits to AGENTS."108- "Refactor this class to follow SOLID and document the one exception."109110## Guardrails111112- numeric limits belong in `AGENTS.md`, not in the framework guide or skill metadata113- a justified exception is a debt record, not a permanent escape hatch