agentleFS
yugef3hyugef3h/leo-skills/skills/chatbi-mvp/SKILL.md

chatbi-mvp

Skill11 starsChanged 4 months agoMITView on GitHub

Use when building a ChatBI (conversational BI) MVP from scratch, need to understand the 5 core capabilities (NL2SQL, multi-turn dialogue, RAG knowledge base, data visualization, intelligent attribution), or want to reference SuperSonic's architecture to guide implementation

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    First time: Read files in this order:

    line 88

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 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

ChatBI MVP Architecture

Overview

Build a ChatBI system: user asks questions in natural language → system generates SQL → executes → displays interactive charts with AI insights.

Architecture: NL → S2SQL (semantic SQL / MQL) → Physical SQL. LLM generates S2SQL using business terms (bizName), a deterministic Translator converts to physical SQL. LLM never touches physical table/column names.

Tech stack assumed: React (frontend) + Python/FastAPI (backend). Architecture is language-agnostic.

Five Core Layers

User: "最近7天各分区播放量怎么样"
         │
         ▼
┌─ Layer 3: RAG ────────────────┐  Trie + Embedding recall
│  "播放量" → views (metric)     │  Identify schema elements
│  "分区"   → category (dim)     │  in user query
│  "最近7天" → DateConf{-7d}     │
└───────────────┬───────────────┘
                │
                ▼
┌─ Layer 1: NL → S2SQL → SQL ──┐  5-stage pipeline
│  MAPPING → PARSING →          │  LLM generates S2SQL (bizName)
│  CORRECTING → TRANSLATING     │  Translator → physical SQL
│  → EXECUTE                    │
└───────────────┬───────────────┘
                │
        ┌───────┴───────┐
        ▼               ▼
┌─ Layer 2 ───┐  ┌─ Layer 5 ──────────┐
│ Multi-turn   │  │ Attribution         │
│ Context save │  │ LLM summary + YoY   │
│ + LLM rewrite│  │ + drill-down recs   │
└──────────────┘  └─────────────────────┘
        │               │
        └───────┬───────┘
                ▼
┌─ Layer 4: Visualization ──────┐
│  Auto chart type → ECharts    │
│  User can toggle chart/table  │
│  Drill-down → re-query        │
└───────────────────────────────┘

File Index

This skill is split into focused files. Read in order, or jump to what you need.

Core Architecture (read first)

FileContentsWhen to read
data-models.mdAll shared POJOs: SemanticSchema, SchemaMapInfo, SemanticParseInfo, QueryResultAlways start here — these connect every layer
nl2sql-pipeline.mdLayer 1 in detail: 5-stage pipeline, prompt template, self-consistency, corrector chain, S2SQL→physical translatorCore of the system
wiring.mdHow all layers connect: full request flow, plugin registration, DB tablesWhen you need to see the big picture

Supporting Layers

FileContentsWhen to read
layers-2-3-5.mdMulti-turn dialogue (Layer 2), RAG knowledge base (Layer 3), Attribution analysis (Layer 5)After understanding Layer 1
visualization.mdChart auto-classification, ECharts configs, chart type toggle, interaction patterns (Layer 4)Frontend implementation

Implementation Guides

FileContentsWhen to read
data-generation.mdHow to generate demo data with Faker + Pandas + SQLite, semantic model YAML, few-shot exemplarsBefore you start coding
frontend-interaction.mdComplete frontend state machine, component tree, API calls, drill-down/metric-switch/date-filter flowsFrontend implementation
bilibili-example.mdFull end-to-end: B站 creator analytics, from data generation to chart display, trace one queryWhen you want a concrete example
ui-design-system.mdCSS variables, color palette, typography, component recipes, shadows, ECharts themeWhen building UI

Planning

FileContentsWhen to read
mvp-plan.md4-week MVP scope, SuperSonic source code reference, common pitfalls, Python+React tech stack recommendationsProject planning

Getting Started

First time: Read files in this order:

  1. data-models.md — understand the data structures
  2. nl2sql-pipeline.md — understand the core engine
  3. bilibili-example.md — see a concrete example end-to-end
  4. wiring.md — see how everything connects

Starting to code: 5. data-generation.md — generate your demo data 6. mvp-plan.md — follow the 4-week plan 7. ui-design-system.md — copy CSS variables into your project

Implementing specific layers:

  • layers-2-3-5.md — for multi-turn, RAG, or attribution
  • visualization.md — for charts
  • frontend-interaction.md — for frontend state machine and components

Core Principles

  1. Semantic layer isolation: LLM generates S2SQL (bizName), NEVER physical SQL. The Translator is deterministic.
  2. Plugin chain architecture: Each layer is a chain of plugins registered in config, executed sequentially. Add/remove plugins without touching core code.
  3. Dual strategy everywhere: Rule-based (fast, deterministic) first → LLM-based (flexible) fallback. Applies to parsing, correction, and mapping.
  4. Full context persistence: Save the entire SemanticParseInfo (not just query text) after each turn. Include history SQL in multi-turn rewrite prompt.
  5. User can always override: Chart type auto-selected but user can toggle. Filters auto-detected but user can adjust.

Reference Implementation

SuperSonic is the reference architecture. See mvp-plan.md for a source code file map to key classes.

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.