{
  "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": {
    "downloadMode": "redirect",
    "downloadUrl": "/downloads/sql",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=sql",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "installMethod": "Manual import",
    "extraction": "Extract archive",
    "prerequisites": [
      "OpenClaw"
    ],
    "packageFormat": "ZIP package",
    "includedAssets": [
      "SKILL.md",
      "operations.md",
      "patterns.md",
      "schemas.md"
    ],
    "primaryDoc": "SKILL.md",
    "quickSetup": [
      "Download the package from Yavira.",
      "Extract the archive and review SKILL.md first.",
      "Import or place the package into your OpenClaw setup."
    ],
    "agentAssist": {
      "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
      "steps": [
        "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."
      ],
      "prompts": [
        {
          "label": "New install",
          "body": "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."
        },
        {
          "label": "Upgrade existing",
          "body": "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."
        }
      ]
    },
    "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."
      ]
    },
    "downloadPageUrl": "https://openagent3.xyz/downloads/sql",
    "agentPageUrl": "https://openagent3.xyz/skills/sql/agent",
    "manifestUrl": "https://openagent3.xyz/skills/sql/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/sql/agent.md"
  },
  "agentAssist": {
    "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
    "steps": [
      "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."
    ],
    "prompts": [
      {
        "label": "New install",
        "body": "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."
      },
      {
        "label": "Upgrade existing",
        "body": "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."
      }
    ]
  },
  "documentation": {
    "source": "clawhub",
    "primaryDoc": "SKILL.md",
    "sections": [
      {
        "title": "SQL",
        "body": "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."
      },
      {
        "title": "When to Use",
        "body": "Working with relational databases—designing schemas, writing queries, building migrations, optimizing performance, or managing backups. Applies to SQLite, PostgreSQL, MySQL, and SQL Server."
      },
      {
        "title": "Quick Reference",
        "body": "TopicFileQuery patternspatterns.mdSchema designschemas.mdOperationsoperations.md"
      },
      {
        "title": "1. Choose the Right Database",
        "body": "Use CaseDatabaseWhyLocal/embeddedSQLiteZero setup, single fileGeneral productionPostgreSQLBest standards, JSONB, extensionsLegacy/hostingMySQLWide hosting supportEnterprise/.NETSQL ServerWindows integration"
      },
      {
        "title": "2. Always Parameterize Queries",
        "body": "# ❌ NEVER\ncursor.execute(f\"SELECT * FROM users WHERE id = {user_id}\")\n\n# ✅ ALWAYS\ncursor.execute(\"SELECT * FROM users WHERE id = ?\", (user_id,))"
      },
      {
        "title": "3. Index Your Filters",
        "body": "Any column in WHERE, JOIN ON, or ORDER BY on large tables needs an index."
      },
      {
        "title": "4. Use Transactions",
        "body": "BEGIN;\nUPDATE accounts SET balance = balance - 100 WHERE id = 1;\nUPDATE accounts SET balance = balance + 100 WHERE id = 2;\nCOMMIT;"
      },
      {
        "title": "5. Prefer EXISTS Over IN",
        "body": "-- ✅ Faster (stops at first match)\nSELECT * FROM orders o WHERE EXISTS (\n  SELECT 1 FROM users u WHERE u.id = o.user_id AND u.active\n);"
      },
      {
        "title": "SQLite",
        "body": "sqlite3 mydb.sqlite                              # Create/open\nsqlite3 mydb.sqlite \"SELECT * FROM users;\"       # Query\nsqlite3 -header -csv mydb.sqlite \"SELECT *...\" > out.csv\nsqlite3 mydb.sqlite \"PRAGMA journal_mode=WAL;\"   # Better concurrency"
      },
      {
        "title": "PostgreSQL",
        "body": "psql -h localhost -U myuser -d mydb              # Connect\npsql -c \"SELECT NOW();\" mydb                     # Query\npsql -f migration.sql mydb                       # Run file\n\\dt  \\d+ users  \\di+                             # List tables/indexes"
      },
      {
        "title": "MySQL",
        "body": "mysql -h localhost -u root -p mydb               # Connect\nmysql -e \"SELECT NOW();\" mydb                    # Query"
      },
      {
        "title": "SQL Server",
        "body": "sqlcmd -S localhost -U myuser -d mydb            # Connect\nsqlcmd -Q \"SELECT GETDATE()\"                     # Query\nsqlcmd -S localhost -d mydb -E                   # Windows auth"
      },
      {
        "title": "NULL Traps",
        "body": "NOT IN (subquery) returns empty if subquery has NULL → use NOT EXISTS\nNULL = NULL is NULL, not true → use IS NULL\nCOUNT(column) excludes NULLs, COUNT(*) counts all"
      },
      {
        "title": "Index Killers",
        "body": "Functions on columns → WHERE YEAR(date) = 2024 scans full table\nType conversion → WHERE varchar_col = 123 skips index\nLIKE '%term' can't use index → only LIKE 'term%' works\nComposite (a, b) won't help filtering only on b"
      },
      {
        "title": "Join Traps",
        "body": "LEFT JOIN with WHERE on right table becomes INNER JOIN\nMissing JOIN condition = Cartesian product\nMultiple LEFT JOINs can multiply rows"
      },
      {
        "title": "EXPLAIN",
        "body": "-- PostgreSQL\nEXPLAIN (ANALYZE, BUFFERS) SELECT * FROM orders WHERE user_id = 5;\n\n-- SQLite\nEXPLAIN QUERY PLAN SELECT * FROM orders WHERE user_id = 5;\n\nRed flags:\n\nSeq Scan on large tables → needs index\nRows Removed by Filter high → index doesn't cover filter\nActual vs estimated rows differ → run ANALYZE tablename;"
      },
      {
        "title": "Index Strategy",
        "body": "-- Composite index (equality first, range last)\nCREATE INDEX idx_orders ON orders(user_id, status);\n\n-- Covering index (avoids table lookup)\nCREATE INDEX idx_orders ON orders(user_id) INCLUDE (total);\n\n-- Partial index (smaller, faster)\nCREATE INDEX idx_pending ON orders(user_id) WHERE status = 'pending';"
      },
      {
        "title": "Portability",
        "body": "FeaturePostgreSQLMySQLSQLiteSQL ServerLIMITLIMIT nLIMIT nLIMIT nTOP nUPSERTON CONFLICTON DUPLICATE KEYON CONFLICTMERGEBooleantrue/false1/01/01/0Concat||CONCAT()||+"
      },
      {
        "title": "Related Skills",
        "body": "Install with clawhub install <slug> if user confirms:\n\nprisma — Node.js ORM\nsqlite — SQLite-specific patterns\nanalytics — data analysis queries"
      },
      {
        "title": "Feedback",
        "body": "If useful: clawhub star sql\nStay updated: clawhub sync"
      }
    ],
    "body": "SQL\n\nMaster relational databases from the command line. Covers SQLite, PostgreSQL, MySQL, and SQL Server with battle-tested patterns for schema design, querying, migrations, and operations.\n\nWhen to Use\n\nWorking with relational databases—designing schemas, writing queries, building migrations, optimizing performance, or managing backups. Applies to SQLite, PostgreSQL, MySQL, and SQL Server.\n\nQuick Reference\nTopic\tFile\nQuery patterns\tpatterns.md\nSchema design\tschemas.md\nOperations\toperations.md\nCore Rules\n1. Choose the Right Database\nUse Case\tDatabase\tWhy\nLocal/embedded\tSQLite\tZero setup, single file\nGeneral production\tPostgreSQL\tBest standards, JSONB, extensions\nLegacy/hosting\tMySQL\tWide hosting support\nEnterprise/.NET\tSQL Server\tWindows integration\n2. Always Parameterize Queries\n# ❌ NEVER\ncursor.execute(f\"SELECT * FROM users WHERE id = {user_id}\")\n\n# ✅ ALWAYS\ncursor.execute(\"SELECT * FROM users WHERE id = ?\", (user_id,))\n\n3. Index Your Filters\n\nAny column in WHERE, JOIN ON, or ORDER BY on large tables needs an index.\n\n4. Use Transactions\nBEGIN;\nUPDATE accounts SET balance = balance - 100 WHERE id = 1;\nUPDATE accounts SET balance = balance + 100 WHERE id = 2;\nCOMMIT;\n\n5. Prefer EXISTS Over IN\n-- ✅ Faster (stops at first match)\nSELECT * FROM orders o WHERE EXISTS (\n  SELECT 1 FROM users u WHERE u.id = o.user_id AND u.active\n);\n\nQuick Start\nSQLite\nsqlite3 mydb.sqlite                              # Create/open\nsqlite3 mydb.sqlite \"SELECT * FROM users;\"       # Query\nsqlite3 -header -csv mydb.sqlite \"SELECT *...\" > out.csv\nsqlite3 mydb.sqlite \"PRAGMA journal_mode=WAL;\"   # Better concurrency\n\nPostgreSQL\npsql -h localhost -U myuser -d mydb              # Connect\npsql -c \"SELECT NOW();\" mydb                     # Query\npsql -f migration.sql mydb                       # Run file\n\\dt  \\d+ users  \\di+                             # List tables/indexes\n\nMySQL\nmysql -h localhost -u root -p mydb               # Connect\nmysql -e \"SELECT NOW();\" mydb                    # Query\n\nSQL Server\nsqlcmd -S localhost -U myuser -d mydb            # Connect\nsqlcmd -Q \"SELECT GETDATE()\"                     # Query\nsqlcmd -S localhost -d mydb -E                   # Windows auth\n\nCommon Traps\nNULL Traps\nNOT IN (subquery) returns empty if subquery has NULL → use NOT EXISTS\nNULL = NULL is NULL, not true → use IS NULL\nCOUNT(column) excludes NULLs, COUNT(*) counts all\nIndex Killers\nFunctions on columns → WHERE YEAR(date) = 2024 scans full table\nType conversion → WHERE varchar_col = 123 skips index\nLIKE '%term' can't use index → only LIKE 'term%' works\nComposite (a, b) won't help filtering only on b\nJoin Traps\nLEFT JOIN with WHERE on right table becomes INNER JOIN\nMissing JOIN condition = Cartesian product\nMultiple LEFT JOINs can multiply rows\nEXPLAIN\n-- PostgreSQL\nEXPLAIN (ANALYZE, BUFFERS) SELECT * FROM orders WHERE user_id = 5;\n\n-- SQLite\nEXPLAIN QUERY PLAN SELECT * FROM orders WHERE user_id = 5;\n\n\nRed flags:\n\nSeq Scan on large tables → needs index\nRows Removed by Filter high → index doesn't cover filter\nActual vs estimated rows differ → run ANALYZE tablename;\nIndex Strategy\n-- Composite index (equality first, range last)\nCREATE INDEX idx_orders ON orders(user_id, status);\n\n-- Covering index (avoids table lookup)\nCREATE INDEX idx_orders ON orders(user_id) INCLUDE (total);\n\n-- Partial index (smaller, faster)\nCREATE INDEX idx_pending ON orders(user_id) WHERE status = 'pending';\n\nPortability\nFeature\tPostgreSQL\tMySQL\tSQLite\tSQL Server\nLIMIT\tLIMIT n\tLIMIT n\tLIMIT n\tTOP n\nUPSERT\tON CONFLICT\tON DUPLICATE KEY\tON CONFLICT\tMERGE\nBoolean\ttrue/false\t1/0\t1/0\t1/0\nConcat\t||\tCONCAT()\t||\t+\nRelated Skills\n\nInstall with clawhub install <slug> if user confirms:\n\nprisma — Node.js ORM\nsqlite — SQLite-specific patterns\nanalytics — data analysis queries\nFeedback\nIf useful: clawhub star sql\nStay updated: clawhub sync"
  },
  "trust": {
    "sourceLabel": "tencent",
    "provenanceUrl": "https://clawhub.ai/ivangdavila/sql",
    "publisherUrl": "https://clawhub.ai/ivangdavila/sql",
    "owner": "ivangdavila",
    "version": "1.0.1",
    "license": null,
    "verificationStatus": "Indexed source record"
  },
  "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"
  }
}