技能 nodejs-backend-patterns
🟢

nodejs-backend-patterns

安全 🌐 網路存取⚡ 包含腳本⚙️ 外部命令📁 檔案系統存取🔑 環境變數

建構生產級 Node.js 後端

建立 Node.js 後端服務需要了解中介軟體模式、認證流程和資料庫整合。本技能提供可立即使用的程式碼模式和架構指導,適用於 Express 和 Fastify 框架。

支援: Claude Codex Code(CC)
⚠️ 68
1

下載技能 ZIP

2

在 Claude 中上傳

前往 設定 → 功能 → 技能 → 上傳技能

3

開啟並開始使用

測試它

正在使用「nodejs-backend-patterns」。 Create an Express server with authentication and rate limiting

預期結果:

  • Server setup with helmet security, cors configuration, and compression middleware
  • Rate limiting using express-rate-limit with Redis store for distributed environments
  • JWT authentication middleware that validates tokens and handles unauthorized errors
  • Request logging middleware using pino for structured logging

正在使用「nodejs-backend-patterns」。 Show me how to structure a Node.js backend with layered architecture

預期結果:

  • Controllers handle HTTP requests and responses
  • Services contain business logic and validation
  • Repositories manage data access and database operations
  • Middleware provides cross-cutting concerns like auth and logging

正在使用「nodejs-backend-patterns」。 How do I connect to PostgreSQL in Node.js with TypeScript?

預期結果:

  • Use pg library with connection pool for efficient database connections
  • Implement repository pattern to abstract database operations
  • Use parameterized queries to prevent SQL injection
  • Handle transactions for atomic operations across multiple queries

安全審計

安全
v4 • 1/17/2026

Pure documentation skill containing code examples and architectural patterns for Node.js backend development. No executable code, no file system access, no network calls, no system command execution. All content is static documentation meant for user reference. Static findings are false positives triggered by example code patterns.

2
已掃描檔案
1,198
分析行數
5
發現項
4
審計總數

風險因素

🌐 網路存取 (6)
⚡ 包含腳本 (1)
⚙️ 外部命令 (47)
📁 檔案系統存取 (11)
🔑 環境變數 (50)
審計者: claude 查看審計歷史 →

品質評分

38
架構
100
可維護性
87
內容
21
社群
100
安全
78
規範符合性

你能建構什麼

建構 REST API

使用 Express 或 Fastify 建立具有適當中介軟體、驗證和錯誤處理的可擴展 REST API

設計後端架構

實作具有控制器、服務、儲存庫和依賴注入模式的分層架構

設定認證

使用 bcrypt 設定 JWT 認證、基於角色的授權和安全密碼處理

試試這些提示

伺服器設定
Show me how to set up an Express.js server with helmet, cors, compression, and request logging middleware
認證中介軟體
Create JWT authentication middleware for Express that validates Bearer tokens and attaches user to request
資料庫模式
Show the repository pattern for PostgreSQL with connection pooling, transaction support, and CRUD operations
錯誤處理
Create a global error handler for Express with custom error classes and proper HTTP status codes

最佳實務

  • 使用 TypeScript 確保類型安全並防止生產級後端中的執行時錯誤
  • 使用自訂錯誤類別和全域錯誤處理器實作適當的錯誤處理
  • 在使用業務邏輯處理之前,使用 Zod 或 Joi 結構描述驗證所有輸入

避免

  • 直接在原始碼中硬編碼密鑰或憑證,而非使用環境變數
  • 使用同步方法或會降低伺服器效能的阻塞操作
  • 在生產環境中返回暴露內部實作細節的詳細錯誤訊息

常見問題

支援哪些 Node.js 框架?
本技能涵蓋使用 TypeScript 的 Express.js 和 Fastify。兩個框架都有豐富的路徑、中介軟體和外掛範例。
建議的資料庫模式是什麼?
涵蓋使用 pg 連線池的 PostgreSQL 和使用 Mongoose ODM 的 MongoDB,包含儲存庫模式和交易支援。
此技能如何與其他工具整合?
模式在結構上是框架無關的。JWT、bcrypt 和 Redis 模式可與任何 Node.js 後端框架搭配使用。
使用此技能時我的資料安全嗎?
是的。本技能是純文件。不會執行任何程式碼、不會存取任何檔案,也不會有資料離開您的環境。
為什麼我的 API 路徑無法運作?
檢查中介軟體順序是否正確、驗證結構描述是否符合請求結構,以及錯誤處理程式是否最後註冊。
這與其他後端技能有何不同?
本技能專注於生產級模式,包括分層架構、依賴注入和企業級錯誤處理模式。