Practical Async Patterns with fp-ts workflow skill. Use this skill when the user needs Practical async patterns using TaskEither - clean pipelines instead of try/catch hell, with real API examples and the operator should preserve the upstream workflow, copied support files, and provenance before merging or handing off.
Standardmäßig ist der Prompt ausgewählt, der zuerst die Quelle prüft. Sie können zu einem direkten Befehl wechseln oder eine lokale Kopie herunterladen.
Quelldateien prüfen
Lesen Sie SKILL.md und alle von SkillsMP angezeigten Begleitdateien, bevor Sie sich für eine Installation entscheiden.
Mit Codex oder Claude installieren Kopieren Sie diesen Prompt, fügen Sie ihn in Codex, Claude oder einen anderen Assistant ein und lassen Sie die Skill-Seite prüfen und installieren.
Ein direkter Befehl überspringt den Prüf-Prompt. Prüfen Sie die Quelle, bevor Sie ihn ausführen.
Practical Async Patterns with fp-ts workflow skill. Use this skill when the user needs Practical async patterns using TaskEither - clean pipelines instead of try/catch hell, with real API examples and the operator should preserve the upstream workflow, copied support files, and provenance before merging or handing off.
This public intake copy packages plugins/antigravity-awesome-skills/skills/fp-async from https://github.com/sickn33/antigravity-awesome-skills into the native Omni Skills editorial shape without hiding its origin.
Use it when the operator needs the upstream workflow, support files, and repository context to stay intact while the public validator and private enhancer continue their normal downstream flow.
This intake keeps the copied upstream files intact and uses the external_source block in metadata.json plus ORIGIN.md as the provenance anchor for review.
Practical Async Patterns with fp-ts Stop writing nested try/catch blocks. Stop losing error context. Start building clean async pipelines that handle errors properly. TaskEither is simply an async operation that tracks success or failure. That's it. No fancy terminology needed.
Imported source sections that did not map cleanly to the public headings are still preserved below or in the support files. Notable imported sections: 1. Wrapping Promises Safely, 2. Chaining Async Operations, 3. Parallel vs Sequential Execution, 4. Error Recovery Patterns, 6. Handling Results, Before/After Summary.
When to Use This Skill
Use this section as the trigger filter. It should make the activation boundary explicit before the operator loads files, runs commands, or opens a pull request.
You need async error handling in TypeScript with TaskEither.
The task involves wrapping Promises, composing API calls, or replacing nested try/catch flows.
You want practical fp-ts async patterns instead of academic explanations.
Use when the request clearly matches the imported source intent: Practical async patterns using TaskEither - clean pipelines instead of try/catch hell, with real API examples.
Use when the operator should preserve upstream workflow detail instead of rewriting the process from scratch.
Use when provenance needs to stay visible in the answer, PR, or review packet.
Operating Table
Situation
Start here
Why it matters
First-time use
metadata.json
Confirms repository, branch, commit, and imported path through the external_source block before touching the copied workflow
Provenance review
ORIGIN.md
Gives reviewers a plain-language audit trail for the imported source
Workflow execution
SKILL.md
Starts with the smallest copied file that materially changes execution
Supporting context
SKILL.md
Adds the next most relevant copied source file without loading the entire package
Handoff decision
## Related Skills
Helps the operator switch to a stronger native skill when the task drifts
Workflow
This workflow is intentionally editorial and operational at the same time. It keeps the imported source useful to the operator while still satisfying the public intake standards that feed the downstream enhancer flow.
Confirm the user goal, the scope of the imported workflow, and whether this skill is still the right router for the task.
Read the overview and provenance files before loading any copied upstream support files.
Load only the references, examples, prompts, or scripts that materially change the outcome for the current request.
Execute the upstream workflow while keeping provenance and source boundaries explicit in the working notes.
Validate the result against the upstream expectations and the evidence you can point to in the copied files.
Escalate or hand off to a related skill when the work moves out of this imported workflow's center of gravity.
Before merge or closure, record what was used, what changed, and what the reviewer still needs to verify.
Imported Workflow Notes
Imported: 1. Wrapping Promises Safely
The Problem: Try/Catch Everywhere
// BEFORE: Try/catch hellasyncfunctiongetUserData(userId: string) {
try {
const response = awaitfetch(`/api/users/${userId}`)
if (!response.ok) {
thrownewError(`HTTP ${response.status}`)
}
const user = await response.json()
try {
const posts = awaitfetch(`/api/users/${userId}/posts`)
if (!posts.ok) {
thrownewError(`HTTP ${posts.status}`)
}
const postsData = await posts.json()
return { user, posts: postsData }
} catch (postsError) {
// Now what? Return partial data? Rethrow? Log?console.error('Failed to fetch posts:', postsError)
return { user, posts: [] }
}
} catch (error) {
// Lost all context about what failedconsole.error('Something failed:', error)
throw error
}
}
A function to convert the thrown value into your error type
TE.tryCatch(
() => somePromise, // The async work(thrown) =>toError(thrown) // Convert failures to your error type
)
Creating Success and Failure Values
// Wrap a value as successconst success = TE.right<Error, number>(42)
// Wrap a value as failureconst failure = TE.left<Error, number>(newError('Nope'))
// From a nullable value (null/undefined becomes error)const fromNullable = TE.fromNullable(newError('Value was null'))
const result = fromNullable(maybeUser) // TaskEither<Error, User>// From a conditionconst mustBePositive = TE.fromPredicate(
(n: number) => n > 0,
(n) =>newError(`Expected positive, got ${n}`)
)
Examples
Example 1: Ask for the upstream workflow directly
Use @fp-async-v2 to handle <task>. Start from the copied upstream workflow, load only the files that change the outcome, and keep provenance visible in the answer.
Explanation: This is the safest starting point when the operator needs the imported workflow, but not the entire repository.
Example 2: Ask for a provenance-grounded review
Review @fp-async-v2 against metadata.json and ORIGIN.md, then explain which copied upstream files you would load first and why.
Explanation: Use this before review or troubleshooting when you need a precise, auditable explanation of origin and file selection.
Example 3: Narrow the copied support files before execution
Use @fp-async-v2 for <task>. Load only the copied references, examples, or scripts that change the outcome, and name the files explicitly before proceeding.
Explanation: This keeps the skill aligned with progressive disclosure instead of loading the whole copied package by default.
Example 4: Build a reviewer packet
Review @fp-async-v2 using the copied upstream files plus provenance, then summarize any gaps before merge.
Explanation: This is useful when the PR is waiting for human review and you want a repeatable audit packet.
Treat the generated public skill as a reviewable packaging layer around the upstream repository. The goal is to keep provenance explicit and load only the copied source material that materially improves execution.
Keep the imported skill grounded in the upstream repository; do not invent steps that the source material cannot support.
Prefer the smallest useful set of support files so the workflow stays auditable and fast to review.
Keep provenance, source commit, and imported file paths visible in notes and PR descriptions.
Point directly at the copied upstream files that justify the workflow instead of relying on generic review boilerplate.
Treat generated examples as scaffolding; adapt them to the concrete task before execution.
Route to a stronger native skill when architecture, debugging, design, or security concerns become dominant.
Troubleshooting
Problem: The operator skipped the imported context and answered too generically
Symptoms: The result ignores the upstream workflow in plugins/antigravity-awesome-skills/skills/fp-async, fails to mention provenance, or does not use any copied source files at all.
Solution: Re-open metadata.json, ORIGIN.md, and the most relevant copied upstream files. Check the external_source block first, then restate the provenance before continuing.
Problem: The imported workflow feels incomplete during review
Symptoms: Reviewers can see the generated SKILL.md, but they cannot quickly tell which references, examples, or scripts matter for the current task.
Solution: Point at the exact copied references, examples, scripts, or assets that justify the path you took. If the gap is still real, record it in the PR instead of hiding it.
Problem: The task drifted into a different specialization
Symptoms: The imported skill starts in the right place, but the work turns into debugging, architecture, design, security, or release orchestration that a native skill handles better.
Solution: Use the related skills section to hand off deliberately. Keep the imported provenance visible so the next skill inherits the right context instead of starting blind.
Related Skills
@00-andruia-consultant - Use when the work is better handled by that native specialization after this imported skill establishes context.
@00-andruia-consultant-v2 - Use when the work is better handled by that native specialization after this imported skill establishes context.
@10-andruia-skill-smith - Use when the work is better handled by that native specialization after this imported skill establishes context.
@10-andruia-skill-smith-v2 - Use when the work is better handled by that native specialization after this imported skill establishes context.
Additional Resources
Use this support matrix and the linked files below as the operator packet for this imported skill. They should reflect real copied source material, not generic scaffolding.
Resource family
What it gives the reviewer
Example path
references
copied reference notes, guides, or background material from upstream
references/n/a
examples
worked examples or reusable prompts copied from upstream
examples/n/a
scripts
upstream helper scripts that change execution or validation
scripts/n/a
agents
routing or delegation notes that are genuinely part of the imported package
agents/n/a
assets
supporting assets or schemas copied from the source package
assets/n/a
Imported Reference Notes
Imported: 7. Common Patterns Reference
Quick Transformations
// Transform success valueTE.map(user => user.name)
// Transform errorTE.mapLeft(error => ({ ...error, timestamp: Date.now() }))
// Transform both at onceTE.bimap(
error =>enhanceError(error),
user => user.profile
)
Filtering
// Fail if condition not metpipe(
fetchUser(userId),
TE.filterOrElse(
user => user.isActive,
user =>newError(`User ${user.id} is not active`)
)
)
Side Effects Without Changing Value
// Log on success, keep the value unchangedpipe(
fetchUser(userId),
TE.tap(user =>TE.fromIO(() =>console.log(`Fetched user: ${user.id}`)))
)
// Log on error, keep the error unchangedpipe(
fetchUser(userId),
TE.tapError(error =>TE.fromIO(() =>console.error(`Failed: ${error.message}`)))
)
// chainFirst is like tap but for operations that return TaskEitherpipe(
createUser(userData),
TE.chainFirst(user =>sendWelcomeEmail(user.email))
) // Returns the created user, not the email result
Converting From Other Types
// From Eitherconst fromEither = TE.fromEither(E.right(42))
// From Optionimport * as O from'fp-ts/Option'const fromOption = TE.fromOption(() =>newError('Value was None'))
const result = fromOption(O.some(42))
// From booleanconst fromBoolean = TE.fromPredicate(
(x: number) => x > 0,
() =>newError('Must be positive')
)
Imported: Quick Reference Card
What you want
How to do it
Wrap a promise
TE.tryCatch(() => promise, toError)
Create success
TE.right(value)
Create failure
TE.left(error)
Transform value
TE.map(fn)
Transform error
TE.mapLeft(fn)
Chain async ops
TE.chain(fn) or TE.flatMap(fn)
Run in parallel
sequenceT(TE.ApplyPar)(te1, te2, te3)
Array in parallel
TE.traverseArray(fn)(items)
Recover from error
TE.orElse(fn)
Use default value
TE.getOrElse(() => T.of(default))
Handle both cases
TE.fold(onError, onSuccess)
Build up context
TE.Do + TE.bind('name', () => te)
Log without changing
TE.tap(fn)
Filter with error
TE.filterOrElse(pred, toError)
Imported: 2. Chaining Async Operations
The Problem: Callback Hell / Nested Awaits
// BEFORE: Deeply nested, hard to followasyncfunctionprocessOrder(orderId: string) {
try {
const order = awaitfetchOrder(orderId)
if (!order) thrownewError('Order not found')
try {
const user = awaitfetchUser(order.userId)
if (!user) thrownewError('User not found')
try {
const inventory = awaitcheckInventory(order.items)
if (!inventory.available) thrownewError('Out of stock')
try {
const payment = awaitchargePayment(user, order.total)
if (!payment.success) thrownewError('Payment failed')
try {
const shipment = awaitcreateShipment(order, user)
return { order, shipment, payment }
} catch (e) {
// Refund payment? Log? What's the state now?awaitrefundPayment(payment.id)
throw e
}
} catch (e) {
throw e
}
} catch (e) {
throw e
}
} catch (e) {
throw e
}
} catch (e) {
console.error('Order processing failed', e)
throw e
}
}
When each operation depends on the previous result
When you need to respect rate limits
When order matters
Parallel (all at once):
When operations are independent
When you want speed
When fetching multiple resources by ID
Sequential Chaining
// Operations depend on each other - must be sequentialconstgetUserWithOrg = (userId: string) =>
pipe(
fetchUser(userId), // First: get userTE.chain(user =>fetchTeam(user.teamId)), // Then: get their teamTE.chain(team =>fetchOrganization(team.orgId)) // Finally: get org
)
// Fetch multiple users in parallelconst userIds = ['1', '2', '3', '4', '5']
// TE.traverseArray runs all fetches in parallelconst fetchAllUsers = pipe(
userIds,
TE.traverseArray(fetchUser)
) // TaskEither<Error, readonly User[]>// Note: Fails fast - if ANY request fails, the whole thing fails// All errors after the first are lost
Parallel with Batch Control
When you need to limit concurrent requests:
const chunk = <T>(arr: T[], size: number): T[][] => {
constchunks: T[][] = []
for (let i = 0; i < arr.length; i += size) {
chunks.push(arr.slice(i, i + size))
}
return chunks
}
// Process in batches of 5 concurrent requestsconstfetchUsersWithLimit = (userIds: string[]) => {
const batches = chunk(userIds, 5)
returnpipe(
batches,
// Process batches sequentiallyTE.traverseArray(batch =>// But within each batch, run in parallelpipe(batch, TE.traverseArray(fetchUser))
),
TE.map(results => results.flat())
)
}
Sequential When Parallel Looks Tempting
// WRONG: This looks parallel but order might matter for DB operationsconstcreateUserAndProfile = (userData: UserData) =>
sequenceT(TE.ApplyPar)(
createUser(userData), // Creates user with IDcreateProfile(userData.profile) // Needs user ID - race condition!
)
// RIGHT: Sequential when there's a dependencyconstcreateUserAndProfile = (userData: UserData) =>
pipe(
createUser(userData),
TE.chain(user =>pipe(
createProfile(user.id, userData.profile),
TE.map(profile => ({ user, profile }))
)
)
)
// Get value or use default (removes the error channel)constgetUsernameOrDefault = (userId: string) =>
pipe(
fetchUser(userId),
TE.map(user => user.name),
TE.getOrElse(() => T.of('Anonymous'))
) // Task<string> - no more error tracking// Keep error channel but provide fallback valueconstgetUserWithDefault = (userId: string) =>
pipe(
fetchUser(userId),
TE.orElse(() =>TE.right(defaultUser))
) // TaskEither<Error, User> - error channel still exists but always succeeds
Imported: 6. Handling Results
Pattern Matching with fold/match
// fold: Handle both success and failure, returns a Task (no more error channel)const displayResult = pipe(
fetchUser(userId),
TE.fold(
(error) => T.of(`Error: ${error.message}`),
(user) => T.of(`Welcome, ${user.name}!`)
)
) // Task<string>// Execute and get the stringconst message = awaitdisplayResult()
Getting the Raw Either
// Sometimes you need to work with the Either directlyconst result = awaitfetchUser(userId)() // Either<Error, User>if (E.isLeft(result)) {
console.error('Failed:', result.left)
} else {
console.log('User:', result.right)
}