스킬 pitfalls-express-api
🛣️

pitfalls-express-api

안전 🌐 네트워크 접근📁 파일 시스템 액세스⚙️ 외부 명령어

使用正確的 REST 模式建構 Express API

Express API 開發經常導致路由不一致、狀態碼錯誤以及儲存邏輯緊密耦合。此技能提供經過驗證的 RESTful 路由、HTTP 狀態碼、儲存介面和背景工作管理模式。

지원: Claude Codex Code(CC)
📊 69 적절함
1

스킬 ZIP 다운로드

2

Claude에서 업로드

설정 → 기능 → 스킬 → 스킬 업로드로 이동

3

토글을 켜고 사용 시작

테스트해 보기

"pitfalls-express-api" 사용 중입니다. Create a users API with CRUD operations

예상 결과:

  • GET /api/users - Returns list of users (200)
  • GET /api/users/:id - Returns single user (200) or not found (404)
  • POST /api/admin/users - Creates user (201) with validation
  • PATCH /api/admin/users/:id - Updates user (200) or not found (404)
  • DELETE /api/admin/users/:id - Deletes user (204)

"pitfalls-express-api" 사용 중입니다. How should I handle status codes for a PATCH endpoint?

예상 결과:

  • 200 OK on successful update with modified data
  • 404 Not Found when resource does not exist
  • 400 Bad Request when validation fails
  • 204 No Content is not recommended for PATCH as the response typically includes updated data

"pitfalls-express-api" 사용 중입니다. Create a storage interface for products

예상 결과:

  • interface IStorage with getProducts, getProduct, createProduct, updateProduct, deleteProduct methods
  • DbStorage class implementing PostgreSQL backend
  • MemStorage class implementing in-memory storage for testing
  • Generic CRUD operations using TypeScript types

보안 감사

안전
v5 • 1/16/2026

This is a pure documentation skill containing only TypeScript code examples in markdown. The static scanner triggered on markdown code block backticks and function naming conventions that have no security implications. All 41 findings are false positives caused by the scanner misinterpreting documentation syntax as code patterns.

2
스캔된 파일
296
분석된 줄 수
3
발견 사항
5
총 감사 수

위험 요인

🌐 네트워크 접근 (1)
📁 파일 시스템 액세스 (1)
⚙️ 외부 명령어 (5)
감사자: claude 감사 이력 보기 →

품질 점수

38
아키텍처
100
유지보수성
85
콘텐츠
20
커뮤니티
100
보안
91
사양 준수

만들 수 있는 것

建構一致的 API

在建立新的 Express 路由和端點時,應用 REST 慣例和狀態碼模式。

審查 API 實作

驗證現有的 Express API 是否遵循路由結構和錯誤處理的最佳實踐。

設計儲存介面

建立抽象的儲存層,支援不同的後端並便於測試。

이 프롬프트를 사용해 보세요

新 API 路由
Create a new Express route for [resource] following REST conventions. Include validation, proper status codes, and error handling.
審查路由
Review these Express routes for REST compliance, correct status codes, and missing validation. Point out any anti-patterns.
儲存模式
Design a TypeScript storage interface for [entity] with create, read, update, delete operations. Include an in-memory implementation for testing.
背景工作
Add a background job to my Express app that runs every 5 minutes. Include proper cleanup on process exit and overlap protection.

모범 사례

  • 使用適當的驗證中介軟體分離公開路由和管理員路由
  • 在處理之前始終使用中介軟體驗證請求主體
  • 定義儲存介面以抽象資料庫實作細節
  • 在程序終止訊號時清理背景工作間隔

피하기

  • 在類似操作中使用不一致的 HTTP 狀態碼
  • 在建立和更新端點上跳過輸入驗證
  • 直接在路由處理器中實作儲存邏輯
  • 在沒有保護的情況下執行重疊的背景工作

자주 묻는 질문

此技能是否適用於 Express v5?
是的。這些模式與版本無關,適用於 Express v4 和 v5。
此技能建議使用哪些狀態碼?
GET: 200/404, POST: 201/400, PATCH: 200/404/400, DELETE: 204/404.
我可以將這些模式用於其他框架嗎?
路由和狀態碼模式適用於任何 REST API。儲存介面適用於任何後端。
使用此技能時我的資料安全嗎?
是的。此技能僅提供指導模式。它不會存取檔案或向外部傳送資料。
為什麼我的路由驗證失敗?
確保 validateBody 中介軟體已定義並在路由處理器之前呼叫。檢查架構定義。
這與文件有何不同?
此技能提供為 Claude 和 Codex 量身定制的即用模式、檢查清單和程式碼範例。

개발자 세부 정보

파일 구조

📄 SKILL.md