Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

step-functions

БесплатноБез исполняемых скриптовНе проверен

AWS Step Functions runs serverless workflows defined as state machines in Amazon States Language (ASL): Lambda and direct AWS service calls with branching…

TerminalSkillsот TerminalSkills★ 221 звезда на GitHub

Об этом скилле

AWS Step Functions

Overview

Step Functions executes a state machine written in Amazon States Language (JSON). Each state is a Task (Lambda or any of the many AWS services, called directly), Choice, Parallel, Map, Wait, Pass, Succeed or Fail. Two workflow types exist and the type cannot be changed after creation:

  • Standard: runs up to one year, exactly-once execution, execution history available. Use for payments, approvals, long processes.
  • Express: runs up to five minutes, at-least-once, billed by executions and duration, history only in CloudWatch Logs. Use for high-volume, idempotent event processing.

New workflows should set "QueryLanguage": "JSONata" at the top level. JSONata replaces the five JSONPath fields (InputPath, Parameters, ResultSelector, ResultPath, OutputPath) with Arguments and Output, writes expressions as "{% ... %}", and uses $states.input and $states.result. Existing JSONPath machines keep working; the older field names below apply only to them.

Instructions

Step 1: Write the definition

A JSONata order workflow with a direct Lambda integration, retry, catch and a Choice. Use the optimized arn:aws:states:::lambda:invoke resource; its result is under $states.result.Payload.

{
  "Comment": "Order processing",
  "QueryLanguage": "JSONata",
  "StartAt": "ValidateOrder",
  "States": {
    "ValidateOrder": {
      "Type": "Task",
      "Resource": "arn:aws:states:::lambda:invoke",
      "Arguments": {
        "FunctionName": "arn:aws:lambda:eu-west-1:482910563127:function:validate-order:live",
        "Payload": "{% $states.input %}"
      },
      "Assign": { "orderId": "{% $states.input.orderId %}" },
      "Output": "{% $states.result.Payload %}",
      "Retry": [
        {
          "ErrorEquals": ["Lambda.ServiceException", "Lambda.AWSLambdaException", "Lambda.SdkClientException", "Lambda.TooManyRequestsException"],
          "IntervalSeconds": 2,
          "MaxAttempts": 4,
          "BackoffRate": 2,
          "JitterStrategy": "FULL"
        }
      ],
      "Catch": [
        { "ErrorEquals": ["ValidationError"], "Next": "RejectOrder", "Output": "{% $states.errorOutput %}" }
      ],
      "Next": "InventoryDecision"
    },
    "InventoryDecision": {
      "Type": "Choice",
      "Choices": [
        { "Condition": "{% $states.input.inStock = true %}", "Next": "ChargeCard" }
      ],
      "Default": "RejectOrder"
    },
    "ChargeCard": {
      "Type": "Task",
      "Resource": "arn:aws:states:::lambda:invoke",
      "Arguments": {
        "FunctionName": "arn:aws:lambda:eu-west-1:482910563127:function:charge-card:live",
        "Payload": { "orderId": "{% $orderId %}", "total": "{% $states.input.total %}" }
      },
      "Output": "{% $states.result.Payload %}",
      "End": true
    },
    "RejectOrder": {
      "Type": "Fail",
      "Error": "OrderRejected",
      "Cause": "Validation failed or item out of stock"
    }
  }
}

Notes on the definition:

  • Assign stores values in workflow variables ($orderId) that every later state can read. Assignments in one Assign block all see the values from before that block.
  • Retriers and catchers are evaluated in order; States.ALL must be alone in its entry and last. A Catch replaces the state's output with the error output unless you set Output.
  • Error names you can match include States.TaskFailed, States.Timeout, States.Runtime, and Lambda's Lambda.Unknown and Sandbox.Timedout. Custom error names must not start with States..
  • Set TimeoutSeconds on every Task; without it a stuck task can wait for up to a year in a Standard workflow.

Step 2: Direct service integrations and callbacks

Calling DynamoDB, SQS, SNS, EventBridge, ECS and other services directly skips a Lambda hop. Append .waitForTaskToken to pause until something calls SendTaskSuccess or SendTaskFailure with the token:

// excerpt: one entry of the top-level "States" object (Standard workflows only)
"RequestApproval": {
  "Type": "Task",
  "Resource": "arn:aws:states:::sqs:sendMessage.waitForTaskToken",
  "Arguments": {
    "QueueUrl": "https://sqs.eu-west-1.amazonaws.com/482910563127/refund-approvals",
    "MessageBody": { "taskToken": "{% $states.context.Task.Token %}", "orderId": "{% $orderId %}" }
  },
  "TimeoutSeconds": 86400,
  "Next": "IssueRefund"
}

Step 3: Map and Parallel

Map runs an ItemProcessor per array item (the old Iterator and Parameters fields are deprecated; use ItemProcessor and ItemSelector). MaxConcurrency caps parallel iterations; 0 means no limit. Parallel runs fixed Branches and returns an array of their outputs.

Step 4: Deploy, validate and run

$ aws stepfunctions validate-state-machine-definition --definition file://order.asl.json --type STANDARD
$ aws stepfunctions create-state-machine --name order-processing --type STANDARD \
    --definition file://order.asl.json \
    --role-arn arn:aws
Полный SKILL.md на GitHub

Установить step-functions в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

_scores.json

FAQ

Что делает скилл step-functions?

AWS Step Functions runs serverless workflows defined as state machines in Amazon States Language (ASL): Lambda and direct AWS service calls with branching, parallel and map steps, retries, error catching and human approval callbacks. Use when a user wants to orchestrate Lambda functions, build an AWS workflow or saga, add retries and error handling to a multi-step process, wait for an approval, or write ASL JSON with JSONata.

Как установить скилл step-functions?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл step-functions запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить step-functions с