Skip to content

πŸͺ’ Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

docs(agents): document versioned API type location convention (#14080)

Niklas Semmler0219baba5087
diff --git a/.agents/skills/backend-dev-guidelines/references/routing-and-controllers.md b/.agents/skills/backend-dev-guidelines/references/routing-and-controllers.md
index 139fe511b8..60c7c290df 100644
--- a/.agents/skills/backend-dev-guidelines/references/routing-and-controllers.md
+++ b/.agents/skills/backend-dev-guidelines/references/routing-and-controllers.md
@@ -362,10 +362,34 @@ export default withMiddlewares({
- Input/output validated with Zod schemas
- Delegate to services for business logic
+### Versioned API Type Location
+
+When a feature has versioned public API types, place them in `packages/shared/`
+under the feature's `interfaces/api/` folder, one subdirectory per version.
+The scores feature (`packages/shared/src/features/scores/interfaces/api/`) is
+the canonical example β€” the `GetScoresQueryV1` / `GetScoresResponseV1` symbols
+imported from `@langfuse/shared` originate there.
+
+Do not create a flat file (e.g. `<domain>-api-v2.ts`) and do not place
+versioned types in `web/src/features/public-api/types/`.
+
+```
+packages/shared/src/features/<domain>/interfaces/api/
+β”œβ”€β”€ v1/
+β”‚ β”œβ”€β”€ schemas.ts # Zod schemas for request/response shapes
+β”‚ β”œβ”€β”€ endpoints.ts # Composed request/response types
+β”‚ └── validation.ts # Cross-field validation helpers
+β”œβ”€β”€ v2/
+β”‚ └── ...
+└── vN/
+ └── ...
+```
+
### Fern API Definitions
-When modifying public API types in `web/src/features/public-api/types/`, update
-the matching Fern API definitions in `fern/apis/server/definition/`.
+When modifying public API types in `web/src/features/public-api/types/` or under
+`packages/shared/src/features/<domain>/interfaces/api/`, update the matching
+Fern API definitions in `fern/apis/server/definition/`.
**Zod to Fern Type Mapping:**