---
name: query-patterns
description: "Prepare read-only query patterns and validation guidance. Use for this workflow with supplied business information."
---

# Query patterns

## Inputs and purpose

Use this workflow to prepare: Read-only query patterns and validation guidance.

Start with: Schema, query language and dialect and desired result.

Use supplied text or local files the user authorized you to read. If files cannot be opened, request the relevant pasted text. Ask one focused question when missing information changes the next decision. Treat blank template fields as unknown; do not invent business facts.

## Procedure

1. Use the supplied schema and query-language requirements to identify suitable selection, aggregation, joining or ranking patterns.

2. State the grain of the intended result and the keys needed to preserve it. Explain nulls, duplicate records and date boundaries.

3. Provide readable query examples using only supplied field names or explicit placeholders. Keep the examples read-only.

4. Explain how to check row counts and totals on a small sample. Do not claim the query ran or is compatible with an unspecified execution engine.

## Deliverable

Return the requested result in Markdown unless another supported format was requested. Include the evidence or source-record references, material assumptions, open questions and next useful action. Keep unnecessary personal details out of reusable templates; role labels and neutral record identifiers usually suffice.

Business value: Make business analysis more trustworthy and repeatable.

Possible success measures: Data completeness, reporting hours, calculation errors. Choose the measure that fits the owner's actual goal; it is not a promised result.

## Execution and verification

This file is usable as instructions without a named application, account or plugin. Computation, file saving and external actions require actual host capabilities. Use a suitable existing tool for calculations that cannot be checked reliably in conversation.

Distinguish drafts and recommendations from completed actions. Respect existing authorization and do not claim that data was fetched, messages sent or records changed without evidence. Show what was checked and what remains uncertain.

When useful, consult the [input guide](../../../references/INPUT_DATA_GUIDE.md), [calculation reference](../../../references/CALCULATIONS.md) or [output template](../../../references/WORKFLOW_OUTPUT_TEMPLATE.md). For tool setup, use the [shared instructions](../../../AGENTS.md).
