Agent SkillsAjayIrkal23/agentic-mercy-10x › backend-error-handling

backend-error-handling

GitHub

规范后端错误处理,定义错误分类、统一响应信封及HTTP状态码映射。确保日志安全脱敏,隐藏内部细节,实现服务层与控制器层的职责分离。

skills/backend-error-handling/SKILL.md AjayIrkal23/agentic-mercy-10x

Trigger Scenarios

定义后端错误类或分类体系 设计集中式错误处理器 审查日志记录与安全脱敏行为 将领域错误映射为HTTP状态码

Install

npx skills add AjayIrkal23/agentic-mercy-10x --skill backend-error-handling -g -y
More Options

Use without installing

npx skills use AjayIrkal23/agentic-mercy-10x@backend-error-handling

指定 Agent (Claude Code)

npx skills add AjayIrkal23/agentic-mercy-10x --skill backend-error-handling -a claude-code -g -y

安装 repo 全部 skill

npx skills add AjayIrkal23/agentic-mercy-10x --all -g -y

预览 repo 内 skill

npx skills add AjayIrkal23/agentic-mercy-10x --list

SKILL.md

Frontmatter
{
    "name": "backend-error-handling",
    "schema": 1,
    "category": "backend",
    "surfaces": [
        "backend"
    ],
    "triggers": {
        "paths": [],
        "intents": [
            "backend"
        ],
        "keywords": [
            "backend",
            "behavior",
            "centralized",
            "client-safe",
            "defining",
            "error",
            "handler",
            "handling",
            "logging",
            "mapping",
            "redaction",
            "safe",
            "taxonomy"
        ]
    },
    "platforms": [
        "linux",
        "darwin",
        "windows"
    ],
    "token-cost": 482,
    "description": "ALWAYS invoke when defining backend error taxonomy, centralized handler behavior, safe logging, redaction, or client-safe error mapping.",
    "disable-model-invocation": false
}

Backend Error Handling

Overview

Backend failures must be structured, safe, and predictable.

This skill owns the error taxonomy, centralized handler behavior, and the rule that clients never see raw internal failures.

Use When

  • Defining or reviewing backend error classes.
  • Mapping domain errors to HTTP status codes.
  • Designing centralized error handling.
  • Reviewing safe logging and redaction behavior.

Do Not Use

  • Service/controller boundary questions by themselves.
  • API query semantics by themselves.
  • Performance tuning without error-handling impact.

Standard Error Envelope

{
  "success": false,
  "error": {
    "code": "ERROR_CODE",
    "message": "Safe user-facing message",
    "details": {}
  }
}

Rules:

  • success must be false
  • error.code is required
  • message must be safe for clients
  • details is optional and should stay narrow

Status Code Rules

  • 400 validation
  • 401 unauthorized
  • 403 forbidden
  • 404 not found
  • 409 conflict
  • 429 rate limited
  • 500 internal error

Centralized Handler Rules

  • Normalize internal errors into the public error envelope.
  • Log safely.
  • Hide stack traces and internal implementation details from clients.
  • Keep controllers from building ad hoc error payloads unless they are only delegating to a shared formatter.

Service Rules

  • Services throw typed domain errors.
  • Services do not send transport responses.
  • Services do not swallow failures silently.

Logging Rules

  • Log enough context to debug.
  • Do not log secrets, tokens, or sensitive payloads carelessly.
  • Redact internal details before anything can surface to clients.

Combine With

  • api-contract-standards for envelope compatibility.
  • service-layer-standards for where errors should originate.

References

  • Use references/full-guide.md for the longer strict version with class patterns and more detailed rules.

Version History

  • 581d130 Current 2026-07-19 09:04

Same Skill Collection

attic/2026-07-09/skills-pre-update/taste-skill/SKILL.md
attic/2026-07-09/skills-pre-update/ui-ux-pro-max/SKILL.md
skills/agent-development/SKILL.md
skills/api-and-interface-design/SKILL.md
skills/api-contract-standards/SKILL.md
skills/architect-system-design/SKILL.md
skills/backend-api-standards/SKILL.md
skills/backend-code-review/SKILL.md
skills/backend-performance-standards/SKILL.md
skills/backend-standards-always-follow/SKILL.md
skills/canary-playwright/SKILL.md
skills/caveman/SKILL.md
skills/ci-cd-and-automation/SKILL.md
skills/code-execution-standard/SKILL.md
skills/code-review-and-quality/SKILL.md
skills/code-simplification/SKILL.md
skills/codebase-design/SKILL.md
skills/codebase-start-point-guide/SKILL.md
skills/command-development/SKILL.md
skills/composition-patterns/SKILL.md
skills/context-engineering/SKILL.md
skills/dead-code-and-change-audit/SKILL.md
skills/debug-investigation/SKILL.md
skills/debugging-and-error-recovery/SKILL.md
skills/deprecation-and-migration/SKILL.md
skills/design-extract/SKILL.md
skills/design-review-playwright/SKILL.md
skills/diagnose/SKILL.md
skills/documentation-and-adrs/SKILL.md
skills/domain-modeling/SKILL.md
skills/domain-scaffold-patterns/SKILL.md
skills/doubt-driven-development/SKILL.md
skills/dox-doc-tree/SKILL.md
skills/eval-harness/SKILL.md
skills/fix-lint-format/SKILL.md
skills/forensic-change-coupling/SKILL.md
skills/forensic-complexity-trends/SKILL.md
skills/forensic-debt-quantification/SKILL.md
skills/forensic-hotspot-finder/SKILL.md
skills/frontend-api-standards/SKILL.md
skills/frontend-code-review/SKILL.md
skills/frontend-response-handling/SKILL.md
skills/frontend-server-data-patterns/SKILL.md
skills/frontend-standards-always-follow/SKILL.md
skills/frontend-structure-standards/SKILL.md
skills/frontend-ui-engineering/SKILL.md
skills/git-workflow-and-versioning/SKILL.md
skills/golang-patterns/SKILL.md
skills/golang-testing/SKILL.md

Metadata

Files
0
Version
fc73590
Hash
93ba5520
Indexed
2026-07-19 09:04

- 위키
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-03 12:23
浙ICP备14020137号-1 $방문자$