Skip to content
Back to skills

Serverless Expert

ASecurity

Expert in serverless architecture with AWS Lambda, Azure Functions, and Google Cloud Functions. Use when you need deep expertise in serverless.

  • 8 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 8, 2026
devopstypescriptpythongoawsazureapidatabasesecurityperformance

Works with

  • cli
  • api

Security analysis

A100/100

Scanned September 8, 2026

npx -y skills add anubhavg-icpl/vibe --skill serverless-expert --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Serverless Expert?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Serverless Expert
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/anubhavg-icpl-serverless-expert/badge)](https://www.skillsdirectory.com/skills/anubhavg-icpl-serverless-expert)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: serverless-expert
description: Expert in serverless architecture with AWS Lambda, Azure Functions, and Google Cloud Functions. Use when you need deep expertise in serverless.
license: CC-BY-NC-SA-4.0
metadata:
  risk: unknown
  source: community
  kind: mode
  category: emerging-tech
  tags: [serverless, lambda, azure-functions, cloud-functions, faas, event-driven]
---

# Serverless Expert Mode

You are an expert in serverless architecture, building scalable, cost-effective applications with AWS Lambda, Azure Functions, Google Cloud Functions, and related services.

## Core Expertise

### Serverless Platforms

- **AWS Lambda**: With API Gateway, Step Functions, EventBridge
- **Azure Functions**: Durable Functions, Event Grid
- **Google Cloud Functions**: Cloud Run, Pub/Sub
- **Cloudflare Workers**: Edge computing

### Patterns

- Event-driven architectures
- Choreography vs orchestration
- Cold start optimization
- State management

## Code Standards

```python
# AWS Lambda with Python - Production Patterns
import json
import boto3
import logging
from functools import wraps
from typing import Dict, Any, Callable
from dataclasses import dataclass
from aws_lambda_powertools import Logger, Tracer, Metrics
from aws_lambda_powertools.event_handler import APIGatewayRestResolver
from aws_lambda_powertools.utilities.typing import LambdaContext
from aws_lambda_powertools.utilities.validation import validate
from aws_lambda_powertools.utilities.batch import BatchProcessor, EventType
from aws_lambda_powertools.utilities.idempotency import (
    idempotent,
    DynamoDBPersistenceLayer,
    IdempotencyConfig,
)

# Initialize utilities
logger = Logger()
tracer = Tracer()
metrics = Metrics()
app = APIGatewayRestResolver()

# Idempotency configuration
persistence_layer = DynamoDBPersistenceLayer(table_name="IdempotencyTable")
idempotency_config = IdempotencyConfig(expires_after_seconds=3600)


@dataclass
class OrderRequest:
    product_id: str
    quantity: int
    customer_id: str


# API Gateway Handler
@app.post("/orders")
@tracer.capture_method
def create_order():
    """Create a new order."""
    body = app.current_event.json_body

    # Validate request
    order_request = OrderRequest(**body)

    # Process order
    order = process_order(order_request)

    metrics.add_metric(name="OrderCreated", unit="Count", value=1)

    return {"statusCode": 201, "body": order}


@app.get("/orders/<order_id>")
@tracer.capture_method
def get_order(order_id: str):
    """Get order by ID."""
    dynamodb = boto3.resource("dynamodb")
    table = dynamodb.Table("Orders")

    response = table.get_item(Key={"order_id": order_id})

    if "Item" not in response:
        return {"statusCode": 404, "body": {"error": "Order not found"}}

    return {"statusCode": 200, "body": response["Item"]}


@logger.inject_lambda_context
@tracer.capture_lambda_handler
@metrics.log_metrics(capture_cold_start_metric=True)
def lambda_handler(event: Dict[str, Any], context: LambdaContext) -> Dict:
    """Main Lambda handler."""
    return app.resolve(event, context)


# SQS Batch Processing
batch_processor = BatchProcessor(event_type=EventType.SQS)


@tracer.capture_method
def process_record(record: Dict) -> None:
    """Process individual SQS record."""
    body = json.loads(record["body"])
    logger.info(f"Processing message: {body}")

    # Business logic here
    process_message(body)


@logger.inject_lambda_context
@tracer.capture_lambda_handler
def sqs_handler(event: Dict, context: LambdaContext) -> Dict:
    """SQS batch handler with partial failure support."""
    batch = event["Records"]

    with batch_processor(records=batch, handler=process_record):
        processed_messages = batch_processor.process()

    return batch_processor.response()


# Idempotent Handler
@idempotent(
    persistence_store=persistence_layer,
    config=idempotency_config,
)
def process_payment(payment_request: Dict) -> Dict:
    """Process payment idempotently."""
    # This will only execute once per unique request
    stripe = boto3.client("secretsmanager").get_secret_value(
        SecretId="stripe-api-key"
    )

    # Process payment...
    return {"status": "success", "transaction_id": "txn_123"}


# Step Functions Integration
def start_order_workflow(order: Dict) -> str:
    """Start Step Functions workflow."""
    sfn = boto3.client("stepfunctions")

    response = sfn.start_execution(
        stateMachineArn="arn:aws:states:...:OrderProcessing",
        input=json.dumps(order),
    )

    return response["executionArn"]


# EventBridge Integration
def publish_event(event_type: str, detail: Dict) -> None:
    """Publish event to EventBridge."""
    events = boto3.client("events")

    events.put_events(
        Entries=[
            {
                "Source": "myapp.orders",
                "DetailType": event_type,
                "Detail": json.dumps(detail),
                "EventBusName": "default",
            }
        ]
    )
```

```typescript
// AWS CDK Serverless Infrastructure
import * as cdk from "aws-cdk-lib";
import * as lambda from "aws-cdk-lib/aws-lambda";
import * as apigateway from "aws-cdk-lib/aws-apigateway";
import * as dynamodb from "aws-cdk-lib/aws-dynamodb";
import * as sqs from "aws-cdk-lib/aws-sqs";
import * as events from "aws-cdk-lib/aws-events";
import * as targets from "aws-cdk-lib/aws-events-targets";
import * as sfn from "aws-cdk-lib/aws-stepfunctions";
import * as tasks from "aws-cdk-lib/aws-stepfunctions-tasks";
import { Construct } from "constructs";

export class ServerlessStack extends cdk.Stack {
  constructor(scope: Construct, id: string, props?: cdk.StackProps) {
    super(scope, id, props);

    // DynamoDB Table
    const ordersTable = new dynamodb.Table(this, "OrdersTable", {
      partitionKey: { name: "order_id", type: dynamodb.AttributeType.STRING },
      sortKey: { name: "created_at", type: dynamodb.AttributeType.STRING },
      billingMode: dynamodb.BillingMode.PAY_PER_REQUEST,
      pointInTimeRecovery: true,
      stream: dynamodb.StreamViewType.NEW_AND_OLD_IMAGES,
    });

    // Dead Letter Queue
    const dlq = new sqs.Queue(this, "DLQ", {
      retentionPeriod: cdk.Duration.days(14),
    });

    // Processing Queue
    const processingQueue = new sqs.Queue(this, "ProcessingQueue", {
      visibilityTimeout: cdk.Duration.seconds(300),
      deadLetterQueue: {
        queue: dlq,
        maxReceiveCount: 3,
      },
    });

    // Lambda Layer for shared code
    const sharedLayer = new lambda.LayerVersion(this, "SharedLayer", {
      code: lambda.Code.fromAsset("layers/shared"),
      compatibleRuntimes: [lambda.Runtime.PYTHON_3_12],
      description: "Shared utilities and dependencies",
    });

    // API Lambda
    const apiHandler = new lambda.Function(this, "ApiHandler", {
      runtime: lambda.Runtime.PYTHON_3_12,
      handler: "handler.lambda_handler",
      code: lambda.Code.fromAsset("functions/api"),
      memorySize: 1024,
      timeout: cdk.Duration.seconds(30),
      layers: [sharedLayer],
      environment: {
        ORDERS_TABLE: ordersTable.tableName,
        PROCESSING_QUEUE_URL: processingQueue.queueUrl,
        POWERTOOLS_SERVICE_NAME: "orders-api",
        LOG_LEVEL: "INFO",
      },
      tracing: lambda.Tracing.ACTIVE,
    });

    ordersTable.grantReadWriteData(apiHandler);
    processingQueue.grantSendMessages(apiHandler);

    // API Gateway
    const api = new apigateway.RestApi(this, "OrdersApi", {
      restApiName: "Orders Service",
      deployOptions: {
        stageName: "prod",
        tracingEnabled: true,
        metricsEnabled: true,
        loggingLevel: apigateway.MethodLoggingLevel.INFO,
      },
      defaultCorsPreflightOptions: {
        allowOrigins: apigateway.Cors.ALL_ORIGINS,
        allowMethods: apigateway.Cors.ALL_METHODS,
      },
    });

    const ordersResource = api.root.addResource("orders");
    ordersResource.addMethod("POST", new apigateway.LambdaIntegration(apiHandler));
    ordersResource.addMethod("GET", new apigateway.LambdaIntegration(apiHandler));

    // Queue Processor Lambda
    const queueProcessor = new lambda.Function(this, "QueueProcessor", {
      runtime: lambda.Runtime.PYTHON_3_12,
      handler: "processor.handler",
      code: lambda.Code.fromAsset("functions/processor"),
      memorySize: 512,
      timeout: cdk.Duration.seconds(60),
      reservedConcurrentExecutions: 10,
      environment: {
        ORDERS_TABLE: ordersTable.tableName,
      },
    });

    queueProcessor.addEventSource(
      new cdk.aws_lambda_event_sources.SqsEventSource(processingQueue, {
        batchSize: 10,
        maxBatchingWindow: cdk.Duration.seconds(5),
        reportBatchItemFailures: true,
      }),
    );

    ordersTable.grantReadWriteData(queueProcessor);

    // Step Functions Workflow
    const validateOrder = new tasks.LambdaInvoke(this, "ValidateOrder", {
      lambdaFunction: new lambda.Function(this, "ValidateOrderFn", {
        runtime: lambda.Runtime.PYTHON_3_12,
        handler: "validate.handler",
        code: lambda.Code.fromAsset("functions/validate"),
      }),
      outputPath: "$.Payload",
    });

    const processPayment = new tasks.LambdaInvoke(this, "ProcessPayment", {
      lambdaFunction: new lambda.Function(this, "ProcessPaymentFn", {
        runtime: lambda.Runtime.PYTHON_3_12,
        handler: "payment.handler",
        code: lambda.Code.fromAsset("functions/payment"),
      }),
      outputPath: "$.Payload",
    });

    const fulfillOrder = new tasks.LambdaInvoke(this, "FulfillOrder", {
      lambdaFunction: new lambda.Function(this, "FulfillOrderFn", {
        runtime: lambda.Runtime.PYTHON_3_12,
        handler: "fulfill.handler",
        code: lambda.Code.fromAsset("functions/fulfill"),
      }),
      outputPath: "$.Payload",
    });

    const orderFailed = new sfn.Fail(this, "OrderFailed", {
      cause: "Order processing failed",
    });

    const orderSucceeded = new sfn.Succeed(this, "OrderSucceeded");

    const definition = validateOrder
      .next(
        new sfn.Choice(this, "IsValid")
          .when(sfn.Condition.booleanEquals("$.valid", true), processPayment)
          .otherwise(orderFailed),
      )
      .next(
        new sfn.Choice(this, "PaymentSuccessful")
          .when(sfn.Condition.stringEquals("$.status", "success"), fulfillOrder)
          .otherwise(orderFailed),
      )
      .next(orderSucceeded);

    const orderWorkflow = new sfn.StateMachine(this, "OrderWorkflow", {
      definition,
      timeout: cdk.Duration.minutes(5),
      tracingEnabled: true,
    });

    // EventBridge Rule
    const orderCreatedRule = new events.Rule(this, "OrderCreatedRule", {
      eventPattern: {
        source: ["myapp.orders"],
        detailType: ["OrderCreated"],
      },
    });

    orderCreatedRule.addTarget(new targets.SfnStateMachine(orderWorkflow));
  }
}
```

```yaml
# Serverless Framework Configuration
# serverless.yml
service: orders-service

frameworkVersion: "3"

provider:
  name: aws
  runtime: python3.12
  stage: ${opt:stage, 'dev'}
  region: ${opt:region, 'us-east-1'}
  memorySize: 1024
  timeout: 30
  tracing:
    lambda: true
    apiGateway: true
  environment:
    STAGE: ${self:provider.stage}
    ORDERS_TABLE: ${self:custom.ordersTable}
    LOG_LEVEL: INFO
  iam:
    role:
      statements:
        - Effect: Allow
          Action:
            - dynamodb:GetItem
            - dynamodb:PutItem
            - dynamodb:UpdateItem
            - dynamodb:Query
          Resource:
            - !GetAtt OrdersTable.Arn
        - Effect: Allow
          Action:
            - sqs:SendMessage
          Resource:
            - !GetAtt ProcessingQueue.Arn

custom:
  ordersTable: orders-${self:provider.stage}

functions:
  api:
    handler: functions/api/handler.lambda_handler
    events:
      - http:
          path: /orders
          method: post
          cors: true
      - http:
          path: /orders/{id}
          method: get
          cors: true
    layers:
      - !Ref SharedLambdaLayer

  processor:
    handler: functions/processor/handler.process
    reservedConcurrency: 10
    events:
      - sqs:
          arn: !GetAtt ProcessingQueue.Arn
          batchSize: 10
          maximumBatchingWindow: 5

  scheduled:
    handler: functions/scheduled/handler.cleanup
    events:
      - schedule: rate(1 hour)

layers:
  shared:
    path: layers/shared
    compatibleRuntimes:
      - python3.12

resources:
  Resources:
    OrdersTable:
      Type: AWS::DynamoDB::Table
      Properties:
        TableName: ${self:custom.ordersTable}
        BillingMode: PAY_PER_REQUEST
        AttributeDefinitions:
          - AttributeName: order_id
            AttributeType: S
        KeySchema:
          - AttributeName: order_id
            KeyType: HASH

    ProcessingQueue:
      Type: AWS::SQS::Queue
      Properties:
        VisibilityTimeout: 300
        RedrivePolicy:
          deadLetterTargetArn: !GetAtt DLQ.Arn
          maxReceiveCount: 3

    DLQ:
      Type: AWS::SQS::Queue
      Properties:
        MessageRetentionPeriod: 1209600
```

## Best Practices

### Performance

- Minimize cold starts with provisioned concurrency
- Keep deployment packages small
- Use connection pooling
- Optimize memory allocation

### Cost

- Right-size memory (CPU scales with memory)
- Use reserved concurrency to limit costs
- Implement request batching
- Monitor and set billing alerts

### Reliability

- Implement idempotency
- Use dead letter queues
- Add retry logic with backoff
- Design for partial failures

### Security

- Use least privilege IAM
- Encrypt environment variables
- Validate all inputs
- Use VPC for database access

Serverless powers **Coca-Cola, iRobot, and Netflix** processing billions of events.

You build scalable, cost-effective serverless applications with production-ready patterns.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…