Agent skill
tagged-error
Generate Effect TaggedError types for error handling. Use when adding new error types or improving error handling.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/development/tagged-error-legacy3-wowlab
SKILL.md
Tagged Error Generator
Generate Effect Data.TaggedError types following project conventions.
Error Location
packages/wowlab-core/src/internal/errors/Errors.ts
Basic Error Template
import * as Data from "effect/Data";
export class MyError extends Data.TaggedError("MyError")<{
readonly message: string;
readonly cause?: unknown;
}> {}
Error with Context
import * as Branded from "../schemas/Branded.js";
import * as Entities from "../entities/index.js";
export class SpellNotFound extends Data.TaggedError("SpellNotFound")<{
readonly unitId: Branded.UnitID;
readonly spellId: number;
}> {}
export class CastFailed extends Data.TaggedError("CastFailed")<{
readonly reason: string;
readonly spell: Entities.Spell.Spell;
readonly caster?: Entities.Unit.Unit;
}> {}
Error Union Types
Group related errors:
export type RotationError =
| NoChargesAvailable
| SpellNotFound
| SpellOnCooldown
| UnitNotFound;
export type CombatLogError = QueueEmpty | HandlerError | EventValidationError;
Naming Conventions
- Error class:
{Thing}{Problem}- e.g.,SpellNotFound,CastFailed - Tag: Same as class name
- Include relevant context in payload (IDs, entities, messages)
Usage in Effects
import * as Errors from "@wowlab/core/Errors";
// Failing with error
yield *
Effect.fail(
new Errors.SpellNotFound({
unitId,
spellId,
}),
);
// In function signature
const cast = (
spellId: number,
): Effect.Effect<CastResult, Errors.SpellNotFound | Errors.SpellOnCooldown> =>
Effect.gen(function* () {
// ...
});
Instructions
- Identify what can fail
- Design payload with useful context
- Create error class with TaggedError
- Add to union type if applicable
- Update function signatures to include 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?