admin-listing
Skill4 starsChanged 56 days agoMITView on GitHub
Generate a Magento 2 adminhtml UI-component listing/grid: `ui_component/{entity}_listing.xml` plus DataProvider, columns, actions column, and mass actions, wired to an existing edit form. Use to add or scaffold an admin grid, data grid, listing page, filters, or mass actions. Pairs with magento2-tools:admin-form (the edit form); for the form itself use magento2-tools:admin-form. Detects edition and flags Commerce-only grid features.
In this repository35 other files it gives its agents.
- a11y-auditSkill
- admin-formSkill
- auditSkill
- breeze-adaptSkill
- breeze-compatSkill
- breeze-themeSkill
- cli-commandSkill
- contextSkill
- data-migrationSkill
- debugSkill
- deploySkill
- docsSkill
- eav-attributeSkill
- extension-pointSkill
- featureSkill
- fixSkill
- frontendSkill
- graphqlSkill
- i18nSkill
- indexerSkill
- lintSkill
- marketplaceSkill
- message-queueSkill
- module-createSkill
- perf-auditSkill
- releaseSkill
- remediateSkill
- reviewSkill
- securitySkill
- system-configSkill
- test-generateSkill
- triageSkill
- upgradeSkill
- webapiSkill
- widgetSkill
The file
We split this skill into the rules it gives an agent
9 rules. About 0 are common, 3 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 38
Test-first: Write the failing test before the listing code (red → green) and watch it fail for the right reason.
- Distinctive: line 56
Ask for any missing values:
- Very specific: line 78
3A — Write the failing test (RED): Before any listing code, add a test under Test/Integration/ that boots the DataProvider and asserts …
- Very specific: line 86
3B — Generate (GREEN): Write the minimal files from templates/ to turn 3A green:
- Very specific: line 102
Run the Phase 3A test with {ctx.runner} vendor/bin/phpunit.
- Very specific: line 104
Apply the shared module-hygiene baseline (required): After generating or modifying PHP files, run …
- Distinctive: line 118
Test path + red→green evidence (or recorded gap)
- Very specific: line 194
All templates follow the placeholder registry in context/references/placeholder-schema.md using the {Vendor} / {ModuleName} / {EntityName} …
- Distinctive: line 206
No Commerce-only wiring emitted on Open Source.
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Magento 2 Adminhtml Listing
Scaffold a backend entity grid/listing the modern way — a declarative
view/adminhtml/ui_component/{entity}_listing.xml bound to a DataProvider, with an actions
column, mass-action controllers, and an Index controller — optionally wired to a sibling edit
form. Never the legacy Magento\Backend\Block\Widget\Grid.
Core Rules
- Declarative UI component only. The listing is XML (
ui_component/{entity}_listing.xml) + a PHPDataProvider. Never generateBlock\Widget\Grid/Block\Widget\Grid\Container. - The naming contract prevents the empty grid. These five names MUST agree, or the grid
renders empty with no error:
- file name →
{vendor_lower}_{module_lower}_{entity}_listing.xml js_config→provider→{LISTING}.{SOURCE}whereLISTING={vendor_lower}_{module_lower}_{entity}_listingandSOURCE={LISTING}_data_source<settings>→<deps>→<dep>→{LISTING}.{SOURCE}<dataSource name>and inner<dataProvider name>→ both{SOURCE}<columns name>→{vendor_lower}_{module_lower}_{entity}_columns(referenced by<spinner>)
- file name →
- Default DataProvider is
AbstractDataProvider+CollectionFactory.AbstractDataProvider::getData()already returns the grid shape (['items' => [...], 'totalRecords' => N]) — do NOT overridegetData(). InjectCollectionFactoryand assign$this->collection. Seereferences/dataprovider-wiring.md. - Optional SearchResult path. For joins or large grids, swap the PHP DataProvider for the generic
Magento\Framework\View\Element\UiComponent\DataProvider\DataProviderplus adi.xmlCollectionFactory.collectionsmap pointing toGrid\Collection extends SearchResult. Thedi-listing.xmltemplate handles this. Seereferences/dataprovider-wiring.mdandreferences/grid-collection.md. selectionsColumnis required for mass actions. Without<selectionsColumn name="ids">, the mass-action checkboxes never appear and mass actions are silently inert.actionsColumnmust carry the correctindexField. TheindexFieldsetting in<actionsColumn>must match the primary key column (e.g.faq_idforfaq). A mismatch produces blank or broken edit/delete URLs.- Reuse the form's acl/menu/routes when present. If
admin-formalready createdetc/adminhtml/routes.xml,etc/acl.xml, andetc/adminhtml/menu.xmlfor the same module, do not overwrite them — merge only the listing's ACL resource if absent. Create them when the listing is standalone. When reusing, the listing's own generated artifacts must reference the FORM's route-id ({vendor_lower}_{entity}) and ACL resource ({Vendor}_{ModuleName}::{entity}) — in theIndex/mass-action controllers'ADMIN_RESOURCE, the<aclResource>in{entity}_listing.xml, the layout handle, the menuaction/resource, and the actions-column Edit/Delete/Add-New URLs — not this skill's standalone{vendor_lower}_{module_lower}/::maindefaults, which would not match what the form created (an admin route-404 / access-denied on Edit and Delete). The two skills must resolve to one route-id and one base ACL resource for the same module. - Layout uses
admin-1column. The listing layout (layout-index.xml) must declarelayout="admin-1column"— a full-width grid.admin-2columns-leftleaves an empty left column. - Never assume a running Magento instance. Generate files; do not call
bin/magentoor hit the database during generation.setup:upgradeis a post-gen command listed in the Phase 5 report. - Edition awareness. Detect
{ctx.edition}. A basic grid is Open Source-compatible. Flag Commerce-only features (e.g. advanced column types, staging) and gate them. Seereferences/edition-differences.md. - Test-first. Write the failing test before the listing code (red → green) and watch it fail for the right reason. See
context/references/tdd-discipline.md. - Coding style. Generated PHP follows PER-CS 3.0 baseline, Magento 2 standard taking precedence;
--standard=Magento2PHPCS is the gate. Seecontext/references/php-coding-style.md. - Source of truth. Generate from templates → shared references → baked-in Magento 2 knowledge
→ official Magento/Adobe docs (live-fetched only when uncertain). Do NOT read, grep, or "study"
other modules under
app/code/vendor/*/Magento core to infer conventions, entity shapes, naming, or wiring. Narrow exceptions: the target module/class of this operation, and the specific contract of a module this code explicitly depends on. Affirm sources in the final report. Seecontext/references/source-of-truth.md.
Workflow
Phase 0 — Context Resolution
Invoke context. Capture {ctx}. Abort with a clear message if the target module does
not exist (offer module-create) or if {ctx.magento_root} is unresolved.
Phase 1 — Resolve Inputs
Ask for any missing values:
| Input | Default | Notes |
| Target module | (ask) | Existing {Vendor}_{Module}; offer module-create if absent |
| Entity name | (ask) | PascalCase {EntityName} + lowercase {entity} (e.g. Faq/faq) |
| Primary key column | {entity}_id | The id column referenced by selectionsColumn and actionsColumn; matches the paired form's getParam('{entity}_id') |
| Columns | (ask) | Each: name, label, column type, filter type, sortOrder |
| Has status field? | (ask) | Enables MassStatus controller + enable/disable mass actions |
| Paired form? | (ask) | Name of the edit form (used for actions column routes); "none" if standalone |
| Performance path? | No | Use SearchResult + di map when joins / large tables are needed |
| ACL resource | {Vendor}_{Module}::main | Guards Index + mass controllers |
Consult references/columns-and-types.md, references/edition-differences.md while asking.
Phase 2 — Plan
Present the file plan (every path to create/modify, surfaces enabled, ACL/route/menu touches, DataProvider wiring chosen). Wait for "proceed."
Phase 3 — Test First, then Generate
3A — Write the failing test (RED). Before any listing code, add a test under Test/Integration/
that boots the DataProvider and asserts getData() returns the grid shape
(['items' => [...], 'totalRecords' => N]), plus a controller test (Index returns HTTP 200 and
the correct page title; MassDelete processes the correct collection). If no test DB is available,
fall back to a unit test of the DataProvider construction and record the gap in the Phase 5
report. Run it and confirm it fails for the right reason. See
context/references/tdd-discipline.md.
3B — Generate (GREEN). Write the minimal files from templates/ to turn 3A green:
templates/listing.xml→view/adminhtml/ui_component/{vendor_lower}_{module_lower}_{entity}_listing.xmltemplates/data-provider.php→Ui/DataProvider/{EntityName}DataProvider.phptemplates/column-actions.php→Ui/Component/Listing/Column/{EntityName}Actions.phptemplates/controller-index.php→Controller/Adminhtml/{EntityName}/Index.phptemplates/controller-mass-delete.php→Controller/Adminhtml/{EntityName}/MassDelete.phptemplates/controller-mass-status.php→Controller/Adminhtml/{EntityName}/MassStatus.php(when status surface enabled)templates/layout-index.xml→view/adminhtml/layout/{vendor_lower}_{module_lower}_{entity}_index.xmltemplates/routes.xml,acl.xml,menu.xml(created-if-absent / merged-from-form)- Optional:
templates/di-listing.xml+templates/grid-collection.php(SearchResult path)
Phase 4 — Verify
xmllint --noouton every XML ({ctx.tools.xmllint}): listing, layout, routes, acl, menu, di.php -lon every PHP file.- Run the Phase 3A test with
{ctx.runner} vendor/bin/phpunit; confirm it now passes; run the module suite to confirm no regressions. - Confirm the five naming-contract names agree (the empty-grid check).
- Apply the shared module-hygiene baseline (required). After generating or modifying PHP files, run
${CLAUDE_PLUGIN_ROOT}/skills/context/scripts/add-license-headers.sh {ctx.magento_root}/app/code/{Vendor}/{Module} {Vendor}to stamp the standard copyright header onto every new.php(idempotent — it skips files that already carry it). If you add acomposer.jsonrequireentry, resolve a bounded constraint via${CLAUDE_PLUGIN_ROOT}/skills/context/scripts/resolve-dep-constraint.sh <vendor/package>— never"*". Seecontext/references/module-hygiene.md. - Optionally run
reviewon the module → zero Critical/High. scripts/verify-listing.shruns the XML + PHP lints in one pass.
Phase 5 — Report
Brief Markdown saved to {output_root}/adminhtml-listings/{Vendor}_{Module}-{entity}-listing-{date}.md:
- Files generated/modified + surfaces enabled
- Test path + red→green evidence (or recorded gap)
- Post-gen commands:
bin/magento setup:upgrade(if di/routes/menu/acl changed), cache flush,setup:di:compilenote for production - The listing's admin URL + ACL resource to grant
- Links to
reviewandtest-generate
Docs may now be stale. This change modified module code. Run
docs --module={Vendor}_{Module}to refresh the module's README, CHANGELOG, anddocs/*.md(technical reference, guides, and API references as applicable).
Inputs
/admin-listing --module=Acme_Faq --entity=Faq --primary=faq_id --status --paired-form=acme_faq_faq [--docs-root=<path>]--docs-root=<path> — output-root override; see "Output root" below.
Outputs
{ctx.magento_root}/app/code/{Vendor}/{Module}/view/adminhtml/ui_component/{vendor_lower}_{module_lower}_{entity}_listing.xml
{ctx.magento_root}/app/code/{Vendor}/{Module}/Ui/DataProvider/{EntityName}DataProvider.php
{ctx.magento_root}/app/code/{Vendor}/{Module}/Ui/Component/Listing/Column/{EntityName}Actions.php
{ctx.magento_root}/app/code/{Vendor}/{Module}/Controller/Adminhtml/{EntityName}/Index.php
{ctx.magento_root}/app/code/{Vendor}/{Module}/Controller/Adminhtml/{EntityName}/MassDelete.php
{ctx.magento_root}/app/code/{Vendor}/{Module}/Controller/Adminhtml/{EntityName}/MassStatus.php # status surface
{ctx.magento_root}/app/code/{Vendor}/{Module}/view/adminhtml/layout/{vendor_lower}_{module_lower}_{entity}_index.xml
{ctx.magento_root}/app/code/{Vendor}/{Module}/etc/adminhtml/{routes,menu}.xml
{ctx.magento_root}/app/code/{Vendor}/{Module}/etc/acl.xml
{ctx.magento_root}/app/code/{Vendor}/{Module}/etc/di.xml # optional: SearchResult path
{ctx.magento_root}/app/code/{Vendor}/{Module}/Model/ResourceModel/{EntityName}/Grid/Collection.php # optional
{ctx.magento_root}/app/code/{Vendor}/{Module}/Test/Integration/.../{EntityName}ListingTest.php # test-first
{output_root}/adminhtml-listings/{Vendor}_{Module}-{entity}-listing-{date}.md{output_root} defaults to .docs ({ctx.docs_root}), anchored at the project root, never
under {ctx.magento_root}. See the Artifact location rule in context/SKILL.md.
Output root (--docs-root)
This skill accepts --docs-root=<path> (see
context/references/artifact-layout.md). When set, write the run report (and any
report artifacts) under <path>/adminhtml-listings/; otherwise default to
{ctx.docs_root}/adminhtml-listings/. feature passes this so a
feature run's reports collect under its folder.
Reference Files
references/listing-xml-anatomy.md—{entity}_listing.xmlstructure + the 5-place naming contract.references/dataprovider-wiring.md— defaultAbstractDataProviderpath vs optionalSearchResult+di path.references/columns-and-types.md— text/select/date/actionsColumn, filters, options sources, sortOrder.references/mass-actions.md— selectionsColumn + massaction + MassDelete/MassStatus controllers + Filter pattern.references/grid-collection.md— SearchResult collection (joins, mainTable/resourceModel,_initSelect).references/controllers-and-routing.md— Index + mass controllers, ADMIN_RESOURCE, routes, layout handles.references/edition-differences.md— Open Source vs Adobe Commerce grid notes.references/pairing-with-form.md— actions column / Add-New button targeting the form's routes; reusing acl/menu/routes;admin-1columnlayout.references/pitfalls.md— empty grid, inert mass actions, broken actionsColumn, wrong layout handle.context/references/tdd-discipline.md— shared test-first loop (Phase 3A).context/references/source-of-truth.md— source-of-truth hierarchy + the no-unrelated-module-scanning rule (allowed reads, live-doc fetch protocol, report affirmation).
Templates
templates/listing.xmltemplates/data-provider.phptemplates/column-actions.phptemplates/controller-index.phptemplates/controller-mass-delete.phptemplates/controller-mass-status.phptemplates/layout-index.xmltemplates/routes.xml,templates/acl.xml,templates/menu.xmltemplates/di-listing.xml(optional: SearchResult path)templates/grid-collection.php(optional: SearchResult path)
All templates follow the placeholder registry in
context/references/placeholder-schema.md using the {Vendor} / {ModuleName} /
{EntityName} / {entity} / {vendor_lower} / {module_lower} convention. Every token used
must be registered there — tests/test-placeholder-tokens.sh enforces it.
Acceptance Criteria
- The five naming-contract names agree; the grid loads rows and paginates.
selectionsColumnpresent andactionsColumncarries the correctindexField.- DataProvider returns the grid shape without overriding
getData(). acl.xmlhas notranslateattribute; every XML passesxmllint --noout.- A test asserting DataProvider construction + grid shape and the Index controller render was written and watched to fail before the listing existed, and passes after (or the gap is recorded).
- No Commerce-only wiring emitted on Open Source.
- Passes
reviewwith zero Critical/High findings.
Common Pitfalls Handled
| Pitfall | How the skill avoids it |
| Empty grid | The five-name naming contract is generated consistently |
| Mass actions inert | selectionsColumn always generated before any <massaction> element |
| Broken edit/delete URLs | actionsColumn indexField matches the primary key column |
| Wrong layout (empty left column) | admin-1column declared in layout-index.xml |
| DataProvider returns wrong shape | AbstractDataProvider::getData() not overridden — grid shape by default |
xmllint fails on acl.xml | No translate attribute on <resource> |
| Empty grid on SearchResult path | di.xml collections map key matches {SOURCE} name byte-for-byte |
| Commerce-only features on Open Source | Edition checked in Phase 1; advanced features gated |
Legacy Block\Widget\Grid | Skill refuses; declarative UI component only |
Related Skills
| Phase | Skill |
| 0 | context |
| upstream | module-create — create the module first if absent; defers here for standalone grids |
| sibling | admin-form — the edit form this listing's actions column links to |
| downstream | test-generate — fuller unit/integration/MFTF coverage |
| gate | review — acceptance gate (zero Critical/High) |
| (caller) | feature — the admin-listing slice of a feature |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

