agentleFS
farofyfarofy/ignite/skills/vendor/book-clean-architecture/SKILL.md

book-clean-architecture

Skill0 starsChanged 4 months agoApache-2.0View on GitHub

Clean Architecture principles (dependency rule, boundaries, keeping business rules independent of frameworks and databases) to consult when designing or structuring code. Reference material, not a review. Use when the user asks about dependency direction, layering, or ports and adapters.

The file

Show its rules and text

We split this skill into the rules it gives an agent

17 rules. About 0 are common, 16 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈16

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Distinctive:

    Use when adding, changing, reviewing, or refactoring code whose business rules should survive changes in frameworks, databases, delivery …

    line 14
  2. Distinctive:

    Do not let details become the architecture.

    line 18
  3. Distinctive:

    Put enterprise rules and invariants in entities or equivalent domain objects.

    line 24
  4. Distinctive:

    Treat frameworks, databases, web delivery, messaging, filesystems, clocks, service clients, networks, devices, and vendors as outer-layer …

    line 26
  5. Distinctive:

    Keep adapters humble. Controllers, endpoints, presenters, gateway adapters, service listeners, and hardware adapters translate external …

    line 28
  6. Distinctive:

    Do not merge unrelated use cases or eliminate duplication when sharing would couple actors, change reasons, team ownership, deployment …

    line 31
  7. Distinctive:

    Use structured code, dependency inversion, role-sized interfaces, substitutable implementations, controlled mutation, acyclic components, …

    line 32
  8. Distinctive:

    Test entities, use cases, and boundary contracts first, without the real framework, database, network, external service, or target hardware.

    line 34
  9. Distinctive:

    When urgent delivery would skip architecture, state the future change, test, replacement, or operational cost before accepting the shortcut.

    line 39
  10. Distinctive:

    When framework annotations, request/response objects, serializers, ORM rows, schemas, vendor SDKs, config, environment reads, device …

    line 40
  11. Distinctive:

    When controllers, jobs, handlers, views, presenters, gateways, repositories, SQL, service listeners, scripts, or hardware adapters contain …

    line 41
  12. Distinctive:

    When a use case instantiates infrastructure, calls a volatile dependency directly, or depends on a concrete implementation, introduce a …

    line 42
  13. Very specific:

    When a *Service, utility folder, shared module, base package, or generic core package becomes an escape hatch, split by use case, role, or …

    line 43
  14. Distinctive:

    When an adapter bypasses a use case, a presenter reads persistence directly, or infrastructure is both imported by and importing inward …

    line 44
  15. Distinctive:

    When service boundaries, process boundaries, remote calls, deployment boundaries, or embedded hardware appear, still verify source …

    line 45
  16. Distinctive:

    When tests need the framework, database, network, service, or hardware to verify business rules, move tests to use cases/entities with …

    line 46
  17. Distinctive:

    When a compromise is unavoidable, keep it at the outermost layer possible, document the violation, avoid normalizing it, and preserve a …

    line 47

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 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
<!-- Vendored verbatim from ciembor/agent-rules-books (MIT License). Source: https://github.com/ciembor/agent-rules-books/blob/main/clean-architecture/clean-architecture.mini.md Third-party reference. Exempt from repo diction and prettier. -->

OBEY Clean Architecture by Robert C. Martin

When to use

Use when adding, changing, reviewing, or refactoring code whose business rules should survive changes in frameworks, databases, delivery mechanisms, services, devices, vendors, deployment shape, or schedule pressure.

Primary bias to correct

Do not let details become the architecture. Business policy stays independent, dependencies point inward, and volatile mechanisms remain replaceable.

Decision rules

  • Preserve independent business rules, inward dependencies, testability, and replaceable details even when the immediate feature would be shorter without them.
  • Source dependencies must point inward toward higher-level policy. Domain and use cases must not import frameworks, databases, web handlers, queues, external service clients, UI types, or other details.
  • Put enterprise rules and invariants in entities or equivalent domain objects; put application-specific orchestration in focused use cases.
  • Pass plain request and response models across use-case boundaries. Do not pass web requests, framework contexts, ORM rows, database-bound structures, or framework response objects into or out of core policy.
  • Treat frameworks, databases, web delivery, messaging, filesystems, clocks, service clients, networks, devices, and vendors as outer-layer details behind ports, gateways, presenters, mappers, or adapters.
  • Inner layers own the interfaces they need; outer layers implement them. Object construction and concrete wiring belong in the composition root or other outer-layer main component.
  • Keep adapters humble. Controllers, endpoints, presenters, gateway adapters, service listeners, and hardware adapters translate external formats to use-case calls and back; they do not own business decisions.
  • Organize by use case, feature, or business capability before generic technical buckets. The structure should reveal domain intent and application actions.
  • Choose boundaries by volatility, policy importance, substitution value, testability, and cost. Use the lightest enforceable boundary, including partial boundaries, when full deployment or runtime separation is too expensive.
  • Do not merge unrelated use cases or eliminate duplication when sharing would couple actors, change reasons, team ownership, deployment needs, or release pressure.
  • Use structured code, dependency inversion, role-sized interfaces, substitutable implementations, controlled mutation, acyclic components, and stability-directed dependencies to protect policy from volatile details.
  • Enforce boundaries with package structure, dependency rules, build constraints, tests, visibility, or narrow APIs. A diagram, service split, package name, or shared common folder is not enough.
  • Test entities, use cases, and boundary contracts first, without the real framework, database, network, external service, or target hardware. Test adapters separately at the seams.
  • Preserve behavior while improving dependency direction. Prefer incremental boundary extraction over rewrites, and call out architectural debt when it cannot be fixed safely now.

Trigger rules

  • When urgent delivery would skip architecture, state the future change, test, replacement, or operational cost before accepting the shortcut.
  • When framework annotations, request/response objects, serializers, ORM rows, schemas, vendor SDKs, config, environment reads, device registers, or transport formats enter core policy, move translation outward.
  • When controllers, jobs, handlers, views, presenters, gateways, repositories, SQL, service listeners, scripts, or hardware adapters contain business branching or validation, move the rule inward.
  • When a use case instantiates infrastructure, calls a volatile dependency directly, or depends on a concrete implementation, introduce a policy-owned port and wire the concrete detail at the edge.
  • When a *Service, utility folder, shared module, base package, or generic core package becomes an escape hatch, split by use case, role, or ownership and restore dependency direction.
  • When an adapter bypasses a use case, a presenter reads persistence directly, or infrastructure is both imported by and importing inward code, restore the intended boundary.
  • When service boundaries, process boundaries, remote calls, deployment boundaries, or embedded hardware appear, still verify source dependencies, data ownership, I/O cost, and policy independence.
  • When tests need the framework, database, network, service, or hardware to verify business rules, move tests to use cases/entities with fakes or add a stable boundary contract.
  • When a compromise is unavoidable, keep it at the outermost layer possible, document the violation, avoid normalizing it, and preserve a path to separation.

Final checklist

  • Business rules independent from frameworks, databases, UI, services, devices, and vendors?
  • Dependencies point inward, with ports owned by inner policy and concrete details outside?
  • Entities guard invariants and focused use cases orchestrate one application action?
  • Boundaries explicit and enforced in code, tests, packages, or build rules?
  • Controllers, presenters, gateways, service listeners, and adapters humble?
  • Structure reveals use cases and business capabilities instead of generic technical buckets?
  • Core tests run fast without real delivery, persistence, network, external service, or hardware?
  • Details remain replaceable without rewriting business rules?

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.