/universal-dev-standards:error-code-guidefrom universal-dev-standards
Designs consistent error codes following the PREFIX_CATEGORY_NUMBER format. Useful when defining error codes, creating error handling, or designing APIs.
Ships in universal-dev-standards. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Language: English | 繁體中文
Version: 1.0.0 Last Updated: 2025-12-30 Applicability: Claude Code Skills
Core Standard: This skill implements Error Code Standards. For comprehensive methodology documentation, refer to the core standard.
This skill helps design consistent error codes following the standard format, enabling better debugging, monitoring, and user experience.
<PREFIX>_<CATEGORY>_<NUMBER>
| Component | Description | Example |
|---|---|---|
| PREFIX | Application/service identifier | AUTH, PAY, USR |
| CATEGORY | Error category | VAL, SYS, BIZ |
| NUMBER | Unique numeric identifier | 001, 100, 404 |
AUTH_VAL_001 → Authentication validation error
PAY_SYS_503 → Payment system unavailable
USR_BIZ_100 → User business rule violation
API_NET_408 → API network timeout
| Category | Full Name | Description | HTTP Status |
|---|---|---|---|
| VAL | Validation | Client input validation failures | 400 |
| BIZ | Business | Business rule violations | 422 |
| SYS | System | Internal system failures | 500 |
| NET | Network | Communication failures | 502/503/504 |
| AUTH | Auth | Security-related errors | 401/403 |
| Range | Description | Example |
|---|---|---|
| *_VAL_001-099 | Field validation | Missing required field |
| *_VAL_100-199 | Format validation | Invalid email format |
| *_VAL_200-299 | Constraint validation | Password too short |
| *_BIZ_001-099 | State violations | Order already cancelled |
| *_BIZ_100-199 | Rule violations | Cannot return after 30 days |
| *_BIZ_200-299 | Limit violations | Daily limit exceeded |
| *_AUTH_001-099 | Authentication | Invalid credentials |
| *_AUTH_100-199 | Authorization | Insufficient permissions |
| *_AUTH_200-299 | Token/session | Token expired |
| Category | HTTP Status | Description |
|---|---|---|
| VAL | 400 | Bad Request |
| BIZ | 422 | Unprocessable Entity |
| AUTH (001-099) | 401 | Unauthorized |
| AUTH (100-199) | 403 | Forbidden |
| SYS | 500 | Internal Server Error |
| NET | 502/503/504 | Gateway errors |
For complete standards, see:
For AI assistants, use the YAML format files for reduced token usage:
ai/standards/error-codes.ai.yaml{
"success": false,
"error": {
"code": "AUTH_VAL_001",
"message": "Email is required",
"field": "email",
"requestId": "req_abc123"
}
}
{
"success": false,
"errors": [
{
"code": "AUTH_VAL_001",
"message": "Email is required",
"field": "email"
},
{
"code": "AUTH_VAL_201",
"message": "Password must be at least 8 characters",
"field": "password"
}
],
"requestId": "req_abc123"
}
interface ApplicationError {
// Core fields
code: string; // "AUTH_VAL_001"
message: string; // Technical message for logs
// User-facing
userMessage: string; // Localized user message
userMessageKey: string; // i18n key: "error.auth.val.001"
// Context
field?: string; // Affected field: "email"
details?: object; // Additional context
// Debugging
timestamp: string; // ISO 8601
requestId: string; // Correlation ID
}
error.<prefix>.<category>.<number>
# en.yaml
error:
auth:
val:
001: "Email is required"
101: "Invalid email format"
auth:
001: "Invalid credentials"
# zh-TW.yaml
error:
auth:
val:
001: "電子郵件為必填欄位"
101: "電子郵件格式無效"
auth:
001: "帳號或密碼錯誤"
AUTH_VAL_001 // Missing required field: email
AUTH_VAL_101 // Invalid email format
ORDER_BIZ_001 // Order already cancelled
ORDER_BIZ_201 // Daily purchase limit exceeded
DB_SYS_001 // Database query failed
SEC_AUTH_001 // Invalid credentials
SEC_AUTH_201 // Token expired
ERR_001 // Too vague, no prefix or category
INVALID // Not descriptive
error // Not a code
AUTH_ERROR // Missing number
This skill supports project-specific configuration.
CONTRIBUTING.md for error code guidelinesIf no error code standard found:
errors/registry.ts:export const ErrorCodes = {
AUTH_VAL_001: {
code: 'AUTH_VAL_001',
httpStatus: 400,
messageKey: 'error.auth.val.001',
description: 'Email field is required',
},
// ... more codes
} as const;
After /errors completes, the AI assistant should suggest:
錯誤碼設計已完成。建議下一步 / Error code design completed. Suggested next steps:
- 執行
/sdd將錯誤碼設計納入正式規格 ⭐ Recommended / 推薦 — 確保錯誤碼在規格中有完整定義 / Ensure error codes are fully defined in specs- 執行
/logging設定結構化日誌以配合錯誤碼 — 讓錯誤碼與日誌系統整合 / Integrate error codes with logging system- 執行
/tdd為錯誤處理邏輯撰寫測試 — 確保每個錯誤碼都有對應的測試 / Ensure each error code has corresponding tests
| Version | Date | Changes |
|---|---|---|
| 1.0.0 | 2025-12-30 | Initial release |
This skill is released under CC BY 4.0.
Source: universal-dev-standards
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
asiaostrich-universal-dev-standards@cascade-code-general-misc-3 is listed by joshuarweaver/cascade-code-general-misc-3 — review the source before installing
npx claudepluginhub joshuarweaver/cascade-code-general-misc-3 --plugin asiaostrich-universal-dev-standards57 skills in this plugin
/ac-coverage[UDS] Analyze AC-to-test traceability and generate requirement-level coverage reports.
Use when: auditing which acceptance criteria have tests, building a traceability matrix from a SPEC file, finding uncovered AC before release.
Not for: code-level line/branch/function coverage — use /coverage; writing the missing tests — use /tdd or /spec-derive.
Keywords: AC coverage, traceability, acceptance criteria, SPEC, traceability matrix, 驗收條件, 需求追蹤, 覆蓋率矩陣.
/adr[UDS] Create, manage, and track Architecture Decision Records (ADR).
Use when: architecture decisions, technology choices, design trade-offs, pattern selection.
Not for: decisions that do not change architecture — record them in the spec or commit; ideas not yet formed enough to decide — use /brainstorm.
Keywords: ADR, architecture decision, decision record, trade-off.
/ai-collaboration-standardsPrevent AI hallucination and ensure evidence-based responses when analyzing code or making suggestions.
Use when: analyzing code, making recommendations, providing options, or when user asks about confidence/certainty.
Not for: authoring the AI instruction files themselves — use /ai-instruction-standards; reviewing a concrete diff — use /code-review.
Keywords: certainty, assumption, inference, evidence, source.
/ai-friendly-architectureDesign AI-friendly architecture with explicit patterns, layered documentation, and semantic boundaries.
Use when: structuring projects for AI collaboration, optimizing codebase for AI analysis, setting up AI context.
Not for: writing the instruction files — use /ai-instruction-standards; language-conventional directory layout — use /project-structure-guide.
Keywords: architecture, AI-friendly, context, modules, documentation layers, .ai-context.yaml.
/ai-instruction-standardsCreate and maintain AI instruction files (CLAUDE.md, AGENTS.md, .cursor/rules/, etc.) with proper structure.
Use when: creating AI instruction files, separating universal vs project-specific rules, configuring AI tools.
Not for: shaping the codebase so AI can navigate it — use /ai-friendly-architecture; enforcing evidence-based answers — use /ai-collaboration-standards.
Keywords: CLAUDE.md, AGENTS.md, cursorrules, windsurfrules, clinerules, AI instructions, system prompt.
/api-designGuide API design following REST, GraphQL, and gRPC best practices.
Use when: designing APIs, reviewing endpoints, API versioning decisions.
Not for: verifying a running API against its consumers — use /contract-test; schema design behind the API — use /database.
Keywords: API, REST, GraphQL, gRPC, endpoint, versioning.
Other plugins' skills for the same job