Agent skill

Tsed Exceptions

by tsedio in tsedio/tsed

Handle errors and shape responses in a Ts.ED v8 application with @tsed/exceptions, exception filters from @tsed/platform-exceptions and response filters from @tsed/platform-response-filter.

MITAuto-check passedDevelopment

Install Tsed Exceptions

skills CLI
$ npx skills add tsedio/tsed --skill tsed-exceptions -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install tsedio/tsed tsed-exceptions --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/tsedio/tsed.git skills-src && mkdir -p .claude/skills && cp -r skills-src/plugins/tsed/skills/tsed-exceptions .claude/skills/tsed-exceptions && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
tsed-exceptions
GitHub stars
3.1k
Token cost
~2.4k tokens
SKILL.md length
742 words
Files
2
Skills in repo
19
Repo updated
First seen
Licence
MIT

At a glance

Handle errors and shape responses in a Ts.ED v8 application with @tsed/exceptions, exception filters from @tsed/platform-exceptions and response filters from @tsed/platform-response-filter.

  • Works in 6 steps: Throw exceptions → Create domain exceptions → Know the default payload → …
  • Throwing BadRequest/NotFound/Unauthorized
  • SKILL.md covers 1. Throw exceptions, 2. Create domain exceptions, 3. Know the default payload and 4. Write an exception filter, plus 4 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Tsed Exceptions is an agent skill from tsedio/tsed. Handle errors and shape responses in a Ts.ED v8 application with @tsed/exceptions, exception filters from @tsed/platform-exceptions and response filters from @tsed/platform-response-filter. Use when throwing BadRequest/NotFound/Unauthorized or a custom exception, customizing the JSON error payload, writing a @Catch filter, customizing the 404 ResourceNotFound page, wrapping all responses in an envelope with @ResponseFilter, documenting errors with @Returns(404, NotFound), or debugging responses such as…

Its SKILL.md is about 2.4k tokens, which your agent loads only when the skill is triggered. The skill folder holds 2 other files (for example `agents/openai.yaml`).

It sits in Development. The repository describes itself as: :triangularruler: Ts.ED is a Node.js and TypeScript framework on top of Express to write your application with TypeScript (or ES6). It provides a lot of decorators and guideline… The licence is MIT.

When your agent uses it

  • Throwing BadRequest/NotFound/Unauthorized
  • A custom exception
  • Customizing the JSON error payload
  • Writing a @Catch filter

Example prompts

  • “InternalServerError”
  • “/tsed-exceptions”

Workflow steps

6 steps, taken from the step headings in SKILL.md.

  1. Throw exceptions
  2. Create domain exceptions
  3. Know the default payload
  4. Write an exception filter
  5. Shape successful responses with a response filter
  6. Document error responses

What it can do on your machine

Read from SKILL.md and the folder at commit cebcc11. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are typescript and json).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • tsed.dev

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Tsed Exceptions loads about 2.4k tokens when it runs. Until then it costs about 153 tokens; SKILL.md has 742 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~153
When it runs · the whole SKILL.md, loaded when a task matches
~2.4k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from tsedio/tsed at commit cebcc11, republished under its MIT licence (© tsedio). 742 words, ~2,449 tokens.

Download SKILL.mdSave it as .claude/skills/tsed-exceptions/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
tsed-exceptions
description
Handle errors and shape responses in a Ts.ED v8 application with @tsed/exceptions, exception filters from @tsed/platform-exceptions and response filters from @tsed/platform-response-filter. Use when throwing BadRequest/NotFound/Unauthorized or a custom exception, customizing the JSON error payload, writing a @Catch filter, customizing the 404 ResourceNotFound page, wrapping all responses in an envelope with @ResponseFilter, documenting errors with @Returns(404, NotFound), or debugging responses such as "InternalServerError", AJV_VALIDATION_ERROR or a response filter that is never called.

Ts.ED Exceptions and Response Filters

Throw typed exceptions anywhere in the request flow. PlatformExceptions routes each error to one exception filter, which writes the response. Response filters shape successful responses only.

Package map (never import from @tsed/common):

SymbolPackage
Exception, BadRequest, Unauthorized, Forbidden, NotFound, Conflict, UnprocessableEntity, TooManyRequests, InternalServerError, ...@tsed/exceptions
Catch, ExceptionFilterMethods, ResourceNotFound, PlatformExceptions@tsed/platform-exceptions
ResponseFilter, ResponseFilterMethods@tsed/platform-response-filter
PlatformContext@tsed/platform-http
ValidationError, ParamValidationError@tsed/platform-params

1. Throw exceptions

typescript
import {BadRequest, NotFound} from "@tsed/exceptions";

throw new NotFound("Calendar not found");
throw new BadRequest("Invalid import file", cause); // cause: Error | string | object
const error = new BadRequest("Invalid payload");
error.errors = [{path: "/email", message: "already used"}];
error.setHeaders({"x-reason": "duplicate"});
throw error;
  1. Signature: new Xxx(message, origin?). Base class: new Exception(status, message, origin?). error.name is derived from the status (NOT_FOUND, BAD_REQUEST); error.status holds the code.
  2. origin as Error or string is stored in error.origin and appended to the message as , innerException: <message>. origin as a plain object is stored in error.body.
  3. headers (via setHeader/setHeaders) are copied to the response; an errors array is copied to the payload. Both are also read from error.origin.
  4. Throw from controllers, services, middlewares, pipes and interceptors alike. Do not catch and call response.status(...) manually in handlers. Do not throw strings or plain objects.

2. Create domain exceptions

typescript
import {Conflict} from "@tsed/exceptions";

export class EmailAlreadyUsed extends Conflict {
  constructor(email: string) {
    super(`Email ${email} is already used`);
    this.errors = [{code: "EMAIL_ALREADY_USED", email}];
  }
}

Extend the built-in class matching the status. Alternatively keep domain errors HTTP-free (plain Error subclasses) and translate them in an exception filter.

3. Know the default payload

Any Exception subclass is sent with its status as application/json:

json
{"name": "NOT_FOUND", "message": "Calendar not found", "status": 404, "errors": []}
  1. stack is added only when env is development. Any other Error is sent with error.status || error.statusCode || 500; in production its body is the string "InternalServerError", otherwise the same object shape.
  2. Validation failures are a 400 with name: "AJV_VALIDATION_ERROR", a message starting with Bad request on parameter "request.body", and errors[] holding the AJV entries (keyword, dataPath, message, modelName, requestPath). A missing required parameter gives REQUIRED_VALIDATION_ERROR. Rules that produce them: tsed-models.
  3. An unmatched route throws ResourceNotFound (a NotFound with url), message Resource "<url>" not found.

4. Write an exception filter

typescript
import {Exception} from "@tsed/exceptions";
import {Catch, type ExceptionFilterMethods} from "@tsed/platform-exceptions";
import type {PlatformContext} from "@tsed/platform-http";

@Catch(Exception)
export class HttpExceptionFilter implements ExceptionFilterMethods<Exception> {
  catch(error: Exception, ctx: PlatformContext) {
    ctx.logger.error({event: "HTTP_ERROR", status: error.status, message: error.message});
    ctx.response
      .setHeaders(error.headers)
      .status(error.status)
      .body({code: error.name, detail: error.message, errors: error.errors || []});
  }
}
  1. @Catch(...types) accepts classes or class-name strings (for third-party errors that cannot be imported, e.g. @Catch("MongooseError")).
  2. Registration: @Catch registers the class when the file is evaluated. Import the file from the server entry point (import "./filters/HttpExceptionFilter.js";) or list the class in imports. There is no configuration key for exception filters.
  3. Resolution: exact class-name match, then the nearest ancestor class with a filter, then the Error filter. One filter handles one error.
  4. A filter declared for an already handled type replaces the built-in one. Built-ins: Error, Exception, Mongoose errors and thrown strings.
  5. catch must write the response: ctx.response.status(...).body(...). It may be async. Filters are injectable; use inject() or @Inject() for services.
  6. Catch narrow types first (@Catch(EmailAlreadyUsed)), keep one generic @Catch(Exception) and, if needed, one @Catch(Error).
  7. Do not leak error.stack or raw third-party messages in a custom @Catch(Error) filter.

Custom 404:

typescript
import {Catch, type ExceptionFilterMethods, ResourceNotFound} from "@tsed/platform-exceptions";
import type {PlatformContext} from "@tsed/platform-http";

@Catch(ResourceNotFound)
export class ResourceNotFoundFilter implements ExceptionFilterMethods<ResourceNotFound> {
  catch(error: ResourceNotFound, ctx: PlatformContext) {
    ctx.response.status(404).body({status: 404, message: error.message, url: error.url});
  }
}
Show full SKILL.md (301 more words)Show less

5. Shape successful responses with a response filter

typescript
import type {Context} from "@tsed/platform-params";
import {ResponseFilter, type ResponseFilterMethods} from "@tsed/platform-response-filter";

@ResponseFilter("application/json")
export class EnvelopeFilter implements ResponseFilterMethods {
  transform(data: unknown, ctx: Context) {
    return {data, errors: [], links: []};
  }
}

// Server.ts
@Configuration({responseFilters: [EnvelopeFilter]})
export class Server {}
  1. List every filter in responseFilters. Decorating and importing is not enough: unlisted filters are ignored.
  2. One filter per content type; "*/*" is the fallback for all types.
  3. Selection uses the response content type (@ContentType, @(Returns(200, Model).ContentType("text/xml")), or JSON for objects), negotiated against the request Accept header when present.
  4. The filter receives data already serialized by the json-mapper and runs only for controller endpoints.
  5. Exception filters write the body directly, so the envelope is not applied to errors. Produce the same envelope in the exception filter.
  6. Update @Returns schemas to describe the envelope (generic wrapper model: tsed-models, tsed-openapi).

6. Document error responses

typescript
@Get("/:id")
@Returns(200, Calendar)
@(Returns(404, NotFound).Description("Calendar not found"))
get(@PathParams("id") id: string) {}

Built-in exception classes ship with a schema (name, message, status, errors, stack). If a custom filter changes the payload, pass a model describing the new shape instead.

Pitfalls

  • Production responds InternalServerError for an expected error: a plain Error was thrown instead of an Exception subclass.
  • Custom filter never called: its file is not imported at startup, or a more specific filter matched first.
  • Response filter never called: missing from responseFilters, or the negotiated content type differs from the filter's.
  • Message contains , innerException: ...: an Error or string was passed as second constructor argument. Pass details through errors instead.
  • ResourceNotFound imported from @tsed/platform-http (as older doc snippets show) fails; import it from @tsed/platform-exceptions.
  • Double response or hanging request: the filter did not call ctx.response.body(...), or also rethrew.

Checklist

  • Expected failures throw @tsed/exceptions classes or subclasses; nothing throws strings.
  • Filters decorated with @Catch, implement catch(error, ctx), and are imported at startup.
  • Response filters listed in responseFilters.
  • Success and error payload shapes are consistent and documented with @Returns.
  • 4xx, 5xx and 404 paths covered by integration tests (see tsed-testing).
  • No @tsed/common import; relative imports end with .js.

Depth: https://tsed.dev/docs/exceptions.md, https://tsed.dev/docs/response-filter.md, https://tsed.dev/docs/not-found-page.md.

© tsedio, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 1 other file in plugins/tsed/skills/tsed-exceptions of tsedio/tsed.

  • SKILL.md
  • agents/openai.yaml

Open the folder on GitHubat commit cebcc11

Compare with similar skills

Tsed Exceptions next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Tsed Exceptions compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Tsed Exceptions this skilltsedio/tsed3.1k—~2.4kAutomated safety check: PassMIT
Vercel Composition Patternssupabase/supabase111k59 repos~726Automated safety check: PassMIT
Finishing a Development Branchobra/superpowers296k5 repos~1.9kAutomated safety check: PassMIT
Typescript Advanced Typesrolling-scopes/rsschool-app10k25 repos~4.2kAutomated safety check: PassMPL-2.0
PR Babysitteropeninterpreter/openinterpreter69k3 repos~4.2kAutomated safety check: PassApache-2.0
Code Review ChecklistshareAI-lab/learn-claude-code78k5 repos~1.1kAutomated safety check: PassMIT

Similar skills

  • Official

    React composition patterns that scale. An agent skill from supabase/supabase.

    111k GitHub starsUsed in 59 repos~726 tokens
    DevelopmentAuto-check passed
  • Walks the last step of a branch: confirm tests pass, detect the git environment, ask how to integrate, carry out your choice and clean up the worktree.

    296k GitHub starsUsed in 5 repos~1.9k tokens
    DevelopmentAuto-check passed
  • Typescript Advanced Types

    rolling-scopes/rsschool-app

    Master TypeScript's advanced type system including generics, conditional types, mapped types, template literals, and utility types for building type-safe applications.

    10k GitHub starsUsed in 25 repos~4.2k tokens
    DevelopmentAuto-check passed
  • PR Babysitter

    openinterpreter/openinterpreter

    Watches an open GitHub pull request until it merges, handling review comments, diagnosing CI failures and retrying flaky checks along the way.

    69k GitHub starsUsed in 3 repos~4.2k tokens
    DevelopmentAuto-check passed
  • Code Review Checklist

    shareAI-lab/learn-claude-code

    Reviews code against a five-part checklist covering security, correctness, performance, maintainability and testing, and reports findings in a fixed format.

    78k GitHub starsUsed in 5 repos~1.1k tokens
    DevelopmentAuto-check passed
  • Greploop

    onyx-dot-app/onyx

    Iteratively improves a PR (GitHub), MR (GitLab), or shelved changelist (Perforce) until Greptile gives it a 5/5 confidence score with zero unresolved comments.

    32k GitHub starsUsed in 4 repos~3.3k tokens
    DevelopmentAuto-check passed

More from tsedio/tsed

All 19 skills in this repo
  • Create a production-ready Ts.ED platform adapter for a new HTTP framework or runtime, such as Hono, Elysia, Bun.serve, or a Node framework.

    3.1k GitHub stars~2.7k tokensUpdated today
    Auto-check passed
  • Tsed CLI

    tsedio/tsed

    Scaffolds Ts.ED v8 projects and generates files with the Ts.ED CLI v7, through its MCP server (tools set-workspace, init-project, list-templates, get-template, generate-file) or the tsed binary…

    3.1k GitHub stars~2.7k tokensUpdated today
    Auto-check passed
  • Configure and bootstrap a Ts.ED v8 server - the @Configuration decorator or configuration() on the Server class, PlatformExpress/PlatformKoa/PlatformFastify.bootstrap, server options (mount…

    3.1k GitHub stars~2.1k tokensUpdated today
    Auto-check: notes
  • Tsed Di

    tsedio/tsed

    Declare, inject and scope Ts.ED v8 providers and wire lifecycle hooks - @Injectable, @Module, @Controller, @Inject, the functional API (inject, injectMany, lazyInject, constant, refValue…

    3.1k GitHub stars~2.1k tokensUpdated today
    Auto-check passed
  • Tsed Docs

    tsedio/tsed

    Locates authoritative Ts.ED v8 documentation and API reference instead of guessing framework APIs.

    3.1k GitHub stars~2.6k tokensUpdated today
    Auto-check passed
  • Tsed Logger

    tsedio/tsed

    Configure and use logging in a Ts.ED v8 application with @tsed/logger v8.

    3.1k GitHub stars~2.3k tokensUpdated today
    Auto-check passed

Categories

Questions about Tsed Exceptions

What does Tsed Exceptions do?

Handle errors and shape responses in a Ts.ED v8 application with @tsed/exceptions, exception filters from @tsed/platform-exceptions and response filters from @tsed/platform-response-filter. Tsed Exceptions is an agent skill from tsedio/tsed.ED v8 application with @tsed/exceptions, exception filters from @tsed/platform-exceptions and response filters from @tsed/platform-response-filter.

When should I use Tsed Exceptions?

Tsed Exceptions fits situations like: throwing BadRequest/NotFound/Unauthorized; A custom exception; customizing the JSON error payload; writing a @Catch filter.

How do I install Tsed Exceptions in Claude Code?

Run `npx skills add tsedio/tsed --skill tsed-exceptions -a claude-code`. Or copy the skill folder (plugins/tsed/skills/tsed-exceptions in tsedio/tsed) into .claude/skills/tsed-exceptions in your project. Claude Code loads it when a task matches its description.

How do I install Tsed Exceptions in Codex?

Run `npx skills add tsedio/tsed --skill tsed-exceptions -a codex`. Or copy the skill folder (plugins/tsed/skills/tsed-exceptions in tsedio/tsed) into .agents/skills/tsed-exceptions in your project. Codex loads it when a task matches its description.

Can I use Tsed Exceptions in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add tsedio/tsed --skill tsed-exceptions -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/tsed-exceptions, .gemini/skills/tsed-exceptions, .github/skills/tsed-exceptions and .opencode/skills/tsed-exceptions in your project.

What does Tsed Exceptions need to run?

SKILL.md names no scripts, command-line tools or credentials: Tsed Exceptions is instructions for the agent only.

Does Tsed Exceptions access the network?

SKILL.md names 1 domain. As links in the text: tsed.dev. This is read from the text; nothing was executed.

Is Tsed Exceptions safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Tsed Exceptions use?

Tsed Exceptions is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Tsed Exceptions use?

About 2.4k tokens (SKILL.md is roughly 9.8k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Tsed Exceptions?

Skills that share tags, products or a category with Tsed Exceptions: Vercel Composition Patterns (supabase/supabase, 111k stars), Finishing a Development Branch (obra/superpowers, 296k stars), Typescript Advanced Types (rolling-scopes/rsschool-app, 10k stars) and PR Babysitter (openinterpreter/openinterpreter, 69k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Tsed Exceptions?

tsedio (a GitHub organization) maintains it in tsedio/tsed, which has 3,088 GitHub stars. The repository holds 19 skills in this directory. The repository was last updated on October 7, 2026.

Source: tsedio/tsed on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.