agentleFS
zademyzademy/lu-query/skills/lu-query-query-data/SKILL.md

lu-query-query-data

Skill2 starsChanged 29 days agoMITView on GitHub

Use lu-query to answer a data question from Oracle with a read-only SELECT - run_query for arbitrary SELECTs with offset/limit pagination, get_sample_data for a quick row preview. Covers capped reads (1000 rows), when a specialized tool is better than SQL, how to read the row envelope, and how CLOB, BLOB, JSON and XML columns come back.

The file

We split this skill into the rules it gives an agent

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

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

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

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

    Page deterministically: Always add an ORDER BY when you page, and pass offset/limit.

    line 24

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

Query data with lu-query

When to use

  • "How many rows match X?", "show me the last 20 orders", "what does this table look like?"
  • Any read-only question whose answer is a SELECT.

When not to use

  • You do not know which table holds the data → lu-query-explore-schema.
  • You want duplicates/orphans/exact counts → lu-query-audit-data-quality (dedicated tools beat handcrafted SQL).
  • You want to change rows → lu-query-plan-data-changes.

Workflow

  1. Prefer the specialized tool. count_rows, get_table_stats, find_duplicates, get_session_sql_text exist because handcrafted SQL on those questions is slower or wrong. Use run_query when nothing fits.
  2. Write one SELECT. CTEs are fine. No DML: run_query rejects anything that is not a SELECT before Oracle sees it, so a mistake costs nothing.
  3. Page deterministically. Always add an ORDER BY when you page, and pass offset/limit; without them the 1000-row cap of every read tool hides the rest. Server-side SQL becomes OFFSET n ROWS FETCH NEXT m ROWS ONLY.
  4. Read the envelope. run_query returns {columns, rows, rowCount, truncated, rowLimit, offset, limit}. If truncated is true, you did not see everything - page or narrow the query (when rowCount == rowLimit, the result may be exactly at the cap).
  5. Preview unknown data cheaply. get_sample_data returns the first N rows (default 10, max 1000) and reports progress on long reads.

Reading results correctly

  • Values are JSON: DATE/TIMESTAMP columns serialise as ISO strings in UTC (2024-01-15T06:00:00.000Z), NUMBER as JSON numbers, NULL as null.
  • Column names come back UPPERCASE from Oracle; address them as returned, not as you typed them.
  • Non-scalar columns are materialised, not left as handles: a CLOB/NCLOB comes back as the full text (no 4000-character truncation), a BLOB as {"type":"Buffer","data":[65,66]}, a JSON column as the parsed object, and an XMLTYPE column as the XML text.
  • Empty result and error look different: a successful call has rowCount: 0; a failed call returns isError text.

Safety

Read-only. But note:

  • A SELECT can still lock (rarely, with FOR UPDATE) and can be expensive: statement timeout is 120 s, socket 30 s, request watchdog 150 s. Prefer predicates that use indexes.
  • Aggregates over huge tables (COUNT(*) without filter) are the classic timeout; use count_rows.

Tool reference

ToolSignatureReturns
run_querysql*, offset?, limit?{columns, rows, rowCount, truncated, rowLimit, offset, limit}
get_sample_datatable*, rows?, schema?same envelope, first N rows

Details: references/tools.md. Verified transcripts: references/examples.md.

Failure recovery

SymptomCauseAction
run_query needs a SELECTstatement is not a SELECTuse execute_dml* for writes (different skill)
ORA-00942missing grants / typocheck with search_objects, ask for the grant; do not retry blindly
a list_* tool returns fewer rows than the table hasthe 1000-row cap, and array results carry no truncated flagnarrow with the tool filters, or count with count_rows
truncated: true and short of expected rows1000-row capadd ORDER BY + offset/limit, or narrow the predicate
ORA-01013 / ORA-03113 / ORA-03114statement cancelled by timeout or clientnarrow the query; do not treat as data loss

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.