skills/funkcia/SKILL.md
Adopt Funkcia in TypeScript codebases using Option, Result, OptionAsync, ResultAsync, and module utilities such as Brand, SafeJSON, SafeURI, SafeURL, and TaggedError patterns. Use when migrating from null/throw/promise-rejection flows, designing typed error boundaries, or implementing domain-safe parsing and validation.
npx skillsauth add lukemorales/funkcia funkciaInstall 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.
Migrate existing error handling and validation into explicit, typed, chainable flows using Funkcia.
Option/Result.Option/OptionAsync for expected absence without an error payload.Result/ResultAsync for expected failure with explicit error semantics.Panic), not domain errors.TaggedError before refactoring call chains.
try/catch with Result.try or ResultAsync.try.fromNullable/fromFalsy.map, andThen, filter, or, match for focused one-step transforms.match in handlers/controllers to map outcomes to transport responses._tag), prefer exhaustive(error, { ... }) to enforce full case handling.unwrap in business logic.expectTypeOf tests.Option.none() or Result.error(...).Panic.| API | Domain behavior | Defect behavior |
| --- | --- | --- |
| Option / Result | Return None / Error for expected failures | Throws in combinator callbacks (map, andThen, filter, or, match, tap, etc.) become Panic |
| OptionAsync | try or let rejection/nullable resolves to None | tap throw/reject becomes Panic |
| ResultAsync | try rejection resolves to Error (UnhandledException or mapped error) | let, tap, or tapError throw/reject becomes Panic |
ResultAsync.resource and mapping each dependency to pre-defined resource error types before wiring business flows.Resultimport { Result } from 'funkcia';
function parseWebhook(raw: string) {
return Result.try(
() => JSON.parse(raw),
() => new Error('Invalid webhook payload'),
);
}
Optionimport { Option } from 'funkcia';
function findPrimaryEmail(user: User) {
return Option.fromNullable(user.emails.find((x) => x.primary))
.map((email) => email.value.toLowerCase());
}
ResultAsyncimport { ResultAsync } from 'funkcia';
function fetchCheckoutSession(sessionId: string) {
return ResultAsync.try(
() => payments.getSession(sessionId),
(cause) => new Error(`Failed to fetch session ${sessionId}: ${String(cause)}`),
);
}
async function buildCheckoutSummary(userId: string): Promise<Result<CheckoutSummary, CheckoutError>> {
try {
const user = await usersApi.getById(userId);
if (!user.defaultPaymentMethodId) {
return Result.error(new MissingPaymentMethodError(user.id));
}
const paymentMethod = await paymentsApi.getMethod(user.defaultPaymentMethodId);
const cart = await cartApi.getActiveCart(user.id);
if (!cart) {
return Result.error(new CartNotFoundError(user.id));
}
return Result.ok({
userEmail: user.email,
paymentMethod: paymentMethod.brand,
total: cart.total,
});
} catch (cause) {
return Result.error(new CheckoutInfrastructureError(cause));
}
}
function buildCheckoutSummary(userId: string): ResultAsync<CheckoutSummary, CheckoutError> {
return ResultAsync.use(async function* () {
const user = yield* ResultAsync.try(
() => usersApi.getById(userId),
(cause) => new CheckoutInfrastructureError(cause),
);
const paymentMethodId = yield* Result.fromNullable(
user.defaultPaymentMethodId,
() => new MissingPaymentMethodError(user.id),
);
const paymentMethod = yield* ResultAsync.try(
() => paymentsApi.getMethod(paymentMethodId),
(cause) => new CheckoutInfrastructureError(cause),
);
const cart = yield* Result.fromNullable(
yield* ResultAsync.try(
() => cartApi.getActiveCart(user.id),
(cause) => new CheckoutInfrastructureError(cause),
),
() => new CartNotFoundError(user.id),
);
return ResultAsync.ok({
userEmail: user.email,
paymentMethod: paymentMethod.brand,
total: cart.total,
});
});
}
references/tagged-errors.md: Model real application failures with TaggedError.references/exhaustive.md: Use exhaustive and corrupt for type-safe branching.references/brand.md: Build branded domain primitives and safe parsers.references/exceptions.md: Use built-in exception types and panic.references/safe-functions.md: Safely parse JSON and normalize URLs/URIs.references/generators.md: Preferred generator-based style for Option/Result and async variants.references/do-notation.md: Context-accumulation style with Do, bind, let, and bindTo.references/resources.md: Wrap shared resources with ResultAsync.resource so operations return expected values or pre-defined resource errors.development
Maintainer-only workflow for handling GitHub Secret Scanning alerts on OpenClaw. Use when Codex needs to triage, redact, clean up, and resolve secret leakage found in issue comments, issue bodies, PR comments, or other GitHub content.
development
Maintainer workflow for OpenClaw releases, prereleases, changelog release notes, and publish validation. Use when Codex needs to prepare or verify stable or beta release steps, align version naming, assemble release notes, check release auth requirements, or validate publish-time commands and artifacts.
development
Run, watch, debug, and extend OpenClaw QA testing with qa-lab and qa-channel. Use when Codex needs to execute the repo-backed QA suite, inspect live QA artifacts, debug failing scenarios, add new QA scenarios, or explain the OpenClaw QA workflow. Prefer the live OpenAI lane with regular openai/gpt-5.4 in fast mode; do not use gpt-5.4-pro or gpt-5.4-mini unless the user explicitly overrides that policy.
development
End-to-end Parallels smoke, upgrade, and rerun workflow for OpenClaw across macOS, Windows, and Linux guests. Use when Codex needs to run, rerun, debug, or interpret VM-based install, onboarding, gateway smoke tests, latest-release-to-main upgrade checks, fresh snapshot retests, or optional Discord roundtrip verification under Parallels.