Loading...
Loading...
Compare original and translation side by side
/oh-my-claudecode:ralph/oh-my-claudecode:ralphundefinedundefined
If NONE found: **STOP. This skill does not apply.** Inform user.
If found: proceed with architecture enforcement.
如果未找到任何标识:**停止操作,本规范不适用于当前项目,请告知用户。**
如果找到标识:继续执行架构校验流程。architecture-rules.mdrules/conventions.mdrules/routes.mdrules/services.mdrules/hooks.mdarchitecture-rules.mdrules/conventions.mdrules/routes.mdrules/services.mdrules/hooks.mdRoutes -> Server Functions -> Features -> Database| Check | Rule |
|---|---|
| Route accessing DB directly? | BLOCKED. Must go through Server Functions -> Features |
| Route calling Prisma? | BLOCKED. Use Server Functions |
| Server Function skipping Features? | ALLOWED only for simple CRUD |
| Client calling Server Function directly? | BLOCKED. Use TanStack Query (exception: |
Routes -> Server Functions -> Features -> Database| 检查项 | 规则 |
|---|---|
| 路由是否直接访问数据库? | 禁止,必须走Server Functions -> Features层 |
| 路由是否调用Prisma? | 禁止,请使用Server Functions |
| Server Function是否跳过Features层? | 仅简单CRUD场景允许 |
| 客户端是否直接调用Server Function? | 禁止,请使用TanStack Query(例外: |
| Check | Rule |
|---|---|
Flat file route? ( | BLOCKED. Use folder ( |
Missing | BLOCKED. Every page needs it |
Missing | BLOCKED. Every page needs it |
Missing | BLOCKED. Every page needs it |
| BLOCKED. Must be |
| Logic in page component? | BLOCKED. Extract to |
Layout route missing | BLOCKED. Routes needing beforeLoad/loader must have |
Route with search params but no | BLOCKED. Must use |
Route without | WARNING. Recommended for all routes with loaders |
| 检查项 | 规则 |
|---|---|
是否为扁平文件路由?( | 禁止,请使用文件夹结构( |
是否缺失 | 禁止,每个页面必须包含该文件夹 |
是否缺失 | 禁止,每个页面必须包含该文件夹 |
是否缺失 | 禁止,每个页面必须包含该文件夹 |
| 禁止,必须写为 |
| 页面组件中是否包含业务逻辑? | 禁止,提取到 |
布局路由是否缺失 | 禁止,需要使用beforeLoad/loader的路由必须有 |
路由使用搜索参数但没有配置 | 禁止,必须结合 |
路由没有配置 | 警告,建议所有带loader的路由都配置该属性 |
| Check | Rule |
|---|---|
POST/PUT/PATCH without | BLOCKED |
Auth-required without | BLOCKED |
Using | BLOCKED. |
| handler not last in chain? | BLOCKED. handler must ALWAYS be last (middleware/inputValidator order is flexible) |
Missing | BLOCKED. Use |
| Direct server function call in component? | BLOCKED. Use |
| BLOCKED. Tree shaking failure |
| 检查项 | 规则 |
|---|---|
POST/PUT/PATCH请求是否没有配置 | 禁止 |
需要鉴权的接口是否没有配置 | 禁止 |
是否使用 | 禁止, |
| handler是否不在调用链末尾? | 禁止,handler必须始终放在最后(middleware/inputValidator的顺序可灵活调整) |
搜索参数是否缺失 | 禁止,请使用 |
| 组件中是否直接调用Server Function? | 禁止,请使用 |
是否存在 | 禁止,会导致tree shaking失效 |
| Check | Rule |
|---|---|
| Hook inside page component? | BLOCKED. Must be in |
| Wrong hook order? | BLOCKED. State -> Global -> Server Fns -> Query -> Handlers -> Memo -> Effect |
| Missing return type interface? | BLOCKED |
| camelCase hook filename? | BLOCKED. Use |
| 检查项 | 规则 |
|---|---|
| Hook是否写在页面组件内部? | 禁止,必须放在 |
| Hook内部调用顺序是否错误? | 禁止,顺序必须为:State -> Global -> Server Fns -> Query -> Handlers -> Memo -> Effect |
| 是否缺失返回类型定义? | 禁止 |
| Hook文件名是否为驼峰命名? | 禁止,请使用 |
| Check | Rule |
|---|---|
| camelCase filename? | BLOCKED. Use kebab-case |
| BLOCKED. Use const arrow function |
| BLOCKED. Use |
| Missing explicit return type? | BLOCKED |
| Wrong import order? | BLOCKED. External -> @/ -> Relative -> Type |
| Missing Korean block comments? | BLOCKED for code groups |
Using | BLOCKED. Use Zod 4.x |
| 检查项 | 规则 |
|---|---|
| 文件名是否为驼峰命名? | 禁止,请使用短横线分隔命名 |
是否使用 | 禁止,请使用const箭头函数 |
是否使用 | 禁止,请使用 |
| 是否缺失显式返回类型? | 禁止 |
| 导入顺序是否错误? | 禁止,顺序必须为:外部依赖 -> @/别名导入 -> 相对路径导入 -> 类型导入 |
| 是否缺失韩文块注释? | 代码组必须添加,禁止缺失 |
是否使用 | 禁止,请直接使用Zod 4.x的 |
- [ ] Layer architecture respected (no layer skipping)
- [ ] Route uses folder structure with -components/, -hooks/, -functions/
- [ ] export const Route = createFileRoute(...) used
- [ ] Server Functions use correct chaining (handler always last, middleware/inputValidator flexible)
- [ ] Search params use zodValidator from @tanstack/zod-adapter
- [ ] Custom Hooks in -hooks/ with correct internal order
- [ ] All filenames kebab-case
- [ ] Korean block comments present
- [ ] const arrow functions with explicit return types- [ ] 遵守分层架构要求(无跨层调用)
- [ ] 路由使用文件夹结构,包含`-components/`、`-hooks/`、`-functions/`
- [ ] 使用`export const Route = createFileRoute(...)`写法
- [ ] Server Functions使用正确的调用链(handler始终在末尾,middleware/inputValidator顺序灵活)
- [ ] 搜索参数使用`@tanstack/zod-adapter`提供的`zodValidator`
- [ ] 自定义Hook放在`-hooks/`文件夹中,内部调用顺序正确
- [ ] 所有文件名使用短横线分隔命名
- [ ] 存在韩文块注释
- [ ] 使用const箭头函数并声明显式返回类型ls-components/-hooks/-functions/export const Routefunctionls-components/-hooks/-functions/export const Routefunctionsrc/
├── routes/ # File-based routing
│ └── <page>/
│ ├── index.tsx # Page (UI only)
│ ├── route.tsx # Layout (beforeLoad, loader)
│ ├── -components/ # REQUIRED: page components
│ ├── -hooks/ # REQUIRED: page hooks (ALL logic here)
│ ├── -functions/ # REQUIRED: page server functions
│ └── -sections/ # Optional: 200+ line pages
├── features/<domain>/ # Internal domain (Prisma queries)
│ ├── schemas.ts
│ ├── queries.ts
│ └── mutations.ts
├── services/<provider>/ # External SDK wrappers
├── functions/ # Global server functions (NO index.ts!)
│ └── middlewares/
├── database/ # Prisma client singleton
├── stores/ # Zustand stores
├── hooks/ # Global hooks
├── components/ # Shared UI
│ ├── ui/ # shadcn/ui
│ ├── layout/ # Header, Sidebar, Footer
│ └── shared/ # Common components
├── types/ # Global types
├── env/ # t3-env validation
├── config/ # auth, query-client, sentry
└── lib/ # Utilities
├── utils/
├── constants/
└── validators/src/
├── routes/ # 基于文件的路由
│ └── <page>/
│ ├── index.tsx # 页面(仅UI代码)
│ ├── route.tsx # 布局(beforeLoad、loader逻辑)
│ ├── -components/ # 必填:页面专属组件
│ ├── -hooks/ # 必填:页面专属hooks(所有逻辑放在此处)
│ ├── -functions/ # 必填:页面专属server functions
│ └── -sections/ # 可选:代码超过200行的页面拆分模块
├── features/<domain>/ # 内部领域层(Prisma查询逻辑)
│ ├── schemas.ts
│ ├── queries.ts
│ └── mutations.ts
├── services/<provider>/ # 外部SDK封装层
├── functions/ # 全局server functions(禁止添加index.ts!)
│ └── middlewares/
├── database/ # Prisma client单例
├── stores/ # Zustand stores
├── hooks/ # 全局hooks
├── components/ # 共享UI组件
│ ├── ui/ # shadcn/ui组件
│ ├── layout/ # 头部、侧边栏、底部组件
│ └── shared/ # 通用组件
├── types/ # 全局类型定义
├── env/ # t3-env校验
├── config/ # auth、query-client、sentry配置
└── lib/ # 工具函数
├── utils/
├── constants/
└── validators/| Mistake | Fix |
|---|---|
| |
| |
| |
| Logic in page component | Extract to |
| Use |
| Import directly from individual files |
| Hook with mixed order | Follow: State -> Global -> Server Fns -> Query -> Handlers -> Memo -> Effect |
| |
| |
Direct Zod schema in | Use |
Server function call without | Use |
| Use |
Missing | Add |
| 错误写法 | 修复方案 |
|---|---|
| |
| |
| |
| 页面组件中包含业务逻辑 | 提取到 |
| 使用 |
| 直接从单个文件导入 |
| Hook内部调用顺序混乱 | 遵循:State -> Global -> Server Fns -> Query -> Handlers -> Memo -> Effect |
| |
| |
| 使用 |
不通过 | 组件中使用 |
| 使用 |
路由缺失 | 添加 |
@/database/prismaexportconst RouteuseStateuseQuery.validator().inputValidator()any/api-hooks/validateSearchuseServerFncreateMiddleware(){ type: 'function' }@/database/prismaconst RouteexportuseStateuseQuery.validator().inputValidator()any/api-hooks/validateSearchuseServerFncreateMiddleware(){ type: 'function' }