# Backend Architecture Patterns (architecture-patterns)

> Applies Clean Architecture, Hexagonal Architecture and DDD to give a service layered structure, dependency rules, interfaces and test boundaries.

- Category: [Architecture](https://www.myskills.tools/en/categories/architecture/)
- Source: Community · Seth Hobson
- Repository: https://github.com/wshobson/agents/tree/main/plugins/backend-development/skills/architecture-patterns (commit 0f73766)
- SKILL.md: https://github.com/wshobson/agents/blob/main/plugins/backend-development/skills/architecture-patterns/SKILL.md
- Install command: `npx skills add wshobson/agents --skill architecture-patterns`
- License: MIT
- Compatible with: Claude Code, Codex, Cursor, Copilot, OpenCode
- Permissions: read-repo ✓, write-files ✓, shell ✗, network ✗
- Status: Scan passed
- A rule scan cannot catch every risk. Read this skill's SKILL.md and check its permissions before installing.

## Core rule

Dependencies point inward only; inner layers know nothing about outer layers.

## Execution Phases

1. **Choose pattern and boundaries** — Pick Clean, Hexagonal or DDD for the situation, draw bounded contexts and align on a ubiquitous language.
2. **Layer and define interfaces** — Separate entities, use cases, interface adapters and frameworks, crossing every layer boundary through an abstract interface.
3. **Apply tactical patterns** — Use aggregates, value objects, repositories and domain events, validating value-object invariants in the constructor.
4. **Test with in-memory adapters** — Every use case should run in a plain unit test with no real database, Docker or network.
5. **Troubleshoot** — Fix circular imports between layers, framework decorators on entities, bloated controllers and context bleed, adding an Anti-Corruption Layer where needed.

## Permissions (summarised from SKILL.md)

| Capability | Needed | Details |
|---|---|---|
| File writes | Required | Creates or refactors layered code structure, interface definitions and unit tests. |
| Command execution | Not required | The skill does not call for running commands. |
| Network outbound | Not required | No network access. |

## SKILL.md frontmatter (YAML)

```yaml
---
name: architecture-patterns
description: Implement proven backend architecture patterns including Clean Architecture, Hexagonal Architecture, and Domain-Driven Design. Use this skill when designing clean architecture for a new microservice, when refactoring a monolith to use bounded contexts, when implementing hexagonal or onion architecture patterns, or when debugging dependency cycles between application layers.
---
```

Home: https://www.myskills.tools/en/ · URL: https://www.myskills.tools/en/skills/architecture-patterns/
