agentleFS
AlizHarbAlizHarb/agent-skills/skills/decompose-model/SKILL.md

decompose-model

Skill1 starsChanged 5 months agoMITView on GitHub

Use when a model is getting too large and needs concerns, casts, builders, or other extractions.

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 4 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this skill when an Eloquent model is becoming too large or starts mixing persistence with workflow code.

    line 13
  2. Distinctive:

    Keep only small model-level invariants in the model.

    line 25
  3. Distinctive:

    Add or update tests for the extracted behavior.

    line 26
  4. Distinctive:

    Test the extracted behavior where it now lives.

    line 44

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Decompose Model

When To Use

Use this skill when an Eloquent model is becoming too large or starts mixing persistence with workflow code.

Inputs Needed

  • Model name, current responsibilities, reusable behaviors, query needs, and extraction target.

Workflow

  1. Inspect the model and its related classes.
  2. Identify what belongs in relations, casts, accessors, mutators, builders, policies, or support classes.
  3. Extract reusable query logic into a builder or query object.
  4. Extract reusable behavior into a concern when it fits.
  5. Keep only small model-level invariants in the model.
  6. Add or update tests for the extracted behavior.

Files That May Be Created

  • Builders, concerns, casts, support classes, policies, DTOs, and tests.

Files That May Be Modified

  • The model, related builders, and related tests.

Architecture Rules

  • The model should stay readable and persistence-focused.
  • Reusable query logic should not become model scopes in new code.
  • The model should not orchestrate workflows.

Testing Requirements

  • Test the extracted behavior where it now lives.

Review Checklist

  • Did the extraction reduce model size?
  • Is the logic in the right layer?
  • Did behavior stay the same?

Common Mistakes to Avoid

  • Extracting too many tiny files without reducing complexity.
  • Leaving reusable query behavior in model scopes.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.