Agent skill
zerospin-error
Create and map ZerospinError instances for Effect-based code in zerospin. Use when defining error codes/messages, wrapping causes, mapping/catching errors in Effects, or returning structured errors from Effect.gen/Effect.fn or promise boundaries.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/zeropsin-error
SKILL.md
ZerospinError
Create structured errors with stable codes, human messages, and optional metadata.
Quick patterns
- Prefer full form with
code,message, andcausewhen wrapping. - Use the short form only for trivial cases:
new ZerospinError('some-code'). - Return errors from
Effect.genwithreturn yield* new ZerospinError(...).
const error = new ZerospinError({
code: 'failed-to-fetch',
message: 'Failed to fetch data',
cause: originalError,
extra: { url },
status: 502,
});
Rules
- Use a stable, kebab-case
codestring; never include dynamic data in the code. - Keep
messagehuman-readable and specific to the failure. - Always attach the original
causewhen wrapping another error. - Use
extrafor structured metadata (ids, inputs, context), not for free-form text. - Use
statusonly for HTTP-facing errors.
Effect usage
Return it don't throw it, duh
const res = yield* Effect.promise(() => fetch('/api/data'));
if (res.status === 404) {
return yield* new ZerospinError({
code: 'resource-not-found',
message: 'Resource not found',
});
}
Working with promises - mapError!
const parsed = Effect.promise(() => res.json()).pipe(
Effect.mapError((error) => {
return new ZerospinError({
code: 'failed-to-parse-json',
message: 'Failed to parse JSON',
cause: error,
});
})
);
Effect.fn
Catch all
const safe = effect.pipe(
Effect.catchAll((error) => {
return new ZerospinError({
code: 'operation-failed',
message: error.message,
cause: error,
});
})
);
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?