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.
In this repository45 other files it gives its agents.
- AGENTS.mdAGENTS.md
- api-and-interface-designSkill
- browser-testing-with-devtoolsSkill
- ci-cd-and-automationSkill
- code-review-and-qualitySkill
- code-reviewSkill
- code-simplificationSkill
- constraint-driven-developmentSkill
- debugging-and-error-recoverySkill
- deprecation-and-migrationSkill
- documentation-and-adrsSkill
- domain-modelingSkill
- doubt-driven-developmentSkill
- frontend-ui-engineeringSkill
- git-workflow-and-versioningSkill
- grill-meSkill
- grill-with-docsSkill
- implementSkill
- implement-specSkill
- improve-codebase-architectureSkill
- incremental-implementationSkill
- observability-and-instrumentationSkill
- performance-optimizationSkill
- planning-and-task-breakdownSkill
- prSkill
- security-and-hardeningSkill
- setup-matt-pocock-skillsSkill
- shipping-and-launchSkill
- source-driven-developmentSkill
- spec-driven-developmentSkill
- test-driven-developmentSkill
- to-specSkill
- to-ticketsSkill
- using-agent-skillsSkill
- wayfinderSkill
- writing-for-agentsSkill
- lu-query-audit-data-qualitySkill
- lu-query-audit-reportSkill
- lu-query-benchmark-sqlSkill
- lu-query-explore-schemaSkill
- lu-query-manage-schemaSkill
- lu-query-plan-data-changesSkill
- lu-query-triage-incidentSkill
- lu-query-tune-sqlSkill
- lu-query-use-plsqlSkill
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
- Very specific: line 24
Page deterministically: Always add an ORDER BY when you page, and pass offset/limit.
≈ “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.
Files
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
- Prefer the specialized tool.
count_rows,get_table_stats,find_duplicates,get_session_sql_textexist because handcrafted SQL on those questions is slower or wrong. Userun_querywhen nothing fits. - Write one SELECT. CTEs are fine. No DML:
run_queryrejects anything that is not aSELECTbefore Oracle sees it, so a mistake costs nothing. - Page deterministically. Always add an
ORDER BYwhen you page, and passoffset/limit; without them the 1000-row cap of every read tool hides the rest. Server-side SQL becomesOFFSET n ROWS FETCH NEXT m ROWS ONLY. - Read the envelope.
run_queryreturns{columns, rows, rowCount, truncated, rowLimit, offset, limit}. Iftruncatedistrue, you did not see everything - page or narrow the query (whenrowCount == rowLimit, the result may be exactly at the cap). - Preview unknown data cheaply.
get_sample_datareturns the first N rows (default 10, max 1000) and reports progress on long reads.
Reading results correctly
- Values are JSON:
DATE/TIMESTAMPcolumns serialise as ISO strings in UTC (2024-01-15T06:00:00.000Z),NUMBERas JSON numbers,NULLasnull. - 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/NCLOBcomes back as the full text (no 4000-character truncation), aBLOBas{"type":"Buffer","data":[65,66]}, aJSONcolumn as the parsed object, and anXMLTYPEcolumn as the XML text. - Empty result and error look different: a successful call has
rowCount: 0; a failed call returnsisErrortext.
Safety
Read-only. But note:
- A
SELECTcan still lock (rarely, withFOR 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; usecount_rows.
Tool reference
| Tool | Signature | Returns |
run_query | sql*, offset?, limit? | {columns, rows, rowCount, truncated, rowLimit, offset, limit} |
get_sample_data | table*, rows?, schema? | same envelope, first N rows |
Details: references/tools.md. Verified transcripts: references/examples.md.
Failure recovery
| Symptom | Cause | Action |
run_query needs a SELECT | statement is not a SELECT | use execute_dml* for writes (different skill) |
ORA-00942 | missing grants / typo | check with search_objects, ask for the grant; do not retry blindly |
a list_* tool returns fewer rows than the table has | the 1000-row cap, and array results carry no truncated flag | narrow with the tool filters, or count with count_rows |
truncated: true and short of expected rows | 1000-row cap | add ORDER BY + offset/limit, or narrow the predicate |
ORA-01013 / ORA-03113 / ORA-03114 | statement cancelled by timeout or client | narrow the query; do not treat as data loss |
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
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.

