agentleFS
tiagosilva07tiagosilva07/zyrax-guard/.agents/skills/clean-architecture/SKILL.md

clean-architecture

Skill2 starsChanged 3 months agoMITView on GitHub

Principles and checks for structuring code with clear boundaries, low coupling, and high cohesion. Use this whenever you are designing a new module, refactoring existing code, reviewing structure, deciding where logic should live, or untangling a messy codebase — even if the user doesn't say the words "clean architecture". Applies to Go, React/TypeScript, and C#/.NET.

33 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use convention-learner, opentelemetry and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • codewithmukeshSkill

    convention-learner

    Detects and enforces project-specific coding conventions by analyzing existing codebase patterns. Learns naming conventions, folder structure, test organization, and coding style from the existing code. Load when: "conventions", "coding standards", "project patterns", "enforce style", "detect patterns", "learn conventions", "code consistency".

    Also in 3 projects that use this

  • codewithmukeshSkill

    opentelemetry

    OpenTelemetry observability for .NET 10 applications. Covers traces, metrics, and logs using the OpenTelemetry SDK with OTLP export. Includes custom ActivitySource, IMeterFactory metrics, resource configuration, and Aspire Dashboard integration. Load this skill when setting up distributed tracing, custom metrics, OTLP export, or when the user mentions "OpenTelemetry", "OTLP", "traces", "spans", "Activity", "ActivitySource", "metrics", "IMeterFactory", "Meter", "Counter", "Histogram", "Gauge", "telemetry", "observability", "distributed tracing", "OTEL", or "Aspire Dashboard".

    Also in 3 projects that use this

  • MovGP0Skill

    modern-csharp

    Modern C# style guidance for Bendex and MicroSea code changes, including primary constructors, expression-bodied members, var usage, target-typed new, lambdas, and pattern matching.

    Also in 3 projects that use this

  • MicrosoftSkill

    resilience

    Apply resilience patterns (retry, backoff, circuit breaking) when writing or reviewing code that makes outbound HTTP/REST calls, database operations, or any I/O that can experience transient failures. Use this skill when: (1) writing new code that calls external services or APIs, (2) reviewing code that uses fetch, HTTP clients, or service-to-service calls, (3) adding queue consumers or workers that interact with remote systems, (4) debugging intermittent failures in production.

    Also in 3 projects that use this

  • hongyuancSkill

    vertical-slice

    Build and evaluate a production-quality vertical slice before advancing from Pre-Production to Production.

    Also in 3 projects that use this

  • wpankSkill

    caching

    Caching strategies, invalidation, eviction policies, HTTP caching, distributed caching, and anti-patterns. Use when designing cache layers, choosing eviction policies, debugging stale data, or optimizing read-heavy workloads.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

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

  • 0

    Common

    Most of the 31 edited versions we read keep these.

  • 3

    Distinctive

    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:

    No leaky boundaries: Don't pass framework types (HTTP requests, ORM entities) into business logic.

    line 26
  2. Distinctive:

    Put server-state access behind a data layer (e.g.

    line 56
  3. Distinctive:

    Add abstraction "for later" with no current consumer.

    line 67

“Common” is measured: kept by at least 6 in 10 of the 31 edited versions of this file we could read. “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

Clean architecture (applied, not dogmatic)

The goal is code that's easy to change safely. Use these principles as a lens, not a religion — apply the ones that reduce real coupling, skip ceremony that doesn't.

Core principles

  1. Separate concerns by responsibility. Transport (HTTP/handlers), business logic (services/use-cases), and data access (repositories) are three different jobs. Keep them in different units so a change to one doesn't ripple into the others.
  2. Depend inward, on abstractions. Business logic should not import the database driver or the web framework. Define interfaces it needs; let the outer layers implement them. Dependencies point toward the domain, never out of it.
  3. High cohesion, low coupling. Things that change together live together; things that don't, don't. A package/module should have one clear reason to exist.
  4. No leaky boundaries. Don't pass framework types (HTTP requests, ORM entities) into business logic. Translate at the edge.
  5. Single source of truth. One place for each piece of logic. Duplication is a bug waiting to diverge.

When structuring or refactoring, check:

  • Can I describe each unit's single responsibility in one sentence? If not, split it.
  • Does business logic depend on a concrete framework/DB? Invert it behind an interface.
  • Is the same logic in more than one place? Consolidate.
  • Could I swap the database or the web layer without touching business rules? That's the test for whether boundaries are clean.
  • Am I adding a layer that doesn't pull its weight? Remove it. Simplicity wins.

Stack-specific shape

Go

/cmd            entrypoints
/internal
  /transport    http handlers, routing, request/response mapping
  /service      business logic, depends on repo interfaces
  /repository   data access, implements interfaces
  /domain       core types, no external imports

Define repository interfaces in the service layer (consumer side), implement them in /repository. Wrap errors with context as they cross boundaries.

React / TypeScript

  • Separate presentation (dumb components) from container/logic (hooks).
  • Put server-state access behind a data layer (e.g. query hooks), not inside UI.
  • Shared logic → custom hooks; shared UI → reusable components. No business rules buried in JSX.

C# / .NET

  • Layered or vertical-slice; domain project has no dependency on infrastructure.
  • Constructor injection; program against interfaces; keep EF/DbContext out of the domain.

Do not

  • Add abstraction "for later" with no current consumer.
  • Refactor and change behavior in the same step (see the refactorer agent's rule).
  • Mistake "more folders" for "better architecture." Boundaries are about dependencies, not directory count.

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.