.claude/skills/pikku-deploy-lambda/SKILL.md
Use when deploying a Pikku app to AWS Lambda. Covers HTTP handlers, scheduled tasks, SQS queue workers, WebSocket via API Gateway, and cold start caching. TRIGGER when: code imports @pikku/lambda, user mentions Lambda/serverless/AWS deployment, or handler files export Lambda-typed functions. DO NOT TRIGGER when: just defining functions/wirings without Lambda-specific code.
npx skillsauth add pikkujs/pikku pikku-deploy-lambdaInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
yarn add @pikku/lambda
Cache singleton services across Lambda invocations:
// cold-start.ts
import './.pikku/pikku-bootstrap.gen.js'
import { createConfig, createSingletonServices } from './services.js'
let singletonServices: SingletonServices | undefined
export const coldStart = async () => {
if (!singletonServices) {
const config = await createConfig()
singletonServices = await createSingletonServices(config)
}
return singletonServices
}
import type { APIGatewayProxyEvent } from 'aws-lambda'
import { runFetch } from '@pikku/lambda/http'
export const httpRoute = async (event: APIGatewayProxyEvent) => {
await coldStart()
return await runFetch(event)
}
import type { ScheduledHandler } from 'aws-lambda'
import { runScheduledTask } from '@pikku/core/scheduler'
export const myScheduledTask: ScheduledHandler = async () => {
await coldStart()
await runScheduledTask({ name: 'myScheduledTask' })
}
import type { SQSHandler } from 'aws-lambda'
import { runSQSQueueWorker } from '@pikku/lambda/queue'
export const mySQSWorker: SQSHandler = async (event) => {
const { logger } = await coldStart()
return runSQSQueueWorker(logger, event)
}
import {
connectWebsocket,
disconnectWebsocket,
processWebsocketMessage,
LambdaEventHubService,
} from '@pikku/lambda/websocket'
export const connectHandler = async (event) => {
const params = await getParams(event)
await connectWebsocket(event, params)
return { statusCode: 200, body: '' }
}
export const disconnectHandler = async (event) => {
const params = await getParams(event)
return await disconnectWebsocket(event, params)
}
export const defaultHandler = async (event) => {
const params = await getParams(event)
return await processWebsocketMessage(event, params)
}
WebSocket requires a ChannelStore (e.g., PgChannelStore) and LambdaEventHubService for cross-connection messaging.
documentation
Standard cleanup to run right after a Pikku template is cloned or scaffolded into a new project. TRIGGER when: a Pikku template was just cloned/scaffolded (via `pikku create`, `git clone <template>`, or the user says "I cloned the kanban template / starter / template"), or the working tree still looks like an untouched template (template README, placeholder `@project/*` name in package.json). DO NOT TRIGGER when: working in an established project mid-feature, or editing the template repo itself.
development
Make a Pikku frontend work in both English (LTR) and Arabic / right-to-left languages. Direction is derived from the active locale, applied once at the document root, and the layout mirrors itself — but only if styling is written flow-relative (margin-inline-start, text-align: start, Mantine ms/me) instead of left/right. TRIGGER when: adding Arabic (or Hebrew/Farsi/Urdu), asked to "support RTL / right-to-left / bidi / mirror the layout", or writing layout styles in an app that may run RTL. Builds on pikku-i18n (an RTL language is just another locale file). DO NOT TRIGGER for backend functions or for LTR-only copy changes.
development
Wire i18n into a Pikku frontend (Vite SPA, Vite SSR, or Next.js app-router) with react-i18next + i18next. English by default, every user-facing string goes through a `t()` token, and additional languages are served under `/de` `/es` URL prefixes. TRIGGER when: scaffolding or editing a frontend and writing user-facing text, adding a second language, or asked to "make this translatable / use tokens / add i18n". DO NOT TRIGGER for backend functions, error messages thrown from functions, or log output.
development
Use when translating an n8n Code node body into a real Pikku function body. Triggered when the user opens or points at a stub generated by @pikku/n8n-import (look for `STUB — generated from n8n Code node` in the file's JSDoc), or when the user says 'translate this n8n code', 'port this n8n code node', 'finish the codeStub__... function', etc. The stub file is a `pikkuSessionlessFunc` with a Zod input/output, a JSDoc preserving the original n8n JavaScript verbatim, and a `throw new Error('… — implement me')` body.