magento-db-schema

Generate Magento 2 db_schema.xml and Model/ResourceModel/Collection triads.

32|3|Updated Feb 20, 2026
One-click install
npx skills add https://github.com/furan917/magento-ai-toolkit --skill magento-db-schema
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: magento-db-schema
Source: https://github.com/furan917/magento-ai-toolkit/tree/main/skills/magento-db-schema
Command: npx skills add https://github.com/furan917/magento-ai-toolkit --skill magento-db-schema

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Create and modify Magento 2 declarative database schemas (db_schema.xml) and the Model/ResourceModel/Collection pattern, enabling clean, versioned database definitions and consistent data access layers.

Core Features & Use Cases

  • Declarative schema generation: produce db_schema.xml for tables, columns, keys, and constraints.
  • Model/ResourceModel/Collection triad: automatically generate the Magento data layer alongside the schema.
  • Upgrade-ready migrations: supports schema declarations used by Magento's declarative schema flow.

Quick Start

Describe the database table and fields you need, and I will generate the db_schema.xml along with the Model/ResourceModel/Collection trio.

Frequently Asked Questions about magento-db-schema

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I generate a Magento 2 db_schema.xml for a new custom module table?

Magento 2 declarative db_schema.xml generation requires describing your table and fields. The Skill produces the schema XML, whitelist, and Model/ResourceModel/Collection files to establish a versioned database definition and data access layer.

What is the Magento 2 declarative schema and when do I use db_schema.xml?

Magento 2 declarative schema uses db_schema.xml to define tables, columns, and constraints without upgrade scripts. It is needed when creating new tables, adding fields, or migrating existing structures to a versioned database definition.

Can I automatically generate the Model, ResourceModel, and Collection when creating a Magento database table?

Yes, generating the Model, ResourceModel, and Collection triad is fully supported. By describing your table for the db_schema.xml, the Skill produces the corresponding Magento data access layer files following conventional module structure.

How do I add a new column to an existing Magento 2 table using declarative schema?

Adding a column to an existing Magento 2 table involves declaring the new field in db_schema.xml. The Skill processes this schema modification and supports upgrade-ready migrations using Magento's declarative schema flow.

Does Magento 2 declarative schema require a whitelist for db_schema.xml?

Yes, a whitelist is required for Magento 2 declarative schemas. The Skill satisfies this requirement by producing the db_schema.xml alongside its corresponding whitelist to ensure clean, versioned database definitions.

What is the best way to structure a Magento 2 module for database access layers?

The conventional approach is using the Model, ResourceModel, and Collection pattern. The Skill generates this triad alongside db_schema.xml, ensuring a consistent and conventional Magento module structure for your data access layer.