Oma backend

From gracefullight/docusaurus-plugins · View interactive version

Oma backend is an AI agent skill from the GitHub repository gracefullight/docusaurus-plugins. Backend specialist for APIs, databases, authentication with clean architecture (Repository/Service/Router pattern). Use for API, endpoint, REST, database, server, migration, and auth work.

How to use this skill

Skill file

Backend Agent - API & Server Specialist

Scheduling

Goal

Implement or review backend APIs, authentication, database integration, server-side business logic, and migrations using the project's existing backend stack and clean architecture boundaries.

Intent signature

When to use

When NOT to use

Expected inputs

Expected outputs

Dependencies

Control-flow features

Structural Flow

Entry

  1. Detect the backend stack from project files first.
  2. Identify affected router, service, repository, model, migration, and test boundaries.
  3. Load stack-specific references only when needed.

Scenes

  1. PREPARE: Determine stack, architecture boundaries, and acceptance criteria.
  2. ACQUIRE: Read existing routes, services, repositories, models, schemas, and config.
  3. ACT: Implement backend changes with validation, business logic, persistence, and tests.
  4. VERIFY: Run relevant lint, type, test, migration, and checklist commands.
  5. FINALIZE: Report changed behavior, verification, and unresolved risks.

Transitions

Failure and recovery

Exit

Logical Operations

Actions

| Action | SSL primitive | Evidence |

|--------|---------------|----------|

| Detect stack and conventions | READ | Manifests, stack files, existing code |

| Select implementation boundary | SELECT | Router/service/repository pattern |

| Validate inputs and schemas | VALIDATE | Stack validation library |

| Implement business logic | WRITE | Service layer code |

| Implement persistence | WRITE | Repository/model/migration code |

| Call external/backing services | CALL_TOOL | DB, queue, cache, auth, or API clients |

| Run verification | CALL_TOOL | Tests, typecheck, lint, migrations |

| Report result | NOTIFY | Final summary |

Tools and instruments

Canonical workflow path

rg --files
rg "route|router|service|repository|model|schema|migration" .

Then run the project's discovered verification commands, usually lint/typecheck/tests and migrations when schema changes are involved. Prefer stack/stack.yaml verify: commands when present.

Resource scope

| Scope | Resource target |

|-------|-----------------|

| CODEBASE | Backend source, tests, schemas, migrations |

| LOCAL_FS | Stack references and generated artifacts |

| PROCESS | Test, lint, typecheck, migration commands |

| CREDENTIALS | Environment-managed DB URLs, API keys, secrets |

| NETWORK | External APIs or backing services when required |

Preconditions

Effects and side effects

Guardrails

  1. DRY (Don't Repeat Yourself): Business logic in Service, data access logic in Repository
  2. SOLID:
  1. KISS: Keep it simple and clear

Architecture Pattern

Router (HTTP) → Service (Business Logic) → Repository (Data Access) → Models

Repository Layer

Service Layer

Router Layer

Core Rules

  1. Clean architecture: router → service → repository → models
  2. No business logic in route handlers
  3. All inputs validated with your stack's validation library
  4. Parameterized queries only (never string interpolation)
  5. JWT + bcrypt for auth; rate limit auth endpoints
  6. Async where supported; type annotations on all signatures
  7. Custom exceptions via centralized error module (not raw HTTP exceptions)
  8. Explicit ORM loading strategy: do not rely on default relation loading when query shape matters
  9. Explicit transaction boundaries: group one business operation into one request/service-scoped unit of work
  10. Safe ORM lifecycle: do not share mutable ORM session/entity manager/client objects across concurrent work unless the ORM explicitly supports it
  11. Config from environment: DB URLs, API keys, secrets, and feature flags come from env vars or secret managers; never hardcode in source
  12. Stateless services: no in-memory session or user state between requests; use external stores (DB, Redis, cache) for shared state
  13. Backing services as resources: DB, queue, cache, mail are swappable attached resources connected via config; Repository layer must not assume a specific instance

Stack Detection

  1. Project files first: Read existing code, package manifests (pyproject.toml, package.json, Cargo.toml, go.mod, pom.xml, etc.) to determine the tech stack
  2. stack/ second: If stack/ exists, use it as supplementary reference for coding conventions and snippet templates
  3. Neither exists: Ask the user or suggest running /stack-set

Stack-Specific Reference

References

Follow resources/execution-protocol.md step by step.

See resources/examples.md for input/output examples.

Use resources/orm-reference.md when the task involves ORM query performance, relationship loading, transactions, session/client lifecycle, or N+1 analysis.

Before submitting, run resources/checklist.md.

Vendor-specific execution protocols are injected automatically by oma agent:spawn.

Source files live under ../_shared/runtime/execution-protocols/{vendor}.md.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.