skills/effect-ts-testing/SKILL.md
Testing guidelines and patterns for Effect-based code.
npx skillsauth add morgs32/skills effect-ts-testingInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Use this skill when writing or reviewing tests for Effect-based code.
*.spec.* files)When testing a method that returns an Effect type, use the @effect/vitest
package.
import { it } from '@effect/vitest' as opposed to importing it from
regular vitest.it.effect('test name', () => {
return Effect.gen(...)
})
it.layer() to provide test dependencies when your Effect requires
specific services:
it.layer(Layer.fresh(IncrementalIdGenerator))((it) => {
it.effect('test name', () => {
return Effect.gen(...)
})
})
Use tsafe package for compile-time type assertions to validate type safety in
tests.
import { assert } from 'tsafe' and import type { Equals } from 'tsafe'assert<Equals<ActualType, ExpectedType>>() - validates exact type
equality at compile timeNever use new Date() in tests. Always use yield* DateTime.now and convert to
Date if needed.
import { DateTime, Effect } from 'effect';
const nowDateTime = yield* DateTime.now;
const now = DateTime.toDateUtc(nowDateTime);
When decoding unknown values using Effect schemas, always use the
decodeUnknown function exported from zerospin instead of
Schema.decodeUnknown directly.
import { decodeUnknown } from 'zerospin'onExcessProperty: 'error', 'ignore', or 'preserve'
based on your needsZerospinError with code 'failed-to-decode-unknown'In Effect.gen contexts:
import { decodeUnknown } from 'zerospin';
import { ZerospinError } from '@zerospin/error';
import { Effect } from 'effect';
const decoded = yield* decodeUnknown({
onExcessProperty: 'error', // or 'ignore' or 'preserve'
schema: MySchema,
value: unknownValue,
}).pipe(
Effect.mapError((error) => {
return new ZerospinError({
code: 'failed-to-decode-unknown',
message: error.message,
cause: error,
});
})
);
In async/await contexts:
import { decodeUnknown } from 'zerospin';
import { ZerospinError } from '@zerospin/error';
import { Effect } from 'effect';
const decoded = await Effect.runPromise(
decodeUnknown({
onExcessProperty: 'error',
schema: MySchema,
value: unknownValue,
}).pipe(
Effect.mapError((error) => {
return new ZerospinError({
code: 'failed-to-decode-unknown',
message: error.message,
cause: error,
});
})
)
);
development
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.
data-ai
Update agent skills in this repo or another.
development
TypeScript type-safety rules and guidance.
devops
Fix and update Turborepo (Turbo) configuration and task setup. Use for turbo.json errors, schema updates (pipeline -> tasks), and package-level config issues like missing extends.