Oma backend

From first-fluke/oh-my-agent · View interactive version

Oma backend is an AI agent skill from the GitHub repository first-fluke/oh-my-agent. Implement server APIs, authentication, and application data access. Schema modeling and query tuning use oma-db.

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

<!-- oma-docs:ignore-start -->

<!-- oma-docs:ignore-end -->

Structural Flow

Transitions

Failure and recovery

Exit

Logical Operations

Canonical workflow path

  1. Detect the stack (see Stack Detection) and identify the affected router, service, repository, model, migration, and test boundaries.
  2. Locate files and inspect symbols or content with the configured code-intelligence provider. For Serena, use find_file, search_for_pattern, get_symbols_overview, and find_symbol. Native search is limited to the provider exclusions and non-code paths permitted by the project's search policy.
  3. Read the existing routes, services, repositories, models, schemas, and config. Load a stack-specific reference only when the task needs it.
  4. Implement the change with validation, business logic, persistence, and tests, following the Core Rules.

<!-- oma-docs:ignore-start -->

  1. Select the project's verification commands (lint, typecheck, tests, and migrations when schema changes are involved), preferring the verify: commands in stack/stack.yaml when present. Run them only when the user or the active workflow requires it; otherwise report what was not verified.

<!-- oma-docs:ignore-end -->

  1. Review the applicable checklist items and report the changed behavior, the verification status, and unresolved risks.

Resource scope and effects

Reads and edits backend source, tests, schemas, and migrations. A change may alter the database schema, API or auth behavior, or a service contract, and may require regenerated clients or migration artifacts. Credentials (DB URLs, API keys, secrets) stay in the environment or a secret manager; external APIs and backing services are called only when the task requires them.

Guardrails

Apply framework, library, architecture, and data-model defaults only when the target project has no established choice. Scoped edits do not authorize a stack migration or unrelated infrastructure.

Architecture Pattern

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

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 + Argon2id for auth (bcrypt acceptable for legacy compatibility); 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 the environment; a fallback is declared, never implied: DB URLs, API keys, secrets, and feature flags come from environment variables or a secret manager, never from source. A missing credential fails with a clear error by default. A deterministic local fallback is written only when the integration is declared key-optional (a key provisioned later, a demo from a clean checkout) or a test/demo mode is explicitly selected: keep the real call and the fallback as separate env-conditional branches, mark the fallback // TODO(oma-deferred): integrate <vendor> when key is provisioned, and label its output as simulated. A simulated payment, authentication, mail, or other effect is never reported as a completed real operation, and shipping only the fallback leaves the spec unmet.
  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 reference second: Use stack/ when present; otherwise the matching variants/<language>/. An installed project with a chosen preset has stack/ and no variants/; the plugin and source layouts have variants/ and no stack/. Treat it as supplementary reference for coding conventions and snippet templates
  3. Neither applies: Ask the user or suggest running /stack-set

Stack-Specific Reference

File names are relative to the stack reference directory selected above.

<!-- oma-docs:ignore-start -->

<!-- oma-docs:ignore-end -->

References

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.