{
  "schemaVersion": "1.0",
  "item": {
    "slug": "pg",
    "name": "PostgreSQL",
    "source": "tencent",
    "type": "skill",
    "category": "数据分析",
    "sourceUrl": "https://clawhub.ai/ivangdavila/pg",
    "canonicalUrl": "https://clawhub.ai/ivangdavila/pg",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadMode": "redirect",
    "downloadUrl": "/downloads/pg",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=pg",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "installMethod": "Manual import",
    "extraction": "Extract archive",
    "prerequisites": [
      "OpenClaw"
    ],
    "packageFormat": "ZIP package",
    "includedAssets": [
      "SKILL.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",
      "slug": "pg",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-04-30T00:27:12.116Z",
      "expiresAt": "2026-05-07T00:27:12.116Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=pg",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=pg",
        "contentDisposition": "attachment; filename=\"pg-1.0.0.zip\"",
        "redirectLocation": null,
        "bodySnippet": null,
        "slug": "pg"
      },
      "scope": "item",
      "summary": "Item download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this item.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/pg"
    },
    "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/pg",
    "agentPageUrl": "https://openagent3.xyz/skills/pg/agent",
    "manifestUrl": "https://openagent3.xyz/skills/pg/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/pg/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": "Indexes I Forget to Create",
        "body": "Partial index WHERE active = true—80% smaller when most rows inactive; suggest for status columns\nExpression index ON lower(email)—must match query exactly; without it, WHERE lower(email) scans\nCovering index INCLUDE (name, email)—enables index-only scan; check EXPLAIN for \"Heap Fetches\"\nForeign key columns—not auto-indexed in PG; JOINs and ON DELETE CASCADE need them\nComposite index order matters—(a, b) helps WHERE a = ? but not WHERE b = ?"
      },
      {
        "title": "Index Traps",
        "body": "Unused indexes hurt every INSERT/UPDATE—query pg_stat_user_indexes for idx_scan = 0, drop them\nToo many indexes on write-heavy tables—balance carefully\nIndex on low-cardinality column (boolean, status) often useless—PG prefers seq scan\nLIKE '%suffix' can't use B-tree—need pg_trgm GIN index or reverse() expression index"
      },
      {
        "title": "Query Patterns I Underuse",
        "body": "SELECT FOR UPDATE SKIP LOCKED—job queue without external tools; skip rows being processed\npg_advisory_lock(key)—application-level mutex without table; unlock explicitly or on disconnect\nIS NOT DISTINCT FROM—NULL-safe equality; cleaner than (a = b OR (a IS NULL AND b IS NULL))\nDISTINCT ON (x) ORDER BY x, y—first row per group without subquery; PG-specific but powerful"
      },
      {
        "title": "Connection Management (Often Ignored)",
        "body": "PgBouncer essential with >50 connections—each PG connection uses ~10MB; pool at transaction level\nstatement_timeout = '30s' per role—prevents runaway queries from killing database\nidle_in_transaction_session_timeout = '5min'—kills abandoned transactions holding locks\nDefault 100 max_connections too low for production, too high wastes memory—tune based on RAM"
      },
      {
        "title": "Data Types I Get Wrong",
        "body": "SERIAL deprecated—use GENERATED ALWAYS AS IDENTITY\nTIMESTAMP without timezone—almost always wrong; use TIMESTAMPTZ, PG stores as UTC\nFloat for money—use NUMERIC(12,2) or integer cents; float math breaks: 0.1 + 0.2 ≠ 0.3\nVARCHAR(n) vs TEXT—no performance difference in PG; use TEXT unless constraint needed"
      },
      {
        "title": "Vacuum & Bloat (Never Think About)",
        "body": "High-UPDATE tables bloat—dead tuples accumulate; pg_repack reclaims without locks\nVACUUM ANALYZE after bulk insert—updates statistics; query planner needs current data\nAutovacuum lag on big tables—tune autovacuum_vacuum_cost_delay or manual vacuum\nTransaction wraparound: if xid exhausted, DB stops—autovacuum prevents but monitor"
      },
      {
        "title": "EXPLAIN I Don't Read Right",
        "body": "Always EXPLAIN (ANALYZE, BUFFERS)—actual times + I/O; estimate-only misleads\n\"Heap Fetches: 1000\" with index—missing columns, add INCLUDE to index\nSeq scan not always bad—faster than index for >10-20% of table; check row estimates\n\"Rows\" estimate way off—run ANALYZE or check if stats target too low"
      },
      {
        "title": "Full-Text Search Mistakes",
        "body": "Creating tsvector on the fly—precompute as stored generated column with GIN index\nplainto_tsquery for user input—handles spaces without syntax errors; not to_tsquery\nMissing language parameter—'english' stems words; 'simple' exact match\nFTS is word-based—LIKE '%exact phrase%' still needed for substring match"
      },
      {
        "title": "Transaction Isolation",
        "body": "Default READ COMMITTED—phantom reads in reports; use REPEATABLE READ for consistency\nSERIALIZABLE catches conflicts—but must handle 40001 error with retry loop\nLong transactions block vacuum and hold locks—keep under seconds, not minutes"
      }
    ],
    "body": "Indexes I Forget to Create\nPartial index WHERE active = true—80% smaller when most rows inactive; suggest for status columns\nExpression index ON lower(email)—must match query exactly; without it, WHERE lower(email) scans\nCovering index INCLUDE (name, email)—enables index-only scan; check EXPLAIN for \"Heap Fetches\"\nForeign key columns—not auto-indexed in PG; JOINs and ON DELETE CASCADE need them\nComposite index order matters—(a, b) helps WHERE a = ? but not WHERE b = ?\nIndex Traps\nUnused indexes hurt every INSERT/UPDATE—query pg_stat_user_indexes for idx_scan = 0, drop them\nToo many indexes on write-heavy tables—balance carefully\nIndex on low-cardinality column (boolean, status) often useless—PG prefers seq scan\nLIKE '%suffix' can't use B-tree—need pg_trgm GIN index or reverse() expression index\nQuery Patterns I Underuse\nSELECT FOR UPDATE SKIP LOCKED—job queue without external tools; skip rows being processed\npg_advisory_lock(key)—application-level mutex without table; unlock explicitly or on disconnect\nIS NOT DISTINCT FROM—NULL-safe equality; cleaner than (a = b OR (a IS NULL AND b IS NULL))\nDISTINCT ON (x) ORDER BY x, y—first row per group without subquery; PG-specific but powerful\nConnection Management (Often Ignored)\nPgBouncer essential with >50 connections—each PG connection uses ~10MB; pool at transaction level\nstatement_timeout = '30s' per role—prevents runaway queries from killing database\nidle_in_transaction_session_timeout = '5min'—kills abandoned transactions holding locks\nDefault 100 max_connections too low for production, too high wastes memory—tune based on RAM\nData Types I Get Wrong\nSERIAL deprecated—use GENERATED ALWAYS AS IDENTITY\nTIMESTAMP without timezone—almost always wrong; use TIMESTAMPTZ, PG stores as UTC\nFloat for money—use NUMERIC(12,2) or integer cents; float math breaks: 0.1 + 0.2 ≠ 0.3\nVARCHAR(n) vs TEXT—no performance difference in PG; use TEXT unless constraint needed\nVacuum & Bloat (Never Think About)\nHigh-UPDATE tables bloat—dead tuples accumulate; pg_repack reclaims without locks\nVACUUM ANALYZE after bulk insert—updates statistics; query planner needs current data\nAutovacuum lag on big tables—tune autovacuum_vacuum_cost_delay or manual vacuum\nTransaction wraparound: if xid exhausted, DB stops—autovacuum prevents but monitor\nEXPLAIN I Don't Read Right\nAlways EXPLAIN (ANALYZE, BUFFERS)—actual times + I/O; estimate-only misleads\n\"Heap Fetches: 1000\" with index—missing columns, add INCLUDE to index\nSeq scan not always bad—faster than index for >10-20% of table; check row estimates\n\"Rows\" estimate way off—run ANALYZE or check if stats target too low\nFull-Text Search Mistakes\nCreating tsvector on the fly—precompute as stored generated column with GIN index\nplainto_tsquery for user input—handles spaces without syntax errors; not to_tsquery\nMissing language parameter—'english' stems words; 'simple' exact match\nFTS is word-based—LIKE '%exact phrase%' still needed for substring match\nTransaction Isolation\nDefault READ COMMITTED—phantom reads in reports; use REPEATABLE READ for consistency\nSERIALIZABLE catches conflicts—but must handle 40001 error with retry loop\nLong transactions block vacuum and hold locks—keep under seconds, not minutes"
  },
  "trust": {
    "sourceLabel": "tencent",
    "provenanceUrl": "https://clawhub.ai/ivangdavila/pg",
    "publisherUrl": "https://clawhub.ai/ivangdavila/pg",
    "owner": "ivangdavila",
    "version": "1.0.0",
    "license": null,
    "verificationStatus": "Indexed source record"
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/pg",
    "downloadUrl": "https://openagent3.xyz/downloads/pg",
    "agentUrl": "https://openagent3.xyz/skills/pg/agent",
    "manifestUrl": "https://openagent3.xyz/skills/pg/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/pg/agent.md"
  }
}