gin-lambda-api-service-patterns

gin-lambda-api-service-patterns is a skill for Claude Code from shennawardana23/skillme. It costs 78 tokens per session (1,468 once invoked), scanned A, original, Apache-2.0.

A guide to building Go web APIs with Gin that run both as a normal local HTTP server and as an AWS Lambda function. AWS Lambda runs code on demand, while API Gateway receives web requests and forwards them to it.

In plain words
What is it for?
Structuring the entry point, sharing routes between both runtimes, configuring the Lambda adapter, and checking the build-and-deploy path.
Why use it?
It clarifies the different startup, shutdown, deployment, and error-handling rules between local servers and serverless deployments.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the skillme plugin — 137 skills, 2 commands shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/shennawardana23/skillme/gin-lambda-api-service-patterns
Any agent
npx skills add shennawardana23/skillme --skill gin-lambda-api-service-patterns
Clone the repo
git clone --depth 1 https://github.com/shennawardana23/skillme

Made for: Claude Code.

Or install skillme, the plugin that ships this one along with the rest of its 137 skills, 2 commands.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for gin-lambda-api-service-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/shennawardana23/skillme/gin-lambda-api-service-patterns.svg)](https://agentmods.dev/skills/shennawardana23/skillme/gin-lambda-api-service-patterns)
Your own site
<a href="https://agentmods.dev/skills/shennawardana23/skillme/gin-lambda-api-service-patterns"><img src="https://agentmods.dev/badge/skills/shennawardana23/skillme/gin-lambda-api-service-patterns.svg" alt="Measured on agentmods" height="20"></a>
Per session 78 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,468 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00078 $0.01468
Opus 5 $0.00039 $0.00734
Sonnet 5 $0.00016 $0.00294
Haiku 4.5 $0.00008 $0.00147

Measured 2d ago against content hash be20ba864d09, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

gin-lambda-api-service-patterns scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/gin-lambda-api-service-patterns/SKILL.md · 139 lines

How it starts

The opening of the file, as written. The whole thing — 139 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Gin + Lambda Dual-Runtime API Service

A common shape for a Go API service targeting serverless deployment: one Gin engine, wired to two different runtimes depending on environment — a plain http.Server for local development, and a Lambda/API-Gateway adapter (e.g. github.com/apex/gateway or github.com/aws/aws-lambda-go's httpadapter) for the deployed path. The two paths share the same route handlers but are genuinely different code, not the same server started two ways — this skill is about the places that difference actually matters.

The dual entrypoint

func main() {
    router := setupRouter()

    if os.Getenv("APP_ENV") == "production" {
        // Serverless path: no listener, no graceful-shutdown signal handling —
        // the Lambda runtime owns the process lifecycle.
        log.Fatal(gateway.ListenAndServe(port, router))
    } else {
        // Local dev path: a real listener, real graceful shutdown.
        srv := &http.Server{Addr: ":" + port, Handler: router}
        go func() {
            if err := srv.ListenAndServe(); err != nil && err != http.ErrServerClosed {
                log.Fatal(err)
            }
        }()
        waitForShutdownSignal(srv)
    }
}

Treat these as two genuinely different runtime paths, not one server started two ways: the Lambda-adapter path typically has no graceful shutdown or OS signal handling (the platform owns process lifecycle, cold starts and freezes replace long-running-process concerns), while the local path does. A change to shutdown behavior, connection draining, or long-lived background goroutines needs to be reasoned about separately for each path — testing only the local path can miss a change that behaves differently once actually deployed as a function.

Build and deploy shape

A Lambda-target Go service is typically built as a static cross-compiled binary and zipped, not built as a container image:

GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -o ./bootstrap ./cmd
zip main.zip bootstrap
aws lambda update-function-code --function-name <fn> --zip-file fileb://./main.zip

Read the full file on GitHub · 139 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 139 lines · 78 tokens per session scan A be20ba864d09

Subscribe to this mod's changes

gin-lambda-api-service-patterns is a skill published in the GitHub repository shennawardana23/skillme (2 stars, last pushed 8d ago), licensed Apache-2.0. It adds 78 tokens to every session and 1,468 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

insforge-cli

Use this skill whenever someone needs a backend, or when managing InsForge backend and cloud infrastructure with the InsForge CLI. For application code that calls InsForge from a frontend, backend, or edge function, use the insforge app-integration skill instead.

sutchan/Agent-Skills-Hub · 0 tokens

cloudrun-development

CloudBase Run backend development rules (Function mode/Container mode). Use this skill when deploying backend services that require long connections, multi-language support, custom environments, AI agent development, or migrating existing/GitHub apps that need VPC access to MySQL/PostgreSQL/Redis. Also use when…

sutchan/Agent-Skills-Hub · 99 tokens

cloudbase

腾讯云开发 CloudBase 全栈开发技能,覆盖 Web/小程序/uni-app 前端、云函数、云数据库、云存储与内置大模型能力,提供从接入到部署的全流程指导。.

sutchan/Agent-Skills-Hub · 52 tokens

cloud-storage-web

Complete guide for CloudBase cloud storage using Web SDK (@cloudbase/js-sdk) - upload, download, temporary URLs, file management, and best practices.

sutchan/Agent-Skills-Hub · 35 tokens

cloud-functions

CloudBase function runtime guide for building, deploying, and debugging your own Event Functions or HTTP Functions. This skill should be used when users need application runtime code on CloudBase, not when they are merely calling CloudBase official platform APIs.

sutchan/Agent-Skills-Hub · 50 tokens

google-cloud-solution-n-tier-serverless-web-app

Assists in designing and implementing secure n-tier serverless web applications and microservices on Google Cloud. Use when users need architecture designs, security checklists, Terraform code, or deployment guidance for multi-tier serverless apps, regional data residency / European sovereignty compliance, zero-trust…

google/skills · 91 tokens