← ClaudeAtlas

server-app-developmentlisted

Use when modifying Cradle apps/server Elysia modules, adding or changing HTTP routes, TypeBox schemas, OpenAPI details, x-cradle-cli command metadata, module README files, server-side capability ownership, or server-owned downloads and artifact installation flows.
wibus-wee/cradle-app · ★ 73 · API & Backend · score 74
Install: claude install-skill wibus-wee/cradle-app
# Server App Development Use this skill for `apps/server` work. Cradle server features are owned by modules under `apps/server/src/modules/{domain}` and exposed through Elysia route modules. ## Core Ownership Rule Every server feature needs a clear owner and namespace: - Put business routes in the owning `modules/{domain}/index.ts`. - Keep shared HTTP/runtime concerns under `src/http`, `src/config`, `src/errors`, `src/database`, or `src/infra`. - Modules may read other namespaces when needed, but should not write data owned by another product namespace. - If a route is for a generated CLI command, the server route still owns the API contract; the CLI only projects that contract. ## Download Workflow 新增或修改涉及远程文件下载的 Server 能力时,默认先评估并优先复用 `DownloadCenterService`,不要直接增加 `fetch()`、`arrayBuffer()`、手写 HTTP stream 或新的下载队列。以下场景应接入 Download Center:HTTP(S) artifact 下载需要排队、进度、取消、重试、大小限制、checksum 校验、断点续传或临时 artifact 交接。 - 由业务 owner 构造 `DownloadRequest`:使用稳定的 `owner.namespace`、`resourceType`、`resourceId` 和面向用户的 `displayName`,并明确 `sources`、`integrity` 与 `maxBytes`。不要让 Download Center 推断业务身份。 - 从 `apps/server/src/app.ts` 注入现有 Download Center;不要在业务 module 内创建第二个实例或第二套任务存储。 - 让 Download Center 拥有队列、传输、重试状态、校验、临时 artifact 和任务历史;让业务 owner 继续拥有 URL/manifest 发现、安装、解压、信任判断、资源状态、最终发布与卸载。 - 仅在业务 owner 已复制或发布 artifact、或失败清理已完成后调用 `release()`。一旦取得 artifact,使用 `try/finally` 或等价的结构覆盖成功与失败路径,避免遗留 staging artifact。 - 由 owner 操作触发 retry,因为只有 owner 知道下载完成后如何继续业务流程。不要新增脱离 owner 的通用 retry/install route。