Api steer

From Vrooli/Vrooli · View interactive version

Api steer is an AI agent skill from the GitHub repository Vrooli/Vrooli. Design and maintain scenario APIs as **stable, intuitive, domain-aligned contracts**. The API is the scenario’s entrypoint for core logic and the primary integration surface for other scenarios and th

How to use this skill

Skill file

Steer focus: API Steer

Design and maintain scenario APIs as stable, intuitive, domain-aligned contracts. The API is the scenario’s entrypoint for core logic and the primary integration surface for other scenarios and the scenario CLI—treat it as a product.

Optional reading:


0. Why This Skill Exists

In Vrooli, the API is not “just an interface”—it is:

This skill steers toward APIs that are:


1. Scope Boundaries

In scope

Out of scope


2. The Scenario Development Ladder (Where API Fits)

A useful ordering for development clarity:


PRD (what + targets)
↓
Requirements (how targets are met; constraints; failure modes)
↓
Documentation (onboarding + mental model)
↓
API (how other systems and agents use the scenario)
↓
Implementation (services, domain logic, infra)

Steer: If the API is unclear, the implementation will trend toward being unclear too.

A strong API surface forces clean boundaries and makes downstream development faster and safer.


3. Scream the Architecture: Organize APIs by Domain, Not by Mechanics

Goal: A new engineer (or agent) should be able to infer the scenario’s major capabilities by scanning the API directory tree.

Prefer:

Avoid:

3.1 Convergence Pattern: Endpoint Placement Decision Tree

New API operation needed
│
▼
Is it clearly part of an existing domain module?
├─ YES → add to that domain module (keep module cohesive)
└─ NO
│
▼
Is it a cross-cutting concern (auth, health, admin, observability)?
├─ YES → place in a dedicated cross-cutting module
└─ NO
│
▼
Does it represent a new bounded context / capability?
├─ YES → create a new domain module with its own routes + handlers
└─ NO  → refactor: your concept boundaries aren’t clear yet
3.2 Convergence Pattern: Module Size and Responsibility Rules

A module stays healthy when:

Red flags


4. API Shape: Resources, Commands, and Jobs (Make Usage Obvious)

Scenarios commonly need three kinds of operations. Design the API so each kind is unmistakable.

| Operation kind | What it means | Common patterns | Key property |

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

| Query | Read state without side effects | list/get endpoints | Safe + idempotent |

| Command | Change state / trigger side effects | create/update/execute endpoints | Explicit intent |

| Job | Long-running / async work | start + status + result endpoints | Observable progress |

4.1 Resource vs Action: Naming Convergence Table

| If the client is… | Prefer | Example shape |

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

| Managing a domain entity | Resource endpoints | /projects/{id}, /projects:list |

| Triggering a meaningful operation | Command/action endpoint | /projects/{id}:archive, /runs:execute |

| Starting work that may outlive the request | Job endpoints | /imports:start → /imports/{jobId} |

Steer: Avoid “verb soup” routes that encode business logic in URLs without a stable conceptual model.

If you must expose actions, make them explicit and consistent.


5. Proto-First Contracts (Reliability + Interoperability)

Principle: Treat the proto schema as the canonical contract. Generated types should flow through:

This increases reliability by eliminating “stringly typed” drift and enforcing consistent shapes.

Guidance (high-level):

For detailed proto conventions (package naming, field numbering, compat rules, generation workflow), defer to interoperability-steer.


6. Consistency Rules That Make APIs Feel “Professional”

Professional APIs are boring in a good way: predictable, uniform, and easy to compose.

6.1 Error Model Consistency

Steer: Every endpoint should fail in familiar ways and return errors in a consistent shape.

Minimum expectations:

Avoid:

6.2 Pagination, Filtering, Sorting

Pick one canonical approach and use it everywhere.

Convergence checklist:

Avoid:

6.3 Idempotency and Retries

Assume clients (and other scenarios) will retry.

Use idempotency patterns for:

Avoid:

6.4 Authentication and Authorization Consistency

Steer toward:

Avoid:

6.5 Observability Hooks (APIs Must Be Debuggable)

Minimum: consistent structured logging fields such as:

Avoid:


7. Keep the Transport Edge Thin (Handlers Orchestrate)

The API boundary should do boundary work:

It should not:

7.1 Convergence Pattern: Layering Diagram

API Boundary (routes/controllers/handlers)

* parse + validate + auth context + error mapping
* orchestrate a use-case call
  ↓
  Use-cases / Application services
* coordinates domain operations
* handles transactional boundaries if needed
  ↓
  Domain services
* core rules and invariants
  ↓
  Infra adapters (DB, queues, external APIs)

Dependency rule: domain must not depend on API transport details.


8. DRY Without Losing Clarity: Shared Utilities and Singletons

A “professional API” avoids repeated boilerplate while preserving readability.

Examples of good shared primitives:

8.1 Convergence Pattern: Extract Helper Decision Tree

You wrote helper logic in an endpoint
│
▼
Will this logic be used in 2+ endpoints or 2+ modules?
├─ NO → keep it local (optimize for readability)
└─ YES
│
▼
Is it a domain rule?
├─ YES → move to domain/service layer (not API utils)
└─ NO
│
▼
Is it boundary glue (validation, auth, error mapping, pagination)?
├─ YES → extract to shared API utility (canonical)
└─ NO  → consider a dedicated application service helper

Avoid


9. API Evolution: Backward Compatibility Is a Feature

Assume other scenarios and agents depend on you.

9.1 Convergence Pattern: Change Strategy Table

| Desired change | Prefer | Avoid |

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

| Add a new optional field | Additive schema change | Breaking existing consumers |

| Change meaning of a field | New field + deprecate old | Silent semantic change |

| Remove a field/endpoint | Deprecate + migration window | Sudden removal |

| Replace a workflow | New endpoint/version + compat shim | Forcing all clients to update immediately |

Steer: Additive changes scale. Breaking changes create coordination tax.


10. API Documentation and Discoverability

A professional API can be learned quickly.

Minimum expectations:

Avoid:


11. API Coherence Audit (Brownfield-Friendly)

When inheriting or improving an existing scenario API, first establish the current shape.

Audit prompts (what to look for):

Typical red flags:

Document findings in a durable place (e.g., docs/internal/API_NOTES.md or equivalent):


12. Output Expectations

You may:

You must:

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.