packages/cli/skills/pikku-mongodb/SKILL.md
Use when setting up MongoDB database services in a Pikku app. Covers PikkuMongoDB connection, channel stores, workflow services, secret services, AI storage, agent runs, and deployment services. TRIGGER when: code uses PikkuMongoDB, MongoDBChannelStore, MongoDBWorkflowService, MongoDBSecretService, or user asks about MongoDB setup with Pikku. DO NOT TRIGGER when: user asks about SQL databases (use pikku-kysely) or Redis (use pikku-redis).
npx skillsauth add pikkujs/pikku pikku-mongodbInstall 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.
Use this skill as an execution checklist, not reference material.
pikku-meta when available; otherwise run the relevant pikku meta ... --json command and inspect only the focused output you need..pikku, node_modules, vendored packages, or broad build artifacts.pikku-verify or pikku all when functions, wirings, schemas, or generated clients may have changed.@pikku/mongodb provides MongoDB-backed implementations of Pikku's core service interfaces.
yarn add @pikku/mongodb
PikkuMongoDB (Connection Wrapper)import { PikkuMongoDB } from '@pikku/mongodb'
const mongo = new PikkuMongoDB(
logger: Logger,
clientOrUri: MongoClient | string,
dbName: string,
options?: MongoClientOptions
)
await mongo.init()
mongo.db // Db instance for queries
await mongo.close()
| Service | Interface | Purpose |
| --------------------------- | ------------------------------------- | ---------------------------------------------- |
| MongoDBChannelStore | ChannelStore | WebSocket channel state persistence |
| MongoDBEventHubStore | EventHubStore | Event hub state persistence |
| MongoDBWorkflowService | PikkuWorkflowService | Workflow definition storage |
| MongoDBWorkflowRunService | WorkflowRunService | Workflow execution tracking |
| MongoDBDeploymentService | DeploymentService | Deployment state management |
| MongoDBAIStorageService | AIStorageService, AIRunStateService | AI conversation/run storage |
| MongoDBAgentRunService | AgentRunService | Agent execution tracking |
| MongoDBSecretService | SecretService | Encrypted secret storage (envelope encryption) |
All services take a Db instance in their constructor and have an init() method that creates collections/indexes.
import { MongoDBSecretService } from '@pikku/mongodb'
const secrets = new MongoDBSecretService(mongo.db, {
kekSecret: 'your-key-encryption-key',
salt: 'your-salt',
})
await secrets.init()
await secrets.setSecretJSON('api-key', { key: 'sk-...' })
const value = await secrets.getSecretJSON<{ key: string }>('api-key')
await secrets.rotateKEK()
import {
PikkuMongoDB,
MongoDBChannelStore,
MongoDBWorkflowService,
} from '@pikku/mongodb'
const createSingletonServices = pikkuServices(async (config) => {
const logger = new PinoLogger()
const mongo = new PikkuMongoDB(logger, config.mongoUri, 'myapp')
await mongo.init()
const channelStore = new MongoDBChannelStore(mongo.db)
await channelStore.init()
const workflowService = new MongoDBWorkflowService(mongo.db)
await workflowService.init()
return { config, logger, database: mongo, channelStore, workflowService }
})
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.