opencode-skills-collection 1.0.186 → 1.0.188

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 (71) hide show
  1. package/bundled-skills/.antigravity-install-manifest.json +5 -1
  2. package/bundled-skills/3d-web-experience/SKILL.md +152 -37
  3. package/bundled-skills/agent-evaluation/SKILL.md +1088 -26
  4. package/bundled-skills/agent-memory-systems/SKILL.md +1037 -25
  5. package/bundled-skills/agent-tool-builder/SKILL.md +668 -16
  6. package/bundled-skills/ai-agents-architect/SKILL.md +271 -31
  7. package/bundled-skills/ai-product/SKILL.md +716 -26
  8. package/bundled-skills/ai-wrapper-product/SKILL.md +450 -44
  9. package/bundled-skills/algolia-search/SKILL.md +867 -15
  10. package/bundled-skills/autonomous-agents/SKILL.md +1033 -26
  11. package/bundled-skills/aws-serverless/SKILL.md +1046 -35
  12. package/bundled-skills/azure-functions/SKILL.md +1318 -19
  13. package/bundled-skills/browser-automation/SKILL.md +1065 -28
  14. package/bundled-skills/browser-extension-builder/SKILL.md +159 -32
  15. package/bundled-skills/bullmq-specialist/SKILL.md +347 -16
  16. package/bundled-skills/clerk-auth/SKILL.md +796 -15
  17. package/bundled-skills/computer-use-agents/SKILL.md +1870 -28
  18. package/bundled-skills/context-window-management/SKILL.md +271 -18
  19. package/bundled-skills/conversation-memory/SKILL.md +453 -24
  20. package/bundled-skills/crewai/SKILL.md +252 -46
  21. package/bundled-skills/discord-bot-architect/SKILL.md +1207 -34
  22. package/bundled-skills/docs/integrations/jetski-cortex.md +3 -3
  23. package/bundled-skills/docs/integrations/jetski-gemini-loader/README.md +1 -1
  24. package/bundled-skills/docs/maintainers/repo-growth-seo.md +3 -3
  25. package/bundled-skills/docs/maintainers/skills-update-guide.md +1 -1
  26. package/bundled-skills/docs/users/bundles.md +1 -1
  27. package/bundled-skills/docs/users/claude-code-skills.md +1 -1
  28. package/bundled-skills/docs/users/gemini-cli-skills.md +1 -1
  29. package/bundled-skills/docs/users/getting-started.md +1 -1
  30. package/bundled-skills/docs/users/kiro-integration.md +1 -1
  31. package/bundled-skills/docs/users/usage.md +4 -4
  32. package/bundled-skills/docs/users/visual-guide.md +4 -4
  33. package/bundled-skills/email-systems/SKILL.md +646 -26
  34. package/bundled-skills/faf-expert/SKILL.md +221 -0
  35. package/bundled-skills/faf-wizard/SKILL.md +252 -0
  36. package/bundled-skills/file-uploads/SKILL.md +212 -11
  37. package/bundled-skills/firebase/SKILL.md +646 -16
  38. package/bundled-skills/gcp-cloud-run/SKILL.md +1117 -32
  39. package/bundled-skills/graphql/SKILL.md +1026 -27
  40. package/bundled-skills/hubspot-integration/SKILL.md +804 -19
  41. package/bundled-skills/idea-darwin/SKILL.md +120 -0
  42. package/bundled-skills/inngest/SKILL.md +431 -16
  43. package/bundled-skills/interactive-portfolio/SKILL.md +342 -44
  44. package/bundled-skills/langfuse/SKILL.md +296 -41
  45. package/bundled-skills/langgraph/SKILL.md +259 -50
  46. package/bundled-skills/micro-saas-launcher/SKILL.md +343 -44
  47. package/bundled-skills/neon-postgres/SKILL.md +572 -15
  48. package/bundled-skills/nextjs-supabase-auth/SKILL.md +269 -21
  49. package/bundled-skills/notion-template-business/SKILL.md +371 -44
  50. package/bundled-skills/personal-tool-builder/SKILL.md +537 -44
  51. package/bundled-skills/plaid-fintech/SKILL.md +825 -19
  52. package/bundled-skills/prompt-caching/SKILL.md +438 -25
  53. package/bundled-skills/rag-engineer/SKILL.md +271 -29
  54. package/bundled-skills/salesforce-development/SKILL.md +912 -19
  55. package/bundled-skills/satori/SKILL.md +54 -0
  56. package/bundled-skills/scroll-experience/SKILL.md +381 -44
  57. package/bundled-skills/segment-cdp/SKILL.md +817 -19
  58. package/bundled-skills/shopify-apps/SKILL.md +1475 -19
  59. package/bundled-skills/slack-bot-builder/SKILL.md +1162 -28
  60. package/bundled-skills/telegram-bot-builder/SKILL.md +152 -37
  61. package/bundled-skills/telegram-mini-app/SKILL.md +445 -44
  62. package/bundled-skills/trigger-dev/SKILL.md +916 -27
  63. package/bundled-skills/twilio-communications/SKILL.md +1310 -28
  64. package/bundled-skills/upstash-qstash/SKILL.md +898 -27
  65. package/bundled-skills/vercel-deployment/SKILL.md +637 -39
  66. package/bundled-skills/viral-generator-builder/SKILL.md +132 -37
  67. package/bundled-skills/voice-agents/SKILL.md +937 -27
  68. package/bundled-skills/voice-ai-development/SKILL.md +375 -46
  69. package/bundled-skills/workflow-automation/SKILL.md +982 -29
  70. package/bundled-skills/zapier-make-patterns/SKILL.md +772 -27
  71. package/package.json +1 -1
@@ -1,22 +1,38 @@
1
1
  ---
2
2
  name: aws-serverless
3
- description: "Proper Lambda function structure with error handling"
3
+ description: Specialized skill for building production-ready serverless
4
+ applications on AWS. Covers Lambda functions, API Gateway, DynamoDB, SQS/SNS
5
+ event-driven patterns, SAM/CDK deployment, and cold start optimization.
4
6
  risk: unknown
5
- source: "vibeship-spawner-skills (Apache 2.0)"
6
- date_added: "2026-02-27"
7
+ source: vibeship-spawner-skills (Apache 2.0)
8
+ date_added: 2026-02-27
7
9
  ---
8
10
 
9
11
  # AWS Serverless
10
12
 
13
+ Specialized skill for building production-ready serverless applications on AWS.
14
+ Covers Lambda functions, API Gateway, DynamoDB, SQS/SNS event-driven patterns,
15
+ SAM/CDK deployment, and cold start optimization.
16
+
17
+ ## Principles
18
+
19
+ - Right-size memory and timeout (measure before optimizing)
20
+ - Minimize cold starts for latency-sensitive workloads
21
+ - Use SnapStart for Java/.NET functions
22
+ - Prefer HTTP API over REST API for simple use cases
23
+ - Design for failure with DLQs and retries
24
+ - Keep deployment packages small
25
+ - Use environment variables for configuration
26
+ - Implement structured logging with correlation IDs
27
+
11
28
  ## Patterns
12
29
 
13
30
  ### Lambda Handler Pattern
14
31
 
15
32
  Proper Lambda function structure with error handling
16
33
 
17
- **When to use**: ['Any Lambda function implementation', 'API handlers, event processors, scheduled tasks']
34
+ **When to use**: Any Lambda function implementation,API handlers, event processors, scheduled tasks
18
35
 
19
- ```python
20
36
  ```javascript
21
37
  // Node.js Lambda Handler
22
38
  // handler.js
@@ -97,16 +113,57 @@ table = dynamodb.Table(os.environ['TABLE_NAME'])
97
113
 
98
114
  def handler(event, context):
99
115
  try:
100
- # Parse i
116
+ # Parse input
117
+ body = json.loads(event.get('body', '{}')) if isinstance(event.get('body'), str) else event.get('body', {})
118
+
119
+ # Business logic
120
+ result = process_request(body)
121
+
122
+ return {
123
+ 'statusCode': 200,
124
+ 'headers': {
125
+ 'Content-Type': 'application/json',
126
+ 'Access-Control-Allow-Origin': '*'
127
+ },
128
+ 'body': json.dumps(result)
129
+ }
130
+
131
+ except ClientError as e:
132
+ logger.error(f"DynamoDB error: {e.response['Error']['Message']}")
133
+ return error_response(500, 'Database error')
134
+
135
+ except json.JSONDecodeError:
136
+ return error_response(400, 'Invalid JSON')
137
+
138
+ except Exception as e:
139
+ logger.error(f"Unexpected error: {str(e)}", exc_info=True)
140
+ return error_response(500, 'Internal server error')
141
+
142
+ def process_request(data):
143
+ response = table.get_item(Key={'id': data['id']})
144
+ return response.get('Item')
145
+
146
+ def error_response(status_code, message):
147
+ return {
148
+ 'statusCode': status_code,
149
+ 'headers': {'Content-Type': 'application/json'},
150
+ 'body': json.dumps({'error': message})
151
+ }
101
152
  ```
102
153
 
154
+ ### Best_practices
155
+
156
+ - Initialize clients outside handler (reused across warm invocations)
157
+ - Always return proper API Gateway response format
158
+ - Log with structured JSON for CloudWatch Insights
159
+ - Include request ID in error logs for tracing
160
+
103
161
  ### API Gateway Integration Pattern
104
162
 
105
163
  REST API and HTTP API integration with Lambda
106
164
 
107
- **When to use**: ['Building REST APIs backed by Lambda', 'Need HTTP endpoints for functions']
165
+ **When to use**: Building REST APIs backed by Lambda,Need HTTP endpoints for functions
108
166
 
109
- ```javascript
110
167
  ```yaml
111
168
  # template.yaml (SAM)
112
169
  AWSTemplateFormatVersion: '2010-09-09'
@@ -199,16 +256,55 @@ exports.handler = async (event) => {
199
256
  };
200
257
  }
201
258
 
202
- const item =
259
+ const item = await getItem(id);
260
+
261
+ if (!item) {
262
+ return {
263
+ statusCode: 404,
264
+ body: JSON.stringify({ error: 'Item not found' })
265
+ };
266
+ }
267
+
268
+ return {
269
+ statusCode: 200,
270
+ body: JSON.stringify(item)
271
+ };
272
+ };
203
273
  ```
204
274
 
275
+ ### Structure
276
+
277
+ project/
278
+ ├── template.yaml # SAM template
279
+ ├── src/
280
+ │ ├── handlers/
281
+ │ │ ├── get.js
282
+ │ │ ├── create.js
283
+ │ │ └── delete.js
284
+ │ └── lib/
285
+ │ └── dynamodb.js
286
+ └── events/
287
+ └── event.json # Test events
288
+
289
+ ### Api_comparison
290
+
291
+ - Http_api:
292
+ - Lower latency (~10ms)
293
+ - Lower cost (50-70% cheaper)
294
+ - Simpler, fewer features
295
+ - Best for: Most REST APIs
296
+ - Rest_api:
297
+ - More features (caching, request validation, WAF)
298
+ - Usage plans and API keys
299
+ - Request/response transformation
300
+ - Best for: Complex APIs, enterprise features
301
+
205
302
  ### Event-Driven SQS Pattern
206
303
 
207
304
  Lambda triggered by SQS for reliable async processing
208
305
 
209
- **When to use**: ['Decoupled, asynchronous processing', 'Need retry logic and DLQ', 'Processing messages in batches']
306
+ **When to use**: Decoupled, asynchronous processing,Need retry logic and DLQ,Processing messages in batches
210
307
 
211
- ```python
212
308
  ```yaml
213
309
  # template.yaml
214
310
  Resources:
@@ -290,39 +386,954 @@ def handler(event, context):
290
386
  'itemIdentifier': record['messageId']
291
387
  })
292
388
 
293
- return {'batchItemFailures': batch_ite
389
+ return {'batchItemFailures': batch_item_failures}
390
+ ```
391
+
392
+ ### Best_practices
393
+
394
+ - Set VisibilityTimeout to 6x Lambda timeout
395
+ - Use ReportBatchItemFailures for partial batch failure
396
+ - Always configure a DLQ for poison messages
397
+ - Process messages idempotently
398
+
399
+ ### DynamoDB Streams Pattern
400
+
401
+ React to DynamoDB table changes with Lambda
402
+
403
+ **When to use**: Real-time reactions to data changes,Cross-region replication,Audit logging, notifications
404
+
405
+ ```yaml
406
+ # template.yaml
407
+ Resources:
408
+ ItemsTable:
409
+ Type: AWS::DynamoDB::Table
410
+ Properties:
411
+ TableName: items
412
+ AttributeDefinitions:
413
+ - AttributeName: id
414
+ AttributeType: S
415
+ KeySchema:
416
+ - AttributeName: id
417
+ KeyType: HASH
418
+ BillingMode: PAY_PER_REQUEST
419
+ StreamSpecification:
420
+ StreamViewType: NEW_AND_OLD_IMAGES
421
+
422
+ StreamProcessorFunction:
423
+ Type: AWS::Serverless::Function
424
+ Properties:
425
+ Handler: src/handlers/stream.handler
426
+ Events:
427
+ Stream:
428
+ Type: DynamoDB
429
+ Properties:
430
+ Stream: !GetAtt ItemsTable.StreamArn
431
+ StartingPosition: TRIM_HORIZON
432
+ BatchSize: 100
433
+ MaximumRetryAttempts: 3
434
+ DestinationConfig:
435
+ OnFailure:
436
+ Destination: !GetAtt StreamDLQ.Arn
437
+
438
+ StreamDLQ:
439
+ Type: AWS::SQS::Queue
440
+ ```
441
+
442
+ ```javascript
443
+ // src/handlers/stream.js
444
+ exports.handler = async (event) => {
445
+ for (const record of event.Records) {
446
+ const eventName = record.eventName; // INSERT, MODIFY, REMOVE
447
+
448
+ // Unmarshall DynamoDB format to plain JS objects
449
+ const newImage = record.dynamodb.NewImage
450
+ ? unmarshall(record.dynamodb.NewImage)
451
+ : null;
452
+ const oldImage = record.dynamodb.OldImage
453
+ ? unmarshall(record.dynamodb.OldImage)
454
+ : null;
455
+
456
+ console.log(`${eventName}: `, { newImage, oldImage });
457
+
458
+ switch (eventName) {
459
+ case 'INSERT':
460
+ await handleInsert(newImage);
461
+ break;
462
+ case 'MODIFY':
463
+ await handleModify(oldImage, newImage);
464
+ break;
465
+ case 'REMOVE':
466
+ await handleRemove(oldImage);
467
+ break;
468
+ }
469
+ }
470
+ };
471
+
472
+ // Use AWS SDK v3 unmarshall
473
+ const { unmarshall } = require('@aws-sdk/util-dynamodb');
474
+ ```
475
+
476
+ ### Stream_view_types
477
+
478
+ - KEYS_ONLY: Only key attributes
479
+ - NEW_IMAGE: After modification
480
+ - OLD_IMAGE: Before modification
481
+ - NEW_AND_OLD_IMAGES: Both before and after
482
+
483
+ ### Cold Start Optimization Pattern
484
+
485
+ Minimize Lambda cold start latency
486
+
487
+ **When to use**: Latency-sensitive applications,User-facing APIs,High-traffic functions
488
+
489
+ ## 1. Optimize Package Size
490
+
491
+ ```javascript
492
+ // Use modular AWS SDK v3 imports
493
+ // GOOD - only imports what you need
494
+ const { DynamoDBClient } = require('@aws-sdk/client-dynamodb');
495
+ const { DynamoDBDocumentClient, GetCommand } = require('@aws-sdk/lib-dynamodb');
496
+
497
+ // BAD - imports entire SDK
498
+ const AWS = require('aws-sdk'); // Don't do this!
499
+ ```
500
+
501
+ ## 2. Use SnapStart (Java/.NET)
502
+
503
+ ```yaml
504
+ # template.yaml
505
+ Resources:
506
+ JavaFunction:
507
+ Type: AWS::Serverless::Function
508
+ Properties:
509
+ Handler: com.example.Handler::handleRequest
510
+ Runtime: java21
511
+ SnapStart:
512
+ ApplyOn: PublishedVersions # Enable SnapStart
513
+ AutoPublishAlias: live
514
+ ```
515
+
516
+ ## 3. Right-size Memory
517
+
518
+ ```yaml
519
+ # More memory = more CPU = faster init
520
+ Resources:
521
+ FastFunction:
522
+ Type: AWS::Serverless::Function
523
+ Properties:
524
+ MemorySize: 1024 # 1GB gets full vCPU
525
+ Timeout: 30
526
+ ```
527
+
528
+ ## 4. Provisioned Concurrency (when needed)
529
+
530
+ ```yaml
531
+ Resources:
532
+ CriticalFunction:
533
+ Type: AWS::Serverless::Function
534
+ Properties:
535
+ Handler: src/handlers/critical.handler
536
+ AutoPublishAlias: live
537
+
538
+ ProvisionedConcurrency:
539
+ Type: AWS::Lambda::ProvisionedConcurrencyConfig
540
+ Properties:
541
+ FunctionName: !Ref CriticalFunction
542
+ Qualifier: live
543
+ ProvisionedConcurrentExecutions: 5
544
+ ```
545
+
546
+ ## 5. Keep Init Light
547
+
548
+ ```python
549
+ # GOOD - Lazy initialization
550
+ _table = None
551
+
552
+ def get_table():
553
+ global _table
554
+ if _table is None:
555
+ dynamodb = boto3.resource('dynamodb')
556
+ _table = dynamodb.Table(os.environ['TABLE_NAME'])
557
+ return _table
558
+
559
+ def handler(event, context):
560
+ table = get_table() # Only initializes on first use
561
+ # ...
562
+ ```
563
+
564
+ ### Optimization_priority
565
+
566
+ - 1: Reduce package size (biggest impact)
567
+ - 2: Use SnapStart for Java/.NET
568
+ - 3: Increase memory for faster init
569
+ - 4: Delay heavy imports
570
+ - 5: Provisioned concurrency (last resort)
571
+
572
+ ### SAM Local Development Pattern
573
+
574
+ Local testing and debugging with SAM CLI
575
+
576
+ **When to use**: Local development and testing,Debugging Lambda functions,Testing API Gateway locally
577
+
578
+ ```bash
579
+ # Install SAM CLI
580
+ pip install aws-sam-cli
581
+
582
+ # Initialize new project
583
+ sam init --runtime nodejs20.x --name my-api
584
+
585
+ # Build the project
586
+ sam build
587
+
588
+ # Run locally
589
+ sam local start-api
590
+
591
+ # Invoke single function
592
+ sam local invoke GetItemFunction --event events/get.json
593
+
594
+ # Local debugging (Node.js with VS Code)
595
+ sam local invoke --debug-port 5858 GetItemFunction
596
+
597
+ # Deploy
598
+ sam deploy --guided
599
+ ```
600
+
601
+ ```json
602
+ // events/get.json (test event)
603
+ {
604
+ "pathParameters": {
605
+ "id": "123"
606
+ },
607
+ "httpMethod": "GET",
608
+ "path": "/items/123"
609
+ }
610
+ ```
611
+
612
+ ```json
613
+ // .vscode/launch.json (for debugging)
614
+ {
615
+ "version": "0.2.0",
616
+ "configurations": [
617
+ {
618
+ "name": "Attach to SAM CLI",
619
+ "type": "node",
620
+ "request": "attach",
621
+ "address": "localhost",
622
+ "port": 5858,
623
+ "localRoot": "${workspaceRoot}/src",
624
+ "remoteRoot": "/var/task/src",
625
+ "protocol": "inspector"
626
+ }
627
+ ]
628
+ }
629
+ ```
630
+
631
+ ### Commands
632
+
633
+ - Sam_build: Build Lambda deployment packages
634
+ - Sam_local_start_api: Start local API Gateway
635
+ - Sam_local_invoke: Invoke single function
636
+ - Sam_deploy: Deploy to AWS
637
+ - Sam_logs: Tail CloudWatch logs
638
+
639
+ ### CDK Serverless Pattern
640
+
641
+ Infrastructure as code with AWS CDK
642
+
643
+ **When to use**: Complex infrastructure beyond Lambda,Prefer programming languages over YAML,Need reusable constructs
644
+
645
+ ```typescript
646
+ // lib/api-stack.ts
647
+ import * as cdk from 'aws-cdk-lib';
648
+ import * as lambda from 'aws-cdk-lib/aws-lambda';
649
+ import * as apigateway from 'aws-cdk-lib/aws-apigateway';
650
+ import * as dynamodb from 'aws-cdk-lib/aws-dynamodb';
651
+ import { Construct } from 'constructs';
652
+
653
+ export class ApiStack extends cdk.Stack {
654
+ constructor(scope: Construct, id: string, props?: cdk.StackProps) {
655
+ super(scope, id, props);
656
+
657
+ // DynamoDB Table
658
+ const table = new dynamodb.Table(this, 'ItemsTable', {
659
+ partitionKey: { name: 'id', type: dynamodb.AttributeType.STRING },
660
+ billingMode: dynamodb.BillingMode.PAY_PER_REQUEST,
661
+ removalPolicy: cdk.RemovalPolicy.DESTROY, // For dev only
662
+ });
663
+
664
+ // Lambda Function
665
+ const getItemFn = new lambda.Function(this, 'GetItemFunction', {
666
+ runtime: lambda.Runtime.NODEJS_20_X,
667
+ handler: 'get.handler',
668
+ code: lambda.Code.fromAsset('src/handlers'),
669
+ environment: {
670
+ TABLE_NAME: table.tableName,
671
+ },
672
+ memorySize: 256,
673
+ timeout: cdk.Duration.seconds(30),
674
+ });
675
+
676
+ // Grant permissions
677
+ table.grantReadData(getItemFn);
678
+
679
+ // API Gateway
680
+ const api = new apigateway.RestApi(this, 'ItemsApi', {
681
+ restApiName: 'Items Service',
682
+ defaultCorsPreflightOptions: {
683
+ allowOrigins: apigateway.Cors.ALL_ORIGINS,
684
+ allowMethods: apigateway.Cors.ALL_METHODS,
685
+ },
686
+ });
687
+
688
+ const items = api.root.addResource('items');
689
+ const item = items.addResource('{id}');
690
+
691
+ item.addMethod('GET', new apigateway.LambdaIntegration(getItemFn));
692
+
693
+ // Output API URL
694
+ new cdk.CfnOutput(this, 'ApiUrl', {
695
+ value: api.url,
696
+ });
697
+ }
698
+ }
699
+ ```
700
+
701
+ ```bash
702
+ # CDK commands
703
+ npm install -g aws-cdk
704
+ cdk init app --language typescript
705
+ cdk synth # Generate CloudFormation
706
+ cdk diff # Show changes
707
+ cdk deploy # Deploy to AWS
294
708
  ```
295
709
 
296
- ## Anti-Patterns
710
+ ## Sharp Edges
297
711
 
298
- ### Monolithic Lambda
712
+ ### Cold Start INIT Phase Now Billed (Aug 2025)
299
713
 
300
- **Why bad**: Large deployment packages cause slow cold starts.
301
- Hard to scale individual operations.
302
- Updates affect entire system.
714
+ Severity: HIGH
303
715
 
304
- ### Large Dependencies
716
+ Situation: Running Lambda functions in production
305
717
 
306
- **Why bad**: Increases deployment package size.
307
- Slows down cold starts significantly.
308
- Most of SDK/library may be unused.
718
+ Symptoms:
719
+ Unexplained increase in Lambda costs (10-50% higher).
720
+ Bill includes charges for function initialization.
721
+ Functions with heavy startup logic cost more than expected.
309
722
 
310
- ### Synchronous Calls in VPC
723
+ Why this breaks:
724
+ As of August 1, 2025, AWS bills the INIT phase the same way it bills
725
+ invocation duration. Previously, cold start initialization wasn't billed
726
+ for the full duration.
311
727
 
312
- **Why bad**: VPC-attached Lambdas have ENI setup overhead.
313
- Blocking DNS lookups or connections worsen cold starts.
728
+ This affects functions with:
729
+ - Heavy dependency loading (large packages)
730
+ - Slow initialization code
731
+ - Frequent cold starts (low traffic or poor concurrency)
314
732
 
315
- ## ⚠️ Sharp Edges
733
+ Cold starts now directly impact your bill, not just latency.
316
734
 
317
- | Issue | Severity | Solution |
318
- |-------|----------|----------|
319
- | Issue | high | ## Measure your INIT phase |
320
- | Issue | high | ## Set appropriate timeout |
321
- | Issue | high | ## Increase memory allocation |
322
- | Issue | medium | ## Verify VPC configuration |
323
- | Issue | medium | ## Tell Lambda not to wait for event loop |
324
- | Issue | medium | ## For large file uploads |
325
- | Issue | high | ## Use different buckets/prefixes |
735
+ Recommended fix:
736
+
737
+ ## Measure your INIT phase
738
+
739
+ ```bash
740
+ # Check CloudWatch Logs for INIT_REPORT
741
+ # Look for Init Duration in milliseconds
742
+
743
+ # Example log line:
744
+ # INIT_REPORT Init Duration: 423.45 ms
745
+ ```
746
+
747
+ ## Reduce INIT duration
748
+
749
+ ```javascript
750
+ // 1. Minimize package size
751
+ // Use tree shaking, exclude dev dependencies
752
+ // npm prune --production
753
+
754
+ // 2. Lazy load heavy dependencies
755
+ let heavyLib = null;
756
+ function getHeavyLib() {
757
+ if (!heavyLib) {
758
+ heavyLib = require('heavy-library');
759
+ }
760
+ return heavyLib;
761
+ }
762
+
763
+ // 3. Use AWS SDK v3 modular imports
764
+ const { S3Client } = require('@aws-sdk/client-s3');
765
+ // NOT: const AWS = require('aws-sdk');
766
+ ```
767
+
768
+ ## Use SnapStart for Java/.NET
769
+
770
+ ```yaml
771
+ Resources:
772
+ JavaFunction:
773
+ Type: AWS::Serverless::Function
774
+ Properties:
775
+ Runtime: java21
776
+ SnapStart:
777
+ ApplyOn: PublishedVersions
778
+ ```
779
+
780
+ ## Monitor cold start frequency
781
+
782
+ ```javascript
783
+ // Track cold starts with custom metric
784
+ let isColdStart = true;
785
+
786
+ exports.handler = async (event) => {
787
+ if (isColdStart) {
788
+ console.log('COLD_START');
789
+ // CloudWatch custom metric here
790
+ isColdStart = false;
791
+ }
792
+ // ...
793
+ };
794
+ ```
795
+
796
+ ### Lambda Timeout Misconfiguration
797
+
798
+ Severity: HIGH
799
+
800
+ Situation: Running Lambda functions, especially with external calls
801
+
802
+ Symptoms:
803
+ Function times out unexpectedly.
804
+ "Task timed out after X seconds" in logs.
805
+ Partial processing with no response.
806
+ Silent failures with no error caught.
807
+
808
+ Why this breaks:
809
+ Default Lambda timeout is only 3 seconds. Maximum is 15 minutes.
810
+
811
+ Common timeout causes:
812
+ - Default timeout too short for workload
813
+ - Downstream service taking longer than expected
814
+ - Network issues in VPC
815
+ - Infinite loops or blocking operations
816
+ - S3 downloads larger than expected
817
+
818
+ Lambda terminates at timeout without graceful shutdown.
819
+
820
+ Recommended fix:
821
+
822
+ ## Set appropriate timeout
823
+
824
+ ```yaml
825
+ # template.yaml
826
+ Resources:
827
+ MyFunction:
828
+ Type: AWS::Serverless::Function
829
+ Properties:
830
+ Timeout: 30 # Seconds (max 900)
831
+ # Set to expected duration + buffer
832
+ ```
833
+
834
+ ## Implement timeout awareness
835
+
836
+ ```javascript
837
+ exports.handler = async (event, context) => {
838
+ // Get remaining time
839
+ const remainingTime = context.getRemainingTimeInMillis();
840
+
841
+ // If running low on time, fail gracefully
842
+ if (remainingTime < 5000) {
843
+ console.warn('Running low on time, aborting');
844
+ throw new Error('Insufficient time remaining');
845
+ }
846
+
847
+ // For long operations, check periodically
848
+ for (const item of items) {
849
+ if (context.getRemainingTimeInMillis() < 10000) {
850
+ // Save progress and exit gracefully
851
+ await saveProgress(processedItems);
852
+ throw new Error('Timeout approaching, saved progress');
853
+ }
854
+ await processItem(item);
855
+ }
856
+ };
857
+ ```
858
+
859
+ ## Set downstream timeouts
860
+
861
+ ```javascript
862
+ const axios = require('axios');
863
+
864
+ // Always set timeouts on HTTP calls
865
+ const response = await axios.get('https://api.example.com/data', {
866
+ timeout: 5000 // 5 seconds
867
+ });
868
+ ```
869
+
870
+ ### Out of Memory (OOM) Crash
871
+
872
+ Severity: HIGH
873
+
874
+ Situation: Lambda function processing data
875
+
876
+ Symptoms:
877
+ Function stops abruptly without error.
878
+ CloudWatch logs appear truncated.
879
+ "Max Memory Used" hits configured limit.
880
+ Inconsistent behavior under load.
881
+
882
+ Why this breaks:
883
+ When Lambda exceeds memory allocation, AWS forcibly terminates
884
+ the runtime. This happens without raising a catchable exception.
885
+
886
+ Common causes:
887
+ - Processing large files in memory
888
+ - Memory leaks across invocations
889
+ - Buffering entire response bodies
890
+ - Heavy libraries consuming too much memory
891
+
892
+ Recommended fix:
893
+
894
+ ## Increase memory allocation
895
+
896
+ ```yaml
897
+ Resources:
898
+ MyFunction:
899
+ Type: AWS::Serverless::Function
900
+ Properties:
901
+ MemorySize: 1024 # MB (128-10240)
902
+ # More memory = more CPU too
903
+ ```
904
+
905
+ ## Stream large data
906
+
907
+ ```javascript
908
+ // BAD - loads entire file into memory
909
+ const data = await s3.getObject(params).promise();
910
+ const content = data.Body.toString();
911
+
912
+ // GOOD - stream processing
913
+ const { S3Client, GetObjectCommand } = require('@aws-sdk/client-s3');
914
+ const s3 = new S3Client({});
915
+
916
+ const response = await s3.send(new GetObjectCommand(params));
917
+ const stream = response.Body;
918
+
919
+ // Process stream in chunks
920
+ for await (const chunk of stream) {
921
+ await processChunk(chunk);
922
+ }
923
+ ```
924
+
925
+ ## Monitor memory usage
926
+
927
+ ```javascript
928
+ exports.handler = async (event, context) => {
929
+ const used = process.memoryUsage();
930
+ console.log('Memory:', {
931
+ heapUsed: Math.round(used.heapUsed / 1024 / 1024) + 'MB',
932
+ heapTotal: Math.round(used.heapTotal / 1024 / 1024) + 'MB'
933
+ });
934
+ // ...
935
+ };
936
+ ```
937
+
938
+ ## Use Lambda Power Tuning
939
+
940
+ ```bash
941
+ # Find optimal memory setting
942
+ # https://github.com/alexcasalboni/aws-lambda-power-tuning
943
+ ```
944
+
945
+ ### VPC-Attached Lambda Cold Start Delay
946
+
947
+ Severity: MEDIUM
948
+
949
+ Situation: Lambda functions in VPC accessing private resources
950
+
951
+ Symptoms:
952
+ Extremely slow cold starts (was 10+ seconds, now ~100ms).
953
+ Timeouts on first invocation after idle period.
954
+ Functions work in VPC but slow compared to non-VPC.
955
+
956
+ Why this breaks:
957
+ Lambda functions in VPC need Elastic Network Interfaces (ENIs).
958
+ AWS improved this significantly with Hyperplane ENIs, but:
959
+
960
+ - First cold start in VPC still has overhead
961
+ - NAT Gateway issues can cause timeouts
962
+ - Security group misconfig blocks traffic
963
+ - DNS resolution can be slow
964
+
965
+ Recommended fix:
966
+
967
+ ## Verify VPC configuration
968
+
969
+ ```yaml
970
+ Resources:
971
+ MyFunction:
972
+ Type: AWS::Serverless::Function
973
+ Properties:
974
+ VpcConfig:
975
+ SecurityGroupIds:
976
+ - !Ref LambdaSecurityGroup
977
+ SubnetIds:
978
+ - !Ref PrivateSubnet1
979
+ - !Ref PrivateSubnet2 # Multiple AZs
980
+
981
+ LambdaSecurityGroup:
982
+ Type: AWS::EC2::SecurityGroup
983
+ Properties:
984
+ GroupDescription: Lambda SG
985
+ VpcId: !Ref VPC
986
+ SecurityGroupEgress:
987
+ - IpProtocol: tcp
988
+ FromPort: 443
989
+ ToPort: 443
990
+ CidrIp: 0.0.0.0/0 # Allow HTTPS outbound
991
+ ```
992
+
993
+ ## Use VPC endpoints for AWS services
994
+
995
+ ```yaml
996
+ # Avoid NAT Gateway for AWS service calls
997
+ DynamoDBEndpoint:
998
+ Type: AWS::EC2::VPCEndpoint
999
+ Properties:
1000
+ ServiceName: !Sub com.amazonaws.${AWS::Region}.dynamodb
1001
+ VpcId: !Ref VPC
1002
+ RouteTableIds:
1003
+ - !Ref PrivateRouteTable
1004
+ VpcEndpointType: Gateway
1005
+
1006
+ S3Endpoint:
1007
+ Type: AWS::EC2::VPCEndpoint
1008
+ Properties:
1009
+ ServiceName: !Sub com.amazonaws.${AWS::Region}.s3
1010
+ VpcId: !Ref VPC
1011
+ VpcEndpointType: Gateway
1012
+ ```
1013
+
1014
+ ## Only use VPC when necessary
1015
+
1016
+ Don't attach Lambda to VPC unless you need:
1017
+ - Access to RDS/ElastiCache in VPC
1018
+ - Access to private EC2 instances
1019
+ - Compliance requirements
1020
+
1021
+ Most AWS services can be accessed without VPC.
1022
+
1023
+ ### Node.js Event Loop Not Cleared
1024
+
1025
+ Severity: MEDIUM
1026
+
1027
+ Situation: Node.js Lambda function with callbacks or timers
1028
+
1029
+ Symptoms:
1030
+ Function takes full timeout duration to return.
1031
+ "Task timed out" even though logic completed.
1032
+ Extra billing for idle time.
1033
+
1034
+ Why this breaks:
1035
+ By default, Lambda waits for the Node.js event loop to be empty
1036
+ before returning. If you have:
1037
+ - Unresolved setTimeout/setInterval
1038
+ - Dangling database connections
1039
+ - Pending callbacks
1040
+
1041
+ Lambda waits until timeout, even if your response was ready.
1042
+
1043
+ Recommended fix:
1044
+
1045
+ ## Tell Lambda not to wait for event loop
1046
+
1047
+ ```javascript
1048
+ exports.handler = async (event, context) => {
1049
+ // Don't wait for event loop to clear
1050
+ context.callbackWaitsForEmptyEventLoop = false;
1051
+
1052
+ // Your code here
1053
+ const result = await processRequest(event);
1054
+
1055
+ return {
1056
+ statusCode: 200,
1057
+ body: JSON.stringify(result)
1058
+ };
1059
+ };
1060
+ ```
1061
+
1062
+ ## Close connections properly
1063
+
1064
+ ```javascript
1065
+ // For database connections, use connection pooling
1066
+ // or close connections explicitly
1067
+
1068
+ const mysql = require('mysql2/promise');
1069
+
1070
+ exports.handler = async (event, context) => {
1071
+ context.callbackWaitsForEmptyEventLoop = false;
1072
+
1073
+ const connection = await mysql.createConnection({...});
1074
+ try {
1075
+ const [rows] = await connection.query('SELECT * FROM users');
1076
+ return { statusCode: 200, body: JSON.stringify(rows) };
1077
+ } finally {
1078
+ await connection.end(); // Always close
1079
+ }
1080
+ };
1081
+ ```
1082
+
1083
+ ### API Gateway Payload Size Limits
1084
+
1085
+ Severity: MEDIUM
1086
+
1087
+ Situation: Returning large responses or receiving large requests
1088
+
1089
+ Symptoms:
1090
+ "413 Request Entity Too Large" error
1091
+ "Execution failed due to configuration error: Malformed Lambda proxy response"
1092
+ Response truncated or failed
1093
+
1094
+ Why this breaks:
1095
+ API Gateway has hard payload limits:
1096
+ - REST API: 10 MB request/response
1097
+ - HTTP API: 10 MB request/response
1098
+ - Lambda itself: 6 MB sync response, 256 KB async
1099
+
1100
+ Exceeding these causes failures that may not be obvious.
1101
+
1102
+ Recommended fix:
1103
+
1104
+ ## For large file uploads
1105
+
1106
+ ```javascript
1107
+ // Use presigned S3 URLs instead of passing through API Gateway
1108
+
1109
+ const { S3Client, PutObjectCommand } = require('@aws-sdk/client-s3');
1110
+ const { getSignedUrl } = require('@aws-sdk/s3-request-presigner');
1111
+
1112
+ exports.handler = async (event) => {
1113
+ const s3 = new S3Client({});
1114
+
1115
+ const command = new PutObjectCommand({
1116
+ Bucket: process.env.BUCKET_NAME,
1117
+ Key: `uploads/${Date.now()}.file`
1118
+ });
1119
+
1120
+ const uploadUrl = await getSignedUrl(s3, command, { expiresIn: 300 });
1121
+
1122
+ return {
1123
+ statusCode: 200,
1124
+ body: JSON.stringify({ uploadUrl })
1125
+ };
1126
+ };
1127
+ ```
1128
+
1129
+ ## For large responses
1130
+
1131
+ ```javascript
1132
+ // Store in S3, return presigned download URL
1133
+ exports.handler = async (event) => {
1134
+ const largeData = await generateLargeReport();
1135
+
1136
+ await s3.send(new PutObjectCommand({
1137
+ Bucket: process.env.BUCKET_NAME,
1138
+ Key: `reports/${reportId}.json`,
1139
+ Body: JSON.stringify(largeData)
1140
+ }));
1141
+
1142
+ const downloadUrl = await getSignedUrl(s3,
1143
+ new GetObjectCommand({
1144
+ Bucket: process.env.BUCKET_NAME,
1145
+ Key: `reports/${reportId}.json`
1146
+ }),
1147
+ { expiresIn: 3600 }
1148
+ );
1149
+
1150
+ return {
1151
+ statusCode: 200,
1152
+ body: JSON.stringify({ downloadUrl })
1153
+ };
1154
+ };
1155
+ ```
1156
+
1157
+ ### Infinite Loop or Recursive Invocation
1158
+
1159
+ Severity: HIGH
1160
+
1161
+ Situation: Lambda triggered by events
1162
+
1163
+ Symptoms:
1164
+ Runaway costs.
1165
+ Thousands of invocations in minutes.
1166
+ CloudWatch logs show repeated invocations.
1167
+ Lambda writing to source bucket/table that triggers it.
1168
+
1169
+ Why this breaks:
1170
+ Lambda can accidentally trigger itself:
1171
+ - S3 trigger writes back to same bucket
1172
+ - DynamoDB trigger updates same table
1173
+ - SNS publishes to topic that triggers it
1174
+ - Step Functions with wrong error handling
1175
+
1176
+ Recommended fix:
1177
+
1178
+ ## Use different buckets/prefixes
1179
+
1180
+ ```yaml
1181
+ # S3 trigger with prefix filter
1182
+ Events:
1183
+ S3Event:
1184
+ Type: S3
1185
+ Properties:
1186
+ Bucket: !Ref InputBucket
1187
+ Events: s3:ObjectCreated:*
1188
+ Filter:
1189
+ S3Key:
1190
+ Rules:
1191
+ - Name: prefix
1192
+ Value: uploads/ # Only trigger on uploads/
1193
+
1194
+ # Output to different bucket or prefix
1195
+ # OutputBucket or processed/ prefix
1196
+ ```
1197
+
1198
+ ## Add idempotency checks
1199
+
1200
+ ```javascript
1201
+ exports.handler = async (event) => {
1202
+ for (const record of event.Records) {
1203
+ const key = record.s3.object.key;
1204
+
1205
+ // Skip if this is a processed file
1206
+ if (key.startsWith('processed/')) {
1207
+ console.log('Skipping already processed file:', key);
1208
+ continue;
1209
+ }
1210
+
1211
+ // Process and write to different location
1212
+ await processFile(key);
1213
+ await writeToS3(`processed/${key}`, result);
1214
+ }
1215
+ };
1216
+ ```
1217
+
1218
+ ## Set reserved concurrency as circuit breaker
1219
+
1220
+ ```yaml
1221
+ Resources:
1222
+ RiskyFunction:
1223
+ Type: AWS::Serverless::Function
1224
+ Properties:
1225
+ ReservedConcurrentExecutions: 10 # Max 10 parallel
1226
+ # Limits blast radius of runaway invocations
1227
+ ```
1228
+
1229
+ ## Monitor with CloudWatch alarms
1230
+
1231
+ ```yaml
1232
+ InvocationAlarm:
1233
+ Type: AWS::CloudWatch::Alarm
1234
+ Properties:
1235
+ MetricName: Invocations
1236
+ Namespace: AWS/Lambda
1237
+ Statistic: Sum
1238
+ Period: 60
1239
+ EvaluationPeriods: 1
1240
+ Threshold: 1000 # Alert if >1000 invocations/min
1241
+ ComparisonOperator: GreaterThanThreshold
1242
+ ```
1243
+
1244
+ ## Validation Checks
1245
+
1246
+ ### Hardcoded AWS Credentials
1247
+
1248
+ Severity: ERROR
1249
+
1250
+ AWS credentials must never be hardcoded
1251
+
1252
+ Message: Hardcoded AWS access key detected. Use IAM roles or environment variables.
1253
+
1254
+ ### AWS Secret Key in Source Code
1255
+
1256
+ Severity: ERROR
1257
+
1258
+ Secret keys should use Secrets Manager or environment variables
1259
+
1260
+ Message: Hardcoded AWS secret key. Use IAM roles or Secrets Manager.
1261
+
1262
+ ### Overly Permissive IAM Policy
1263
+
1264
+ Severity: WARNING
1265
+
1266
+ Avoid wildcard permissions in Lambda IAM roles
1267
+
1268
+ Message: Overly permissive IAM policy. Use least privilege principle.
1269
+
1270
+ ### Lambda Handler Without Error Handling
1271
+
1272
+ Severity: WARNING
1273
+
1274
+ Lambda handlers should have try/catch for graceful errors
1275
+
1276
+ Message: Lambda handler without error handling. Add try/catch.
1277
+
1278
+ ### Missing callbackWaitsForEmptyEventLoop
1279
+
1280
+ Severity: INFO
1281
+
1282
+ Node.js handlers should set callbackWaitsForEmptyEventLoop
1283
+
1284
+ Message: Consider setting context.callbackWaitsForEmptyEventLoop = false
1285
+
1286
+ ### Default Memory Configuration
1287
+
1288
+ Severity: INFO
1289
+
1290
+ Default 128MB may be too low for many workloads
1291
+
1292
+ Message: Using default 128MB memory. Consider increasing for better performance.
1293
+
1294
+ ### Low Timeout Configuration
1295
+
1296
+ Severity: WARNING
1297
+
1298
+ Very low timeout may cause unexpected failures
1299
+
1300
+ Message: Timeout of 1-3 seconds may be too low. Increase if making external calls.
1301
+
1302
+ ### No Dead Letter Queue Configuration
1303
+
1304
+ Severity: WARNING
1305
+
1306
+ Async functions should have DLQ for failed invocations
1307
+
1308
+ Message: No DLQ configured. Add for async invocations.
1309
+
1310
+ ### Importing Full AWS SDK v2
1311
+
1312
+ Severity: WARNING
1313
+
1314
+ Import specific clients from AWS SDK v3 for smaller packages
1315
+
1316
+ Message: Importing full AWS SDK. Use modular SDK v3 imports for smaller packages.
1317
+
1318
+ ### Hardcoded DynamoDB Table Name
1319
+
1320
+ Severity: WARNING
1321
+
1322
+ Table names should come from environment variables
1323
+
1324
+ Message: Hardcoded table name. Use environment variable for portability.
1325
+
1326
+ ## Collaboration
1327
+
1328
+ ### Delegation Triggers
1329
+
1330
+ - user needs GCP serverless -> gcp-cloud-run (Cloud Run for containers, Cloud Functions for events)
1331
+ - user needs Azure serverless -> azure-functions (Azure Functions, Logic Apps)
1332
+ - user needs database design -> postgres-wizard (RDS design, or use DynamoDB patterns)
1333
+ - user needs authentication -> auth-specialist (Cognito, API Gateway authorizers)
1334
+ - user needs complex workflows -> workflow-automation (Step Functions, EventBridge)
1335
+ - user needs AI integration -> llm-architect (Lambda calling Bedrock or external LLMs)
326
1336
 
327
1337
  ## When to Use
328
- This skill is applicable to execute the workflow or actions described in the overview.
1338
+
1339
+ Use this skill when the request clearly matches the capabilities and patterns described above.