Skip to content
Agentmart
Submit a tool

backend-patterns

Apply proven backend architectural patterns — hexagonal/clean architecture, layered design, repository pattern, CQRS, event sourcing, saga pattern.

Skill by ad-free

IndexedMIT
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/ad-free-backend-patterns

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Apply proven backend architectural patterns — hexagonal/clean architecture, layered design, repository pattern, CQRS, event sourcing, saga pattern. Use when structuring backend services, choosing between architectural patterns, or refactoring existing code toward a cleaner structure. Do NOT use for API surface design (see api-design) or for database migration planning (see database-migrations).

Use cases: design, backend

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/backend-patterns

What's inside

Skill name
backend-patterns
Description
Apply proven backend architectural patterns — hexagonal/clean architecture, layered design, repository pattern, CQRS, event sourcing, saga pattern. Use when structuring backend services, choosing between architectural patterns, or refactoring existing code toward a cleaner structure. Do NOT use for API surface design (see api-design) or for database migration planning (see database-migrations).
License
MIT
Metadata
domain: specialized-engineering · origin: agent-master-skills · version: 2.0.0 · preferred-model: nemotron-3-ultra-free · source-enhancements: v2.0.0 Master Template alignment
Instructions
162 lines in SKILL.md · view on GitHub

Agent Skills spec issues

  • allowed-tools: must be a space-separated string
  • files: referenced but missing: references/folded-architecture-patterns.md

Files (1)

  • SKILL.md

SKILL.md (first lines)

TOKEN CEILING: ~2K tokens. If skill exceeds, extract sections to references/.

# backend-patterns

## Relationship to existing skills

- architecture-patterns: Handles high-level pattern selection (hexagonal, DDD, event-driven, microservices). backend-patterns provides the concrete implementation patterns and code structure for those decisions.
- dev-craft: Provides the overall engineering pipeline; backend-patterns is invoked during the ARCH-SCAN and REFACTOR phases.
- api-design: Defines the API surface; backend-patterns ensures the internal structure supports the API contract cleanly.
- dev-craft/plugins/security-audit: Validates that backend patterns do not introduce security vulnerabilities (e.g., mass assignment, injection).

## When to Use

- Structuring a new backend service or module
- Refactoring an existing service toward a cleaner architecture
- Choosing between hexagonal, layered, or modular monolith patterns
- Implementing repository, CQRS, or event sourcing patterns
- Defining module boundaries and dependency direction
- Setting up dependency injection or service layer patterns

## When NOT to Use

- Choosing a high-level system architecture (hexagonal vs microservices) — see architecture-patterns
- Designing API endpoints or contracts — see api-design
- Database schema design or migration — see database-migrations
- Frontend or UI architecture — see ui-craft
- Performance optimization of existing queries — see performance-profiler-and-tuner

## Workflow

### Phase 1: Pattern Selection

1. **Assess the current structure**: read the codebase to understand the existing architecture (monolith, layered, ad-hoc)
2. **Identify pain points**: coupling, unclear boundaries, testability issues, dependency direction violations
3. **Match pattern to problem**:
   - Coupling between business logic and infrastructure → hexagonal/clean architecture
   - Complex read/write asymmetry → CQRS
   - Long-running business processes with compensation needs → saga pattern
   - Audit trail or event replay needed → event sourcing
   - Simple CRUD with clear boundaries → layered architecture with repository pattern
4. **Define scope**: which module/service is being restructured, and what are the boundaries
5. **Get user confirmation** on the chosen pattern before proceeding

### Phase 2: Structure Definition

Define the module/file structure for the chosen pattern:

**Hexagonal/Clean Architecture**:
```
<module>/
├── domain/
│   ├── entities/
│   ├── value-objects/
│   ├── ports/          (interfaces)
│   └── services/       (domain logic)
├── application/
│   ├── use-cases/
│   ├── dto/
│   └── ports/          (application interfaces)
├── infrastructure/
│   ├── persistence/
│   ├── external/
│   └── adapters/
└── presentation/
    ├── controllers/
    └── dto/
```

**Layered Architecture**:
```
<module>/
├── controllers/
├── services/
├── repositories/
├── models/
└── config/
```

**CQRS**:
```
<module>/
├── commands/
│   ├── handlers/
│   ├── validators/
│   └── models/
├── queries/
│   ├── handlers/
│   ├── projections/
│   └── models/
├── events/
└── domain/
```

### Phase 3: Dependency Mapping

1. **Draw dependency arrows**: which modules depend on which
2. **Enforce direction**: dependencies must point inward (toward domain) for hexagonal, or downward (toward data) for layered
3. **Identify violation points**: existing code that breaks the dependency rule
4. **Plan migration steps**: refactor violations in order of lowest risk first

### Phase 4: Implementation

1. **Create the skeleton**: directories, interfaces, base types
2. **Implement domain layer first**: entities, value objects, domain services
3. **Implement ports/interfaces**: define contracts that infrastructure will fulfill
4. **Implement infrastructure adapters**: database, external API, message queue clients
5. **Wire dependencies**: configure DI container, module exports, or service registration
6. **Write tests per layer**: domain tests (no infrastructure), application tests (mock ports), integration tests (real adapters)

### Phase 5: Validation

1. **Dependency check**: verify no dependency violations remain
2. **Test coverage**: domain layer must have >80% coverage; integration tests for infrastructure
3. **Build and lint**: ensure the new structure compiles and passes linting
4. **Document the pattern**: update architecture decision records (ADRs) with the chosen pattern and rationale

## Context Management

- Track pattern decisions in `.dev-craft/architecture/<module>/pattern.json` with fields: `module`, `pattern`, `rationale`, `date`, `violations`
- On session resume, check for any in-progress restructuring and continue from the last completed phase

From ad-free/agent-master-skills, MIT.

Signals

Stars
0
Forks
0
Open issues
0
Last commit (this folder)
Oct 22, 2026 (6 days ago)

From GitHub (fetched Oct 24, 2026).

Details

Version
2.0.0
License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from ad-free

Cite this page

backend-patterns skill. Agent Mart. https://agentmart.dev/skills/ad-free-backend-patterns (last updated 2026-10-24)