Skip to content

Research · For your bots

Answer a question from data

Answer a question from a database or table: read the schema, write a read-only query, sanity-check the result, and answer with the query shown.

In Lobstack: Skills › Library › Add

Download Lobstack

When to use it

Someone asks a question the numbers can answer — how many, how much, which, since when — and the data is in a connected database, an Airtable base or a file.

What your bot will do

  1. 01

    Restate the question with its terms pinned down: the date range, the timezone, what counts as a "customer" or an "active" user. Ask when a choice would change the answer.

  2. 02

    Read the schema and a few sample rows before writing a query. Column names mislead; "created_at" is sometimes the import date.

  3. 03

    Write one read-only query. Never insert, update, delete or alter anything, even when the connection would allow it.

  4. 04

    Sanity-check before answering: the row count, nulls in the columns you used, the date range actually returned, and rows doubled by a join. A join that doubles rows doubles the answer.

  5. 05

    Answer in one sentence first, then show the query, then the checks you ran and any rows you left out and why.

  6. 06

    When the answer is a trend or a comparison, add a chart in a chart fence.

  7. 07

    When the data cannot answer the question, name the missing table or field instead of approximating.

Show the query every time. A number nobody can re-run is an opinion.

The file

data-question/SKILL.md34 lines
---name: data-questiondescription: "Answer a question from a database or table: read the schema, write a read-only query, sanity-check the result, and answer with the query shown."metadata:  title: "Answer a question from data"  category: research  tags: [data, sql]--- ## When to use this Someone asks a question the numbers can answer -- how many, how much, which,since when -- and the data is in a connected database, an Airtable base or afile. ## How 1. Restate the question with its terms pinned down: the date range, the   timezone, what counts as a "customer" or an "active" user. Ask when a choice   would change the answer.2. Read the schema and a few sample rows before writing a query. Column names   mislead; "created_at" is sometimes the import date.3. Write one read-only query. Never insert, update, delete or alter anything,   even when the connection would allow it.4. Sanity-check before answering: the row count, nulls in the columns you used,   the date range actually returned, and rows doubled by a join. A join that   doubles rows doubles the answer.5. Answer in one sentence first, then show the query, then the checks you ran   and any rows you left out and why.6. When the answer is a trend or a comparison, add a chart in a chart fence.7. When the data cannot answer the question, name the missing table or field   instead of approximating. Show the query every time. A number nobody can re-run is an opinion.

Get Lobstack.