mcpField
N
nextjs-nestjs-integration

nextjs-nestjs-integration

github.com/xirothedev开发290 次安装24 周前更新
代码仓库

关于 nextjs-nestjs-integration

用于协调 Next.js 应用与 NestJS API 的技能,帮助开发者明确后端职责、遵循 API 契约,并协调两端部署边界。

主要功能

  1. 01生成和使用 OpenAPI 客户端
  2. 02划分 Next.js 与 NestJS 职责
  3. 03传递会话与身份验证上下文
  4. 04配置 CORS、代理和 API 来源
  5. 05规范 Server Component 数据获取
  6. 06协调部署与环境变量

适用场景

  1. 01判断逻辑应放在 Next.js 还是 NestJS
  2. 02向 NestJS API 传递身份验证上下文
  3. 03在 Server Component 中获取 API 数据
  4. 04协调 Docker 与部署设置

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/xirothedev/skills --skill nextjs-nestjs-integration

安装后在 Claude Code 中输入/nextjs-nestjs-integration确认已加载。

包含的文件

除 SKILL.md 外,安装时一起下载的参考资料和脚本。

AGENTS.md
metadata.json
test-cases.json
dataset/integration/cors-proxy-contract/
correct.ts
incorrect.ts
notes.md
dataset/integration/deployment-split/
correct.ts
incorrect.ts
notes.md
dataset/integration/openapi-client-boundary/
correct.ts
incorrect.ts
notes.md
dataset/integration/server-component-fetching/
correct.tsx
incorrect.tsx
notes.md
dataset/integration/session-propagation/
correct.ts
incorrect.ts
notes.md
dataset/integration/shared-env-contract/
correct.ts
incorrect.ts
notes.md
references/
_sections.md
integration-cors-proxy-contract.md
integration-deployment-split.md
integration-openapi-client-boundary.md
integration-server-component-fetching.md
integration-session-propagation.md
integration-shared-env-contract.md
sources/
inventory.json

详细介绍

Next.js NestJS 集成

当项目同时包含 Next.js 应用和 NestJS API 时,使用此技能。主要任务是明确职责边界,避免 Web 应用意外重复实现后端策略、绕过 API 契约,或在构建时自行发起请求。

适用场景

在以下情况使用此技能:

  • 从 NestJS OpenAPI 文档生成或使用类型化客户端
  • 判断逻辑应放在 Next.js Route Handlers/Server Actions,还是 NestJS 控制器/服务中
  • 将身份验证/会话上下文从 Next.js 传递给 NestJS
  • 配置 CORS、Cookie、Proxy、重写规则或内部 API 源
  • 从 Server Components 获取 NestJS 数据,而不调用 Next.js 应用自身的 Route Handlers
  • 在应用之间协调 Docker、环境变量、健康检查和部署拓扑

按需加载

从此文件开始。仅在任务需要时加载详细文件:

references/_sections.md
references/integration-openapi-client-boundary.md
references/integration-session-propagation.md
references/integration-cors-proxy-contract.md
references/integration-server-component-fetching.md
references/integration-shared-env-contract.md
references/integration-deployment-split.md
dataset/integration/openapi-client-boundary/correct.ts
sources/inventory.json

每个规则文件都包含:

  • 该模式为何重要
  • 错误和正确示例
  • 含有更完整 TypeScript 示例的数据集路径
  • 官方来源参考

按优先级划分的规则类别

优先级类别影响前缀
1集成边界严重integration-
2API 契约严重api-
3部署与运维高deploy-

来源策略

当工作涉及两个应用时,将此技能与 nextjs-secure-bff、nextjs-production-platform 和 nestjs-production-api-contracts 配合使用。Next.js 和 NestJS 官方文档的优先级高于与框架无关的单体仓库示例。

评论

支持 Markdown