agentleFS
mikejhillmikejhill/agent-skills/skills/software-architecture/SKILL.md

software-architecture

Skill0 starsChanged 3 days agoMITView on GitHub

Language-agnostic code structure: layers, the inward dependency rule, ports and adapters, module boundaries, SOLID checks, naming, configuration, errors, and replay-safe side effects. Use when designing, laying out, or reviewing the structure of a project or module in any language.

38 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use llm-app-patterns, backend-engineering and 9 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.
  • xfstudioSkill

    llm-app-patterns

    Production-ready patterns for building LLM applications. Covers RAG pipelines, agent architectures, prompt IDEs, and LLMOps monitoring. Use when designing AI applications, implementing RAG, building agents, or setting up LLM observability.

    Also in 3 projects that use this

  • yuexueyuSkill

    backend-engineering

    后端资深工程师技能 - 架构设计、服务端开发、中间件、错误处理、日志、配置管理、部署运维。当你涉及后端服务开发、Go/Python/Node/Java/PHP后端代码、中间件配置、服务间通信、配置管理、日志策略、进程管理、交叉编译、部署流程时必须使用此技能。即使用户只是说"写个接口"或"后端加个功能",也应触发。

    Also in 3 projects that use this

  • weirdgmeSkill

    backend-dev-guidelines

    Comprehensive backend development guide for Node.js/Express/TypeScript microservices. Use when creating routes, controllers, services, repositories, middleware, or working with Express APIs, Prisma database access, Sentry error tracking, Zod validation, unifiedConfig, dependency injection, or async patterns. Covers layered architecture (routes → controllers → services → repositories), BaseController pattern, error handling, performance monitoring, testing strategies, and migration from legacy patterns.

    Also in 3 projects that use this

  • AJBcodingSkill

    sql-optimization-patterns

    Master SQL query optimization, indexing strategies, and EXPLAIN analysis to dramatically improve database performance and eliminate slow queries. Use when debugging slow queries, designing database schemas, or optimizing application performance.

    Also in 3 projects that use this

  • ruvnetSkill

    github-workflow-automation

    Advanced GitHub Actions workflow automation with AI swarm coordination, intelligent CI/CD pipelines, and comprehensive repository management

    Also in 3 projects that use this

  • AnthropicSkill

    documentation

    Write and maintain technical documentation. Trigger with "write docs for", "document this", "create a README", "write a runbook", "onboarding guide", or when the user needs help with any form of technical writing — API docs, architecture docs, or operational runbooks.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

7 rules. 0 are common, 6 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 33 edited versions we read keep these.

  • 6

    Distinctive

    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
  1. Distinctive:

    Open/closed: add a variant by adding an adapter or strategy, not by editing a switch in the core.

    line 32
  2. Distinctive:

    Liskov: every port implementation, fakes included, honours the same contract and errors.

    line 33
  3. Distinctive:

    Prefer composition to inheritance.

    line 36
  4. Very specific:

    Use cases are verb phrases (ScanTargets, EndProcess).

    line 43
  5. Distinctive:

    Long or blocking work: never on a UI or request thread.

    line 52
  6. Distinctive:

    Test the core through use cases with fakes.

    line 57
  7. Distinctive:

    Check the dependency rule in CI with the ecosystem's boundary tool, such as import-linter (Python), dependency-cruiser or ESLint boundaries …

    line 61

“Common” is measured: kept by at least 6 in 10 of the 33 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

Software Architecture

Dependencies point inward. The core knows nothing about frameworks, I/O, delivery, or the clock; everything outside it depends on it, never the reverse.

Layers

LayerHoldsMay depend on
DomainEntities, value objects, domain services, pure state machines, domain errorsNothing but the language and its standard library
ApplicationUse cases, and the ports (interfaces) they need: repositories, gateways, clock, process runnerDomain
AdaptersOne technology each, implementing a port: file system, OS API, HTTP client, databaseApplication, domain, and that technology
InterfacesDelivery: CLI, GUI, HTTP handlers, plugin entry points. Parse input, call a use case, render outputApplication, domain
Composition rootThe only place that constructs concrete classes and wires themEverything
  • Size the structure to the project. A small tool may be one core module, one adapter module, and one entry point. Never create empty layers or placeholder folders.
  • Group by feature once a layer holds several unrelated areas; keep the layer split inside each feature.
  • Adapters never import each other or an interface. Interfaces never import adapters; the composition root passes them in.
  • The domain and application layers never read the clock, environment, file system, or randomness directly. Inject them through ports.

Design Checks

  • Single responsibility: one reason to change per module and class. Split a unit that mixes I/O with decisions.
  • Open/closed: add a variant by adding an adapter or strategy, not by editing a switch in the core.
  • Liskov: every port implementation, fakes included, honours the same contract and errors.
  • Interface segregation: ports are narrow and named for the core's need (HoldFinder), not the technology (Win32Api).
  • Dependency inversion: the core owns its ports; adapters implement them.
  • Prefer composition to inheritance. Keep public surfaces small; everything else is private to its module.
  • Value objects validate on construction, so holding one means it is valid. State changes go through methods that check the transition.

Naming

  • Modules and packages are domain nouns (matching, devices, actions), never utils, helpers, common, misc, or manager.
  • Adapters are named for the technology and the port: SqliteTaskRepository, SmsTextMessageSender.
  • Use cases are verb phrases (ScanTargets, EndProcess). Errors name the failure (TargetNotFound).
  • One term per concept across code, docs, and UI.

Boundaries

  • Configuration: load once at the edge into a typed, validated, immutable object; pass it in. No global settings lookups in the core.
  • Errors: the core raises domain errors. Adapters translate technology errors into them. Interfaces translate them into exit codes, messages, or responses, once.
  • Side effects: store intent before acting, make inputs idempotent, keep waits and retries as data rather than scheduler state, and re-read state inside a transaction before deciding.
  • External data is hostile: validate and normalize at the adapter. The operation's contract decides bad records: fail when completeness is required (migrations, restores, exports); skip and report them when partial results are allowed.
  • Long or blocking work: never on a UI or request thread; give every blocking call a timeout or watchdog.

Testing Seams

  • Provide an in-memory fake for every port, shared by all test suites. Prefer fakes to mocking frameworks.
  • Test the core through use cases with fakes; test each adapter against the real technology; test interfaces end to end through the composition root.

Enforcement

Check the dependency rule in CI with the ecosystem's boundary tool, such as import-linter (Python), dependency-cruiser or ESLint boundaries (TypeScript), ArchUnit or Gradle modules (Java and Kotlin), or crates in a Cargo workspace (Rust). Where no tool exists, add a test that scans imports.

Documentation

Record the layer or package table (package, responsibility) and the key decisions with rejected alternatives in the project's architecture document. Update both in the same change that alters structure.

References

  • language-mapping.md: read when mapping these layers onto a specific language's packages, modules, or build units.

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.