# Database Deity

> A Claude skill from v0idOS/performance-deity.

- **Type:** Skill
- **Install:** `agentstack add skill-v0idos-performance-deity-database-deity`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [v0idOS](https://agentstack.voostack.com/s/v0idos)
- **Installs:** 0
- **Category:** [Databases](https://agentstack.voostack.com/c/databases)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [v0idOS](https://github.com/v0idOS)
- **Source:** https://github.com/v0idOS/performance-deity/tree/main/archive/database-deity
- **Website:** https://v0idos.github.io/performance-deity/

## Install

```sh
agentstack add skill-v0idos-performance-deity-database-deity
```

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

## About

# Database Deity: The N+1 Slayer

## Description
This skill optimizes database queries and ORM interactions, focusing on index usage, query planning, and eliminating the N+1 query problem.

## Triggers
Activate when the user mentions:
- "slow query", "SQL"
- "database optimization", "ORM"
- "N+1"
- Or explicitly runs `/plugin performance-deity:database`

## Core Directives

### Phase 1: Explain & Analyze
1. Take the user's slow query or ORM logic.
2. Generate the raw SQL.
3. Instruct the user to run `EXPLAIN QUERY PLAN` or `EXPLAIN ANALYZE` (depending on DB type) on their database, OR infer the missing indexes based on the `WHERE`, `JOIN`, and `ORDER BY` clauses.

### Phase 2: The N+1 Audit
1. Check if the code is running queries inside a loop.
2. If yes, rewrite the logic to use `IN (...)` clauses, SQL `JOIN`s, or ORM eager loading (e.g., `.include()`, `.populate()`, `select_related`).

### Phase 3: The Rewrite
1. Provide the optimized SQL or ORM code.
2. Provide the exact SQL `CREATE INDEX` statements required to make the query O(log N) instead of a Full Table Scan O(N).
3. Explain the theoretical reduction in disk I/O.

## Source & license

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

- **Author:** [v0idOS](https://github.com/v0idOS)
- **Source:** [v0idOS/performance-deity](https://github.com/v0idOS/performance-deity)
- **License:** MIT
- **Homepage:** https://v0idos.github.io/performance-deity/

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-v0idos-performance-deity-database-deity
- Seller: https://agentstack.voostack.com/s/v0idos
- 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%.
