Agent skill

State Machine

by MadAppGang in MadAppGang/claude-code

Task lifecycle state transitions with validation gates. An agent skill from MadAppGang/claude-code.

MITAuto-check passed

Install State Machine

skills CLI
$ npx skills add MadAppGang/claude-code --skill state-machine -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install MadAppGang/claude-code state-machine --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/MadAppGang/claude-code.git skills-src && mkdir -p .claude/skills && cp -r skills-src/plugins/autopilot/skills/state-machine .claude/skills/state-machine && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
state-machine
GitHub stars
285
Token cost
~1.7k tokens
SKILL.md length
273 words
Files
1
Skills in repo
69
Repo updated
First seen
Licence
MIT

At a glance

Task lifecycle state transitions with validation gates. An agent skill from MadAppGang/claude-code.

  • SKILL.md covers When to Use, States, State Definitions and Transition Triggers, plus 6 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

State Machine is an agent skill from MadAppGang/claude-code. Task lifecycle state transitions with validation gates. Defines states, triggers, and required proofs.

Its SKILL.md is about 1.7k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

The repository describes itself as: claude code plugins marketplace. The licence is MIT.

Example prompts

  • “/state-machine”

What it can do on your machine

Read from SKILL.md and the folder at commit 6097ad4. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are typescript).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

State Machine loads about 1.7k tokens when it runs. Until then it costs about 29 tokens; SKILL.md has 273 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~29
When it runs · the whole SKILL.md, loaded when a task matches
~1.7k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from MadAppGang/claude-code at commit 6097ad4, republished under its MIT licence (© MadAppGang). 273 words, ~1,677 tokens.

Download SKILL.mdSave it as .claude/skills/state-machine/SKILL.md (or your agent's skills folder).
name
state-machine
description
Task lifecycle state transitions with validation gates. Defines states, triggers, and required proofs.
version
0.1.0
tags
state-machine, workflow, transitions, gates
keywords
state, transition, gate, validation, workflow, lifecycle

plugin: autopilot updated: 2026-01-20

Task Lifecycle State Machine

Version: 0.1.0 Purpose: Manage task state transitions with validation gates Status: Phase 1

When to Use

Use this skill when you need to:

  • Understand valid state transitions for tasks
  • Implement validation gates before state changes
  • Handle iteration loops (In Review -> In Progress)
  • Manage escalation to blocked state
  • Enforce iteration limits

States

Todo ──→ In Progress ──→ In Review ──→ Done
                 ↑           │
                 └───────────┘
                 (iteration)

In Progress ──→ Blocked (escalation)

State Definitions

StateDescriptionEntry Condition
TodoTask queued for executionCreated with @autopilot label
In ProgressTask being executedPassed start gate
In ReviewAwaiting validationProof generated
DoneTask completedAuto-approved or user approved
BlockedCannot proceedDependency issue or escalation

Transition Triggers

FromToTriggerGate
TodoIn ProgressLabel @autopilot addedHas acceptance criteria
In ProgressIn ReviewWork completeProof >= 80% confidence
In ReviewDoneConfidence >= 95%Auto-approval
In ReviewDoneUser approvesUser feedback = APPROVAL
In ReviewIn ProgressConfidence < 80%Validation failed
In ReviewIn ProgressUser requests changesFeedback = REQUESTED_CHANGES
In ProgressBlockedMax iterationsEscalation
*BlockedUnresolvable blockerManual trigger

Validation Gates

Gate 1: Start Work (Todo -> In Progress)
typescript
async function canStartWork(issue: Issue): Promise<boolean> {
  const checks = [
    // Has acceptance criteria
    extractAcceptanceCriteria(issue.description).length > 0,

    // No blocking dependencies
    (await getBlockingIssues(issue)).length === 0,

    // Assigned to autopilot
    issue.assignee?.id === AUTOPILOT_BOT_USER_ID,
  ];

  return checks.every(c => c);
}
Gate 2: Submit for Review (In Progress -> In Review)
typescript
async function canSubmitForReview(proof: Proof): Promise<boolean> {
  const checks = [
    // All tests pass
    proof.testResults.passed === proof.testResults.total,

    // Build successful
    proof.buildSuccessful,

    // No lint errors
    proof.lintErrors === 0,

    // Has proof artifacts
    proof.screenshots.length > 0 || proof.deploymentUrl,
  ];

  return checks.every(c => c);
}
Gate 3: Complete (In Review -> Done)
typescript
async function canComplete(proof: Proof): Promise<{
  canProceed: boolean;
  autoApproved: boolean;
}> {
  if (proof.confidence >= 95) {
    return { canProceed: true, autoApproved: true };
  }

  if (proof.confidence >= 80) {
    return { canProceed: false, autoApproved: false };
    // Wait for user approval
  }

  return { canProceed: false, autoApproved: false };
  // Validation failed, should iterate
}

Iteration Limits

Loop TypeMax IterationsEscalation
Execution retry2Block task
Feedback rounds5Manual intervention
Quality check fixes2Report to user

Implementation

typescript
class StateMachine {
  async transition(
    issueId: string,
    targetState: string,
    proof?: Proof
  ): Promise<void> {
    const issue = await linear.issue(issueId);
    const currentState = issue.state.name;

    // Validate transition
    const isValid = this.validateTransition(currentState, targetState, proof);

    if (!isValid) {
      throw new Error(`Invalid transition: ${currentState} -> ${targetState}`);
    }

    // Execute transition
    await linear.issueUpdate(issueId, {
      stateId: await this.getStateId(issue.team.id, targetState),
    });

    // Log transition
    await this.logTransition(issueId, currentState, targetState, proof);
  }

  private validateTransition(
    from: string,
    to: string,
    proof?: Proof
  ): boolean {
    const validTransitions: Record<string, string[]> = {
      'Todo': ['In Progress', 'Blocked'],
      'In Progress': ['In Review', 'Blocked'],
      'In Review': ['Done', 'In Progress'],
      'Blocked': ['Todo', 'In Progress'],
    };

    return validTransitions[from]?.includes(to) ?? false;
  }
}

State Transition Diagram

                    ┌─────────────────────────────┐
                    │                             │
                    ▼                             │
┌──────┐       ┌─────────────┐       ┌───────────┴───┐       ┌──────┐
│ Todo │ ────► │ In Progress │ ────► │   In Review   │ ────► │ Done │
└──────┘       └─────────────┘       └───────────────┘       └──────┘
    │               │                        │
    │               │                        │
    │               ▼                        │
    │          ┌─────────┐                   │
    └────────► │ Blocked │ ◄─────────────────┘
               └─────────┘

Examples

Example 1: Happy Path
typescript
// Task created
await transitionState(issueId, 'In Progress');  // Gate: Has acceptance criteria

// Work complete, proof generated
await transitionState(issueId, 'In Review');    // Gate: Proof >= 80%

// High confidence auto-approval
await transitionState(issueId, 'Done');         // Gate: Confidence >= 95%
Example 2: Iteration Loop
typescript
// First attempt
await transitionState(issueId, 'In Progress');
await transitionState(issueId, 'In Review');    // Confidence: 85%

// User requests changes
await transitionState(issueId, 'In Progress');  // Feedback: REQUESTED_CHANGES

// Second attempt
await transitionState(issueId, 'In Review');    // Confidence: 97%
await transitionState(issueId, 'Done');         // Auto-approved
Example 3: Escalation
typescript
// After 5 feedback rounds
if (iterationCount >= MAX_FEEDBACK_ROUNDS) {
  await transitionState(issueId, 'Blocked');
  await addComment(issueId, "Escalated: Max iterations reached");
}

Best Practices

  • Always validate before transitioning
  • Log all transitions for audit trail
  • Include proof artifacts when transitioning to In Review
  • Enforce iteration limits to prevent infinite loops
  • Escalate gracefully rather than failing silently
  • Comment on Linear when state changes for visibility

© MadAppGang, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in plugins/autopilot/skills/state-machine of MadAppGang/claude-code.

Open the folder on GitHubat commit 6097ad4

Compare with similar skills

State Machine next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

State Machine compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
State Machine this skillMadAppGang/claude-code285—~1.7kAutomated safety check: PassMIT
Audit State Machineben-manes/caffeine18k—~1.1kAutomated safety check: PassApache-2.0
State MachineOwl-Listener/designer-skills2.9k1 repos~488Automated safety check: PassMIT
State Machinejame581/GodotPrompter799—~3.5kAutomated safety check: PassMIT
Gate Testsvercel/next.js143k—~2.7kAutomated safety check: PassMIT
View Transitionsthedaviddias/Front-End-Checklist74k—~528Automated safety check: PassMIT

Similar skills

  • Audit State Machine

    ben-manes/caffeine

    Audit explicit state machines (drain status, node lifecycle, async-value lifecycle) for illegal or missed transitions

    18k GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • State Machine

    Owl-Listener/designer-skills

    Model component behaviour as explicit states, events, and transitions.

    2.9k GitHub starsUsed in 1 repo~488 tokens
    Frontend & DesignAuto-check passed
  • State Machine

    jame581/GodotPrompter

    A skill your agent uses when implementing state machines in Godot — enum-based, node-based, and resource-based FSM patterns with trade-offs

    799 GitHub stars~3.5k tokensUpdated yesterday
    Game DevelopmentAuto-check passed
  • Gate Tests

    vercel/next.js

    Official

    How to use the @gate / @force-gate test directives instead of it.skip or fake-green skip patterns.

    143k GitHub stars~2.7k tokensUpdated today
    Auto-check passed
  • View Transitions

    thedaviddias/Front-End-Checklist

    A skill your agent uses when adding page transition animations, image expand/contract effects, shared-element transitions, or improving navigation UX in a single-page or multi-page application.

    74k GitHub stars~528 tokensUpdated 3 days ago
    Auto-check passed
  • Vercel React View Transitions

    sickn33/agentic-awesome-skills

    Guide React and Next.js view transitions, shared element animations, route transitions, transition types, and reduced-motion-safe UI state animation.

    47k GitHub starsUsed in 1 repo~3.1k tokens
    Auto-check passed

More from MadAppGang/claude-code

All 69 skills in this repo
  • Content Brief

    MadAppGang/claude-code

    Content brief template and creation methodology for SEO-optimized content.

    285 GitHub starsUsed in 1 repo~959 tokens
    Auto-check passed
  • Context Detection

    MadAppGang/claude-code

    A skill your agent uses when detecting project technology stack from files/configs/directory structure, auto-loading framework-specific skills, or analyzing multi-stack fullstack projects (e.g…

    285 GitHub stars~5.4k tokensUpdated 6 mo ago
    Auto-check passed
  • Content Optimizer

    MadAppGang/claude-code

    On-page SEO optimization techniques including keyword density, meta tags, heading structure, and readability.

    285 GitHub starsUsed in 1 repo~694 tokens
    Auto-check passed
  • Keyword Cluster Builder

    MadAppGang/claude-code

    Techniques for expanding seed keywords and clustering by topic and intent.

    285 GitHub starsUsed in 1 repo~674 tokens
    Auto-check passed
  • Serp Analysis

    MadAppGang/claude-code

    SERP analysis techniques for intent classification, feature identification, and competitive intelligence.

    285 GitHub starsUsed in 1 repo~1k tokens
    Auto-check passed
  • Agent Coordination Discipline

    MadAppGang/claude-code

    A skill your agent uses when deciding whether to launch an agent, selecting which agent to use, or coordinating multiple agents.

    285 GitHub stars~3.8k tokensUpdated 6 mo ago
    Auto-check passed

Questions about State Machine

What does State Machine do?

Task lifecycle state transitions with validation gates. An agent skill from MadAppGang/claude-code. State Machine is an agent skill from MadAppGang/claude-code. Task lifecycle state transitions with validation gates.

How do I install State Machine in Claude Code?

Run `npx skills add MadAppGang/claude-code --skill state-machine -a claude-code`. Or copy the skill folder (plugins/autopilot/skills/state-machine in MadAppGang/claude-code) into .claude/skills/state-machine in your project. Claude Code loads it when a task matches its description.

How do I install State Machine in Codex?

Run `npx skills add MadAppGang/claude-code --skill state-machine -a codex`. Or copy the skill folder (plugins/autopilot/skills/state-machine in MadAppGang/claude-code) into .agents/skills/state-machine in your project. Codex loads it when a task matches its description.

Can I use State Machine in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add MadAppGang/claude-code --skill state-machine -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/state-machine, .gemini/skills/state-machine, .github/skills/state-machine and .opencode/skills/state-machine in your project.

What does State Machine need to run?

SKILL.md names no scripts, command-line tools or credentials: State Machine is instructions for the agent only.

Does State Machine access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is State Machine safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does State Machine use?

State Machine is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does State Machine use?

About 1.7k tokens (SKILL.md is roughly 6.7k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to State Machine?

Skills that share tags, products or a category with State Machine: Audit State Machine (ben-manes/caffeine, 18k stars), State Machine (Owl-Listener/designer-skills, 2.9k stars), State Machine (jame581/GodotPrompter, 799 stars) and Gate Tests (vercel/next.js, 143k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains State Machine?

MadAppGang (a GitHub organization) maintains it in MadAppGang/claude-code, which has 285 GitHub stars. The repository holds 69 skills in this directory. The repository was last updated on March 15, 2026.

Source: MadAppGang/claude-code on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.