Model a database schema

Have Autohand Code use database schema design patterns to propose tables, relationships, indexes, constraints, and migration notes.

Design tables around access patterns and growth

Data Discovery and planning Planning Data

autohand -p "Design the database schema for this feature with indexes, constraints, and migration notes"

A schema proposal with relationships, indexes, migration plan, and validation queries.

Model a database schema with Autohand Code is a data modeling workflow that designs tables, relationships, indexes, constraints, defaults, migration sequencing, and verification queries from product access patterns. ### At a glance | Question | Answer | | --- | --- | | Best for | new data models, feature planning, high-volume tables, and schema reviews before migrations are written | | Primary inputs | Entities, lifecycle states, and user actions; Expected reads, writes, filters, joins, and growth; Database engine, ORM, migration system, and existing table conventions | | Autohand Code returns | A schema proposal with relationships, indexes, migration plan, and validation queries. | | Avoid when | the feature behavior is too vague to identify entities or access patterns | ### How Autohand Code handles this workflow 1. Extracts entities, relationships, ownership, and retention rules. 2. Maps access patterns to indexes and constraints. 3. Plans migration order, backfill shape, and rollback risk. 4. Returns verification SQL and app surfaces that must be updated. ### Best inputs - Entities, lifecycle states, and user actions - Expected reads, writes, filters, joins, and growth - Database engine, ORM, migration system, and existing table conventions ### Strong prompt autohand -p "Design the database schema for this feature with indexes, constraints, and migration notes" ### Autohand Code CLI options - Use `/skills use database-schema-design` for schema modeling patterns. - Run `autohand -p "Design the database schema for this feature with indexes, constraints, and migration notes"` before writing SQL. - Use `/plan` when schema, API, and admin UI changes need sequencing. ### Review before accepting A usable schema plan names entities, constraints, indexes, migration steps, and validation queries tied to product behavior. ### Source and validation signals Autohand AI maintains this workflow as first-party product guidance for Autohand Code. Use the [Autohand CLI Playbook](https://github.com/autohandai/code-cli/blob/main/docs/AUTOHAND_PLAYBOOK.md), [CLI reference](/docs/working-with-autohand-code/cli-reference.html), and [configuration reference](https://github.com/autohandai/code-cli/blob/main/docs/config-reference.md) when choosing between interactive mode, command mode, auto-mode, feature-enabled /goal, /settings, skills, MCP, and permission settings. The related resources below link to product docs and tutorials for the workflow, and the final answer should name repository-specific files, commands, outputs, or docs that a reviewer can verify. ### Frequently asked questions ### What is Model a database schema with Autohand Code? Model a database schema with Autohand Code is a data modeling workflow that designs tables, relationships, indexes, constraints, defaults, migration sequencing, and verification queries from product access patterns. ### When should a team use Model a database schema? Use it before creating a migration for data that will be queried, reported on, or retained long term. ### What evidence should reviewers check for Model a database schema? A usable schema plan names entities, constraints, indexes, migration steps, and validation queries tied to product behavior.

Skill Skilled: Database Schema Design Use schema, relationship, and indexing patterns. https://skilled.autohand.ai/skill/database-schema-design Tutorial Write Database Migrations Turn schema decisions into safe migrations. /docs/tutorials/write-database-migrations.html Guide Database Modernization Plan database changes with compatibility in mind. /docs/guides/database-modernization.html