{
 "schema": "aiblocks-page/1",
 "id": "agent-database-setup-planner",
 "type": "skill",
 "name": "Agent database setup planner",
 "summary": "Plan the database your AI agents need. Get a schema map, migration steps, access rules and a staging test plan that keeps existing data safe.",
 "headline": "Agent database setup planner",
 "subhead": "Share your project's code, its current tables and your database setup. This skill plans the tables an AI agent needs for its jobs and activity, who can read each row, and how to test it all in staging. You get a schema map, migration steps, access rules and a rollback plan. It changes nothing.",
 "job": {
  "id": "build-software",
  "name": "Build and ship software"
 },
 "level": "intermediate",
 "thinking": "medium",
 "tested": true,
 "updated": "2026-10-28",
 "first_published": "2026-10-25",
 "inputs": [
  {
   "type": "codebase",
   "required": true,
   "label": "Codebase",
   "what": "a project's code, in a folder or repo the AI can open"
  },
  {
   "type": "data_model",
   "required": false,
   "label": "Data model",
   "what": "a database design: the tables or collections, their fields and keys, and how they link"
  }
 ],
 "outputs": [
  {
   "type": "plan",
   "required": true,
   "label": "Plan",
   "what": "a dated plan: what to do, in what order, with a decision rule for each step"
  },
  {
   "type": "data_model",
   "required": true,
   "label": "Data model",
   "what": "a database design: the tables or collections, their fields and keys, and how they link"
  }
 ],
 "you_give": [
  "Your project's code, or a list of its current tables and columns (a schema dump or migration history is best)",
  "Which database you use, and whether this is a new test copy or a shared one holding real data",
  "Your current access rules, if you have any (optional)",
  "What the agent must store, such as jobs, status and who it acts for (optional)",
  "What you allow it to do: plan only, or also write files or run SQL in a test copy"
 ],
 "you_get": [
  "A schema map: the tables, columns, keys and indexes for jobs and activity",
  "Migration files in order, forward only, with what each one changes",
  "An access rule for each table, and which key belongs where",
  "A staging test plan using made-up rows",
  "A rollback and recovery plan",
  "A list of missing inputs and checks that did not run"
 ],
 "use_when": [
  "You are adding AI agents to an app and need tables for their jobs and activity.",
  "Your agents will work for more than one client or account, and each must see only its own rows.",
  "Your database already holds real data and you must add tables without breaking it.",
  "You want a test plan for the database before any agent touches it."
 ],
 "skip_when": [
  "The agent tables already exist and you need to change them. Use the Agent database migration planner.",
  "You want to plan what an agent remembers and how it looks things up. Use the Agent memory designer.",
  "You want the job queue, retries and recovery, not the tables. Use the Recoverable agent job queue builder.",
  "You want the database created for you. This skill plans only. You run the SQL yourself, in staging first, after you read it."
 ],
 "output_sample": {
  "input": [
   "Your project's code or a list of its current tables and columns",
   "Your database provider, and whether it is a test copy or holds real data",
   "Your current access rules (optional)",
   "What you allow: plan only, or run SQL in a test copy"
  ],
  "prerequisites": [
   "An AI that can read your files, or the files pasted in",
   "A staging copy of the database, if you want to run the plan"
  ],
  "output": [
   {
    "name": "DATABASE and WHAT EXISTS",
    "contains": "The provider, the environment, and the tables and access rules already in place."
   },
   {
    "name": "SCHEMA MAP",
    "contains": "The tables, columns, keys and indexes for jobs and activity, and which existing tables are reused."
   },
   {
    "name": "MIGRATIONS",
    "contains": "Forward-only migration files in order, each with what it adds and whether it touches data."
   },
   {
    "name": "ACCESS RULES",
    "contains": "For each table, who can read and write, and how the rule is enforced."
   },
   {
    "name": "KEYS AND CONNECTION",
    "contains": "Which key lives in the browser and which on the server. No key values."
   },
   {
    "name": "STAGING TESTS",
    "contains": "Tests on made-up rows, including one account blocked from another's rows, each marked run or not run."
   },
   {
    "name": "ROLLBACK AND RECOVERY",
    "contains": "What to back up first, how to undo each step and what cannot be undone."
   },
   {
    "name": "ASSUMPTIONS, MISSING and CHECKS MISSED",
    "contains": "What it assumed, what it could not find and which checks did not run."
   }
  ]
 },
 "output_shape": "DATABASE\n<provider> | environment: <new test copy | shared with real data> | allowed: <plan only | run in a test copy>\n\nWHAT EXISTS\n<tables, schema history, access rules found, or MISSING>\n\nSCHEMA MAP\n<table> | key: <...> | account column: <...> | columns: <...> | indexes: <...> | reuses: <existing table or new>\n\nMIGRATIONS (in order)\n1 <file name> | adds: <...> | touches existing data: <no | yes, why>\n\nACCESS RULES\n<table> | who can read | who can write | enforced by: <row rule | app check>\n\nKEYS AND CONNECTION\n<which key goes where; no key values>\n\nSTAGING TESTS\n<test> | made-up rows: <...> | passes if: <...> | status: <run | not run>\n\nROLLBACK AND RECOVERY\n<what to back up first, how to undo each migration, what cannot be undone>\n\nASSUMPTIONS AND OPEN QUESTIONS\n<list>\n\nMISSING\n<inputs that would change the plan>\n\nCHECKS MISSED\n<one line per check not done, or none>",
 "how_to_use": [
  "Add the skill to your AI, or open the pack and give your AI SKILL.md and the file in its references folder. An AI that can read your project folder, such as Claude Code, works best. A chat AI works if you paste the files.",
  "Tell it which project you mean, and whether the database is a test copy or holds real data. Paste your table list or schema dump and your access rules. Never paste passwords or keys.",
  "Say what you allow. If you say nothing, it only plans.",
  "Read the schema map and access rules first. Check that each table has a column for the account and a rule that limits rows to it.",
  "Run the migrations in staging only, with made-up rows, and work through the test plan. The skill does not run the tests for you."
 ],
 "checks": [],
 "next": [
  {
   "name": "Agent database migration planner",
   "url": "https://useaiblocks.com/skills/agent-database-migration-planner",
   "why": "Build it"
  },
  {
   "name": "Database performance analyst",
   "url": "https://useaiblocks.com/skills/agency-engineering-database-optimizer",
   "why": "Build it"
  },
  {
   "name": "Oracle behavior baseline test writer",
   "url": "https://useaiblocks.com/skills/copilot-creating-oracle-to-postgres-migration-integration-tests",
   "why": "Build it"
  }
 ],
 "source": null,
 "credits": [],
 "files": [
  "references/worked-example.md"
 ],
 "links": {
  "page": "https://useaiblocks.com/skills/agent-database-setup-planner",
  "markdown": "https://useaiblocks.com/skills/agent-database-setup-planner.md",
  "json": "https://useaiblocks.com/skills/agent-database-setup-planner.json",
  "instructions": "https://useaiblocks.com/skills/agent-database-setup-planner/SKILL.md",
  "download": "https://useaiblocks.com/skills/agent-database-setup-planner.zip",
  "api_item": "https://useaiblocks.com/api/v1/items/agent-database-setup-planner",
  "api_document": "https://useaiblocks.com/api/v1/documents/skill/agent-database-setup-planner",
  "mcp": "https://useaiblocks.com/mcp"
 }
}
