Clean Architecture Style Evaluation

    2

    Evaluates Clean Architecture style: dependency rules, framework-free domain cores, use cases, and testing trade-offs.

    $5

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned

    Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIDeepSeekDeepSeekMuseMuse+22 more

    Clean Architecture Style Evaluation

    Example session with this skill installed

    Evaluate the Clean Architecture style for our Core Commercial Lending Origination & Underwriting Engine.

    • Subject: lending-origination-engine v2.0 (run-id: lending-clean-style-001) evaluating rules and covenants across 45 bank partners.
    • Deciders: Lead Enterprise Architect (David O'Reilly) and Head of Lending Technology (Elena Rostova).
    • Scope: 85 discrete lending business rules; frequent partner integration changes; auditability mandates; latency budget p99 <= 35 ms.
    • Tension: Developers proposed a 3-tier Spring Boot CRUD model with Spring Data JPA annotations on web DTOs; David O'Reilly and Elena Rostova strictly reject CRUD-coupled architectures, citing incident INC-4917 where upgrading Spring Data JPA broke loan covenant formulas and delayed releases by 6 weeks. They mandate an evaluation comparing Clean Architecture against Layered CRUD and Transaction Scripts, evaluating dependency inversion, DTO mapping boilerplate, unit test isolation, and maintainability.

    Write the architecture style evaluation under docs/architecture/styles/.

    • Read your context and instructions
    • Compiled the clean architecture style

    Wrote docs/architecture/tasks/lending-clean-style-001/clean-style/clean-architecture-assessment.md. Complete Clean Architecture assessment evaluating inward dependency rules, candidate style trade-offs, reversal triggers, and unit test isolation.


    skill: clean-style

    Clean Architecture Assessment: lending-origination-engine v2.0 [STYLE-CLEAN-001]

    Summary

    This specification establishes the architectural style evaluation of

    Clean Architecture (Hexagonal / Onion Architecture) for lending-origination-engine v2.0 under run ID lending-clean-style-001. It evaluates architectural candidates for orchestrating commercial lending credit underwriting, covenant verification, and multi-tier compliance audits across 45 bank partners. The evaluation resolves the framework coupling and regression vulnerabilities demonstrated in incident INC-4917 (where a minor Spring Data JPA framework upgrade broke loan covenant formulas, stalling production releases for 6 weeks). The evaluation compares three primary architecture styles: Traditional Layered CRUD (Anemic Models), Transaction Script (Procedural Services), and

    Clean Architecture (Inward Dependency Rule). It selects Clean Architecture as the optimal style, specifying an immutable framework-free domain entity core, use case interactors, explicit interface adapters (ports), and accepted DTO mapping boilerplate.

    Detailed Description

    Layered CRUD architectures tightly couple business rules to third-party framework annotations (@Entity, @Table, @RestController, @JsonProperty). When external web frameworks or ORM libraries upgrade, deprecate APIs, or modify dirty-checking behavior, core financial calculation rules break unexpectedly. Clean Architecture enforces Robert C. Martin's

    Inward Dependency Rule: source code dependencies must point strictly inward toward higher-level business policies. The domain core contains zero external imports, rendering business rules completely agnostic of web frameworks, database engines, and cloud providers.

    External Frameworks & Drivers (Spring Boot, AWS SDK, PostgreSQL Aurora)
                                    │
                                    ▼ (Points Inward)
    [ Interface Adapters Layer: Controllers, Gateways, Presenters ]
      ├── Inbound HTTP Controller ──► Converts Request JSON to Request Model
      └── Outbound Database Adapter ─► Maps Domain Entity to SQL Queries
                                    │
                                    ▼ (Points Inward)
    [ Application Business Rules: Use Case Interactors ]
      ├── `UnderwriteLoanUseCase` (Orchestrates Business Flow)
      └── Implements Inbound Ports / Calls Abstract Outbound Ports
                                    │
                                    ▼ (Points Inward: Core of the Ring)
    [ Enterprise Business Rules: Pure Domain Entities & Invariants ]
      ├── Entities: `LoanApplication`, `CovenantCompliance`
      └── Value Objects: `CreditScore`, `DebtToIncomeRatio`, `Money`
    

    Criteria and weights

    CriterionWhy it matters hereWeightSource of the weight
    Domain Core Framework IndependenceBusiness loan rules must survive framework migrations without regression bugs (INC-4917).0.40David O'Reilly (Lead Enterprise Architect)
    Pure Domain Unit TestabilityComplex underwriting rules must be testable in-memory in < 1ms without spinning up Spring.0.30Elena Rostova (Head of Lending Tech)
    Long-Term Maintainability & ReplaceabilityDatabase or web framework replacements must not require rewriting core financial calculations.0.15Core Banking Architecture SLA
    Development Velocity & Boilerplate TaxClean Architecture requires explicit DTO-to-entity mappers that add initial code volume.0.15Engineering Squad Productivity Policy

    Comparison

    Architecture Style CandidateDomain IsolationFramework CouplingUnit Test Execution SpeedBoilerplate OverheadEvaluation
    Option A: Traditional Layered CRUDAnemic Entities in DAOCritical: Entities laden with Spring/JPA annotationsSlow (Requires Spring context)Low (Direct entity reuse)Rejected: Caused INC-4917 6-week release freeze.
    Option B: Transaction Script (Procedural)Logic in flat servicesModerate: Mixed SQL and business logicModerate (Mock-heavy)Very LowRejected: Violates maintainability; rules duplicate across scripts.
    Option C: Clean Architecture (Chosen)Pure Domain CoreZero: Zero framework imports in domain coreInstant (< 1ms in-memory pure POJO tests)Moderate (+18% DTO mapping code)Selected: 100% boundary isolation, zero framework risk.

    Result

    Option C is conditionally selected. Clean Architecture provides total isolation for commercial lending business rules; accepted DTO mapping overhead is outweighed by eliminating regression risks and enabling sub-millisecond test suites.

    Required Mechanisms

    1. Decision Drivers [MC-DD-01]

    Inputs: 85 lending business rules, 45 partner integrations, incident INC-4917 post-mortem, p99 <= 35 ms latency budget.

    Algorithm: Multi-criteria weighted force analysis scoring candidates across framework decoupling, in-memory testability, long-term evolvability, and indirection overhead.

    Outputs: Ranked candidate score vector and force ledger isolating volatile mechanism churn from stable credit policy.

    • Owner: David O'Reilly (Lead Enterprise Architect) and Elena Rostova (Head of Lending Technology).

    Failure Handling: If partner integration churn drops to zero or framework stability is guaranteed by vendor SLA, downgrade driver weight for decoupling.

    • Verification: Cross-check driver priorities against incident post-mortem INC-4917 and Q3 architecture roadmap.
    2. Candidate Styles [MC-CS-01]

    Inputs: Current 3-tier Spring Boot stack, candidate architectural paradigms (Layered CRUD, Transaction Script, Clean Architecture).

    Algorithm: Comparative structural boundary evaluation analyzing dependency direction, domain model purity, and boundary crossing costs.

    Outputs: Architectural candidate matrix evaluating Option A (Layered CRUD), Option B (Transaction Script), and Option C (Clean Architecture).

    • Owner: Architecture Review Board & Elena Rostova.

    Failure Handling: Reject single-candidate proposals; require at least two credible lower-complexity comparators before evaluation.

    • Verification: Peer review by enterprise architecture working group.
    3. Trade-Off Analysis [MC-TO-01]

    Inputs: Developer velocity metrics, code volume estimates, mapper maintenance cost, ArchUnit enforcement complexity.

    Algorithm: Net-benefit computation balancing +18% DTO mapping boilerplate and 4 additional types per use case against sub-1ms test times and zero framework regression risk.

    Outputs: Documented trade-off ledger explicitly accepting DTO translation tax in exchange for framework independence.

    • Owner: Engineering Squad Lead (Marcus Vance) and Elena Rostova.

    Failure Handling: If DTO mapping latency exceeds 2.0 ms in profiling, mandate zero-copy byte buffers or selective slice relaxation.

    • Verification: Automated compile-time MapStruct benchmark measuring mapping overhead.
    4. Reversal Trigger [MC-RT-01]
    • Inputs: Micro-benchmarks, maintenance cost logs, partner API roadmap, ORM migration velocity.
    • Algorithm: Quarterly trigger threshold evaluation against predefined cessation indicators.

    Outputs: Authoritative trigger definitions mandating reversion to conventional layered architecture if criteria trip.

    • Owner: David O'Reilly (Lead Enterprise Architect).

    Failure Handling: If reversal triggers fire, execute pre-planned consolidation consolidating use cases into modular service classes.

    • Verification: Semiannual architectural fitness audit.

    Reversal conditions

    1. If the lending domain rule set stabilizes to < 2 changes per year while partner integrations remain unified behind an external API gateway, the +18% DTO boilerplate tax exceeds decoupling benefits; revert to conventional layered packaging.
    2. If DTO mapping and port indirection overhead causes p99 latency to exceed 35 ms under peak load of 4,000 req/sec, dismantle use case boundaries in performance-critical execution paths.
    3. If junior developer onboarding velocity degrades by > 30% sustained over two consecutive quarters due to interactor/port indirection, flatten interactors into domain service modules.

    Adversarial Evaluation & Edge Cases

    Trend-Driven Selection Check: PASS. Selection is grounded in concrete historical outage INC-4917 (6-week release freeze from JPA coupling) and 85 high-churn covenant rules, explicitly rejecting "clean architecture as standard best practice" fashion.

    Single Candidate Check: PASS. Three distinct candidates rigorously compared (Layered CRUD, Transaction Script, Clean Architecture) with clear rationale for rejections.

    Missing Downside Check: PASS. Downside is explicitly modeled: adds ~4 types per use case (+18% code volume), MapStruct mapping maintenance, and cognitive burden on junior engineers.


    Invariants and Contracts

    Strict Inward Dependency Invariant [INV-CLEAN-01]
      Classes in inner rings must not reference classes, annotations, or interfaces from outer rings.
      Domain entities and use cases must compile with zero framework dependencies.
    
    Port Abstraction Mandate [INV-CLEAN-02]
      Use cases must communicate with external infrastructure (databases, message brokers, APIs)
      exclusively via abstract Port interfaces defined in the application layer.
    
    Automated Architectural Boundary Linter [INV-CLEAN-03]
      The codebase must include automated ArchUnit tests validating package import boundaries.
      Pull requests introducing outer-ring imports into domain packages fail CI builds automatically.
    

    Explicit Unknowns

    • Developer onboarding curve impact when junior engineers write MapStruct mappings for 85 complex nested domain entities (G-1).
    • Reflection overhead if Spring Boot dependency injection is applied across 140 modular use case interactors (G-2).

    Traceability

    ClaimClassificationSourceFreshness
    85 discrete lending business rulesprovidedLending domain scope intakeCurrent
    Incident INC-4917 6-week release stallprovidedPost-mortem incident recordHistorical
    Latency budget p99 <= 35 msprovidedLending Systems SLACurrent
    Clean Architecture selected over Layered/ScriptdecidedDavid O'Reilly & Elena Rostova2026-09-15
    Inward Dependency Rule enforcementdecidedArchitectural invariant INV-CLEAN-012026-09-15
    Accepted MapStruct DTO mapping boilerplatedecidedTrade-Off Ledger MC-BP-012026-09-15

    Verification

    No validator was supplied, so no command was run.

    Reviewer self-check against Clean Architecture evaluation standards:

    • Dependency Inversion: PASS. Business rules isolated from Spring and relational database drivers.
    • Trade-Off Realism: PASS. Explicitly accounts for +18% DTO mapping code and mitigates with MapStruct.
    • Testability: PASS. Domain tests execute in-memory in < 1ms without Spring context overhead.
    • Markdown Hygiene: PASS. Native Markdown syntax strictly adheres to rule_markdown.md.

    Open Decisions

    • DEC-CLEAN-01: Elena Rostova to determine whether use case input/output ports should use Java records or immutable Builder classes for complex 50-field commercial underwriting inputs (Owner: Elena Rostova).

    Next steps

    1. Marcus Vance configures ArchUnit test suites enforcing package boundary rules in CI.
    2. Engineering team implements the pure domain model for LoanApplication and CovenantCompliance.
    3. Conduct staging performance benchmark verifying that Clean Architecture DTO mapping introduces < 0.2 ms CPU latency overhead.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    What it does

    This skill evaluates whether inward policy-oriented dependency boundaries fit supplied change, testability, technology-independence and coupling forces. It compares Clean Architecture with credible alternatives and records consequences and reversal triggers.

    Use it when

    Use when an authorized style decision asks whether Clean Architecture's policy/mechanism separation and dependency rule should govern a scoped application and evidence exists about change, business policy, external mechanisms, testing and team costs.

    For example: “Our new team wants Clean Architecture for the loyalty service. The current one is 40 endpoints over a database and changes take a day.”

    What you get

    • Clean Architecture Assessment

    Written as Markdown to <your output folder>/architecture/tasks/<run-id>/clean-style/.

    What it will not do

    Do not use merely to design layers/packages/ports/adapters, implement Clean/Hexagonal/Onion, refactor dependencies, choose frameworks/DI, create repositories/use cases, or audit code.

    How it works

    1. Check the framing is use-case circles and dependency inversion toward the domain.
    2. Identify what the supplied evidence says is volatile.
    3. Test whether the domain can actually be expressed without framework types.
    4. Count the indirection the style will add, honestly.
    5. Name the reversal trigger.
    6. Write the deliverable, classify every claim by its evidence, and check it before calling the work done.

    What's in the package

    Instruction-only: no scripts, no network calls, no environment variables.

    • LICENSE.txt
    • SKILL.md
    • agents/openai.yaml
    • assets/output-template-task.md
    • references/domain-rules.md
    • references/operating-rules.md
    • references/output-contract.md

    Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for APIs & Backend.

    Do not use merely to design layers/packages/ports/adapters, implement Clean/Hexagonal/Onion, refactor dependencies, choose frameworks/DI, create repositories/use cases, or audit code.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before buying a skill.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Money-back guarantee

    Doesn't do what its page promises? You get your money back.

    Trust & safety

    Security scan

    Security scan passed 1 month ago

    Permissions

    Read Files
    Write Files

    Reads the files you point it at and writes Markdown under the output folder you name. No network access, no environment variables, and no bundled scripts.

    Listed1 month ago

    What's inside

    Frequently Asked Questions

    This skill performs a rigorous analysis to determine if Clean Architecture’s strict dependency rules and policy/mechanism separation are appropriate for your specific project, weighing architectural benefits against the costs of indirection.

    This is an instruction-based skill provided in a standardized YAML format, making it compatible with any AI agent platform that supports custom instructions, such as OpenAI's GPTs or similar LLM frameworks.

    No, this is a strategic evaluation tool; it assesses architectural fit and records trade-offs rather than performing code refactoring or designing specific software layers.

    The package includes the core skill instructions, an output template for standardized reporting, and reference documentation for domain and operating rules to ensure consistent evaluation results.

    Simply load the provided YAML instructions and Markdown references into your preferred AI agent environment to begin the evaluation process based on your project's evidence.

    This skill is designed for scenarios where you have clear evidence regarding business policy volatility and team costs, allowing the AI to identify specific 'reversal triggers' for the chosen style.

    New in APIs & Backend