JAction provides a fluent API for managing complex, non-allocating task sequences and timers in Unity.

Install

mkdir -p .claude/skills/jaction && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/4611" && unzip -o skill.zip -d .claude/skills/jaction && rm skill.zip

Installs to .claude/skills/jaction

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

JAction fluent chainable task system for Unity. Triggers on: sequential tasks, delay, timer, repeat loop, WaitUntil, WaitWhile, async workflow, zero-allocation async, coroutine alternative, scheduled action, timed event, polling condition, action sequence, ExecuteAsync, parallel execution
289 charsno explicit “when” triggerlonger than Claude Code's old 250-char listing cap (fine on current versions)
Intermediate

Key capabilities

  • Execute synchronous or asynchronous actions with state
  • Introduce delays by seconds or frames
  • Wait until or while a condition is true
  • Repeat actions a specified number of times or based on conditions
  • Enable parallel execution mode for tasks
  • Manage task cancellation for individual executions

How it works

JAction creates chainable task sequences with a fluent API, supporting delays, conditional waits, and loops. It uses object pooling and task snapshot isolation for performance and safe parallel execution.

Inputs & outputs

You give it
Action delegates, delay durations, conditions, repeat counts, state objects
You get back
Executed task sequences, JActionExecution handles, cancellation status

When to use jaction

  • Creating sequential game animations with delays
  • Polling for game conditions like player proximity
  • Scheduling recurring events with repeat loops
  • Executing parallel tasks without extra garbage collection

About this skill

JAction - Chainable Task Execution

Fluent API for composing complex action sequences in Unity with automatic object pooling, zero-allocation async, and parallel execution support.

When to Use

  • Sequential workflows with delays
  • Polling conditions (WaitUntil/WaitWhile)
  • Repeat loops with intervals
  • Game timers and scheduled events
  • Zero-GC async operations
  • Parallel concurrent executions

Core Concepts

Task Snapshot Isolation

When Execute() or ExecuteAsync() is called, the current task list is snapshotted. Modifications to the JAction after execution starts do NOT affect running executions:

var action = JAction.Create()
    .Delay(1f)
    .Do(static () => Debug.Log("Original"));

var handle = action.ExecuteAsync();

// This task is NOT executed by the handle above - it was added after the snapshot
action.Do(static () => Debug.Log("Added Later"));

await handle; // Only prints "Original"

This isolation enables safe parallel execution where each handle operates on its own task snapshot.

Return Types

JActionExecution (returned by Execute, awaited from ExecuteAsync):

  • .Action - The JAction that was executed
  • .Cancelled - Whether THIS specific execution was cancelled
  • .Executing - Whether the action is still executing
  • .Dispose() - Returns JAction to pool

JActionExecutionHandle (returned by ExecuteAsync before await):

  • .Action - The JAction being executed
  • .Cancelled - Whether this execution is cancelled
  • .Executing - Whether still running
  • .Cancel() - Cancel THIS specific execution
  • .AsUniTask() - Convert to UniTask<JActionExecution>
  • Awaitable: await handle returns JActionExecution

API Reference

Execution

MethodReturnsDescription
.Execute(timeout)JActionExecutionSynchronous blocking execution
.ExecuteAsync(timeout)JActionExecutionHandleAsync via PlayerLoop (recommended)

Actions

MethodDescription
.Do(Action)Execute synchronous action
.Do<T>(Action<T>, T)Execute with state (zero-alloc for reference types)
.Do(Func<JActionAwaitable>)Execute async action
.Do<T>(Func<T, JActionAwaitable>, T)Async with state

Timing

MethodDescription
.Delay(seconds)Wait specified seconds
.DelayFrame(frames)Wait specified frame count
.WaitUntil(condition, frequency, timeout)Wait until condition true
.WaitWhile(condition, frequency, timeout)Wait while condition true

Loops

MethodDescription
.Repeat(action, count, interval)Repeat N times
.RepeatWhile(action, condition, frequency, timeout)Repeat while condition true
.RepeatUntil(action, condition, frequency, timeout)Repeat until condition true

All loop methods have <TState> overloads for zero-allocation with reference types.

Configuration

MethodDescription
.Parallel()Enable concurrent execution mode
.OnCancel(callback)Register cancellation callback
.Cancel()Stop ALL active executions
.Reset()Clear state for reuse
.Dispose()Return to object pool

Static Members

MemberDescription
JAction.Create()Get pooled instance
JAction.PooledCountCheck available pooled instances
JAction.ClearPool()Empty the pool

Patterns

Basic Sequence

using var result = await JAction.Create()
    .Do(static () => Debug.Log("Step 1"))
    .Delay(1f)
    .Do(static () => Debug.Log("Step 2"))
    .ExecuteAsync();

Always Use using var (CRITICAL)

// CORRECT - auto-disposes and returns to pool
using var result = await JAction.Create()
    .Do(() => LoadAsset())
    .WaitUntil(() => assetLoaded)
    .ExecuteAsync();

// WRONG - memory leak, never returns to pool
await JAction.Create()
    .Do(() => LoadAsset())
    .ExecuteAsync();

Parallel Execution with Per-Execution Cancellation

var action = JAction.Create()
    .Parallel()
    .Do(static () => Debug.Log("Start"))
    .Delay(5f)
    .Do(static () => Debug.Log("Done"));

// Start multiple concurrent executions (each gets own task snapshot)
var handle1 = action.ExecuteAsync();
var handle2 = action.ExecuteAsync();

// Cancel only the first execution
handle1.Cancel();

// Each has independent Cancelled state
var result1 = await handle1;  // result1.Cancelled == true
var result2 = await handle2;  // result2.Cancelled == false

action.Dispose();

UniTask.WhenAll with Parallel

var action = JAction.Create()
    .Parallel()
    .Delay(1f)
    .Do(static () => Debug.Log("Done"));

var handle1 = action.ExecuteAsync();
var handle2 = action.ExecuteAsync();

await UniTask.WhenAll(handle1.AsUniTask(), handle2.AsUniTask());

action.Dispose();

Zero-Allocation with Reference Types

// CORRECT - static lambda + reference type state = zero allocation
var data = new MyData();
JAction.Create()
    .Do(static (MyData d) => d.Process(), data)
    .Execute();

// Pass 'this' when inside a class - no wrapper needed
public class Enemy : MonoBehaviour
{
    public bool IsStunned;

    public void ApplyStun(float duration)
    {
        IsStunned = true;
        JAction.Create()
            .Delay(duration)
            .Do(static (Enemy self) => self.IsStunned = false, this)
            .ExecuteAsync().Forget();
    }
}

// Value types use closures (boxing would defeat zero-alloc anyway)
int count = 5;
JAction.Create()
    .Do(() => Debug.Log($"Count: {count}"))
    .Execute();

Timeout Handling

using var result = await JAction.Create()
    .WaitUntil(() => networkReady)
    .ExecuteAsync(timeout: 30f);

if (result.Cancelled)
    Debug.Log("Timed out!");

Cancellation Callback

var action = JAction.Create()
    .OnCancel(() => Debug.Log("Cancelled!"))
    .Delay(10f);

var handle = action.ExecuteAsync();
handle.Cancel();  // Triggers OnCancel callback

Game Patterns

Cooldown Timer

public class AbilitySystem
{
    public bool CanUse = true;

    public async UniTaskVoid TryUseAbility(float cooldown)
    {
        if (!CanUse) return;
        CanUse = false;

        PerformAbility();

        // Pass 'this' as state - no extra class needed
        using var _ = await JAction.Create()
            .Delay(cooldown)
            .Do(static s => s.CanUse = true, this)
            .ExecuteAsync();
    }
}

Damage Over Time

public sealed class DoTState
{
    public IDamageable Target;
    public float DamagePerTick;
}

public static async UniTaskVoid ApplyDoT(
    IDamageable target, float damage, int ticks, float interval)
{
    var state = JObjectPool.Shared<DoTState>().Rent();
    state.Target = target;
    state.DamagePerTick = damage;

    using var _ = await JAction.Create()
        .Repeat(
            static s => s.Target?.TakeDamage(s.DamagePerTick),
            state, count: ticks, interval: interval)
        .ExecuteAsync();

    state.Target = null;
    JObjectPool.Shared<DoTState>().Return(state);
}

Wave Spawner

public async UniTask RunWaves(WaveConfig[] waves)
{
    foreach (var wave in waves)
    {
        using var result = await JAction.Create()
            .Do(() => UI.ShowWaveStart(wave.Number))
            .Delay(2f)
            .Do(() => SpawnWave(wave))
            .WaitUntil(() => ActiveEnemyCount == 0, timeout: 120f)
            .Delay(wave.DelayAfter)
            .ExecuteAsync();

        if (result.Cancelled) break;
    }
}

Health Regeneration

public sealed class RegenState
{
    public float Health, MaxHealth, HpPerTick;
}

public static async UniTaskVoid StartRegen(RegenState state)
{
    using var _ = await JAction.Create()
        .RepeatWhile(
            static s => s.Health = MathF.Min(s.Health + s.HpPerTick, s.MaxHealth),
            static s => s.Health < s.MaxHealth,
            state, frequency: 0.1f)
        .ExecuteAsync();
}

Troubleshooting

ProblemCauseSolution
Nothing happensForgot to call Execute/ExecuteAsyncAdd .ExecuteAsync() at the end
Memory leakMissing using varAlways use using var result = await ...
Frame dropsUsing Execute()Switch to ExecuteAsync()
GC allocationsClosures with reference typesUse static lambda + state parameter
Unexpected timingValue type stateWrap in reference type or use closure
Handle shows wrong CancelledReading after modificationSnapshot is isolated - this is expected

Common Mistakes

  1. Missing using var - Memory leak, JAction never returns to pool
  2. Using Execute() in production - Blocks main thread, causes frame drops
  3. State overloads with value types - Causes boxing; use closures instead
  4. Forgetting Execute/ExecuteAsync - Nothing happens
  5. Heavy work in .Do() - Callbacks run atomically; keep them lightweight
  6. Using action.Cancel() in parallel - Cancels ALL executions; use handle.Cancel() for specific execution
  7. Modifying JAction after ExecuteAsync - Changes don't affect running execution (task snapshot isolation)

When not to use it

  • When blocking the main thread with synchronous execution
  • When creating memory leaks by not disposing JAction instances
  • When using value types with state overloads, causing boxing

Limitations

  • Modifications to JAction after execution starts do NOT affect running executions
  • Using Execute() blocks the main thread
  • State overloads with value types cause boxing

How it compares

JAction offers a fluent, chainable API for complex task sequences with zero-allocation async and automatic object pooling, providing a more optimized and structured alternative to traditional coroutines or manual async implementations.

Compared to similar skills

jaction side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
jaction (this skill)26moNo flagsIntermediate
webapp-testing3533moReviewIntermediate
resolve-conflicts818moReviewIntermediate
telegram-bot-builder1066moReviewIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

You might also like

webapp-testing

anthropics

Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.

353585

resolve-conflicts

antinomyhq

Use this skill immediately when the user mentions merge conflicts that need to be resolved. Do not attempt to resolve conflicts directly - invoke this skill first. This skill specializes in providing a structured framework for merging imports, tests, lock files (regeneration), configuration files, and handling deleted-but-modified files with backup and analysis.

81334

telegram-bot-builder

davila7

Expert in building Telegram bots that solve real problems - from simple automation to complex AI-powered bots. Covers bot architecture, the Telegram Bot API, user experience, monetization strategies, and scaling bots to thousands of users. Use when: telegram bot, bot api, telegram automation, chat bot telegram, tg bot.

106130

dev-browser

SawyerHood

Browser automation with persistent page state. Use when users ask to navigate websites, fill forms, take screenshots, extract web data, test web apps, or automate browser workflows. Trigger phrases include "go to [url]", "click on", "fill out the form", "take a screenshot", "scrape", "automate", "test the website", "log into", or any browser interaction request.

53176

openspec-onboard

studyzy

Guided onboarding for OpenSpec - walk through a complete workflow cycle with narration and real codebase work.

10207

codex-cli-bridge

alirezarezvani

Bridge between Claude Code and OpenAI Codex CLI - generates AGENTS.md from CLAUDE.md, provides Codex CLI execution helpers, and enables seamless interoperability between both tools

9180

Search skills

Search the agent skills registry