nuxt-code-editor
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseNuxt Code Editor Skill (Nuxt 代码编辑技能)
Nuxt Code Editor Skill
能力 (Capabilities)
Capabilities
- Vue 3 Composition API: 生成 组件。
<script setup lang="ts"> - PrimeVue 集成: 根据 或现有的
utils/用法正确使用 PrimeVue 组件。components/ - Better-Auth 集成: 正确使用 (前端) 和
authClient(服务端) 进行身份验证和权限控制。auth - 类型安全: 确保所有后端代码使用在 或
server/database/entities中定义的 TypeORM 实体和 DTO。types/ - Zod 校验: 使用 Zod 进行 API 请求参数校验 (参考 )。
utils/schemas/ - 增量编辑: 优先修补 (patch) 而非重写整个文件,以保留上下文。
- Vue 3 Composition API: Generate components.
<script setup lang="ts"> - PrimeVue Integration: Properly use PrimeVue components based on usage in or existing
utils/.components/ - Better-Auth Integration: Correctly use (frontend) and
authClient(server-side) for authentication and permission control.auth - Type Safety: Ensure all backend code uses TypeORM entities and DTOs defined in or
server/database/entities.types/ - Zod Validation: Use Zod for API request parameter validation (refer to ).
utils/schemas/ - Incremental Editing: Prioritize patching over rewriting entire files to preserve context.
指令 (Instructions)
Instructions
- 代码风格指南: 遵守 ESLint 和 Prettier 配置。样式使用 SCSS,并适用 BEM 命名约定。
- 组件标准: 使用 ,
defineProps并配合 TypeScript 接口/类型。defineEmits - 后端标准:
- 确保 处理程序使用
server/api并返回标准化响应 (参考defineEventHandler)。docs/standards/api.md - 禁止使用 PATCH 方法,所有更新操作应使用 PUT 方法。
- 列表类接口必须返回统一的分页格式:(数据列表),
items(总条数),total,page,limit。totalPages
- 确保
- 国际化 (I18n): 所有 UI 字符串必须包裹在 中。
$t()- Key 命名规范: 必须遵循 开发规范 要求的 snake_case (小写+下划线) 命名(现有 kebab-case 字段除外)。
- 文件: 创建文件时,确保它们位于正确的 Nuxt 目录 (,
components,composables等) 中。server/api - 依赖约束: 遵循 中的依赖关系约束,避免循环依赖。
docs/standards/development.md
- Code Style Guide: Adhere to ESLint and Prettier configurations. Use SCSS for styling, following the BEM naming convention.
- Component Standards: Use ,
definePropswith TypeScript interfaces/types.defineEmits - Backend Standards:
- Ensure handlers use
server/apiand return standardized responses (refer todefineEventHandler).docs/standards/api.md - PATCH method is prohibited: All update operations should use the PUT method.
- List-type APIs must return a unified pagination format: (data list),
items(total count),total,page,limit.totalPages
- Ensure
- Internationalization (I18n): All UI strings must be wrapped in .
$t()- Key Naming Convention: Must follow the snake_case (lowercase + underscore) naming requirement specified in Development Standards (except for existing kebab-case fields).
- Files: When creating files, ensure they are placed in the correct Nuxt directories (,
components,composables, etc.).server/api - Dependency Constraints: Follow dependency constraints in to avoid circular dependencies.
docs/standards/development.md
使用示例 (Usage Example)
Usage Example
输入: "创建一个按钮组件。"
动作: 使用 PrimeVue Button 生成 ,并在 TS 接口中定义 props。
components/base/AppButton.vue输入: "创建一个获取文章列表的 API。"
动作: 在 中使用 和 的 Repository 获取数据。
server/api/posts.get.tsdefineEventHandlertypeormInput: "Create a button component."
Action: Generate using PrimeVue Button, and define props in the TS interface.
components/base/AppButton.vueInput: "Create an API to fetch article lists."
Action: Use and TypeORM's Repository to fetch data in .
defineEventHandlerserver/api/posts.get.ts