kybes — Know Your Backend
kybes is a Claude Code plugin that makes AI-generated backends predictable. Every project gets the same folders, the same file names and the same data-access methods. There is no duplicated code, and every rule that can be checked automatically is enforced as a hook or a CI step, not left to a prompt.
After a million lines of generated code across different projects, you should still know without searching that src/model/Clienti.cs holds the CRUD, relations and custom queries of the Clienti table. kybes makes that true.
Why
Asking an AI to "follow our architecture" works only some of the time. Instructions get lost when the context grows. Planners and subagents may never see them. Two runs of the same prompt produce two different layouts. kybes takes a different approach:
| Problem | What kybes does |
|---|
| Repetitive code written differently each time | A deterministic generator writes it from a YAML schema, byte-identical across projects |
| Rules forgotten by planners and subagents | Rules are preloaded into dedicated agents and loaded per folder |
| Rules ignored under pressure | Hooks reject non-compliant writes and block completion until checks pass |
| Code duplicated across services | A duplicate-code gate fails the work, and the fix is always to extract |
| Slow queries discovered in production | Every declared access path gets a covering index, computed automatically |
How it works
flowchart LR
S["schemas/db/Clienti.yaml<br/>columns · relations · queries<br/>pagination · transactions<br/>tenancy · archive"] --> G{{"kybes generator<br/>deterministic"}}
G --> CS["C# · EF Core 8<br/>model/Clienti.cs"]
G --> PY["Python · SQLAlchemy 2<br/>model/Clienti.py"]
G --> TS["TypeScript · TypeORM<br/>model/Clienti.ts"]
G --> JV["Java · JPA / Hibernate 6<br/>model/ClientiRepository.java"]
G --> JS["JSON Schema<br/>API Gateway validation"]
G --> DDL["PostgreSQL DDL<br/>+ index analysis"]
G --> JOB["archive & TTL jobs<br/>Parquet · K8s · Athena"]
G --> IDX["MODEL_INDEX.md<br/>where everything is"]
For each table, every language gets two files:
model/generated/<Table> holds the entity, CRUD, relations, declared queries, cursor pagination and validation. It is regenerated and nobody edits it.
model/<Table> is the only place for custom methods of that table. In C# it is a partial class; in the other languages it is a subclass.
Life of a change with Claude Code
sequenceDiagram
autonumber
actor Dev as You
participant A as kybes:architect
participant I as kybes:implementer
participant H as kybes hooks
participant R as kybes:reviewer
Dev->>A: "Add suppliers, linked to products"
A-->>Dev: plan — schema changes, runtimes, reused & new methods
Dev->>I: implement task 1
I->>H: Write schemas/db/Fornitori.yaml
H-->>I: ✓ model regenerated in 4 languages, index updated
I->>H: Write a query with SQLAlchemy inside a Lambda
H-->>I: ✗ denied — data access only through the model
I->>H: Write custom method in model/Fornitori.py
H-->>I: ✓ allowed (name doesn't collide with generated methods)
I->>R: done
R-->>Dev: independent review against the checklist
Note over H: Stop gate: arch_check + gen --check + tests must pass,<br/>otherwise the agent cannot finish
A schema in, the same API out
# schemas/db/Ordini.yaml
table: Ordini
columns:
- { name: Id, type: uuid, primary_key: true }
- { name: Numero, type: string, length: 20, required: true, unique: true }
- { name: ClienteId, type: uuid, required: true }
- { name: Data, type: date, required: true }
relations:
- { name: Cliente, kind: many_to_one, target: Clienti, foreign_key: ClienteId }
queries:
- name: DelClienteDal
where: [ClienteId, { column: Data, op: gte, param: DaData }]
order_by: [{ column: Data, dir: desc }]
pagination:
default_order: [{ column: Data, dir: desc }]
sortable: [Data, Numero]