usage
Skill này làm gì
Skill này hướng dẫn trả lời câu hỏi dữ liệu bằng dòng lệnh Wren, gồm thu thập ngữ cảnh lược đồ, viết SQL qua lớp ngữ nghĩa và chạy truy vấn. Skill dành cho nhà phân tích và người dùng kinh doanh hỏi những câu như bao nhiêu, top mười hoặc xu hướng.
Khi nào nên dùng
- ✓Khi bạn hỏi có bao nhiêu đơn hàng, khách hàng hoặc số tiền đạt được trong một khoảng thời gian.
- ✓Khi bạn yêu cầu một danh sách top, một bảng phân tích hoặc xu hướng trong dữ liệu kinh doanh.
- ✓Khi bạn muốn một báo cáo hoặc phân tích về một chỉ số kinh doanh từ cơ sở dữ liệu đã kết nối.
Liên kết skill
https://github.com/Canner/WrenAI/blob/main/core/wren/src/wren/skills_content/usage/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Quý trước chúng ta có bao nhiêu khách hàng mới, và con số đó so với quý trước đó như thế nào?”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Skill yêu cầu agent của bạn kiểm tra cài đặt, đọc lược đồ và các truy vấn trước đó của dự án, viết SQL qua mô hình ngữ nghĩa, chạy và hiển thị kết quả.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
Wren Engine CLI — Agent Workflow Guide
This guide is served by the
wrenCLI (wren skills get usage), so it always matches your installed wrenai version. Pull the deeper reference docs withwren skills get usage --full.
Preflight — Verify environment and installation
Goal: Ensure the wren CLI is available before entering any workflow.
Step 1 — Check Python virtual environment
Run python -c "import sys; print(sys.prefix)" (or equivalent) to determine
whether a virtual environment is active.
- If no venv is active, warn the user and ask whether to:
- Create one (e.g.,
python -m venv .venv && source .venv/bin/activate) - Continue without a venv (not recommended — may pollute global packages)
- Create one (e.g.,
Step 2 — Check if the wren CLI is installed
Run wren --version. If the command is not found or errors:
Tell the user that the
wrenCLI is not installed.Ask if you should help install it.
If the user agrees, determine the datasource extra to install:
Auto-detect from project: Check whether the current directory is inside a wren project (look for
wren_project.ymlup to the repository root). If found, read the active profile withcat ~/.wren/profiles.ymlor look for a datasource hint in the project's profile configuration. Extract the datasource type from there.Ask the user: If no project is detected or no datasource can be inferred, ask the user which database they plan to connect to. Valid extras:
postgres(for Aurora Postgres),mysql(for Aurora MySQL),bigquery,snowflake,clickhouse,trino,mssql,databricks,redshift,spark,athena,oracle. DuckDB is included by default — no extra needed.Install with the detected or chosen extra:
# DuckDB (no extra needed) pip install "wrenai" # Other datasources pip install "wrenai[<datasource>]"To also enable semantic memory, interactive prompts, and web UI (recommended):
pip install "wrenai[<datasource>,main]" # or for DuckDB: pip install "wrenai[main]"Verify:
wren --version
If wren --version succeeds, proceed to the relevant workflow below.
The wren CLI queries databases through an MDL (Model Definition Language) semantic layer. You write SQL against model names, not raw tables. The engine translates to the target dialect.
Two things drive everything:
- Profile — database connection + datasource type, managed via
wren profile(stored in~/.wren/profiles.yml) - Project — MDL model definitions in YAML, compiled to
target/mdl.jsonviawren context build
The CLI reads the active profile for connection info and datasource. Use wren profile list to see which profile is active, wren profile switch <name> to change it. dry-plan also accepts --datasource / -d for transpile-only use without a profile.
For memory-specific decisions, see the memory reference (run wren skills get usage --full).
For SQL syntax, CTE-based modeling, and error diagnosis, see the wren-sql reference (run wren skills get usage --full).
For project structure, MDL field definitions, and CLI workflow details, see the documentation.
Workflow 1: Answering a data question
Step 1 — Gather context
| Situation | Command |
|---|---|
| Default | wren memory fetch -q "<question>" |
| Need specific model's columns | wren memory fetch -q "..." --model <name> --threshold 0 |
| Memory not installed | Read target/mdl.json in the project directory, or run wren context show |
If this is the first query in the conversation, also run:
wren context instructions
If it returns content, treat it as rules that override defaults — apply them to all subsequent queries in this session.
Step 2 — Recall past queries
wren memory recall -q "<question>" --limit 3
Use results as few-shot examples. Skip if empty.
Step 2.5 — Assess complexity (before writing SQL)
If the question involves any of the following, consider decomposing:
- Multiple metrics or aggregations (e.g., "churn rate AND expansion revenue")
- Multi-step calculations (e.g., "month-over-month growth rate")
- Comparisons across segments (e.g., "by plan tier, by region")
- Time-series analysis requiring baseline + change (e.g., "retention curve")
Decomposition strategy:
- Identify the sub-questions (e.g.,
Câu hỏi thường gặp
Tôi có cần tự viết SQL không?
Không. Agent của bạn viết SQL qua lớp ngữ nghĩa, dùng các định nghĩa của dự án.
Nó có học từ các câu hỏi trước không?
Có. Skill nhắc đến việc nhớ lại các truy vấn trước và học từ những kết quả đã được xác nhận.
Nếu môi trường thiếu công cụ thì sao?
Skill kiểm tra dòng lệnh Wren trước và đề nghị cài đặt nếu nó chưa có sẵn.
Chi tiết
Mô tả gốc của tác giả
Wren Engine CLI workflow guide for AI agents. Answer data questions end-to-end using the wren CLI: gather schema context, recall past queries, write SQL through the MDL semantic layer, execute, and learn from confirmed results. Use when: user asks a data question, requests a report or analysis, asks about metrics, revenue, customers, orders, trends, or any business data; user says 'how many', 'show me', 'what is the', 'top N', 'compare', 'trend', 'growth', 'breakdown'; user wants to explore, analyze, filter, aggregate, or summarize data from a database; agent needs to query data, connect a dat
repo: Canner/WrenAI
Độ phổ biến
- Sao GitHub
- 18k
- Vị trí xếp hạng
- #10729
- Giấy phép
- —
- Cập nhật
- 2/11/2026
Bình luận
- …
Thêm skill từ kho mã này
dlt-connector
18kGiúp agent của bạn tải dữ liệu từ các công cụ SaaS như HubSpot hoặc Stripe vào một file DuckDB cục bộ, sẵn sàng cho phân tích SQL với Wren.
enrich-context
18kGiúp agent của bạn bổ sung ý nghĩa kinh doanh cho một dự án dữ liệu Wren, như đơn vị đo, giá trị liệt kê, từ đồng nghĩa và các chỉ số chuẩn.
genbi
18kGiúp agent của bạn biến dự án Wren thành bảng điều khiển trên trình duyệt có thể chia sẻ và triển khai lên tài khoản hosting của bạn.
generate-mdl
18kGiúp agent của bạn tạo dự án ngữ nghĩa Wren bằng cách khám phá lược đồ cơ sở dữ liệu, chuẩn hóa kiểu dữ liệu và sinh các file YAML.
Skill tương tự
gitcrawl
394kCho phép agent của bạn tìm trong kho lưu trữ issue và pull request GitHub, gom các mục trùng lặp và kiểm tra trạng thái hiện tại trên GitHub.
slacrawl
394kCho phép agent của bạn tìm và đếm tin nhắn trong kho lưu trữ Slack cục bộ, kiểm tra kho đó mới đến mức nào và làm mới khi cần.
goplaces
394kGiúp agent của bạn tìm địa điểm, lấy chi tiết và đánh giá, và xác định tên địa điểm bằng Google Places, với đầu ra JSON cho script.