vybekiit 0.7.0 → 0.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/dist/bin.js +1697 -562
  2. package/dist/global-skills/add-ai/SKILL.md +1 -1
  3. package/dist/global-skills/add-analytics/SKILL.md +1 -1
  4. package/dist/global-skills/add-blog/SKILL.md +1 -1
  5. package/dist/global-skills/add-crud/SKILL.md +1 -1
  6. package/dist/global-skills/add-files/SKILL.md +1 -1
  7. package/dist/global-skills/add-images/SKILL.md +1 -1
  8. package/dist/global-skills/add-language/SKILL.md +1 -1
  9. package/dist/global-skills/add-notifications/SKILL.md +1 -1
  10. package/dist/global-skills/add-realtime/SKILL.md +1 -1
  11. package/dist/global-skills/add-route/SKILL.md +1 -1
  12. package/dist/global-skills/add-search/SKILL.md +1 -1
  13. package/dist/global-skills/add-signin/SKILL.md +1 -1
  14. package/dist/global-skills/add-teams/SKILL.md +1 -1
  15. package/dist/global-skills/add-upload/SKILL.md +1 -1
  16. package/dist/global-skills/aws-serverless/SKILL.md +44 -44
  17. package/dist/global-skills/aws-serverless/assets/powertools-handler.py +1 -2
  18. package/dist/global-skills/aws-serverless/references/api-gateway.md +470 -50
  19. package/dist/global-skills/aws-serverless/references/architecture.md +186 -47
  20. package/dist/global-skills/aws-serverless/references/concurrency.md +158 -44
  21. package/dist/global-skills/aws-serverless/references/deployment.md +1 -1
  22. package/dist/global-skills/aws-serverless/references/event-sources.md +391 -72
  23. package/dist/global-skills/aws-serverless/references/lambda.md +428 -69
  24. package/dist/global-skills/aws-serverless/references/orchestration.md +384 -65
  25. package/dist/global-skills/aws-serverless/references/production.md +415 -78
  26. package/dist/global-skills/aws-serverless/references/troubleshooting.md +626 -79
  27. package/dist/global-skills/back-up-my-code/SKILL.md +1 -1
  28. package/dist/global-skills/buy-domain/SKILL.md +1 -1
  29. package/dist/global-skills/check-safety/SKILL.md +1 -1
  30. package/dist/global-skills/configure-capabilities/SKILL.md +1 -1
  31. package/dist/global-skills/connect-account/SKILL.md +1 -1
  32. package/dist/global-skills/connect-account-backend/SKILL.md +1 -1
  33. package/dist/global-skills/design-my-data/SKILL.md +1 -1
  34. package/dist/global-skills/doctor/SKILL.md +1 -1
  35. package/dist/global-skills/feedback/SKILL.md +63 -0
  36. package/dist/global-skills/go-live/SKILL.md +1 -1
  37. package/dist/global-skills/harden/SKILL.md +1 -1
  38. package/dist/global-skills/instrument-feature-flags/references/usage.md +0 -35
  39. package/dist/global-skills/instrument-product-analytics/SKILL.md +1 -1
  40. package/dist/global-skills/instrument-product-analytics/references/android.md +0 -36
  41. package/dist/global-skills/instrument-product-analytics/references/configuration.md +0 -1
  42. package/dist/global-skills/instrument-product-analytics/references/flutter.md +0 -37
  43. package/dist/global-skills/instrument-product-analytics/references/posthog-python.md +2 -3
  44. package/dist/global-skills/instrument-product-analytics/references/usage.md +0 -35
  45. package/dist/global-skills/manifest.json +2 -1
  46. package/dist/global-skills/neon/SKILL.md +20 -27
  47. package/dist/global-skills/neon-ai-gateway/SKILL.md +2 -68
  48. package/dist/global-skills/neon-functions/SKILL.md +7 -7
  49. package/dist/global-skills/neon-object-storage/SKILL.md +2 -2
  50. package/dist/global-skills/neon-postgres/SKILL.md +5 -5
  51. package/dist/global-skills/neon-postgres-branches/SKILL.md +1 -1
  52. package/dist/global-skills/onboarding/SKILL.md +1 -1
  53. package/dist/global-skills/plan-my-idea/SKILL.md +1 -1
  54. package/dist/global-skills/publish-app/SKILL.md +1 -1
  55. package/dist/global-skills/publish-extension/SKILL.md +1 -1
  56. package/dist/global-skills/reset-password/SKILL.md +1 -1
  57. package/dist/global-skills/save-data/SKILL.md +1 -1
  58. package/dist/global-skills/setup-email/SKILL.md +1 -1
  59. package/dist/global-skills/setup-payments/SKILL.md +1 -1
  60. package/dist/global-skills/setup-sms/SKILL.md +1 -1
  61. package/dist/global-skills/sign-in-with-email-link/SKILL.md +1 -1
  62. package/dist/global-skills/sign-in-with-google/SKILL.md +1 -1
  63. package/dist/global-skills/sign-in-with-phone/SKILL.md +1 -1
  64. package/dist/global-skills/stripe-best-practices/SKILL.md +6 -11
  65. package/dist/global-skills/stripe-best-practices/references/billing.md +0 -5
  66. package/dist/global-skills/stripe-best-practices/references/payments.md +2 -4
  67. package/dist/global-skills/stripe-best-practices/references/tax.md +8 -78
  68. package/dist/global-skills/track-errors/SKILL.md +1 -1
  69. package/dist/global-skills/update-kit/SKILL.md +1 -1
  70. package/dist/global-skills/wire-auth/SKILL.md +1 -1
  71. package/dist/global-skills/wire-database/SKILL.md +1 -1
  72. package/dist/global-skills/wire-email/SKILL.md +1 -1
  73. package/dist/global-skills/wire-payments/SKILL.md +1 -1
  74. package/package.json +8 -8
  75. package/dist/global-skills/email-best-practices/.github/workflows/sync-skills.yml +0 -30
  76. package/dist/global-skills/email-best-practices/README.md +0 -63
  77. package/dist/global-skills/email-best-practices/references/accessibility.md +0 -189
  78. package/dist/global-skills/email-best-practices/references/compliance.md +0 -125
  79. package/dist/global-skills/email-best-practices/references/deliverability.md +0 -121
  80. package/dist/global-skills/email-best-practices/references/email-capture.md +0 -129
  81. package/dist/global-skills/email-best-practices/references/email-types.md +0 -173
  82. package/dist/global-skills/email-best-practices/references/list-management.md +0 -157
  83. package/dist/global-skills/email-best-practices/references/marketing-emails.md +0 -115
  84. package/dist/global-skills/email-best-practices/references/sending-reliability.md +0 -155
  85. package/dist/global-skills/email-best-practices/references/transactional-email-catalog.md +0 -418
  86. package/dist/global-skills/email-best-practices/references/transactional-emails.md +0 -92
  87. package/dist/global-skills/email-best-practices/references/webhooks-events.md +0 -167
  88. package/dist/global-skills/email-best-practices/tests/README.md +0 -35
  89. package/dist/global-skills/email-best-practices/tests/scenarios/01-spam-deliverability.md +0 -46
  90. package/dist/global-skills/email-best-practices/tests/scenarios/02-multi-region-compliance.md +0 -48
  91. package/dist/global-skills/email-best-practices/tests/scenarios/03-retry-idempotency.md +0 -36
  92. package/dist/global-skills/email-best-practices/tests/scenarios/04-webhook-bounce-handling.md +0 -52
  93. package/dist/global-skills/email-best-practices/tests/scenarios/05-new-saas-email-plan.md +0 -51
  94. package/dist/global-skills/neon-postgres/references/neon-sdk.md +0 -262
@@ -1,18 +1,20 @@
1
1
  # Orchestration Reference
2
2
 
3
- Step Functions and EventBridge decision matrices, error semantics, and limits. Assumes you can write Amazon States Language (Saga/Parallel/Map/Choice JSON) and EventBridge patterns — this file focuses on the choices and gotchas.
3
+ AWS Step Functions and Amazon EventBridge patterns and configuration.
4
4
 
5
5
  ## Contents
6
6
 
7
- - [Standard vs Express](#standard-vs-express)
8
- - [State machine limits and patterns](#state-machine-limits-and-patterns)
7
+ - [Step Functions Standard vs Express](#step-functions-standard-vs-express)
8
+ - [State machine patterns](#state-machine-patterns)
9
9
  - [Error handling](#error-handling)
10
- - [EventBridge rules, pipes, and patterns](#eventbridge-rules-pipes-and-patterns)
11
- - [Step Functions vs Lambda durable functions](#step-functions-vs-lambda-durable-functions)
10
+ - [EventBridge rules and patterns](#eventbridge-rules-and-patterns)
11
+ - [EventBridge Pipes](#eventbridge-pipes)
12
12
 
13
13
  ---
14
14
 
15
- ## Standard vs Express
15
+ ## Step Functions Standard vs Express
16
+
17
+ ### Decision Matrix
16
18
 
17
19
  | Dimension | Standard | Express |
18
20
  |---|---|---|
@@ -23,108 +25,425 @@ Step Functions and EventBridge decision matrices, error semantics, and limits. A
23
25
  | `.waitForTaskToken` | Supported | **Not supported** |
24
26
  | Distributed Map | Supported | **Not supported** |
25
27
  | Activities | Supported | **Not supported** |
26
- | Idempotency | Automatic (execution name unique 90 days) | Not managed |
28
+ | Idempotency | Automatic (execution name unique for 90 days) | Not managed |
29
+
30
+ Express sub-types:
27
31
 
28
- Express sub-types: **Async** (fire-and-forget, results via CloudWatch Logs); **Sync** (blocks until completion, invokable from API Gateway/Lambda/`StartSyncExecution`, 5-min max).
32
+ - **Asynchronous**: Fire-and-forget. Results via CloudWatch Logs.
33
+ - **Synchronous**: Blocks until completion. Invokable from API Gateway, Lambda, or `StartSyncExecution`. 5-min max.
29
34
 
30
- | Use case | Type |
35
+ | Use Case | Type |
31
36
  |---|---|
32
- | Long-running, `.sync`/callback, non-idempotent (payments) | Standard |
37
+ | Long-running orchestration, `.sync`/callback patterns | Standard |
38
+ | Non-idempotent operations (payments, exactly-once) | Standard |
33
39
  | Distributed Map (large-scale parallel) | Standard |
34
40
  | High-volume event processing (IoT, streaming) | Express |
35
41
  | API-backed synchronous microservice orchestration | Synchronous Express |
36
42
 
37
43
  ---
38
44
 
39
- ## State machine limits and patterns
45
+ ## State Machine Patterns
46
+
47
+ ### Saga Pattern (Compensating Transactions)
48
+
49
+ Each step has a corresponding undo step invoked on failure via `Catch`. Compensations chain in reverse.
50
+
51
+ ```json
52
+ {
53
+ "Comment": "Saga pattern — book travel",
54
+ "StartAt": "BookHotel",
55
+ "States": {
56
+ "BookHotel": {
57
+ "Type": "Task",
58
+ "Resource": "arn:aws:lambda:us-east-1:123456789012:function:book-hotel",
59
+ "TimeoutSeconds": 30,
60
+ "Catch": [{
61
+ "ErrorEquals": ["States.ALL"],
62
+ "ResultPath": "$.BookHotelError",
63
+ "Next": "NotifyFailure"
64
+ }],
65
+ "Next": "BookFlight"
66
+ },
67
+ "BookFlight": {
68
+ "Type": "Task",
69
+ "Resource": "arn:aws:lambda:us-east-1:123456789012:function:book-flight",
70
+ "TimeoutSeconds": 30,
71
+ "Catch": [{
72
+ "ErrorEquals": ["States.ALL"],
73
+ "ResultPath": "$.BookFlightError",
74
+ "Next": "CancelHotel"
75
+ }],
76
+ "Next": "BookCar"
77
+ },
78
+ "BookCar": {
79
+ "Type": "Task",
80
+ "Resource": "arn:aws:lambda:us-east-1:123456789012:function:book-car",
81
+ "TimeoutSeconds": 30,
82
+ "Catch": [{
83
+ "ErrorEquals": ["States.ALL"],
84
+ "ResultPath": "$.BookCarError",
85
+ "Next": "CancelFlight"
86
+ }],
87
+ "Next": "ConfirmBooking"
88
+ },
89
+ "CancelFlight": {
90
+ "Type": "Task",
91
+ "Resource": "arn:aws:lambda:us-east-1:123456789012:function:cancel-flight",
92
+ "Next": "CancelHotel"
93
+ },
94
+ "CancelHotel": {
95
+ "Type": "Task",
96
+ "Resource": "arn:aws:lambda:us-east-1:123456789012:function:cancel-hotel",
97
+ "Next": "NotifyFailure"
98
+ },
99
+ "NotifyFailure": {
100
+ "Type": "Fail",
101
+ "Error": "SagaFailed",
102
+ "Cause": "One or more bookings failed; compensations executed"
103
+ },
104
+ "ConfirmBooking": { "Type": "Succeed" }
105
+ }
106
+ }
107
+ ```
108
+
109
+ ### Parallel State
110
+
111
+ Executes branches concurrently. **Output is an array** with one element per branch. All branches must succeed or the entire Parallel state fails. Supports `Retry` and `Catch`.
112
+
113
+ ```json
114
+ {
115
+ "Type": "Parallel",
116
+ "Branches": [
117
+ {
118
+ "StartAt": "ProcessImages",
119
+ "States": {
120
+ "ProcessImages": {
121
+ "Type": "Task",
122
+ "Resource": "arn:aws:lambda:us-east-1:123456789012:function:process-images",
123
+ "End": true
124
+ }
125
+ }
126
+ },
127
+ {
128
+ "StartAt": "ProcessMetadata",
129
+ "States": {
130
+ "ProcessMetadata": {
131
+ "Type": "Task",
132
+ "Resource": "arn:aws:lambda:us-east-1:123456789012:function:process-metadata",
133
+ "End": true
134
+ }
135
+ }
136
+ }
137
+ ],
138
+ "Next": "AggregateResults"
139
+ }
140
+ ```
141
+
142
+ ### Map State
143
+
144
+ **Inline Map**: Iterates over an array in the same execution. Max **40 concurrent** iterations.
145
+
146
+ ```json
147
+ {
148
+ "Type": "Map",
149
+ "ItemsPath": "$.orders",
150
+ "MaxConcurrency": 10,
151
+ "ItemProcessor": {
152
+ "ProcessorConfig": { "Mode": "INLINE" },
153
+ "StartAt": "ProcessOrder",
154
+ "States": {
155
+ "ProcessOrder": {
156
+ "Type": "Task",
157
+ "Resource": "arn:aws:lambda:us-east-1:123456789012:function:process-order",
158
+ "End": true
159
+ }
160
+ }
161
+ },
162
+ "Next": "Done"
163
+ }
164
+ ```
165
+
166
+ **Distributed Map**: Up to **10,000 parallel child executions**. Reads from S3 (JSON, CSV, S3 inventory). Supports `ItemBatcher`, `ItemReader`, `ResultWriter`. **Standard workflows only.**
40
167
 
41
- - **Payload limit: 256 KiB between states** — store large data in S3, pass S3 keys.
42
- - **Inline Map:** max **40 concurrent** iterations, same execution.
43
- - **Distributed Map:** up to **10,000 parallel child executions**, reads from S3 (JSON/CSV/inventory), supports `ItemBatcher`/`ItemReader`/`ResultWriter`. **Standard workflows only.**
44
- - **25,000 execution-history entries** (Standard) — split long workflows into child executions.
45
- - **Parallel state output is an array** (one element per branch); all branches must succeed or the state fails.
46
- - **Choice state:** always include a `Default` branch.
168
+ ### Choice State
47
169
 
48
- Common patterns (write the ASL directly): **Saga** (each step has a compensating undo via `Catch`, chained in reverse); **Parallel** (concurrent branches); **Map** (iterate an array); **Agentic AI loop** (`bedrock:invokeModel` → Choice on `stop_reason = 'tool_use'` → execute tool → loop). Prefer **direct SDK integrations** (200+ services) over Lambda intermediaries to cut latency, and prefer **JSONata** for inline transforms over a Lambda task.
170
+ Routes execution based on input conditions. Always include a `Default` branch.
171
+
172
+ Comparison operators: `StringEquals`, `StringMatches`, `NumericGreaterThan`, `NumericLessThanEquals`, `BooleanEquals`, `IsPresent`, `IsNull`, `TimestampEquals`, and `Path` variants.
173
+
174
+ ```json
175
+ {
176
+ "Type": "Choice",
177
+ "Choices": [
178
+ { "Variable": "$.orderTotal", "NumericGreaterThan": 1000, "Next": "HighValueOrder" },
179
+ { "Variable": "$.isPrime", "BooleanEquals": true, "Next": "PrimeProcessing" }
180
+ ],
181
+ "Default": "StandardProcessing"
182
+ }
183
+ ```
184
+
185
+ ### Agentic AI Loop Pattern (Tool Use)
186
+
187
+ Model outputs a structured response indicating a tool call or final answer. Choice state routes accordingly. Tool results feed back in a loop.
188
+
189
+ ```json
190
+ {
191
+ "Comment": "Agentic AI loop with tool use",
192
+ "QueryLanguage": "JSONata",
193
+ "StartAt": "InvokeModel",
194
+ "States": {
195
+ "InvokeModel": {
196
+ "Type": "Task",
197
+ "Resource": "arn:aws:states:::bedrock:invokeModel",
198
+ "Arguments": {
199
+ "ModelId": "global.anthropic.claude-sonnet-4-6",
200
+ "Body": {
201
+ "anthropic_version": "bedrock-2023-05-31",
202
+ "max_tokens": 4096,
203
+ "messages": "{% $states.input.messages %}"
204
+ },
205
+ "ContentType": "application/json",
206
+ "Accept": "application/json"
207
+ },
208
+ "Next": "CheckAction"
209
+ },
210
+ "CheckAction": {
211
+ "Type": "Choice",
212
+ "Choices": [
213
+ { "Condition": "{% $states.input.Body.stop_reason = 'tool_use' %}", "Next": "ExecuteTool" }
214
+ ],
215
+ "Default": "ReturnResult"
216
+ },
217
+ "ExecuteTool": {
218
+ "Type": "Task",
219
+ "Resource": "arn:aws:lambda:us-east-1:123456789012:function:execute-tool",
220
+ "TimeoutSeconds": 60,
221
+ "Next": "InvokeModel"
222
+ },
223
+ "ReturnResult": { "Type": "Succeed" }
224
+ }
225
+ }
226
+ ```
49
227
 
50
228
  ---
51
229
 
52
- ## Error handling
230
+ ## Error Handling
53
231
 
54
- ### Built-in error names
232
+ ### Built-in Error Names
55
233
 
56
- | Error Name | Retriable? | Notes |
57
- |---|:---:|---|
58
- | `States.ALL` | Yes | Wildcard — but does **NOT** match the two terminal errors below |
59
- | `States.TaskFailed` | Yes | Wildcard for task errors (except `States.Timeout`) |
60
- | `States.Timeout` / `States.HeartbeatTimeout` | Yes | Exceeded `TimeoutSeconds` / missed `HeartbeatSeconds` |
61
- | `States.Permissions` | Yes | Insufficient IAM privileges |
62
- | `States.DataLimitExceeded` | **No** | Payload > 256 KiB — **terminal** |
63
- | `States.Runtime` | **No** | Invalid JSONPath, null payload — **terminal** |
64
- | `States.ItemReaderFailed` / `States.ResultWriterFailed` | Yes | Map source/destination errors |
234
+ | Error Name | Description | Retriable? |
235
+ |---|---|---|
236
+ | `States.ALL` | Wildcard — matches any error | Yes |
237
+ | `States.TaskFailed` | Wildcard for task errors (except `States.Timeout`) | Yes |
238
+ | `States.Timeout` | Task exceeded `TimeoutSeconds` or `HeartbeatSeconds` | Yes |
239
+ | `States.HeartbeatTimeout` | No heartbeat within `HeartbeatSeconds` | Yes |
240
+ | `States.Permissions` | Insufficient IAM privileges | Yes |
241
+ | `States.DataLimitExceeded` | Payload exceeds 256 KiB — **terminal** | **No** |
242
+ | `States.Runtime` | Invalid JSONPath, null payload **terminal** | **No** |
243
+ | `States.ItemReaderFailed` | Map couldn't read from ItemReader source | Yes |
244
+ | `States.ResultWriterFailed` | Map couldn't write to ResultWriter destination | Yes |
245
+
246
+ `States.ALL` does **not** match `States.DataLimitExceeded` or `States.Runtime`.
65
247
 
66
- > **`States.ALL` does NOT catch `States.DataLimitExceeded` or `States.Runtime`.** These are terminal and must be designed around, not retried.
248
+ ### Retry Configuration
67
249
 
68
- ### Retry config
250
+ Available on `Task`, `Parallel`, and `Map` states. Retries are attempted before catchers.
69
251
 
70
252
  ```json
71
253
  "Retry": [
72
- { "ErrorEquals": ["States.Timeout"], "IntervalSeconds": 3, "MaxAttempts": 2,
73
- "BackoffRate": 2.0, "MaxDelaySeconds": 30, "JitterStrategy": "FULL" },
74
- { "ErrorEquals": ["Lambda.ServiceException", "Lambda.SdkClientException"],
75
- "IntervalSeconds": 1, "MaxAttempts": 3, "BackoffRate": 2.0 },
76
- { "ErrorEquals": ["States.ALL"], "IntervalSeconds": 1, "MaxAttempts": 3, "BackoffRate": 2.0 }
254
+ {
255
+ "ErrorEquals": ["States.Timeout"],
256
+ "IntervalSeconds": 3,
257
+ "MaxAttempts": 2,
258
+ "BackoffRate": 2.0,
259
+ "MaxDelaySeconds": 30,
260
+ "JitterStrategy": "FULL"
261
+ },
262
+ {
263
+ "ErrorEquals": ["Lambda.ServiceException", "Lambda.SdkClientException"],
264
+ "IntervalSeconds": 1,
265
+ "MaxAttempts": 3,
266
+ "BackoffRate": 2.0
267
+ },
268
+ {
269
+ "ErrorEquals": ["States.ALL"],
270
+ "IntervalSeconds": 1,
271
+ "MaxAttempts": 3,
272
+ "BackoffRate": 2.0
273
+ }
274
+ ]
275
+ ```
276
+
277
+ | Field | Default | Description |
278
+ |---|---|---|
279
+ | `ErrorEquals` | (required) | Array of error names to match |
280
+ | `IntervalSeconds` | 1 | Initial wait before first retry |
281
+ | `MaxAttempts` | 3 | Max retries; 0 = never retry |
282
+ | `BackoffRate` | 2.0 | Multiplier for exponential backoff |
283
+ | `MaxDelaySeconds` | — | Cap on computed backoff interval |
284
+ | `JitterStrategy` | `"NONE"` | `"FULL"` randomizes wait between 0 and computed interval |
285
+
286
+ Rules:
287
+
288
+ - `States.ALL` must be **last** in the Retry array
289
+ - Retries count as state transitions (billed in Standard workflows)
290
+ - `States.Runtime` and `States.DataLimitExceeded` **cannot be retried**
291
+ - Use `JitterStrategy: "FULL"` to prevent thundering herd
292
+
293
+ ### Catch (Fallback States)
294
+
295
+ ```json
296
+ "Catch": [
297
+ {
298
+ "ErrorEquals": ["CustomBusinessError"],
299
+ "ResultPath": "$.error-info",
300
+ "Next": "HandleBusinessError"
301
+ },
302
+ {
303
+ "ErrorEquals": ["States.ALL"],
304
+ "ResultPath": "$.error-info",
305
+ "Next": "GenericErrorHandler"
306
+ }
77
307
  ]
78
308
  ```
79
309
 
80
- Defaults: `IntervalSeconds` 1, `MaxAttempts` 3 (0 = never), `BackoffRate` 2.0, `JitterStrategy` `"NONE"`.
310
+ - `ResultPath` preserves original input alongside the error (e.g., `"$.error-info"`)
311
+ - Without `ResultPath`, error output replaces entire input
312
+ - Retries are attempted first; catchers apply only after retries are exhausted
313
+
314
+ ### Error handling best practices
315
+
316
+ 1. **Always set `TimeoutSeconds`** on every Task state
317
+ 2. **Always retry Lambda service exceptions**: `Lambda.ServiceException`, `Lambda.SdkClientException`
318
+ 3. **Use `HeartbeatSeconds`** for long-running tasks
319
+ 4. **Combine Retry + Catch**: Retry transient, Catch permanent
320
+ 5. **Use `JitterStrategy: "FULL"`** to prevent thundering herd
321
+ 6. **Listen for execution failures via EventBridge** for top-level failures
322
+
323
+ ---
324
+
325
+ ## EventBridge Rules and Patterns
326
+
327
+ ### Event Pattern Structure
328
+
329
+ All specified fields must match (AND). Values within an array are OR'd.
330
+
331
+ ```json
332
+ {
333
+ "source": ["aws.ec2"],
334
+ "detail-type": ["EC2 Instance State-change Notification"],
335
+ "detail": { "state": ["terminated", "stopped"] }
336
+ }
337
+ ```
338
+
339
+ ### Advanced Pattern Operators
340
+
341
+ | Operator | Syntax | Description |
342
+ |---|---|---|
343
+ | Exact match | `["value"]` | Field equals value |
344
+ | Prefix | `[{"prefix": "prod-"}]` | Starts with string |
345
+ | Suffix | `[{"suffix": ".json"}]` | Ends with string |
346
+ | Anything-but | `[{"anything-but": ["val"]}]` | Not in list |
347
+ | Numeric range | `[{"numeric": [">", 0, "<=", 100]}]` | Numeric comparison |
348
+ | Exists | `[{"exists": true}]` | Field must be present |
349
+ | Wildcard | `[{"wildcard": "prod-*-east"}]` | Glob-style matching |
350
+
351
+ ### EventBridge best practices
352
+
353
+ 1. **Dedicated event bus per application domain** — default bus for AWS service events only
354
+ 2. **Be precise with patterns** — broad patterns increase risk of infinite loops
355
+ 3. **One target per rule** — simplifies debugging and IAM permissions
356
+ 4. **Use DLQs on targets** — capture failed event deliveries
357
+ 5. **Use the EventBridge Sandbox** to test patterns before deploying
358
+
359
+ ### Step Functions Status Change Events
360
+
361
+ Step Functions emits to the default bus automatically:
362
+
363
+ ```json
364
+ {
365
+ "source": ["aws.states"],
366
+ "detail-type": ["Step Functions Execution Status Change"],
367
+ "detail": { "status": ["FAILED", "TIMED_OUT", "ABORTED"] }
368
+ }
369
+ ```
370
+
371
+ ### Integration Patterns
372
+
373
+ **SFN → EventBridge** (publish events from a workflow):
374
+
375
+ ```json
376
+ {
377
+ "Type": "Task",
378
+ "QueryLanguage": "JSONata",
379
+ "Resource": "arn:aws:states:::events:putEvents",
380
+ "Arguments": {
381
+ "Entries": [{
382
+ "Detail": { "orderId": "{% $states.input.orderId %}", "status": "PROCESSED" },
383
+ "DetailType": "OrderProcessed",
384
+ "EventBusName": "my-app-bus",
385
+ "Source": "my-app.orders"
386
+ }]
387
+ },
388
+ "Next": "Done"
389
+ }
390
+ ```
81
391
 
82
- Rules and best practices:
392
+ **EventBridge SFN**: Rule target is the state machine ARN. Event payload becomes execution input.
83
393
 
84
- - `States.ALL` must be **last** in the Retry array; retries are attempted **before** catchers.
85
- - Retries count as state transitions (billed in Standard).
86
- - Always set `TimeoutSeconds` on every Task; always retry `Lambda.ServiceException` / `Lambda.SdkClientException`.
87
- - Use `JitterStrategy: "FULL"` to prevent thundering herd; `HeartbeatSeconds` for long tasks.
88
- - `Catch` with `ResultPath: "$.error-info"` preserves the original input alongside the error (without it, error output replaces the input).
89
- - Listen for top-level execution failures via EventBridge (`source: aws.states`, `detail-type: Step Functions Execution Status Change`, `status: [FAILED, TIMED_OUT, ABORTED]`).
394
+ **Fan-out**: Single event triggers multiple workflows via multiple rules on the same bus.
90
395
 
91
396
  ---
92
397
 
93
- ## EventBridge rules, pipes, and patterns
398
+ ## EventBridge Pipes
94
399
 
95
- ### Event patterns
400
+ ### Architecture
96
401
 
97
- All specified fields must match (AND); values within an array are OR'd. Operators: exact `["value"]`, `{"prefix"}`, `{"suffix"}`, `{"anything-but"}`, `{"numeric": [">", 0, "<=", 100]}`, `{"exists": true}`, `{"wildcard": "prod-*-east"}`.
402
+ ```
403
+ Source → [Filter] → [Enrichment] → [Transform] → Target
404
+ ```
405
+
406
+ Eliminates intermediary Lambda functions for point-to-point integrations.
98
407
 
99
- ### Best practices
408
+ ### Supported Sources
409
+
410
+ | Source | Notes |
411
+ |---|---|
412
+ | Amazon SQS | Standard and FIFO queues |
413
+ | Amazon Kinesis Data Streams | Shard-level polling |
414
+ | Amazon DynamoDB Streams | Change data capture |
415
+ | Amazon MSK / Self-managed Kafka | Topic-level consumption |
416
+ | Amazon MQ | ActiveMQ and RabbitMQ |
100
417
 
101
- 1. **Dedicated event bus per application domain** — default bus for AWS service events only.
102
- 2. **Be precise with patterns** — broad patterns risk infinite loops.
103
- 3. **One target per rule** simplifies debugging and IAM.
104
- 4. **DLQs on all targets.**
105
- 5. Use the EventBridge Sandbox to test patterns before deploying.
418
+ ### Enrichment Options
419
+
420
+ Lambda, API Gateway, EventBridge API Destinations, Step Functions (Synchronous Express).
421
+
422
+ ### Key Features
423
+
424
+ - **Filtering**: Event patterns filter at the source — pay only for matched events
425
+ - **Ordering**: Maintains event ordering within batches
426
+ - **Built-in retry + DLQ**: Source-level retry with dead-letter queue support
106
427
 
107
428
  ### Pipes vs Rules
108
429
 
109
430
  | Dimension | Pipes | Rules |
110
431
  |---|---|---|
111
432
  | Topology | Point-to-point (1→1) | Fan-out (1→N) |
112
- | Flow | Source Filter Enrichment Transform → Target | Event routing on a bus |
113
- | Sources | SQS, Kinesis, DynamoDB Streams, MSK, MQ | Any event on a bus |
114
- | Enrichment | Built-in (Lambda, API GW, API Destinations, Sync Express SFN) | Not built-in |
115
- | Use case | **Replace Lambda glue** for source→target | Event routing and distribution |
116
-
117
- Pipes filtering happens **at the source** — you pay only for matched events — with built-in retry + DLQ.
433
+ | Sources | SQS, Kinesis, DDB Streams, MSK, MQ | Any event on a bus |
434
+ | Enrichment | Built-in | Not built-in |
435
+ | Use case | Replace Lambda glue | Event routing and distribution |
118
436
 
119
437
  ---
120
438
 
121
- ## Step Functions vs Lambda durable functions
439
+ ## Lambda durable functions vs Step Functions
122
440
 
123
- Lambda durable functions let you write reliable multi-step workflows as **plain code** (TS/Python/Java) with automatic checkpointing — the SDK persists each step and replays from the checkpoint on interruption, enabling executions up to 1 year with zero compute during waits. **For full guidance use the aws-lambda-durable-functions skill** (see SKILL.md routing).
441
+ Lambda durable functions let you write reliable multi-step workflows as plain code (TypeScript, Python, Java) with automatic checkpointing — the SDK persists each step's result and replays from the checkpoint on interruption, enabling executions up to 1 year with zero compute during waits. Use the **aws-lambda-durable-functions** skill for full guidance.
124
442
 
125
443
  | Question | Lambda durable functions | Step Functions |
126
444
  |---|---|---|
127
- | Programming model | Standard code (TS/Python/Java) | Amazon States Language / visual designer |
128
- | AWS service integrations | Primarily Lambda | 200+ native integrations |
129
- | Who reads the workflow | Developers | Non-technical stakeholders too |
130
- | Best for | Distributed transactions, stateful logic, AI agent loops | Business process automation, multi-service orchestration |
445
+ | Primary focus? | Application logic in Lambda | Orchestration across AWS services |
446
+ | Programming model? | Standard code (TS/Python/Java) | Amazon States Language (ASL) or visual designer |
447
+ | AWS service integrations? | Primarily Lambda | 200+ native integrations |
448
+ | Who reads the workflow? | Developers | Non-technical stakeholders |
449
+ | Best for? | Distributed transactions, stateful logic, AI agent loops | Business process automation, multi-service orchestration |