# Data Sql Engineering

> Review and generate SQL and data operations with strong attention to correctness, cardinality, performance, and operational safety.

- **Type:** Skill
- **Install:** `agentstack add skill-caiaffa-claude-code-ultimate-engineering-system-data-sql-engineering`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [caiaffa](https://agentstack.voostack.com/s/caiaffa)
- **Installs:** 0
- **Category:** [Databases](https://agentstack.voostack.com/c/databases)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [caiaffa](https://github.com/caiaffa)
- **Source:** https://github.com/caiaffa/claude-code-ultimate-engineering-system/tree/main/skills/data-sql-engineering

## Install

```sh
agentstack add skill-caiaffa-claude-code-ultimate-engineering-system-data-sql-engineering
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Mission
Improve the quality of analytical and operational data work while preventing silent correctness errors and unsafe data operations.

# When to use
- Writing or reviewing SQL.
- Reviewing data pipelines.
- Creating reports or analyses.
- Validating joins and aggregations.
- Planning data migrations or backfills.

# Handoff
- **Receives from:** backend-platform-engineer (data layer) or principal-engineer (analytics need).
- **Hands off to:** postgres-performance-and-safety (if Postgres-specific), release-commander (if migration).

# Before answering
Identify: business question, source-of-truth tables, uniqueness/cardinality relationships, time semantics, acceptable query cost, data freshness expectations.

# Common SQL traps
| Trap | What goes wrong | Prevention |
|---|---|---|
| Join inflation | 1:N join silently doubles counts | Check cardinality before joining; use `COUNT(DISTINCT)` |
| Missing WHERE on UPDATE/DELETE | Affects all rows | Always include WHERE; test with SELECT first |
| Timezone mismatch | UTC vs local produces wrong date grouping | Explicit `AT TIME ZONE` everywhere |
| Offset pagination on live data | Skips or duplicates rows | Use cursor-based pagination |
| SUM on joined data | Sums inflated by join fanout | Aggregate before joining, or use subqueries |

# Validation discipline
Every query that produces a business number should have:
1. **Row count check** — does the count match expectations?
2. **Null check** — are there unexpected NULLs affecting aggregations?
3. **Duplicate check** — `COUNT(*)` vs `COUNT(DISTINCT pk)` — same number?
4. **Boundary check** — does the date range cover what you think?
5. **Sanity check** — does the result make business sense?

# Output format
1. **Objective** (what business question this answers)
2. **Query strategy** (approach, key joins, aggregation logic)
3. **Main SQL** (with comments on non-obvious logic)
4. **Validation queries** (at least 2)
5. **Performance notes** (indexes needed, expected cost)
6. **Safety notes** (if destructive operations involved)

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [caiaffa](https://github.com/caiaffa)
- **Source:** [caiaffa/claude-code-ultimate-engineering-system](https://github.com/caiaffa/claude-code-ultimate-engineering-system)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-caiaffa-claude-code-ultimate-engineering-system-data-sql-engineering
- Seller: https://agentstack.voostack.com/s/caiaffa
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
