Back to Skills

backend-code-organisation

verified

Kotlin backend layering and packaging guidelines

View on GitHub

Marketplace

airbot-reviewers

sids/airbot

Plugin

airbot-backend

Repository

sids/airbot

plugins/airbot-backend/skills/backend-code-organisation/SKILL.md

Last Verified

January 22, 2026

Install Skill

Select agents to install to:

Scope:
npx add-skill https://github.com/sids/airbot/blob/main/plugins/airbot-backend/skills/backend-code-organisation/SKILL.md -a claude-code --skill backend-code-organisation

Installation paths:

Claude
.claude/skills/backend-code-organisation/
Powered by add-skill CLI

Instructions

## Mission
- Keep backend services modular: resources handle transport, managers own business logic, and data access stays isolated.
- Maintain clean dependency flow across modules (`service` → `core` → `models`) to encourage reuse and testability.

## Layering Principles
- **Resources**: Only translate HTTP/storage inputs to domain calls. No database or cross-service logic. Convert `SecurityContext` early.
- **Managers**: Encapsulate business rules; coordinate helpers, other managers, workflows, and DAL components. Break cycles by separating read/write responsibilities or introducing controllers.
- **Helpers/Services**: Reusable integrations (feature flags, external clients). Centralize external service calls to simplify retries and upgrades.
- **Repos/DAL/DAO**: Keep database interactions single-purpose. Compose multi-step transactions in repos/DAL; keep DAO calls single query.
- **Utils/Validators/Transformers**: Pure functions and extensions only; avoid hidden state.
- **Cache Managers**: Inject Redis/Lettuce clients, expose typed `get`/`invalidate` helpers.

## Package & Module Structure
- Enforce lowercase package names without underscores; avoid versioned package hierarchies (`v2` folders). Prefer `managers.slots` over `managers.slots.v2`.
- Organize by responsibility: `managers`, `helpers`, `utils`, `dao`, `workflows`, etc. Mirror structure in tests.
- Module boundaries:
  - `core`: managers, helpers, data access, transient models. May depend on `models`.
  - `service`: Dropwizard resources, configuration, application wiring; no direct DB access.
  - `console-service`: Console-specific resources/auth; depends on `core`.
  - `client`: Outbound clients; depend only on `models`.
  - `models`: Shared API/data contracts; no dependencies.

## Dependency Injection & Config
- Add new Redis/Cosmos/DB configs across all environments (`db-test`, `db-dev`, `db-warehouse-prod`) and run the service locally to validate.
- Annotate injectable classes with `@Singleton` when 

Validation Details

Front Matter
Required Fields
Valid Name Format
Valid Description
Has Sections
Allowed Tools
Instruction Length:
2977 chars