К основному содержанию
скилл Claude Code CX Codex Cursor GitHub Copilot

querying-data-lake — скилл для Claude Code: что делает

Скилл запускает SQL в Amazon Athena: выбирает рабочую группу, останавливает разрушительные запросы на подтверждение и показывает цену прогона.

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add aws/agent-toolkit-for-aws --skill querying-data-lake -a claude-code
Открыть на GitHub

Что делает querying-data-lake

Скилл даёт агенту пульт к Amazon Athena. Он принимает SQL-текст, имя сохранённого запроса, рабочую группу, каталог или profile TABLE_NAME, подбирает рабочую группу (без неё агент не отправляет запрос, иначе промахнётся с S3-локейшном результатов), сверяет доступ через aws sts get-caller-identity и уходит в AWS MCP-сервер (aws___call_aws), а без него — в aws athena из CLI.

Перед запуском каждый оператор проходит разбор по типу. SELECT, SHOW, DESCRIBE и EXPLAIN идут сразу. INSERT, UPDATE, DELETE, DROP, ALTER, CREATE, TRUNCATE и MERGE ждут явного подтверждения, а неопознанный оператор считается разрушительным. В ответе видно, сколько данных просканировано и сколько стоил прогон, — цена запроса перестаёт всплывать сюрпризом в счёте за месяц.

Шершавости начинаются на федеративных каталогах. Для Redshift скилл предупреждает, что партиции не режутся и запрос читает таблицу целиком, поэтому черновой прогон разумно начинать с LIMIT. JOIN между каталогами идёт по сети и тормозит. Ещё агент спросит регион AWS и подтвердит S3-локейшн до нетривиального запроса.

Какие задачи решает

  • прогнать SQL по таблице в Glue-каталоге и увидеть, сколько данных он просканировал
  • поймать DROP или DELETE до выполнения и подтвердить его вручную
  • профилировать незнакомую таблицу перед аналитическим запросом
  • посмотреть статус рабочей группы и её последние запросы
  • соединить таблицы из двух каталогов, зная про сетевые издержки

Примеры запросов агенту

  • Выполни `SELECT * FROM sales.orders LIMIT 5` в рабочей группе `analytics`
  • `profile sales.orders` — покажи схему и пару строк для сверки
  • Покажи статус рабочей группы `primary` и последние запросы в ней

Как установить querying-data-lake

1Через Skills CLI (Vercel)

npx skills add aws/agent-toolkit-for-aws --skill querying-data-lake -a claude-code

2Вручную: положить файлы

~/.claude/skills/querying-data-lake/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/querying-data-lake/

Из того же набора8

Весь набор →
aws-iam aws Проверенные поправки к типичным ошибкам агентов в AWS IAM плюс рабочие процессы для ролей и baseline-политик. Claude Code CX Codex Cursor +1 10 200установок aws-serverless aws Скилл-маршрутизатор для serverless на AWS: выбирает форму вычислений под каждый компонент приложения и передаёт работу профильным скиллам. Claude Code CX Codex Cursor +1 10 100установок aws-cdk aws Скилл для Claude Code, который учит агента писать и деплоить инфраструктуру AWS на CDK на TypeScript и Python — от конструкций до импорта ресурсов и разбора ошибок CloudFormation. Claude Code CX Codex Cursor +1 9 400установок aws-containers aws Разворачивает контейнеры на AWS: EKS, ECS, Fargate, ECR и Elastic Beanstalk. Пригодится при деплое, отладке и оптимизации контейнерных сервисов. Claude Code CX Codex Cursor +1 9 300установок aws-billing-and-cost-management aws Анализирует расходы в AWS, ищет резервы экономии и настраивает бюджеты. Помогает проверить аномалии цен, оценить Savings Plans и снизить затраты на инфраструктуру. Claude Code CX Codex Cursor +1 8 900установок aws-cloudformation aws Ведёт шаблоны CloudFormation от написания до разбора упавших стеков: валидация, проверки cfn-guard и поиск причины сбоя по событиям и CloudTrail. Claude Code CX Codex Cursor +1 8 800установок connecting-to-data-source aws Создаёт подключение AWS Glue к внешней базе — Oracle, PostgreSQL, Redshift, Snowflake или BigQuery — и проверяет его тестом перед передачей в работу. Claude Code CX Codex Cursor +1 6 800установок

Похожие

aws-solution-architect Alireza Rezvani Проектирует архитектуру AWS, генерирует шаблоны IaC и разбирает расходы. Пригодится при запуске серверлес-приложения, миграции или настройке CI/CD. Claude Code 1 586установок azure-cloud-architect Alireza Rezvani Проектирует архитектуру Azure, создаёт шаблоны Bicep и проверяет расходы. Нужен при миграции, настройке CI/CD или выборе сервисов Azure. Claude Code 607установок vercel-sandbox официальный Vercel Labs Скилл запускает пользовательский и сгенерированный код в изолированной Vercel Sandbox. Он пригодится для браузерной автоматизации и проверки кода без запуска в основном окружении. CX Codex GP ChatGPT 27установок workers-best-practices cloudflare Скилл настраивает ИИ на проверку продакшен-кода Cloudflare Workers по актуальным правилам рантайма, типам Wrangler и антипаттернам. Claude Code CX Codex Cursor +1 124 900установок cloudflare-email-service cloudflare Скилл для работы с Cloudflare Email Sending и Email Routing: помогает настроить отправку и приём писем в Workers. Claude Code CX Codex Cursor +1 101 400установок firebase-basics официальный google Скилл настраивает Firebase CLI, помогает войти в аккаунт, создать или выбрать проект и скачать конфигурацию Android или iOS. Claude Code Gemini CLI CX Codex 14 100установок cloudflare-one cloudflare Помогает агенту проектировать, настраивать и разбирать развёртывания Cloudflare One Zero Trust и SASE. Пригодится, когда нужно спланировать Access, Gateway или туннели без похода в документацию вручную. Claude Code CX Codex Cursor +1 92 200установок cloudflare-one-migrations cloudflare Помогает спланировать переход с VPN, SWG или SASE на Cloudflare One: сопоставляет политики, находит пробелы и расписывает порядок выката. Claude Code CX Codex Cursor +1 88 700установок

Вопросы о querying-data-lake

Как установить querying-data-lake в Claude Code?

Одной командой: npx skills add aws/agent-toolkit-for-aws --skill querying-data-lake -a claude-code. После неё файл скилла лежит в ~/.claude/skills/querying-data-lake/SKILL.md.

Что делает querying-data-lake?

Гоняет и сопровождает SQL-запросы в Amazon Athena. Выбирает рабочую группу, различает безопасные и разрушительные операторы, возвращает результат вместе с объёмом просканированных данных и стоимостью.

Что нужно, чтобы скилл заработал?

Действующие учётные данные AWS и хотя бы один путь запуска: AWS MCP-сервер с aws___call_aws или AWS CLI. Регион и S3-локейшн для результатов агент уточнит до запроса.

Исходный текст

SKILL.md · Apache-2.0
---
name: querying-data-lake
description: >-
  Execute and manage Athena SQL queries across default and federated catalogs (Glue,
  S3 Tables, Redshift). Triggers on phrases like: query data, run SQL, athena query,
  analyze table, SQL query, workgroup status, profile table, query Redshift catalog,
  query S3 Tables. Do NOT use for finding specific data assets (use finding-data-lake-assets),
  full catalog audits (use exploring-data-catalog), importing data (use ingesting-into-data-lake).
metadata:
  version: "1"
  argument-hint: "'[SQL-query|query-name|workgroup-name|catalog-name|''profile TABLE_NAME'']'"
---

# Query Data Lake

Execute SQL queries on Amazon Athena across default and federated catalogs (Glue, S3 Tables, Redshift) with workgroup selection, statement classification, and error recovery.

## Overview

Executes and manages Athena SQL queries across default and federated catalogs. Selects a workgroup, resolves target assets (delegating fuzzy references to `finding-data-lake-assets`), classifies statements for safety, and reports cost and data scanned. Use the AWS MCP server for sandboxed execution and audit logging; the same AWS CLI commands work directly when the MCP server is not available.

**Constraints for parameter acquisition:**

- You MUST accept a single optional argument: SQL text, a named-query name, a workgroup name, a catalog name, or `profile TABLE_NAME`
- You MUST accept the argument as direct text or a pointer to a file containing SQL
- You MUST ask the user for the target AWS region if not already set
- You MUST confirm the output S3 location before executing any non-trivial query
- You MUST respect the user's decision to abort at any step

## Common Tasks

### 1. Verify Dependencies

Check for required tools and AWS access before running queries.

**Constraints:**

- You MUST verify AWS MCP server tools are available (`aws___call_aws`) and run queries through them when present; fall back to AWS CLI only if the MCP server is unavailable
- You MUST NOT fall back to shell or Bash for query execution — results must be captured via the MCP tool or `aws athena` CLI so output location and cost are tracked
- You MUST confirm credentials with `aws sts get-caller-identity` and inform the user about any missing tools

### 2. Resolve Workgroup

Check caller identity, list workgroups, auto-select the best one (see [workgroup-selection.md](references/workgroup-selection.md)).

**Constraints:**

- You MUST select a workgroup before submitting any query (prevents output-location errors)
- You MUST present the selected workgroup and its output location to the user
- You MUST NOT auto-escalate to a different workgroup on failure without user confirmation

### 3. Resolve the Target Asset

If the user refers to a table by name, by business concept ("our quarterly report", "the sales data"), by S3 path, or by catalog without specifying the table, delegate to `finding-data-lake-assets` to return the concrete `database.table` (and catalog if non-default).

**Constraints:**

- You MUST NOT attempt to resolve fuzzy asset references with `athena list-data-catalogs` or by iterating `get-tables` — those miss federated catalogs and waste tokens
- You SHOULD skip this step only when the user provides a fully-qualified reference (exact `database.table`) or raw SQL they want executed as-is
- You MUST state the resolved asset explicitly before building the query: "Found [table] in [catalog]. Using this for the query."
- You SHOULD default to the default Glue catalog unless the user mentions "federated", "Redshift", "S3 Tables", or `finding-data-lake-assets` returns a different catalog

### 4. Discover Schema

For analytical queries, You SHOULD profile the target table before building the final query. You MUST show sample rows (`SELECT ... LIMIT 5`) as part of profiling.

### 5. Build Query

Table addressing depends on catalog type:

- Default Glue catalog: `database.table` (omit the catalog prefix for single-catalog queries). In cross-catalog queries, qualify default-catalog tables with `"awsdatacatalog".database.table`.
- Registered data source: `datasource.database.table`
- Unregistered Glue catalog: `"catalog/subcatalog".database.table`

### 6. Classify and Execute

Classify the SQL statement before executing:

| Statement | Behavior |
|---|---|
| `SELECT`, `SHOW`, `DESCRIBE`, `EXPLAIN` | Safe — execute |
| `INSERT`, `UPDATE`, `DELETE`, `DROP`, `ALTER`, `CREATE`, `TRUNCATE`, `MERGE` | Destructive — warn the user and require explicit confirmation |
| Unsure | Treat as destructive; confirm |

Example tool call (via AWS MCP server):

```
aws___call_aws(command="aws athena start-query-execution --work-group <WORKGROUP_NAME> --query-string '<sql>' --query-execution-context Database=<db>")
```

For federated or S3 Tables catalogs, also set `Catalog=<CATALOG_PATH>` in the execution context (e.g. `Catalog=s3tablescatalog/<BUCKET_NAME>`).

**Constraints:**

- You MUST warn the user before executing when the target is Redshift-federated ("No partition pruning — every query scans the full table")
- You MUST warn the user before executing a cross-catalog join ("Cross-catalog joins incur network overhead and may be slow")
- You MUST confirm the output S3 location before executing
- You MUST explain which tool is being called before executing
- You MUST respect the user's decision to abort

### 7. Present and Recover

Present results with cost, data scanned, duration, and actionable insights. On failure, list available workgroups and let the user choose which to retry with.

### Argument Routing

Resolve in this order; stop at the first match:

1. Contains SQL keywords (`SELECT`, `SHOW`, `DESCRIBE`, `INSERT`, etc.) — SQL text, execute directly
2. `profile TABLE_NAME` — run comprehensive table profiling (see [query-patterns.md](references/query-patterns.md))
3. Matches a known named query — look up and execute
4. Matches a known workgroup — show workgroup status and recent queries
5. Matches a known catalog — delegate to `exploring-data-catalog` to enumerate databases and tables
6. No args — show recent query activity and available tables

### Principles

- Always select workgroup before executing (prevents output-location errors)
- Profile unfamiliar tables before running analytical queries
- Present cost alongside results so users build cost awareness
- Suggest `LIMIT` for exploratory queries on large tables
- Never ask domain questions with obvious answers, but always confirm security-relevant actions (workgroup switches, output location changes, non-SELECT statements)

## Troubleshooting

| Error | Cause | Fix |
|---|---|---|
| Redshift identifier error with mixed case | Redshift-federated names are lowercase only | Lowercase the identifier |
| `CatalogId` validation failure | ARN passed instead of catalog name | Pass the catalog name, not the ARN |
| Cross-catalog `information_schema` returns nothing | Missing catalog qualifier | Use catalog-qualified path: `"catalog".information_schema.tables` |
| Query fails with output-location error | Workgroup has no output location configured | Select a different workgroup with an output location, or configure one |
| Destructive statement executed without confirmation | Statement classification skipped | Always classify `INSERT`/`UPDATE`/`DELETE`/`DROP`/`ALTER`/`CREATE`/`TRUNCATE`/`MERGE` and confirm with the user |

## Additional Resources

- [Workgroup selection logic](references/workgroup-selection.md)
- [Common query patterns](references/query-patterns.md)
- [Athena best practices](https://docs.aws.amazon.com/athena/latest/ug/performance-tuning.html)
- [Athena federated query](https://docs.aws.amazon.com/athena/latest/ug/connect-to-a-data-source.html)

© aws · Apache-2.0 · aws/agent-toolkit-for-aws

Смотрите также

Спонсоры проекта

Компании, которые помогают держать аналитику открытой