# Send SQL to your agent
Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.
## Fast path
- Download the package from Yavira.
- Extract it into a folder your agent can access.
- Paste one of the prompts below and point your agent at the extracted folder.
## Suggested prompts
### New install

```text
I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete.
```
### Upgrade existing

```text
I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run.
```
## Machine-readable fields
```json
{
  "schemaVersion": "1.0",
  "item": {
    "slug": "sql",
    "name": "SQL",
    "source": "tencent",
    "type": "skill",
    "category": "数据分析",
    "sourceUrl": "https://clawhub.ai/ivangdavila/sql",
    "canonicalUrl": "https://clawhub.ai/ivangdavila/sql",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadUrl": "/downloads/sql",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=sql",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "packageFormat": "ZIP package",
    "primaryDoc": "SKILL.md",
    "includedAssets": [
      "SKILL.md",
      "operations.md",
      "patterns.md",
      "schemas.md"
    ],
    "downloadMode": "redirect",
    "sourceHealth": {
      "source": "tencent",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-04-23T16:43:11.935Z",
      "expiresAt": "2026-04-30T16:43:11.935Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=4claw-imageboard",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=4claw-imageboard",
        "contentDisposition": "attachment; filename=\"4claw-imageboard-1.0.1.zip\"",
        "redirectLocation": null,
        "bodySnippet": null
      },
      "scope": "source",
      "summary": "Source download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this source.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/sql"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    }
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/sql",
    "downloadUrl": "https://openagent3.xyz/downloads/sql",
    "agentUrl": "https://openagent3.xyz/skills/sql/agent",
    "manifestUrl": "https://openagent3.xyz/skills/sql/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/sql/agent.md"
  }
}
```
## Documentation

### SQL

Master relational databases from the command line. Covers SQLite, PostgreSQL, MySQL, and SQL Server with battle-tested patterns for schema design, querying, migrations, and operations.

### When to Use

Working with relational databases—designing schemas, writing queries, building migrations, optimizing performance, or managing backups. Applies to SQLite, PostgreSQL, MySQL, and SQL Server.

### Quick Reference

TopicFileQuery patternspatterns.mdSchema designschemas.mdOperationsoperations.md

### 1. Choose the Right Database

Use CaseDatabaseWhyLocal/embeddedSQLiteZero setup, single fileGeneral productionPostgreSQLBest standards, JSONB, extensionsLegacy/hostingMySQLWide hosting supportEnterprise/.NETSQL ServerWindows integration

### 2. Always Parameterize Queries

# ❌ NEVER
cursor.execute(f"SELECT * FROM users WHERE id = {user_id}")

# ✅ ALWAYS
cursor.execute("SELECT * FROM users WHERE id = ?", (user_id,))

### 3. Index Your Filters

Any column in WHERE, JOIN ON, or ORDER BY on large tables needs an index.

### 4. Use Transactions

BEGIN;
UPDATE accounts SET balance = balance - 100 WHERE id = 1;
UPDATE accounts SET balance = balance + 100 WHERE id = 2;
COMMIT;

### 5. Prefer EXISTS Over IN

-- ✅ Faster (stops at first match)
SELECT * FROM orders o WHERE EXISTS (
  SELECT 1 FROM users u WHERE u.id = o.user_id AND u.active
);

### SQLite

sqlite3 mydb.sqlite                              # Create/open
sqlite3 mydb.sqlite "SELECT * FROM users;"       # Query
sqlite3 -header -csv mydb.sqlite "SELECT *..." > out.csv
sqlite3 mydb.sqlite "PRAGMA journal_mode=WAL;"   # Better concurrency

### PostgreSQL

psql -h localhost -U myuser -d mydb              # Connect
psql -c "SELECT NOW();" mydb                     # Query
psql -f migration.sql mydb                       # Run file
\\dt  \\d+ users  \\di+                             # List tables/indexes

### MySQL

mysql -h localhost -u root -p mydb               # Connect
mysql -e "SELECT NOW();" mydb                    # Query

### SQL Server

sqlcmd -S localhost -U myuser -d mydb            # Connect
sqlcmd -Q "SELECT GETDATE()"                     # Query
sqlcmd -S localhost -d mydb -E                   # Windows auth

### NULL Traps

NOT IN (subquery) returns empty if subquery has NULL → use NOT EXISTS
NULL = NULL is NULL, not true → use IS NULL
COUNT(column) excludes NULLs, COUNT(*) counts all

### Index Killers

Functions on columns → WHERE YEAR(date) = 2024 scans full table
Type conversion → WHERE varchar_col = 123 skips index
LIKE '%term' can't use index → only LIKE 'term%' works
Composite (a, b) won't help filtering only on b

### Join Traps

LEFT JOIN with WHERE on right table becomes INNER JOIN
Missing JOIN condition = Cartesian product
Multiple LEFT JOINs can multiply rows

### EXPLAIN

-- PostgreSQL
EXPLAIN (ANALYZE, BUFFERS) SELECT * FROM orders WHERE user_id = 5;

-- SQLite
EXPLAIN QUERY PLAN SELECT * FROM orders WHERE user_id = 5;

Red flags:

Seq Scan on large tables → needs index
Rows Removed by Filter high → index doesn't cover filter
Actual vs estimated rows differ → run ANALYZE tablename;

### Index Strategy

-- Composite index (equality first, range last)
CREATE INDEX idx_orders ON orders(user_id, status);

-- Covering index (avoids table lookup)
CREATE INDEX idx_orders ON orders(user_id) INCLUDE (total);

-- Partial index (smaller, faster)
CREATE INDEX idx_pending ON orders(user_id) WHERE status = 'pending';

### Portability

FeaturePostgreSQLMySQLSQLiteSQL ServerLIMITLIMIT nLIMIT nLIMIT nTOP nUPSERTON CONFLICTON DUPLICATE KEYON CONFLICTMERGEBooleantrue/false1/01/01/0Concat||CONCAT()||+

### Related Skills

Install with clawhub install <slug> if user confirms:

prisma — Node.js ORM
sqlite — SQLite-specific patterns
analytics — data analysis queries

### Feedback

If useful: clawhub star sql
Stay updated: clawhub sync
## Trust
- Source: tencent
- Verification: Indexed source record
- Publisher: ivangdavila
- Version: 1.0.1
## Source health
- Status: healthy
- Source download looks usable.
- Yavira can redirect you to the upstream package for this source.
- Health scope: source
- Reason: direct_download_ok
- Checked at: 2026-04-23T16:43:11.935Z
- Expires at: 2026-04-30T16:43:11.935Z
- Recommended action: Download for OpenClaw
## Links
- [Detail page](https://openagent3.xyz/skills/sql)
- [Send to Agent page](https://openagent3.xyz/skills/sql/agent)
- [JSON manifest](https://openagent3.xyz/skills/sql/agent.json)
- [Markdown brief](https://openagent3.xyz/skills/sql/agent.md)
- [Download page](https://openagent3.xyz/downloads/sql)