crud
Skill193 starsChanged 4 months agoMITView on GitHub
创建或修改 CRUD 模块。当需要创建新的增删改查 API、修改现有路由模块、添加新字段、新增接口、或用户请求"创建/修改 XX 管理"时使用
2 other projects use a version of this.
Adopted by
Most recently taken up by
- maxwell2732/claudecode-research-harness-workflowtheir own version, first seen Nov 15, 2026
- efficience-it/claude-skills-phptheir own version, first seen Mar 31, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- maxwell2732/claudecode-research-harness-workflow★ 42same name
- efficience-it/claude-skills-php★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository29 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- bullmqSkill
- create-tierSkill
- crudSkill
- db-schemaSkill
- drizzle-v1Skill
- effect-v4Skill
- openspec-apply-changeSkill
- openspec-archive-changeSkill
- openspec-exploreSkill
- openspec-proposeSkill
- source-command-opsx-applySkill
- source-command-opsx-archiveSkill
- source-command-opsx-exploreSkill
- source-command-opsx-proposeSkill
- bullmqSkill
- create-tierSkill
- db-schemaSkill
- drizzle-v1Skill
- effect-v4Skill
- openspec-apply-changeSkill
- openspec-archive-changeSkill
- openspec-exploreSkill
- openspec-proposeSkill
- openspec-apply-changeSkill
- openspec-archive-changeSkill
- openspec-exploreSkill
- openspec-proposeSkill
The file
Files
CRUD 模块生成/修改指南
模块文件结构
src/routes/{tier}/{category}/{feature}/
├── {feature}.index.ts # 必需:路由入口
├── {feature}.routes.ts # 必需:OpenAPI 路由定义
├── {feature}.handlers.ts # 必需:处理器实现
├── {feature}.types.ts # 必需:类型定义
├── {feature}.schema.ts # 可选:Zod 验证
├── {feature}.services.ts # 可选:复杂业务逻辑或模块内复用
└── __tests__/ # 可选:单元测试路由层级
| Tier | 路径前缀 | 认证 | 说明 |
| public | /api/public/* | 无 | 公开接口 |
| client | /api/client/* | JWT | 客户端用户 |
| admin | /api/admin/* | JWT + RBAC + 审计 | 后台管理 |
生成步骤
1. 数据库 Schema(如需新表)
参考 db-schema.md
// src/db/schema/{tier}/{category}/{feature}.ts
export const {feature}s = pgTable("{tier}_{feature}s", {
...baseColumns,
// 字段定义...
});2. 类型文件
参考 templates/types.md
3. Schema 文件
参考 zod-schema.md
4. 路由文件
参考 templates/routes.md
5. 处理器文件
参考 templates/handlers.md
6. 入口文件
// {feature}.index.ts
import { createRouter } from "@/lib/core/create-app";
import * as handlers from "./{feature}.handlers";
import * as routes from "./{feature}.routes";
export default createRouter()
.openapi(routes.list, handlers.list)
.openapi(routes.create, handlers.create)
.openapi(routes.get, handlers.get)
.openapi(routes.update, handlers.update)
.openapi(routes.remove, handlers.remove);关键规则
响应包装(必须)
return c.json(Resp.ok(data), HttpStatusCodes.OK);
return c.json(Resp.fail("错误信息"), HttpStatusCodes.BAD_REQUEST);日志格式(必须)
logger.info({ userId }, "[模块名]: 操作描述");
// 数据对象放第一个参数审计字段
- 创建时设置
createdBy: sub - 更新时设置
updatedBy: sub sub从c.get("jwtPayload")获取
命名约定
- 文件:kebab-case(
user-roles.ts) - 类型:PascalCase(
SystemUserRouteHandlerType) - 枚举值:UPPER_SNAKE_CASE(
Status.ENABLED)
完整示例
参考 examples/dicts.md 查看完整的 dicts 模块实现。
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

