Skip to main content
Normalized for Mintlify from knowledge-base/aiconnected-apps-and-modules/modules/kb-generator/kb-generator-readme.mdx.

Knowledge Base Generator

Transform any business website into a comprehensive AI knowledge base.

What It Does

This tool takes a website URL and generates everything needed to power an intelligent AI chat assistant:
  1. Scrapes the website - Extracts all pages and content
  2. Identifies services - Finds every service/product offered
  3. Researches each service - Generates educational content, decision guides, and FAQs
  4. Maps concerns to services - Creates relationships between customer problems and solutions
  5. Generates conversation starters - Creates engaging entry points for chat
  6. Writes the system prompt - Defines how the AI should behave
  7. Creates an assessment quiz - Builds a recommendation quiz
  8. Compiles a service guide - Human-readable markdown documentation

Quick Start

# 1. Install dependencies
npm install

# 2. Set up environment variables
cp .env.example .env
# Edit .env and add your API keys

# 3. Generate a knowledge base
npm run generate -- https://example.com

Requirements

  • Node.js 18+
  • Anthropic API key (Claude)
  • Firecrawl API key (web scraping)
Get your API keys:

Usage

# Basic usage
node index.js <website-url> [output-directory]

# Examples
node index.js https://skinbeauty.skin
node index.js https://example.com ./output/my-client

# Help
node index.js --help

Output Files

The generator creates these files in the output directory:
FileDescription
knowledge-base.jsonComplete knowledge base (use this in your app)
8-service-guide.mdHuman-readable service documentation
6-system-prompt.txtAI system prompt
5-starters.jsonConversation starter cards
4-concern-map.jsonConcern → service mapping
7-quiz.jsonAssessment quiz configuration
3-enhanced-services.jsonAll service data with research
2-extracted-data.jsonRaw extracted business/service data
1-raw-scrape.jsonRaw scraped website content

Using the Knowledge Base

In Your Chat Application

import knowledgeBase from './output/knowledge-base.json';

// System prompt for AI
const systemPrompt = knowledgeBase.systemPrompt;

// Service data
const services = knowledgeBase.services;

// Find services for a concern
function findServices(concern) {
  const mapping = knowledgeBase.concernMap[concern];
  if (!mapping) return [];
  
  return mapping.primary.map(id => 
    services.find(s => s.id === id)
  ).filter(Boolean);
}

// Conversation starters for UI
const starters = knowledgeBase.conversationStarters;

Service Data Structure

Each service includes:
{
  id: "service-slug",
  name: "Service Name",
  category: "Category",
  description: "Original description",
  price: "$XXX",
  duration: "XX min",
  
  // Generated content
  education: {
    whatItIs: "...",
    howItWorks: "...",
    duringTreatment: "...",
    results: "..."
  },
  
  chooseThisFor: ["Situation 1", "Goal 2", ...],
  selfIdentification: ["You...", "You...", ...],
  concerns: ["acne", "aging", ...],
  
  experience: {
    during: "...",
    immediately_after: "...",
    downtime: "...",
    results_timeline: "..."
  },
  
  faqs: [{ question: "...", answer: "..." }],
  notRightFor: ["Contraindication 1", ...],
  relatedServices: ["other-service"],
  tags: ["tag1", "tag2"]
}

Time Estimates

Business SizeServicesGeneration Time
Small5-102-5 minutes
Medium10-205-10 minutes
Large20-5010-20 minutes

Cost Estimates

Approximate API costs per generation:
ComponentTokensCost (Claude Sonnet)
Website scrapeN/A~$0.01 (Firecrawl)
Extraction~10K~$0.03
Service research (×15)~60K~$0.20
Concern mapping~5K~$0.02
Starters~3K~$0.01
System prompt~5K~$0.02
Quiz~5K~$0.02
Total~$0.30-0.50

Customization

Override AI Model

AI_MODEL=claude-opus-4-20250514 node index.js https://example.com

Manual Review

After generation, you can:
  1. Review 8-service-guide.md for accuracy
  2. Edit 3-enhanced-services.json to correct any issues
  3. Regenerate the final knowledge base with corrections

Troubleshooting

”Crawl failed”

  • Check your Firecrawl API key
  • The website may be blocking crawlers
  • Try reducing the page limit

”Failed to parse JSON”

  • The AI response was malformed
  • Try running again (rate limits can cause issues)
  • Check the raw output files for debugging

Services missing

  • The website may have services behind JavaScript
  • Try scraping specific pages directly
  • Add services manually to the extracted data

License

MIT
Last modified on April 17, 2026