Anti monolith guard

From Sistema2D/FrameCode-VibeWork · View interactive version

Anti monolith guard is an AI agent skill from the GitHub repository Sistema2D/FrameCode-VibeWork. Prevent mixed-responsibility modules and uncontrolled file growth. Use before adding behavior to a large or mixed-responsibility file, or when splitting one. Do not use for small, local edits to cohesive modules.

How to use this skill

Skill file

SKILL: Anti-Monolith Guard

Purpose

Prevent AI agents from creating or expanding monolithic files, components, routes, services, prompts, or modules. This is a Markdown-only gate: it blocks unsafe structure through explicit checklist decisions, not scripts.

Activation Triggers

Load this skill before implementation when any condition is true:

Inputs

Active plan, target artifact, responsibility map, similar-code search, dependency/consumer evidence, current size or complexity indicators, and the checks that protect behavior during a split.

Applicability Classification

Classify the target before applying numeric thresholds:

| Artifact class | Automatic size enforcement | Review focus |

|---|---|---|

| Source code, query, executable configuration, or runtime prompt | Yes, using the closest project-adjusted budget | responsibility, coupling, side effects, test boundary |

| Operational AI instruction or procedural skill | Warning by default; block only when mixed responsibilities or unsafe context loading are demonstrated | instruction hierarchy, retrieval cost, cohesion, provider neutrality |

| Canonical documentation, specification, report, plan, decision, or release record | No numeric block | cohesion, discoverability, ownership, document-graph relationships |

| Template, example, generated catalog, or historical record | No numeric block | schema correctness, generation source, reachability, preservation |

Markdown is not automatically documentary: classify it by responsibility. A Markdown prompt that controls runtime behavior may be operational, while a long technical specification may remain one cohesive document.

If the target is not source code or an operational instruction, record not numerically applicable and use document-graph and schema validation instead. Do not split prose merely to satisfy a line count.

Hard Gates

Stop and split the work before editing if any gate fails:

| Gate | Pass condition | If it fails |

|---|---|---|

| Single responsibility | The file has one primary reason to change. | Split into module, service, component, adapter, or utility. |

| Boundary named | Inputs, outputs, owner, and public contract are stated. | Create a module boundary note using the monolith gate section of governance/TEMPLATE_REFACTORING.md. |

| Size budget | Planned file growth is small and reviewable. | Split the plan or create extraction task first. |

| Duplication check | Similar code was searched and reused or centralized. | Load code-hygiene-refactor before adding code. |

| Test/validation path | There is a specific validation for the new boundary. | Do not proceed beyond planning. |

| No catch-all file | Names like utils, helpers, manager, service, or index have a precise scoped role. | Rename or split by capability. |

Recommended Size Budgets

These are code-oriented governance defaults, not universal rules. Apply them only after the applicability classification. A project may resize them in PROJECT.md (stack) or APPLICATION_DOCUMENTATION.md when architecture, security, integrity, or performance evidence requires a different budget.

| Artifact | Warning | Block unless justified |

|---|---:|---:|

| Function / method | 40 lines | 80 lines |

| UI component / screen section | 180 lines | 300 lines |

| Route / controller / handler | 120 lines | 220 lines |

| Service / use case | 180 lines | 300 lines |

| Prompt or agent instruction file | 180 lines | 300 lines |

| General module file | 250 lines | 400 lines |

If a file crosses the warning threshold, record the reason in the plan. If it crosses the block threshold, split first or document why a temporary exception is safer.

Exceptions and Threshold Reassessment

An exception may pass only when the plan records:

Line count alone never proves a monolith, and splitting into many low-value files can itself fail this gate. Exceptions cannot waive mandatory security, privacy, accessibility, data-integrity, audit, or regression controls.

Boundary Pattern

Every new non-trivial module must answer in the active plan:

Allowed Splits

Prefer the smallest split that removes real coupling:

Forbidden Patterns

Output Required

Record this compact block in the active plan before editing:

## Anti-Monolith Gate

- Skill loaded: `skills/anti-monolith-guard/SKILL.md`
- Target artifact:
- Primary responsibility:
- Artifact class: `source` / `operational instruction` / `documentation` / `record/template/generated`
- Numeric threshold applicability: `applicable` / `warning only` / `not applicable`
- Explicit non-responsibilities:
- Size budget:
- Similar code checked:
- Split decision: `proceed` / `split first` / `temporary exception`
- Validation:

Exit Criteria

Proceed only when the plan proves the next edit is small, named, bounded, reusable where needed, and validated.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.