agentleFS
WaniWani-AIWaniWani-AI/sdk/skills/waniwani-sdk/SKILL.md

waniwani-sdk

Skill18 starsChanged 5 months agoMITView on GitHub

MCP distribution SDK: build sales funnels, lead generation, booking flows, insurance quote flows, pricing quote flows, and any multi-step conversational MCP app with @waniwani/sdk. Open source createFlow engine (no API key required) with pluggable state backends (in-memory, Redis, Upstash, Cloudflare KV, DynamoDB, or hosted). Optional free tier adds a revenue-first event taxonomy (track leads, prices shown/compared, options selected, and conversions — including off-platform purchases), funnel analytics, knowledge base, and a chat widget. Trigger when the user wants to add an MCP funnel, sales funnel, lead gen flow, booking flow, quote flow, knowledge base / FAQ tool, or embedded chat to an MCP server — or to instrument tracking on a @waniwani/sdk app: emit or track events, record a conversion or revenue, attribute an off-platform purchase back to a lead, or measure where users drop off in a funnel.

  • Reads credentials

The file

We split this skill into the rules it gives an agent

11 rules. About 0 are common, 4 are distinctive, and 7 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 7

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Before you answer an API question or write a line of @waniwani/sdk code, fetch the relevant docs page from the map below.

    line 20
  2. Distinctive:

    If you can fetch only one thing, fetch docs.waniwani.ai/llms.txt: it is the complete page index, always current, and cheap to read.

    line 23
  3. Distinctive:

    Default to the OSS path. Reach for the free tier when the user asks for tracking, analytics, hosted state, KB, or chat, and say plainly …

    line 61
  4. Very specific:

    Use captureIntent / CaptureIntentOptions.

    line 108
  5. Very specific:

    Use createFlow for multi-step tools, server.registerTool for single-shot ones, and WaniwaniChat for chat.

    line 122
  6. Very specific:

    Read the changelog, starting at the Breaking changes at a glance table, then every ## <version>: section above your old version and at or …

    line 135
  7. Very specific:

    Every version hop also ships a self-contained migration skill you can invoke directly, named migrate-waniwani-sdk-<from>-to-<to>.

    line 142
  8. Distinctive:

    When a playbook covers the user's task, follow it step by step instead of writing code directly.

    line 157
  9. Very specific:

    Creating multiple clients: create one waniwani() in lib/waniwani.ts and import it everywhere.

    line 171
  10. Very specific:

    Forgetting START / END edges: every flow needs addEdge(START, firstNode) and addEdge(lastNode, END).

    line 174
  11. Distinctive:

    Answering from memory: if you have not fetched the docs page for what you are writing, fetch it.

    line 187

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Waniwani SDK (@waniwani/sdk)

The MCP distribution SDK. Build sales funnels, lead generation, booking, insurance quote, and pricing quote apps on top of your MCP server.

Read the docs before you write code

This file is a map, not a manual. The full, current documentation lives at docs.waniwani.ai/sdk/introduction and it is the only source of truth for API shapes, option names, event properties, and version behavior. The SDK is 0.x and moves fast, so anything you remember about it may already be wrong.

Before you answer an API question or write a line of @waniwani/sdk code, fetch the relevant docs page from the map below. When this file and the docs disagree, the docs win.

If you can fetch only one thing, fetch docs.waniwani.ai/llms.txt: it is the complete page index, always current, and cheap to read.

Where things live in the docs

You want to...Fetch
Understand what the SDK is and pick a path/sdk/introduction
Get something running end to end/sdk/quickstart
Install the package, pick an entry point/sdk/configuration/installation, /sdk/reference/entry-points
Get a free API key/sdk/configuration/api-key
Learn the flow engine/sdk/flows/overview, then architecture, state, nodes, edges, interrupts, register
Open a flow with an introduction or a GDPR notice/sdk/flows/intro
Plug in Redis / Upstash / Cloudflare KV / DynamoDB/sdk/flows/kv-store, /sdk/reference/kv-store-api
Build a specific funnel/sdk/guides/funnels, then sales-funnel, lead-generation, booking, insurance-quote
See a full worked example/sdk/guides/pet-insurance
Deploy, or self-host with no API key/sdk/deployment/overview, /sdk/deployment/self-hosting
Wrap an existing MCP server, set env vars/sdk/configuration/wrap-server, /sdk/configuration/environment-variables
Track events and build a revenue funnel/sdk/tracking/overview, events, identify, sessions
Know where each event belongs in a flow/sdk/tracking/instrumentation
Check a typed event payload/sdk/reference/event-schema
Add knowledge-base search/sdk/knowledge-base/overview
Send an email from a tool or flow node/sdk/modules/email
Embed the chat widget/sdk/chat/embed (script tag), /sdk/chat/react
Read the exact tool contract a flow compiles to/sdk/reference/flow-tool-contract
Tunnel a dev server for remote testing/sdk/guides/tunnel
Use the CLI/sdk/cli/overview
Upgrade the SDK, or fix a build that broke after a bump/sdk/changelog

Dashboard and free API key: app.waniwani.ai.

The one thing to get right without fetching: the tier split

  • Open source, no API key. createFlow, StateGraph, START, END, the KvStore interface, MemoryKvStore. Runs against any state backend you implement.
  • Free tier, one env var (WANIWANI_API_KEY). Same SDK, plus hosted flow state, event tracking, funnel analytics, knowledge base, email, chat widget, and the dashboard playground.

Default to the OSS path. Reach for the free tier when the user asks for tracking, analytics, hosted state, KB, or chat, and say plainly that it needs a key.

Minimal shape, enough to orient yourself before you fetch the flow docs:

import { createFlow, MemoryKvStore, START, END } from "@waniwani/sdk/mcp";
import { z } from "zod";

const onboardingFlow = createFlow({
  id: "onboarding",
  title: "User Onboarding",
  description: "Use when a new user wants to get started.",
  state: {
    email: z.string().describe("Work email"),
  },
})
  .addNode("ask_email", ({ interrupt }) =>
    interrupt({ email: { question: "What's your work email?" } })
  )
  .addEdge(START, "ask_email")
  .addEdge("ask_email", END)
  .compile({ store: new MemoryKvStore() });

await onboardingFlow.register(server);

Drop the { store } argument once WANIWANI_API_KEY is set and flow state moves to app.waniwani.ai. With neither a store nor a key, .compile() throws and tells you how to fix it. There is no silent fallback.

Removed surfaces

Changed in 0.24.0: a flow's tool listing no longer names state fields under stateUpdates, and flow.config._meta no longer types or sends _flowGraph (read flow.flowGraph). In 0.24.0 to 0.24.2, start merges no stateUpdates, and continue and reset merge only fields the run has asked. npx skills add Waniwani-AI/sdk -s migrate-waniwani-sdk-0.23-to-0.24 applies the migration.

Changed in 0.25.0: the session's first question or widget lists every state field in fields, and any call writes a declared field whose value fits its schema, including one no question asks. Everything in state is exposed that way, so a lookup id or price the user must not choose stays out of state (key it by ctx.sessionId in your own store). Wrap a consent or a must-see widget pick in neverPrefilled(schema) so only an answer to its own question counts. npx skills add Waniwani-AI/sdk -s migrate-waniwani-sdk-0.24-to-0.25 applies the migration, from 0.24.x or straight from 0.23.x.

Removed in 0.23.0: withWaniwani's captureTelemetry option and the CaptureTelemetryOptions type. Use captureIntent / CaptureIntentOptions. Wrapped tools now advertise one optional intent string instead of a telemetry object. npx skills add Waniwani-AI/sdk -s migrate-waniwani-sdk-0.22-to-0.23 applies the migration.

Removed in 0.20.0. An import error for any of these means the code is on a pre-0.20 pattern: createTool, createResource, registerTools, toNextJsHandler, toExpressJsHandler, createApiHandler, ChatCard, every MCP-widget React hook except useWaniwani (WidgetProvider, useWidgetClient, useToolOutput, and the rest), InitializeNextJsInIframe, LoadingWidget, DevModeProvider, detectPlatform, isMCPApps, isOpenAI.

The @waniwani/sdk/legacy, @waniwani/sdk/legacy/react, @waniwani/sdk/legacy/next-js, @waniwani/sdk/legacy/express-js, @waniwani/sdk/chat/server, @waniwani/sdk/next-js, and @waniwani/sdk/express-js entry points no longer exist.

Use createFlow for multi-step tools, server.registerTool for single-shot ones, and WaniwaniChat for chat. npx skills add Waniwani-AI/sdk -s migrate-waniwani-sdk-0.19-to-0.20 applies the whole migration.

@waniwani/sdk/evals was removed entirely. See the changelog.

Upgrading

@waniwani/sdk is 0.x, so minor bumps can break the public API. Whenever you raise the version in a project, whether by editing package.json, running bun add @waniwani/sdk@latest, or chasing a build that started failing, do not treat it as a drop-in.

  1. Read the changelog, starting at the Breaking changes at a glance table, then every ## <version>: section above your old version and at or below your new one.
  2. Apply each documented migration. They are written as mechanical codemods, so apply them rather than paraphrasing them.
  3. Run bun run typecheck && bun test.

Every version hop also ships a self-contained migration skill you can invoke directly, named migrate-waniwani-sdk-<from>-to-<to>. For the latest release:

npx skills add Waniwani-AI/sdk -s migrate-waniwani-sdk-0.24-to-0.25

Guided playbooks

User wants to...Playbook
Initialize a new MCP project from the templatescripts/initialize.md
Create their first flowscripts/create-flow.md
Tunnel the dev server for remote testingscripts/tunnel.md

When a playbook covers the user's task, follow it step by step instead of writing code directly. Each one includes prerequisite checks, interactive design steps, and testing instructions.

Two sibling skills handle tracking work end to end:

npx skills add Waniwani-AI/sdk -s instrument-tracking   # add funnel events across existing flows
npx skills add Waniwani-AI/sdk -s audit-tracking        # read-only audit of an app's instrumentation

Common mistakes

  • createFlow().compile() throws "no flow store configured": pass { store: new MemoryKvStore() } for dev, set WANIWANI_API_KEY for the hosted store, or pass your own KV adapter.
  • Creating multiple clients: create one waniwani() in lib/waniwani.ts and import it everywhere.
  • Wrong import paths: flow primitives and KV come from @waniwani/sdk/mcp, useWaniwani from @waniwani/sdk/mcp/react, the chat widget from @waniwani/sdk/chat.
  • Forgetting START / END edges: every flow needs addEdge(START, firstNode) and addEdge(lastNode, END).
  • Adding a first node just to greet the user or state a GDPR notice: an opening node is skipped once its fields are filled, by an earlier action or by an answer the user gave up front, so that message may never land. Use intro on the flow config instead (/sdk/flows/intro).
  • Writing instructions into createFlow({ description }): the description is the whole consent card a ChatGPT user approves. Numbered protocols, Do NOT, You MUST call X first and other attempts to steer the model get flagged as a Suspicious Instruction on that card. Describe what the flow does in a sentence or two; the engine puts the protocol on each response as nextStep (/sdk/reference/flow-tool-contract).
  • Calling interrupt / showWidget directly: they come from the handler context, ({ interrupt }) => interrupt(...).
  • Answering from memory: if you have not fetched the docs page for what you are writing, fetch it.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.