agentleFS
VercelKnown publishervercel-labs/error/skills/vercel-error/SKILL.md

vercel-error

Skill19 starsChanged 2 months agoMITView on GitHub

Use @vercel/error to design, implement, migrate, audit, or review structured TypeScript errors. Trigger when a project uses or adopts the package, or when work involves its codes, fields, factories, HTTP APIs, telemetry, or terminal output. Use native Error for local failures that need no stable identity, recovery guidance, observability, or transport.

  • In this repositoryOne other file it gives its agents.

The file

Show its rules and text

We split this skill into the rules it gives an agent

14 rules. About 0 are common, 5 are distinctive, and 9 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 9

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use structured fields to identify what failed, explain why, and suggest what to do next.

    line 9
  2. Very specific:

    Read the target project's package.json, lockfile, existing errors, output paths, logging, and tests before choosing an API.

    line 15
  3. Very specific:

    Use the installed @vercel/error version's public exports as the contract.

    line 17
  4. Very specific:

    If the package is absent, resolve the intended version from workspace constraints or the current release, then inspect its published …

    line 18
  5. Distinctive:

    Leave dependencies unchanged for advice and review.

    line 21
  6. Very specific:

    Before continuing, record the selected version and runtime compatibility, verify the public imports, and identify where the error is …

    line 23
  7. Very specific:

    Keep native Error for a simple local failure that no caller classifies, transports, reports, or presents with recovery guidance.

    line 27
  8. Very specific:

    Use a structured error only when you can name the caller, transport, logger, or UI that needs it.

    line 36
  9. Very specific:

    Use VercelError#toString() for a VercelError.

    line 48
  10. Distinctive:

    Read each reference whose row matches the work.

    line 50
  11. Distinctive:

    Before implementation, verify that every populated field has a known use and every client-visible field is safe.

    line 56
  12. Very specific:

    When set, scope and code must be nonblank.

    line 58
  13. Very specific:

    Test the behavior that consumes the error, not private formatting helpers:

    line 70
  14. Distinctive:

    Run the target project's closest test and typecheck first, then its required checks.

    line 80

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

@vercel/error

Use structured fields to identify what failed, explain why, and suggest what to do next. Software should branch on stable fields; people and agents should read the prose. Preserve the fields until output is rendered, and never parse terminal formatting.

Workflow

1. Inspect the target project

Read the target project's package.json, lockfile, existing errors, output paths, logging, and tests before choosing an API.

  • Use the installed @vercel/error version's public exports as the contract. Do not deep-import unexported source paths.
  • If the package is absent, resolve the intended version from workspace constraints or the current release, then inspect its published exports and engines. Add it as a production dependency only for requested implementation work.
  • Compare a Node target's version with the selected version's engines, and report an incompatibility instead of silently changing the runtime. The package itself is isomorphic (browsers, workers, edge runtimes), so treat engines as the Node support matrix, not a runtime allowlist.
  • Record the project's existing code and scope names and the callers that depend on them. In step 4, preserve or challenge those conventions based on evidence.
  • Leave dependencies unchanged for advice and review.

Before continuing, record the selected version and runtime compatibility, verify the public imports, and identify where the error is created, handled, sent, logged, or shown.

2. Decide whether a structured error is needed

Keep native Error for a simple local failure that no caller classifies, transports, reports, or presents with recovery guidance. Use @vercel/error when at least one of these is needed:

  • a stable code or scope
  • structured reason, hint, fix, or documentation
  • response data or HTTP transport and reconstruction
  • telemetry or debugging context
  • consistent terminal presentation
  • reliable recognition across bundle or realm boundaries

Use a structured error only when you can name the caller, transport, logger, or UI that needs it. "It is more consistent" is not enough.

3. Choose the public API

NeedPublic APIRead
Decide error codes, details, public text, and reportingVercelErrorOptionsContract design
Construct one error, define a subclass, preserve a cause, or inspect a caught valueVercelError, core guards and extractorsCore errors
Create a typed family, allowlist reporting, or use a custom classcreateErrorscreateErrors factories
Produce or consume response data or HTTP error responsesbuildErrorResponseData, errorResponse, fromHttpResponse, parseErrorResponseData, fromErrorResponseDataResponse data and HTTP
Format errors for terminal outputformatError, frame, hint, fix, linkTerminal output

Use VercelError#toString() for a VercelError; it already uses the package formatter. Use frame() for errors or CLI output that should remain another type.

Read each reference whose row matches the work. Continue when every required operation maps to a public import verified in the selected package version.

4. Choose fields and recovery guidance

Apply Contract design to every field in scope, including its pushback rules.

Before implementation, verify that every populated field has a known use and every client-visible field is safe.

When set, scope and code must be nonblank. Keep their original text. Omit blank optional public fields and preserve other text.

5. Implement or review

For review work, report correctness, disclosure, and recovery gaps; edit only when asked.

For implementation, change only the error path that needs structured fields. Preserve surrounding behavior, code conventions, and third-party error types. Treat project-wide code or scope renames as a separate migration. Code examples must typecheck in the shown context or be labeled as partial replacements.

This step is complete when the reviewed or changed scope is limited to the identified use and every example is complete or explicitly partial.

6. Test public behavior

Test the behavior that consumes the error, not private formatting helpers:

  • creation, throwing, and reporting through the factory when those paths matter
  • stable code and preserved cause for programmatic handling
  • response data with approved text and identity, excluding diagnostics
  • the same public fields in JSON and ANSI, plus Content-Type, conditional Vary, and HTTP status
  • rejection of invalid unknown response data before reconstruction
  • terminal output with and without optional sections
  • the actual public package entry point used by the target project

Run the target project's closest test and typecheck first, then its required checks. Verification is complete when they pass or every failure and untested runtime or integration path is reported.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.