agentleFS
WaniWani-AIWaniWani-AI/sdk/.claude/skills/knowledge-base/SKILL.md

knowledge-base

Skill18 starsChanged 5 months agoMITView on GitHub

Set up a knowledge base with search for an MCP project. Creates FAQ tool and ingestion script using the Waniwani KB API via @waniwani/sdk.

  • Reads credentials

32 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use playwright, code-reviewer and 4 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • OpenAISkill

    playwright

    Use when the task requires automating a real browser from the terminal (navigation, form filling, snapshots, screenshots, data extraction, UI-flow debugging) via `playwright-cli` or the bundled wrapper script.

    Also in 3 projects that use this

  • GoogleSkill

    code-reviewer

    Also in 4 projects that use this

  • engtySkill

    codex

    Use when the user asks to run Codex CLI (codex exec, codex resume) or references OpenAI Codex for code analysis, refactoring, or automated editing

    Also in 3 projects that use this

  • ElasticSkill

    create-skill

    Interactively create a new Claude Code skill and add it to the elastic-docs-skills catalog. Use when the user wants to generate a new skill, scaffold a slash command, or build automation for docs tasks.

    Also in 3 projects that use this

  • CloudflareSkill

    security-audit

    Security guidance and vulnerability review for codebases, APIs, services, CLI tools, libraries, and daemons. Use for security questions, focused reviews, vulnerability research, security audits, or pen tests. Run the complete workflow only for explicit codebase audit or pen-test requests, full/comprehensive/end-to-end reviews, or requested report artifacts.

    Also in 3 projects that use this

  • Microsoft AzureSkill

    verify

    End-to-end app testing pipeline for browser-based web apps on cloud browsers via Azure Playwright Workspaces: verify the live app, author tests for working flows, heal failing tests, then re-run with video and produce one consolidated report. Three phases (app verification, test authoring, test healing) plus a scoped final sanity run; each phase emits a sub-report. Use when asked to "verify my app", "make sure my app works and has good test coverage", "do a full QA pass", "add tests where I'm missing coverage", "fix failing tests and add new ones", "smoke test before deploy", "QA my deployment", or any combined verify-and-test ask. Requires Azure CLI (`az login`) and a Playwright Workspace resource ID — bootstraps configs on first invocation. Browser-based web apps with Playwright only — not for unit/API tests, native mobile/desktop, load/perf, or full accessibility audits.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

7 rules. 0 are common, 1 is distinctive, and 6 are very specific to this project.

  • 0

    Common

    Most of the 24 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 6

    Very specific

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

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

    Add semantic search over markdown documents to an MCP project using the Waniwani KB API (client.kb).

    line 10
  2. Very specific:

    Look in lib/ for the directory that isn't shared — that's the MCP name.

    line 22
  3. Distinctive:

    Ask the user: "Do you have .md files to add to the knowledge base, or should I create an example file?"

    line 28
  4. Very specific:

    If no files provided, create lib/{MCP_NAME}/knowledge-base/knowledge/example.md:

    line 30
  5. Very specific:

    Create scripts/kb-ingest.ts (create scripts/ directory if it doesn't exist):

    line 46
  6. Very specific:

    Call it where the server is built, inside the withWaniwani wrapper:

    line 148
  7. Very specific:

    Run bun run kb:ingest after adding or updating .md files

    line 177

“Common” is measured: kept by at least 6 in 10 of the 24 edited versions of this file we could read. “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

Set Up Knowledge Base

Add semantic search over markdown documents to an MCP project using the Waniwani KB API (client.kb).

Prerequisites

  • Project must already be initialized (no {{MCP_NAME}} placeholders)
  • @waniwani/sdk must be installed
  • WANIWANI_API_KEY must be set in the environment

Steps

1. Detect MCP name

Look in lib/ for the directory that isn't shared — that's the MCP name. Store as {MCP_NAME}.

2. Create knowledge directory

Create lib/{MCP_NAME}/knowledge-base/knowledge/ directory.

Ask the user: "Do you have .md files to add to the knowledge base, or should I create an example file?"

If no files provided, create lib/{MCP_NAME}/knowledge-base/knowledge/example.md:

# Example Knowledge Base

## What is this?

This is an example knowledge base entry. Replace this file with your own .md files containing information you want your AI assistant to be able to search through.

## How does it work?

Each .md file is split into chunks by H2 headings. The H1 title provides context for each chunk. Run `bun run kb:ingest` to upload your knowledge files to the Waniwani API.

3. Create the ingestion script

Create scripts/kb-ingest.ts (create scripts/ directory if it doesn't exist):

import { readdir, readFile } from "node:fs/promises";
import { join } from "node:path";
import { waniwani } from "@waniwani/sdk";

const knowledgeDir = join(import.meta.dirname, "../lib/{MCP_NAME}/knowledge-base/knowledge");

const mdFiles = (await readdir(knowledgeDir)).filter((f) => f.endsWith(".md"));
console.log(`Found ${mdFiles.length} knowledge file(s)`);

const files = await Promise.all(
  mdFiles.map(async (filename) => ({
    filename,
    content: await readFile(join(knowledgeDir, filename), "utf-8"),
  })),
);

const client = waniwani();

console.log("Ingesting files into knowledge base...");
console.log("Files land in the agent's draft. Publish it in the WaniWani app to make them live.");

const result = await client.kb.ingest(files);
console.log(`Done: ${result.chunksIngested} chunks from ${result.filesProcessed} files`);

4. Add ingest script to package.json

Add to scripts:

"kb:ingest": "bun run scripts/kb-ingest.ts"

5. Create the FAQ tool

A KB lookup is a single-shot tool, not a multi-step flow, so register it directly on the MCP server. withWaniwani wraps the server to capture tool.called and hand the handler a session-scoped client.

Create lib/{MCP_NAME}/tools/faq.ts:

import { waniwani } from "@waniwani/sdk";
import type { McpServer } from "@waniwani/sdk/mcp";
import { z } from "zod";

const client = waniwani();

export function registerFaqTool(server: McpServer): void {
  server.registerTool(
    "faq",
    {
      title: "FAQ",
      description:
        "Answer frequently asked questions. Use this when users ask general questions about the product or service.",
      inputSchema: {
        question: z.string().describe("The user's question"),
      },
      annotations: {
        title: "FAQ",
        readOnlyHint: true,
        openWorldHint: false,
        destructiveHint: false,
      },
    },
    async ({ question }) => {
      const results = await client.kb.search(question, { topK: 5 });

      if (results.length === 0) {
        return {
          content: [
            {
              type: "text" as const,
              text: "I don't have a specific answer for that question.",
            },
          ],
        };
      }

      const text = results
        .map((r) => `**${r.heading}**\n${r.content}`)
        .join("\n\n---\n\n");

      return { content: [{ type: "text" as const, text }] };
    },
  );
}

annotations.title is required by Claude's Connectors Directory, which flags the server at submission without it. The top-level title does not satisfy it.

6. Register the FAQ tool

Export from lib/{MCP_NAME}/tools/index.ts:

export { registerFaqTool } from "./faq";

Call it where the server is built, inside the withWaniwani wrapper:

import { withWaniwani } from "@waniwani/sdk/mcp";
import { registerFaqTool } from "@/lib/{MCP_NAME}/tools";

const server = withWaniwani(new McpServer({ name: "{MCP_NAME}", version: "1.0.0" }));
registerFaqTool(server);

7. Ingest knowledge files

bun run kb:ingest

This requires WANIWANI_API_KEY to be set in the environment.

8. Verify

bun run build

9. Print summary

Tell the user:

  • Knowledge files go in: lib/{MCP_NAME}/knowledge-base/knowledge/
  • Run bun run kb:ingest after adding or updating .md files
  • WANIWANI_API_KEY must be set in the environment
  • Markdown files should use # Title (H1) and ## Section (H2) structure
  • A push replaces only the sources it names and lands in the agent's draft. Publish in the app to make it live.

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.