superpowers-sage:acorn-eloquent

Create Eloquent ORM models, migrations, and relationships for Acorn projects.

13|Updated Mar 19, 2026
One-click install
npx skills add https://github.com/hekivo/superpowers-sage --skill superpowers-sage-acorn-eloquent-hekivo
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: superpowers-sage:acorn-eloquent
Source: https://github.com/hekivo/superpowers-sage/tree/main/skills/acorn-eloquent
Command: npx skills add https://github.com/hekivo/superpowers-sage --skill superpowers-sage-acorn-eloquent-hekivo

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) and assets (resource) components.

What problem does it solve?

This Skill prevents broken or unsafe Eloquent usage when working with Acorn inside WordPress, especially for custom tables and read-only access to WordPress core tables.

Core Features & Use Cases

  • Safe model conventions for custom tables: Explicit $table mapping with WordPress prefixes, plus controlled $fillable and $casts for reliable data modeling.
  • Migrations and relationships for custom schemas: Acorn-compatible migration patterns and practical relationship definitions (hasMany, belongsTo, belongsToMany, polymorphic).
  • Query scopes and performance guardrails: Reusable local/global scopes, safe raw queries, and eager-loading guidance to avoid N+1 issues.
  • WP-aware safety rules: Explicitly avoids writing to WP core tables via Eloquent and instead directs users to WP APIs for hook-triggered writes.

Quick Start

Create a PascalCase Acorn Eloquent model and (optionally) its migration by running the model generator with: bash skills/acorn-eloquent/scripts/create-model.sh Testimonial --migration.

Frequently Asked Questions about superpowers-sage:acorn-eloquent

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

FAQPage Schema
How do I create Eloquent models for custom WordPress tables in Acorn?

Acorn Eloquent models handle custom WordPress table schemas by enforcing explicit `$table` mapping with WP prefixes, `$fillable` for mass assignment, and `$casts` for type casting. This ensures safe data modeling within Acorn projects while preventing uncontrolled attribute updates.

Can I use Eloquent to write data directly to WordPress core tables?

You should not write to WordPress core tables via Eloquent. The Skill enforces read-only constraints for WP core tables and directs you to use native WordPress APIs for hook-triggered write operations, preventing unsafe data modifications.

How do I run database migrations for Acorn Eloquent models?

You run Acorn Eloquent database migrations via `lando acorn` for deterministic schema execution. The Skill provides Acorn-compatible migration patterns to safely create and modify custom database schemas within your WordPress project.

What's the best way to define relationships like Post to Meta in Acorn Eloquent?

The best way to define Acorn Eloquent relationships is using `hasMany`, `belongsTo`, `belongsToMany`, and polymorphic patterns. The Skill specifically guides defining WordPress Post-to-Meta relationships to ensure accurate relational data retrieval.

How do I avoid N+1 query issues when querying Eloquent models in WordPress?

To avoid N+1 query issues in Acorn Eloquent, apply eager-loading guidance and use reusable local or global query scopes. These performance guardrails ensure efficient database queries when filtering and reporting on WordPress data.