SQL Queries

Official Anthropic skill for correct, performant SQL across multiple database dialects.

SQL Queries is an official skill from Anthropic’s knowledge-work-plugins repository. Its direct primary source is https://github.com/anthropics/knowledge-work-plugins/tree/main/data/skills/sql-queries. According to the provider, the skill helps Claude write correct, readable, and performant SQL for major database and data-warehouse dialects. The source covers PostgreSQL, Snowflake, BigQuery, Databricks, and Redshift among others. The skill is a text-based knowledge and workflow instruction, not a database driver, hosting service, query proxy, or guarantee that an unreviewed query is functionally or economically safe.

Purpose and professional boundary

The skill is intended for writing new queries, optimizing slow SQL, translating between dialects, and building complex analytical queries with common table expressions, window functions, or aggregations. The source combines syntax knowledge with practical advice about data modeling, execution, and performance. Anyone designing a query must still inspect the actual schema, data types, permissions, null semantics, time zones, and expected results. A syntactically valid statement can produce incorrect business metrics, multiply rows unexpectedly, or create unplanned cost and load.

Dialects and time logic

For PostgreSQL, the primary source covers expressions such as CURRENT_DATE, CURRENT_TIMESTAMP, interval arithmetic, DATE_TRUNC, EXTRACT, TO_CHAR, ILIKE, regular expressions, string functions, JSON access, and array operations. Snowflake uses different date-arithmetic forms and supports VARIANT access plus LATERAL FLATTEN for semi-structured data. BigQuery uses functions including DATE_ADD, DATE_DIFF, TIMESTAMP_DIFF, LOWER, REGEXP_CONTAINS, UNNEST, and STRUCT fields. Databricks SQL and Redshift each have their own function and optimization models. The skill helps identify these differences, but it does not replace the version-specific documentation of the system being used.

Performance and responsible execution

The recommendations vary by platform. In PostgreSQL, EXPLAIN ANALYZE, suitable indexes, partial indexes, EXISTS, and connection pooling may matter. Snowflake relies more on clustering, partition pruning, an appropriate warehouse size, and RESULT_SCAN. According to the source, BigQuery benefits from filtering partition columns, clustering, APPROX_COUNT_DISTINCT, parameterized scripts, and checking cost with a dry run. Redshift considers distribution keys, sort keys, EXPLAIN, data movement, ANALYZE, and VACUUM. These are starting points rather than universal rules. Test first with a bounded, non-sensitive dataset, inspect the execution plan, and obtain human approval before running expensive or write-capable statements.

E-E-A-T, security, and limitations

This entry is grounded in the official Anthropic source path and Anthropic’s official Claude Code documentation for skills. Provider statements are explicitly identified as according to the provider. SQL can expose confidential data, lock tables, consume resources, or modify records. Avoid unparameterized user input, review permissions according to least privilege, and separate read access from write access. Do not run destructive changes, deletions, or migrations until the target, transaction, backup and recovery plan, and authorization are clear. Never store passwords, tokens, private keys, or real customer data in prompts or skill text. A local skill file does not automatically mean local model processing; a connected client may transmit inputs and results to its model provider. Official dialect documentation remains authoritative for current syntax and platform behavior.

Free
Provider
Anthropic
Last reviewed
09.09.2026

Repository and documentation

Categories

Compatible with

Claude Code