[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M71KERD0E4F2A03R27VSA9EZ":3,"skill-same:01M71KERD0E4F2A03R27VSA9EZ":79},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":38,"linkOnly":39,"markdownContent":40,"markdownBody":41,"frontMatter":42,"refName":43,"commitSha":44,"skillDirectory":45,"forksCount":46,"repositoryHtmlUrl":47,"repositoryHomepageUrl":48,"ownerHtmlUrl":49,"ownerBlogUrl":50,"ownerDescription":51,"updatedAt":52,"install":53,"resources":66},"01M71KERD0E4F2A03R27VSA9EZ","database",null,"Create and manage Replit's built-in PostgreSQL databases, check status, execute SQL queries with safety checks, and run read-only queries against the production database. Use when the user wants to check prod data, debug database issues in production, or asks to \"check the prod db\", \"query production\", \"look at live data\", or \"see what's in the database on the deployed app\". Also use when the user asks how to apply development schema changes to the production database, e.g. \"push dev to prod\", \"migrate the production database\", \"sync the schema\", \"production is missing a column\", or reports a deployed app failing with \"column does not exist\" \u002F \"relation does not exist\".","clawdsolana\u002FOpenClawd","clawdsolana","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F279036008?v=4","01M71JTVF9FNGKE2SVJRPTQM31","OpenClawd","01M71JTVGCKWBSS8ZYC1HYWVA5",2,"MIT","https:\u002F\u002Fgithub.com\u002Fclawdsolana\u002FOpenClawd\u002Fblob\u002Fmain\u002Fskills\u002Fdatabase\u002FSKILL.md",[],[5,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37],"migrate","sync","read","at","sql","run","how","create","postgresql","reports","query","when","only","how to","failing","issues","db","databases","app","2026-11-10 10:12:30",false,"---\nname: database\ndescription: Create and manage Replit's built-in PostgreSQL databases, check status, execute SQL queries with safety checks, and run read-only queries against the production database. Use when the user wants to check prod data, debug database issues in production, or asks to \"check the prod db\", \"query production\", \"look at live data\", or \"see what's in the database on the deployed app\". Also use when the user asks how to apply development schema changes to the production database, e.g. \"push dev to prod\", \"migrate the production database\", \"sync the schema\", \"production is missing a column\", or reports a deployed app failing with \"column does not exist\" \u002F \"relation does not exist\".\n---\n\n# Database Skill\n\nManage PostgreSQL databases and execute SQL queries safely in your development and production environments.\n\n## When to Use\n\nUse this skill when:\n\n- Creating a new PostgreSQL database for your project\n- Checking if a database is provisioned and accessible\n- Running SQL queries against the development or production database\n- Querying data warehouses (BigQuery, Databricks, Snowflake). For Databricks, use the `databricks-m2m` connector (not the plain `databricks` connector).\n\n## When NOT to Use\n\n- Schema migrations in production environments — see \"Production schema changes\" below\n- Direct modifications to Stripe tables (use Stripe API instead)\n- Converting a pre-existing database over to Replit, unless a user explicitly asks you to.\n\n## Production schema changes\n\nFor projects that use Replit's managed PostgreSQL, the production database schema is managed automatically by Replit's Publish flow. When the user clicks Publish, Replit diffs the development schema against production, asks the user to resolve any renames in the Publish UI, and applies the diff to production. This is the supported path for changing the production schema; the agent must not write any code or scripts to migrate the production database.\n\nFor the full set of rules on what the agent must and must not do here — including specific patterns to avoid (custom migration scripts, deploy-build hooks, startup-time DDL) and the correct dev-side flow — read `.local\u002Fskills\u002Fdatabase\u002Freferences\u002Fdatabase-migrations-on-publish.md`.\n\n## Reference Documents\n\n- `.local\u002Fskills\u002Fdatabase\u002Freferences\u002Fdatabase-migrations-on-publish.md` — Full detail on the publish-time schema migration flow, including the two automatic application points (post-merge → dev, publish → prod), the SQL diff and rename-confirmation behavior, and the canonical failure mode this guidance prevents. Read this when the user reports production is missing a column or table, asks to \"push dev to prod\" \u002F \"migrate the production database\" \u002F \"sync the schema\", or reports the deployed app failing with \"column does not exist\" \u002F \"relation does not exist\" errors.\n\n## Available Functions\n\n### checkDatabase()\n\nCheck if the PostgreSQL database is provisioned and accessible.\n\n**Parameters:** None\n\n**Returns:** Dict with `provisioned` (bool) and `message` (str)\n\n**Example:**\n\n```javascript\nconst status = await checkDatabase();\nif (status.provisioned) {\n    console.log(\"Database is ready!\");\n} else {\n    console.log(status.message);\n    \u002F\u002F Consider calling createDatabase()\n}\n```\n\n### createDatabase()\n\nCreate or verify a PostgreSQL database exists for the project.\n\n**Parameters:** None\n\n**Returns:** Dict with:\n\n- `success` (bool): Whether operation succeeded\n- `message` (str): Status message\n- `alreadyExisted` (bool): True if database already existed\n- `secretKeys` (list): Environment variables set (DATABASE_URL, PGHOST, etc.)\n\n**Example:**\n\n```javascript\nconst result = await createDatabase();\nif (result.success) {\n    console.log(`Database ready! Environment variables: ${result.secretKeys}`);\n    \u002F\u002F Now you can use DATABASE_URL in your application\n}\n```\n\n### executeSql()\n\nExecute a SQL query with safety checks.\n\n**Parameters:**\n\n- `sqlQuery` (str, required): The SQL query to execute. Use `$1`, `$2`, etc. placeholders when using parameterized queries.\n- `params` (array, optional): Parameter values for parameterized queries. When provided, values are bound separately from the SQL string, **preventing SQL injection**. Each `$N` placeholder in `sqlQuery` corresponds to the Nth element in this array (1-indexed). Supported types: string, number, boolean, null. **Two restrictions:**\n  - **Single-statement only.** When `params` is provided (including `params: []`), `sqlQuery` MUST be a single SQL statement. Semicolon-delimited multi-statement scripts (`BEGIN; ...; COMMIT;`, migration batches, etc.) are rejected on the parameterized path. Send them as a single `executeSql` call WITHOUT `params` — separate calls do NOT share a transaction or session, so splitting would silently lose atomicity. Validate any interpolated values against a strict allowlist before embedding them.\n  - **`replit_database` target only.** Data warehouse targets (bigquery, databricks, snowflake) do not support parameter binding — passing `params` with those targets raises an error.\n- `target` (str, default \"replit_database\"): Target database: \"replit_database\", \"bigquery\", \"databricks\", or \"snowflake\"\n- `environment` (str, default \"development\"): \"development\" runs against the development database (all SQL operations supported). \"production\" runs READ-ONLY queries against a replica of the production database (only SELECT queries allowed). Production is only supported for the \"replit_database\" target. \"production\" database, depending on when the user last deployed, may have outdated schemas.\n- `sampleSize` (int, optional): Sample size for warehouse queries (only for bigquery\u002Fdatabricks\u002Fsnowflake)\n\n**Returns:** Dict with:\n\n- `success` (bool): Whether query succeeded\n- `output` (str): Query output\u002Fresults\n- `exitCode` (int): Exit code (0 = success)\n- `exitReason` (str | None): Reason for exit if failed\n\n**CRITICAL: When `params` is supported, ALWAYS use it for any user input or variable.**\nThis applies when **all** of these are true:\n\n- `target` is `replit_database` (the default).\n- `sqlQuery` is a single SQL statement (no semicolons separating multiple statements).\n\nIn that case, never use string interpolation or concatenation to build SQL with dynamic literal values — pass them through `params`. This prevents SQL injection.\n\n```javascript\n\u002F\u002F BAD - vulnerable to SQL injection:\nconst result = await executeSql({ sqlQuery: `SELECT * FROM users WHERE id = ${userId}` });\n\n\u002F\u002F GOOD - use parameterized queries:\nconst result = await executeSql({\n    sqlQuery: \"SELECT * FROM users WHERE id = $1\",\n    params: [userId]\n});\n```\n\n**Note: `params` only binds literal values** (strings, numbers, booleans, null). PostgreSQL placeholders cannot substitute identifiers (table or column names), SQL keywords (sort directions like `ASC`\u002F`DESC`, operators), or other syntactic elements. For dynamic identifiers or keywords, validate the value against a strict allowlist (e.g. a fixed set of allowed table names, or a regex like `\u002F^[a-z_][a-z0-9_]*$\u002F`), then interpolate the validated value into the SQL string. Never interpolate free-form user text into identifier positions.\n\n```javascript\n\u002F\u002F BAD - $1 cannot bind a table name; this query fails to parse:\nawait executeSql({ sqlQuery: \"SELECT * FROM $1 WHERE id = $2\", params: [tableName, userId] });\n\n\u002F\u002F GOOD - allowlist + interpolate identifiers, $N for values:\nconst ALLOWED_TABLES = [\"users\", \"orders\", \"products\"];\nif (!ALLOWED_TABLES.includes(tableName)) throw new Error(\"invalid table\");\nawait executeSql({\n    sqlQuery: `SELECT * FROM ${tableName} WHERE id = $1`,\n    params: [userId]\n});\n```\n\n**When `params` is NOT supported on `replit_database`** (multi-statement scripts only — `BEGIN; ...; COMMIT;`, migrations, batched DDL):\n\n1. **For independent statements that don't need shared transaction or session state**, you can split them into separate `executeSql` calls each with its own `params` (e.g., a sequence of unrelated INSERTs into different tables). Note that separate `executeSql` calls do NOT share a connection, transaction, or session — temp tables, `SET LOCAL` GUCs, and `BEGIN`\u002F`COMMIT` will not carry across calls.\n2. **For scripts that DO need transactional atomicity or session state** (most multi-statement writes, migrations, scripts that depend on temp tables), send the whole script as a single `executeSql` call without `params`. Validate any interpolated values against a strict allowlist (e.g. integers only, identifier whitelist) before embedding them in the SQL string. Treat any interpolated value as a potential injection vector — never interpolate free-form user text.\n\n**For warehouse targets** (`bigquery`, `databricks`, `snowflake`), `params` is NEVER supported. The runtime rejects any warehouse query that includes `params`, whether single-statement or multi-statement. You MUST either: (a) reject the user input if it cannot be validated, or (b) validate the value against a strict allowlist (e.g. integers only, fixed identifier set) before interpolating it into the SQL string. Never interpolate free-form user text into warehouse SQL.\n\n**Example:**\n\n```javascript\n\u002F\u002F Simple SELECT with parameters\nconst result = await executeSql({\n    sqlQuery: \"SELECT * FROM users WHERE id = $1\",\n    params: [userId]\n});\nif (result.success) {\n    console.log(result.output);\n}\n\n\u002F\u002F Static query without user input (no params needed)\nconst result1b = await executeSql({ sqlQuery: \"SELECT * FROM users LIMIT 5\" });\n\n\u002F\u002F CREATE TABLE (static DDL, no params needed)\nconst result2 = await executeSql({\n    sqlQuery: `\n        CREATE TABLE IF NOT EXISTS products (\n            id SERIAL PRIMARY KEY,\n            name VARCHAR(255) NOT NULL,\n            price DECIMAL(10, 2)\n        )\n    `\n});\n\n\u002F\u002F INSERT data with parameters\nconst result3 = await executeSql({\n    sqlQuery: \"INSERT INTO products (name, price) VALUES ($1, $2)\",\n    params: [productName, productPrice]\n});\n\n\u002F\u002F UPDATE with parameters\nconst result3b = await executeSql({\n    sqlQuery: \"UPDATE products SET price = $1 WHERE name = $2\",\n    params: [newPrice, productName]\n});\n\n\u002F\u002F DELETE with parameters\nconst result3c = await executeSql({\n    sqlQuery: \"DELETE FROM products WHERE id = $1\",\n    params: [productId]\n});\n\n\u002F\u002F Read-only production query with parameters\nconst result4 = await executeSql({\n    sqlQuery: \"SELECT * FROM users WHERE active = $1\",\n    params: [true],\n    environment: \"production\"\n});\n\n\u002F\u002F Data warehouse query with sampling\n\u002F\u002F (Note: `params` is NOT supported for warehouse targets; if `year` were\n\u002F\u002F dynamic, validate it as an integer literal before interpolating.)\nconst result5 = await executeSql({\n    sqlQuery: \"SELECT * FROM sales_data WHERE year = 2024\",\n    target: \"bigquery\",\n    sampleSize: 100\n});\n\n\u002F\u002F Multi-statement transactional scripts (BEGIN ... COMMIT, temp tables,\n\u002F\u002F SET LOCAL, etc.) MUST run as a single executeSql call WITHOUT `params`\n\u002F\u002F — separate calls do NOT share a connection or transaction, so\n\u002F\u002F splitting a transaction across multiple calls would silently lose\n\u002F\u002F atomicity. If the script needs user-controlled values, validate them\n\u002F\u002F against a strict allowlist (integers only, identifier whitelist)\n\u002F\u002F before interpolating; never interpolate free-form user text.\nconst result = await executeSql({\n    sqlQuery: `\n        BEGIN;\n        UPDATE users SET active = false WHERE last_login \u003C '2024-01-01';\n        UPDATE audit_log SET archived = true WHERE created_at \u003C '2024-01-01';\n        COMMIT;\n    `,\n});\n```\n\n## Safety Features\n\n1. **Environment Isolation**: Development queries run against the development database; production queries are READ-ONLY against a read replica\n2. **Stripe Protection**: Mutations to Stripe schema tables (stripe.*) are blocked\n3. **Discussion Mode**: Mutating queries are blocked in Planning\u002FDiscussion mode\n4. **Destructive Query Protection**: DROP, TRUNCATE, etc. are blocked via the skill callback path (use the tool interface directly for destructive operations that require user confirmation)\n\n## Best Practices\n\n1. **Prefer the built-in database**: Replit's built-in PostgreSQL database is always preferred over external services like Supabase. It supports rollback and integrates directly with the Replit product. Only use external database services if the user has specific requirements. The `pg` package should be installed already.\n2. **Check before creating**: Call `checkDatabase()` before `createDatabase()` to avoid unnecessary operations\n3. **ALWAYS use parameterized queries with user input on the `replit_database` single-statement path**: When `target` is `replit_database` (the default) and `sqlQuery` is a single statement, you MUST use the `params` argument with `$1`, `$2`, etc. placeholders for any user-provided literal value. NEVER use string interpolation, template literals, or concatenation for values in that case. For dynamic identifiers (table\u002Fcolumn names) or SQL keywords (sort directions, operators), validate against a strict allowlist before interpolating since `params` cannot bind those. For warehouse targets and multi-statement transactional scripts where `params` is not supported, send the whole script as a single `executeSql` call and validate any interpolated values against a strict allowlist; only split into separate calls when the statements are truly independent and don't share transaction or session state.\n4. **Test queries first**: Run SELECT queries before INSERT\u002FUPDATE\u002FDELETE\n5. **Keep backups**: Important data should be backed up before destructive operations\n\n## Environment Variables\n\nAfter creating a database, these environment variables are available:\n\n- `DATABASE_URL`: Full connection string\n- `PGHOST`: Database host\n- `PGPORT`: Database port (5432)\n- `PGUSER`: Database username\n- `PGPASSWORD`: Database password\n- `PGDATABASE`: Database name\n\n## Example Workflow\n\n```javascript\n\u002F\u002F 1. Check if database exists\nconst status = await checkDatabase();\n\nif (!status.provisioned) {\n    \u002F\u002F 2. Create database\n    const createResult = await createDatabase();\n    if (!createResult.success) {\n        console.log(`Failed: ${createResult.message}`);\n    }\n}\n\n\u002F\u002F 3. Create schema\nawait executeSql({\n    sqlQuery: `\n        CREATE TABLE IF NOT EXISTS users (\n            id SERIAL PRIMARY KEY,\n            email VARCHAR(255) UNIQUE NOT NULL,\n            created_at TIMESTAMP DEFAULT NOW()\n        )\n    `\n});\n\n\u002F\u002F 4. Insert data (using parameterized query)\nawait executeSql({\n    sqlQuery: \"INSERT INTO users (email) VALUES ($1)\",\n    params: ['user@example.com']\n});\n\n\u002F\u002F 5. Query data\nconst result = await executeSql({ sqlQuery: \"SELECT * FROM users\" });\nconsole.log(result.output);\n```\n\n## Limitations\n\n- Production queries are READ-ONLY (SELECT only) — INSERT, UPDATE, DELETE, and DDL statements will fail\n- Production environment is only supported for the \"replit_database\" target (not data warehouses)\n- Cannot modify Stripe schema tables (read-only)\n- Destructive queries (DROP, TRUNCATE, etc.) are blocked via the skill callback path\n- Mutating queries blocked in Planning mode\n\n## Rollbacks\n\nAs stated in the diagnostic skills, the development database support rollbacks. Open that skill for more information.\n","# Database Skill\n\nManage PostgreSQL databases and execute SQL queries safely in your development and production environments.\n\n## When to Use\n\nUse this skill when:\n\n- Creating a new PostgreSQL database for your project\n- Checking if a database is provisioned and accessible\n- Running SQL queries against the development or production database\n- Querying data warehouses (BigQuery, Databricks, Snowflake). For Databricks, use the `databricks-m2m` connector (not the plain `databricks` connector).\n\n## When NOT to Use\n\n- Schema migrations in production environments — see \"Production schema changes\" below\n- Direct modifications to Stripe tables (use Stripe API instead)\n- Converting a pre-existing database over to Replit, unless a user explicitly asks you to.\n\n## Production schema changes\n\nFor projects that use Replit's managed PostgreSQL, the production database schema is managed automatically by Replit's Publish flow. When the user clicks Publish, Replit diffs the development schema against production, asks the user to resolve any renames in the Publish UI, and applies the diff to production. This is the supported path for changing the production schema; the agent must not write any code or scripts to migrate the production database.\n\nFor the full set of rules on what the agent must and must not do here — including specific patterns to avoid (custom migration scripts, deploy-build hooks, startup-time DDL) and the correct dev-side flow — read `.local\u002Fskills\u002Fdatabase\u002Freferences\u002Fdatabase-migrations-on-publish.md`.\n\n## Reference Documents\n\n- `.local\u002Fskills\u002Fdatabase\u002Freferences\u002Fdatabase-migrations-on-publish.md` — Full detail on the publish-time schema migration flow, including the two automatic application points (post-merge → dev, publish → prod), the SQL diff and rename-confirmation behavior, and the canonical failure mode this guidance prevents. Read this when the user reports production is missing a column or table, asks to \"push dev to prod\" \u002F \"migrate the production database\" \u002F \"sync the schema\", or reports the deployed app failing with \"column does not exist\" \u002F \"relation does not exist\" errors.\n\n## Available Functions\n\n### checkDatabase()\n\nCheck if the PostgreSQL database is provisioned and accessible.\n\n**Parameters:** None\n\n**Returns:** Dict with `provisioned` (bool) and `message` (str)\n\n**Example:**\n\n```javascript\nconst status = await checkDatabase();\nif (status.provisioned) {\n    console.log(\"Database is ready!\");\n} else {\n    console.log(status.message);\n    \u002F\u002F Consider calling createDatabase()\n}\n```\n\n### createDatabase()\n\nCreate or verify a PostgreSQL database exists for the project.\n\n**Parameters:** None\n\n**Returns:** Dict with:\n\n- `success` (bool): Whether operation succeeded\n- `message` (str): Status message\n- `alreadyExisted` (bool): True if database already existed\n- `secretKeys` (list): Environment variables set (DATABASE_URL, PGHOST, etc.)\n\n**Example:**\n\n```javascript\nconst result = await createDatabase();\nif (result.success) {\n    console.log(`Database ready! Environment variables: ${result.secretKeys}`);\n    \u002F\u002F Now you can use DATABASE_URL in your application\n}\n```\n\n### executeSql()\n\nExecute a SQL query with safety checks.\n\n**Parameters:**\n\n- `sqlQuery` (str, required): The SQL query to execute. Use `$1`, `$2`, etc. placeholders when using parameterized queries.\n- `params` (array, optional): Parameter values for parameterized queries. When provided, values are bound separately from the SQL string, **preventing SQL injection**. Each `$N` placeholder in `sqlQuery` corresponds to the Nth element in this array (1-indexed). Supported types: string, number, boolean, null. **Two restrictions:**\n  - **Single-statement only.** When `params` is provided (including `params: []`), `sqlQuery` MUST be a single SQL statement. Semicolon-delimited multi-statement scripts (`BEGIN; ...; COMMIT;`, migration batches, etc.) are rejected on the parameterized path. Send them as a single `executeSql` call WITHOUT `params` — separate calls do NOT share a transaction or session, so splitting would silently lose atomicity. Validate any interpolated values against a strict allowlist before embedding them.\n  - **`replit_database` target only.** Data warehouse targets (bigquery, databricks, snowflake) do not support parameter binding — passing `params` with those targets raises an error.\n- `target` (str, default \"replit_database\"): Target database: \"replit_database\", \"bigquery\", \"databricks\", or \"snowflake\"\n- `environment` (str, default \"development\"): \"development\" runs against the development database (all SQL operations supported). \"production\" runs READ-ONLY queries against a replica of the production database (only SELECT queries allowed). Production is only supported for the \"replit_database\" target. \"production\" database, depending on when the user last deployed, may have outdated schemas.\n- `sampleSize` (int, optional): Sample size for warehouse queries (only for bigquery\u002Fdatabricks\u002Fsnowflake)\n\n**Returns:** Dict with:\n\n- `success` (bool): Whether query succeeded\n- `output` (str): Query output\u002Fresults\n- `exitCode` (int): Exit code (0 = success)\n- `exitReason` (str | None): Reason for exit if failed\n\n**CRITICAL: When `params` is supported, ALWAYS use it for any user input or variable.**\nThis applies when **all** of these are true:\n\n- `target` is `replit_database` (the default).\n- `sqlQuery` is a single SQL statement (no semicolons separating multiple statements).\n\nIn that case, never use string interpolation or concatenation to build SQL with dynamic literal values — pass them through `params`. This prevents SQL injection.\n\n```javascript\n\u002F\u002F BAD - vulnerable to SQL injection:\nconst result = await executeSql({ sqlQuery: `SELECT * FROM users WHERE id = ${userId}` });\n\n\u002F\u002F GOOD - use parameterized queries:\nconst result = await executeSql({\n    sqlQuery: \"SELECT * FROM users WHERE id = $1\",\n    params: [userId]\n});\n```\n\n**Note: `params` only binds literal values** (strings, numbers, booleans, null). PostgreSQL placeholders cannot substitute identifiers (table or column names), SQL keywords (sort directions like `ASC`\u002F`DESC`, operators), or other syntactic elements. For dynamic identifiers or keywords, validate the value against a strict allowlist (e.g. a fixed set of allowed table names, or a regex like `\u002F^[a-z_][a-z0-9_]*$\u002F`), then interpolate the validated value into the SQL string. Never interpolate free-form user text into identifier positions.\n\n```javascript\n\u002F\u002F BAD - $1 cannot bind a table name; this query fails to parse:\nawait executeSql({ sqlQuery: \"SELECT * FROM $1 WHERE id = $2\", params: [tableName, userId] });\n\n\u002F\u002F GOOD - allowlist + interpolate identifiers, $N for values:\nconst ALLOWED_TABLES = [\"users\", \"orders\", \"products\"];\nif (!ALLOWED_TABLES.includes(tableName)) throw new Error(\"invalid table\");\nawait executeSql({\n    sqlQuery: `SELECT * FROM ${tableName} WHERE id = $1`,\n    params: [userId]\n});\n```\n\n**When `params` is NOT supported on `replit_database`** (multi-statement scripts only — `BEGIN; ...; COMMIT;`, migrations, batched DDL):\n\n1. **For independent statements that don't need shared transaction or session state**, you can split them into separate `executeSql` calls each with its own `params` (e.g., a sequence of unrelated INSERTs into different tables). Note that separate `executeSql` calls do NOT share a connection, transaction, or session — temp tables, `SET LOCAL` GUCs, and `BEGIN`\u002F`COMMIT` will not carry across calls.\n2. **For scripts that DO need transactional atomicity or session state** (most multi-statement writes, migrations, scripts that depend on temp tables), send the whole script as a single `executeSql` call without `params`. Validate any interpolated values against a strict allowlist (e.g. integers only, identifier whitelist) before embedding them in the SQL string. Treat any interpolated value as a potential injection vector — never interpolate free-form user text.\n\n**For warehouse targets** (`bigquery`, `databricks`, `snowflake`), `params` is NEVER supported. The runtime rejects any warehouse query that includes `params`, whether single-statement or multi-statement. You MUST either: (a) reject the user input if it cannot be validated, or (b) validate the value against a strict allowlist (e.g. integers only, fixed identifier set) before interpolating it into the SQL string. Never interpolate free-form user text into warehouse SQL.\n\n**Example:**\n\n```javascript\n\u002F\u002F Simple SELECT with parameters\nconst result = await executeSql({\n    sqlQuery: \"SELECT * FROM users WHERE id = $1\",\n    params: [userId]\n});\nif (result.success) {\n    console.log(result.output);\n}\n\n\u002F\u002F Static query without user input (no params needed)\nconst result1b = await executeSql({ sqlQuery: \"SELECT * FROM users LIMIT 5\" });\n\n\u002F\u002F CREATE TABLE (static DDL, no params needed)\nconst result2 = await executeSql({\n    sqlQuery: `\n        CREATE TABLE IF NOT EXISTS products (\n            id SERIAL PRIMARY KEY,\n            name VARCHAR(255) NOT NULL,\n            price DECIMAL(10, 2)\n        )\n    `\n});\n\n\u002F\u002F INSERT data with parameters\nconst result3 = await executeSql({\n    sqlQuery: \"INSERT INTO products (name, price) VALUES ($1, $2)\",\n    params: [productName, productPrice]\n});\n\n\u002F\u002F UPDATE with parameters\nconst result3b = await executeSql({\n    sqlQuery: \"UPDATE products SET price = $1 WHERE name = $2\",\n    params: [newPrice, productName]\n});\n\n\u002F\u002F DELETE with parameters\nconst result3c = await executeSql({\n    sqlQuery: \"DELETE FROM products WHERE id = $1\",\n    params: [productId]\n});\n\n\u002F\u002F Read-only production query with parameters\nconst result4 = await executeSql({\n    sqlQuery: \"SELECT * FROM users WHERE active = $1\",\n    params: [true],\n    environment: \"production\"\n});\n\n\u002F\u002F Data warehouse query with sampling\n\u002F\u002F (Note: `params` is NOT supported for warehouse targets; if `year` were\n\u002F\u002F dynamic, validate it as an integer literal before interpolating.)\nconst result5 = await executeSql({\n    sqlQuery: \"SELECT * FROM sales_data WHERE year = 2024\",\n    target: \"bigquery\",\n    sampleSize: 100\n});\n\n\u002F\u002F Multi-statement transactional scripts (BEGIN ... COMMIT, temp tables,\n\u002F\u002F SET LOCAL, etc.) MUST run as a single executeSql call WITHOUT `params`\n\u002F\u002F — separate calls do NOT share a connection or transaction, so\n\u002F\u002F splitting a transaction across multiple calls would silently lose\n\u002F\u002F atomicity. If the script needs user-controlled values, validate them\n\u002F\u002F against a strict allowlist (integers only, identifier whitelist)\n\u002F\u002F before interpolating; never interpolate free-form user text.\nconst result = await executeSql({\n    sqlQuery: `\n        BEGIN;\n        UPDATE users SET active = false WHERE last_login \u003C '2024-01-01';\n        UPDATE audit_log SET archived = true WHERE created_at \u003C '2024-01-01';\n        COMMIT;\n    `,\n});\n```\n\n## Safety Features\n\n1. **Environment Isolation**: Development queries run against the development database; production queries are READ-ONLY against a read replica\n2. **Stripe Protection**: Mutations to Stripe schema tables (stripe.*) are blocked\n3. **Discussion Mode**: Mutating queries are blocked in Planning\u002FDiscussion mode\n4. **Destructive Query Protection**: DROP, TRUNCATE, etc. are blocked via the skill callback path (use the tool interface directly for destructive operations that require user confirmation)\n\n## Best Practices\n\n1. **Prefer the built-in database**: Replit's built-in PostgreSQL database is always preferred over external services like Supabase. It supports rollback and integrates directly with the Replit product. Only use external database services if the user has specific requirements. The `pg` package should be installed already.\n2. **Check before creating**: Call `checkDatabase()` before `createDatabase()` to avoid unnecessary operations\n3. **ALWAYS use parameterized queries with user input on the `replit_database` single-statement path**: When `target` is `replit_database` (the default) and `sqlQuery` is a single statement, you MUST use the `params` argument with `$1`, `$2`, etc. placeholders for any user-provided literal value. NEVER use string interpolation, template literals, or concatenation for values in that case. For dynamic identifiers (table\u002Fcolumn names) or SQL keywords (sort directions, operators), validate against a strict allowlist before interpolating since `params` cannot bind those. For warehouse targets and multi-statement transactional scripts where `params` is not supported, send the whole script as a single `executeSql` call and validate any interpolated values against a strict allowlist; only split into separate calls when the statements are truly independent and don't share transaction or session state.\n4. **Test queries first**: Run SELECT queries before INSERT\u002FUPDATE\u002FDELETE\n5. **Keep backups**: Important data should be backed up before destructive operations\n\n## Environment Variables\n\nAfter creating a database, these environment variables are available:\n\n- `DATABASE_URL`: Full connection string\n- `PGHOST`: Database host\n- `PGPORT`: Database port (5432)\n- `PGUSER`: Database username\n- `PGPASSWORD`: Database password\n- `PGDATABASE`: Database name\n\n## Example Workflow\n\n```javascript\n\u002F\u002F 1. Check if database exists\nconst status = await checkDatabase();\n\nif (!status.provisioned) {\n    \u002F\u002F 2. Create database\n    const createResult = await createDatabase();\n    if (!createResult.success) {\n        console.log(`Failed: ${createResult.message}`);\n    }\n}\n\n\u002F\u002F 3. Create schema\nawait executeSql({\n    sqlQuery: `\n        CREATE TABLE IF NOT EXISTS users (\n            id SERIAL PRIMARY KEY,\n            email VARCHAR(255) UNIQUE NOT NULL,\n            created_at TIMESTAMP DEFAULT NOW()\n        )\n    `\n});\n\n\u002F\u002F 4. Insert data (using parameterized query)\nawait executeSql({\n    sqlQuery: \"INSERT INTO users (email) VALUES ($1)\",\n    params: ['user@example.com']\n});\n\n\u002F\u002F 5. Query data\nconst result = await executeSql({ sqlQuery: \"SELECT * FROM users\" });\nconsole.log(result.output);\n```\n\n## Limitations\n\n- Production queries are READ-ONLY (SELECT only) — INSERT, UPDATE, DELETE, and DDL statements will fail\n- Production environment is only supported for the \"replit_database\" target (not data warehouses)\n- Cannot modify Stripe schema tables (read-only)\n- Destructive queries (DROP, TRUNCATE, etc.) are blocked via the skill callback path\n- Mutating queries blocked in Planning mode\n\n## Rollbacks\n\nAs stated in the diagnostic skills, the development database support rollbacks. Open that skill for more information.\n",{"name":5,"description":7},"main","6b4a291df75c639681e93b4b5b812126443fd6ed","skills\u002Fdatabase",3,"https:\u002F\u002Fgithub.com\u002Fclawdsolana\u002FOpenClawd","https:\u002F\u002Fsolanaclawd.com\u002Fopenclawd","https:\u002F\u002Fgithub.com\u002Fclawdsolana","https:\u002F\u002Fmusebook.trade","Welcome to Open Clawd. The future of Ai on and off chain. Bringing webMCP to web 3 using X402, A2A, MPP and so much more!","2026-08-01 09:30:51",{"source":8,"skillName":5,"commands":54,"prompt":64,"zipAvailable":65},[55,58,61],{"tool":56,"command":57},"npx","npx skills add clawdsolana\u002FOpenClawd --skill database",{"tool":59,"command":60},"bunx","bunx skills add clawdsolana\u002FOpenClawd --skill database",{"tool":62,"command":63},"pnpm","pnpm dlx skills add clawdsolana\u002FOpenClawd --skill database","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fclawdsolana\u002FOpenClawd\u002Fblob\u002Fmain\u002Fskills\u002Fdatabase\u002FSKILL.md",true,[67,73],{"path":68,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":71,"sourceHtmlUrl":72},".fingerprint","OTHER","其他",32,"https:\u002F\u002Fgithub.com\u002Fclawdsolana\u002FOpenClawd\u002Fblob\u002Fmain\u002Fskills\u002Fdatabase\u002F.fingerprint",{"path":74,"resourceType":75,"resourceTypeDesc":76,"sizeBytes":77,"sourceHtmlUrl":78},"references\u002Fdatabase-migrations-on-publish.md","REFERENCE","参考文档",4051,"https:\u002F\u002Fgithub.com\u002Fclawdsolana\u002FOpenClawd\u002Fblob\u002Fmain\u002Fskills\u002Fdatabase\u002Freferences\u002Fdatabase-migrations-on-publish.md",[80,107,131,155,165,189],{"skillNo":81,"name":82,"nameZh":6,"description":83,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":84,"categories":85,"keywords":86,"publishedAt":106},"01M71KRBD0W01EAXJ8YM4M1SJ2","solana-dev","End-to-end Solana development playbook (Jan 2026). Prefer Solana Foundation framework-kit (@solana\u002Fclient + @solana\u002Freact-hooks) for React\u002FNext.js UI. Prefer @solana\u002Fkit for all new client\u002FRPC\u002Ftransaction code. When legacy dependencies require web3.js, isolate it behind @solana\u002Fweb3-compat (or @solana\u002Fweb3.js as a true legacy fallback). Covers wallet-standard-first connection (incl. ConnectorKit), Anchor\u002FPinocchio programs, Codama-based client generation, LiteSVM\u002FMollusk\u002FSurfpool testing, and security checklists.","https:\u002F\u002Fgithub.com\u002Fclawdsolana\u002FOpenClawd\u002Fblob\u002Fmain\u002Fsrc\u002Fskills\u002Fsolana-dev\u002FSKILL.md",[],[87,88,89,90,91,92,93,94,95,30,96,97,98,99,100,101,102,103,104,105],"solana dev","dev","solana","Wallet","end","testing","hooks","kit","new","web3","code","react","next","2026","playbook","security","ui","fallback","framework","2026-11-10 10:56:23",{"skillNo":108,"name":109,"nameZh":6,"description":110,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":111,"categories":112,"keywords":113,"publishedAt":106},"01M71KR8QPESSY61SVE8ZTFNVT","xurl","A CLI tool for making authenticated requests to the X (Twitter) API. Use this skill when you need to post tweets, reply, quote, search, read posts, manage followers, send DMs, upload media, or interact with any X API v2 endpoint.","https:\u002F\u002Fgithub.com\u002Fclawdsolana\u002FOpenClawd\u002Fblob\u002Fmain\u002Fskills\u002Fxurl\u002FSKILL.md",[],[109,114,115,116,117,118,119,30,120,121,122,21,123,124,125,126,127,128,129,130],"posts","Media","x api","search","send","tap","you","api","cli","install","cli tool","endpoint","brew","for","manage","tool","twitter",{"skillNo":132,"name":133,"nameZh":6,"description":134,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":135,"categories":136,"keywords":137,"publishedAt":106},"01M71KR6FSXV88YDKWP7NBY3SH","wurk-integration","WURK API integration for monetizing agents with x402 payments on Solana\u002FBase - create social jobs, custom challenges, and agent help tasks","https:\u002F\u002Fgithub.com\u002Fclawdsolana\u002FOpenClawd\u002Fblob\u002Fmain\u002Fskills\u002Fwurk-integration\u002FSKILL.md",[],[138,139,140,141,142,143,144,145,121,26,146,147,148,149,150,151,127,152,153,154],"wurk","wurk integration","integration","x402","social","payments","tasks","team","social-jobs","command","agent-help","custom-jobs","clawd","safe","api integration","custom","true",{"skillNo":156,"name":157,"nameZh":6,"description":158,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":159,"categories":160,"keywords":161,"publishedAt":106},"01M71KR4HCX41BPAK9GP7RPRRP","workflows","Manage application workflows including configuration, restart, and removal.","https:\u002F\u002Fgithub.com\u002Fclawdsolana\u002FOpenClawd\u002Fblob\u002Fmain\u002Fskills\u002Fworkflows\u002FSKILL.md",[],[157,128,162,163,164],"configuration","application","restart",{"skillNo":166,"name":167,"nameZh":6,"description":168,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":169,"categories":170,"keywords":171,"publishedAt":106},"01M71KR1VM0F5GPEQDNG5J7A0H","web-search","Search the web, fetch content, extract branding profiles, and capture screenshots from URLs. Use for real-time information, API documentation, current events, design matching, and visual reference.","https:\u002F\u002Fgithub.com\u002Fclawdsolana\u002FOpenClawd\u002Fblob\u002Fmain\u002Fskills\u002Fweb-search\u002FSKILL.md",[],[172,117,173,174,175,127,176,177,178,179,180,181,182,121,183,184,185,186,187,188],"web search","web","fetch","api documentation","real-time","time","profiles","design","use","information","visual","documentation","branding","matching","reference","capture","content",{"skillNo":190,"name":191,"nameZh":6,"description":192,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":193,"categories":194,"keywords":195,"publishedAt":106},"01M71KQZN5MR1JFQHG5GWXYAHS","weather","Get current weather and forecasts via wttr.in or Open-Meteo. Use when: user asks about weather, temperature, or forecasts for any location. NOT for: historical weather data, severe weather alerts, or detailed meteorological analysis. No API key needed.","https:\u002F\u002Fgithub.com\u002Fclawdsolana\u002FOpenClawd\u002Fblob\u002Fmain\u002Fskills\u002Fweather\u002FSKILL.md",[],[191,196,127,197,180,30,198,121,199,200,201,202,203,204,205,206,207,208],"get","open","analysis","alerts","temperature","curl","via","help","about","https","location","data","user"]