Claude-skill-registry backend-error-handling

Backend typed error handling and boundary mapping

install
source · Clone the upstream repo
git clone https://github.com/majiayu000/claude-skill-registry
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/backend-error-handling" ~/.claude/skills/majiayu000-claude-skill-registry-backend-error-handling && rm -rf "$T"
manifest: skills/data/backend-error-handling/SKILL.md
source content

What I do

Je standardise une gestion d'erreurs typée et composable côté backend.

Rules

  • Domain errors : invariants.
  • Application errors : orchestration/policies.
  • Presentation : mapping vers HTTP.

Template

export class NotFoundError extends Error {
  readonly code = 'NOT_FOUND';
}

export function toHttp(err: unknown) {
  if (err instanceof NotFoundError) return { status: 404, body: { message: err.message } };
  return { status: 500, body: { message: 'Internal error' } };
}

When to use

  • Chaque fois qu'un contrôleur commence à contenir des
    if/else
    d'erreurs.