mcpField
B
backend-logic-expert

backend-logic-expert

github.com/caomeiyourenDevelopment1248 installsUpdated today
Repository

About backend-logic-expert

A backend development skill for MomeiBlog, an AI-driven, natively internationalized blog platform. It guides implementation of Nuxt 4 server handlers and business logic with validation, authorization, error handling, and audit logging.

Key features

  1. 01Write Nuxt 4 Nitro handlers
  2. 02Encapsulate reusable business logic
  3. 03Validate inputs with Zod
  4. 04Apply Better-Auth permission checks
  5. 05Standardize errors and audit logging

Use cases

  1. 01Implement a user login API
  2. 02Add validated and permission-checked server endpoints

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/caomeiyouren/momei --skill backend-logic-expert

After installing, type/backend-logic-expertin Claude Code to confirm it loaded.

Details

From the project README

Backend Logic Expert Skill (后端逻辑专家技能)

核心能力 (Core Capabilities)

  • Nitro Handler: 编写标准的 defineEventHandler,利用 Nuxt 4 的服务端特性。
  • 业务流: 在 server/utils/ 或 server/logic/ 中封装可重用的业务逻辑函数,保持 Handler 简洁。
  • 输入验证: 使用 Zod 编写严格的 Schema,对 query, body, params 进行全量校验。
  • 鉴权与权限: 集成 Better-Auth,在 API 头部强制执行权限检查中间件。
  • 错误处理: 使用 createError 抛出具有语义化错误码和消息的响应。

指令 (Instructions)

  1. 标准化响应: 统一返回格式,严禁直接返回裸数据。
  2. 安全隔离: API 逻辑与持久化逻辑分离,敏感操作必须通过 Service 层进行。
  3. 异步安全: 妥善处理 Promise,避免未捕获的异常导致进程崩溃。
  4. 日志记录: 对关键业务操作记录审计日志。

使用示例 (Usage Example)

输入: "实现用户登录 API。" 动作: 编写 Zod 验证,调用 Better-Auth 接口,并处理登录成功后的 Session 注入。

Comments

Markdown supported