agentleFS
troskatertroskater/flowdeck-claude/skills/layered-architecture/SKILL.md

layered-architecture

Skill0 starsChanged 24 days agoMITView on GitHub

Layered architecture patterns for separating presentation, application, domain, and data layers.

5 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

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

  • 0

    Common

    Most of the 5 edited versions we read keep these.

  • 4

    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:

    When building traditional monolithic or client-server applications where clear vertical separation of concerns improves maintainability …

    line 10
  2. Distinctive:

    Create layer interfaces: - Use interfaces or abstract classes to define how adjacent layers communicate.

    line 16
  3. Distinctive:

    Enforce layer access rules: - Use module visibility, package private, or architectural linting tools to prevent cross-layer pollution.

    line 17
  4. Distinctive:

    Keep thin layers: - Avoid bloating any single layer.

    line 18

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

layered-architecture

When to Activate

When building traditional monolithic or client-server applications where clear vertical separation of concerns improves maintainability (e.g., MVC applications, REST APIs, data-driven apps).

Steps

  1. Identify natural layers - Determine the distinct vertical tiers based on responsibility (e.g., presentation, business logic, data access).
  2. Define layer responsibilities - Establish clear contracts for what each layer can and cannot depend on.
  3. Implement top-down dependencies - Higher layers (presentation) depend on lower layers (data), but never vice versa.
  4. Create layer interfaces - Use interfaces or abstract classes to define how adjacent layers communicate.
  5. Enforce layer access rules - Use module visibility, package private, or architectural linting tools to prevent cross-layer pollution.
  6. Keep thin layers - Avoid bloating any single layer; if the business logic layer grows large, consider extracting domain objects.

Examples

// Presentation Layer - Controllers/Handlers
class OrderController {
  constructor(private readonly orderService: OrderService) {}

  async createOrder(req: Request, res: Response): Promise<void> {
    const order = await this.orderService.createOrder(req.body)
    res.status(201).json(order)
  }
}

// Business Logic Layer - Services
class OrderService {
  constructor(
    private readonly orderRepository: OrderRepository,
    private readonly paymentGateway: PaymentGateway
  ) {}

  async createOrder(data: CreateOrderDto): Promise<Order> {
    const order = new Order(data.items)

    if (data.paymentMethod === 'prepaid') {
      await this.paymentGateway.charge(order.total, data.paymentToken)
    }

    return this.orderRepository.save(order)
  }
}

// Data Access Layer - Repositories
interface OrderRepository {
  save(order: Order): Promise<void>
  findById(id: string): Promise<Order | null>
  findByCustomer(customerId: string): Promise<Order[]>
}

class PostgresOrderRepository implements OrderRepository {
  constructor(private readonly db: Database) {}

  async save(order: Order): Promise<void> {
    await this.db.query('INSERT INTO orders (...) VALUES (...)', order.toDbFormat())
  }
}

Related Skills

  • clean-architecture
  • hexagonal-architecture
  • ddd-architecture
  • backend-patterns

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.