/kivo-wise:acorn-datafrom kivo-wise
Guides data storage and querying via Acorn's Eloquent layer: models, custom tables, migrations, seeders, factories, and DB facade. Helps choose between post meta, options, custom post types, and custom tables.
Ships in kivo-wise. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Acorn registers Laravel's database layer with a default wordpress connection built from the WordPress constants (DB_HOST, DB_NAME, DB_USER, DB_PASSWORD, DB_CHARSET) and the WordPress table prefix ($wpdb->prefix). Every Eloquent model, DB::table() call and migration on that connection is prefixed automatically.
Runner placeholders ({{runner.wp}}, {{runner.acorn}}, {{runner.composer}}, {{runner.test}}) come from the session context; on Lando they default to lando wp, lando wp acorn, lando composer and the project's test tooling.
WP_Query expresses badly.| Data | Native mechanism (verify in wp-includes/) | Custom table when |
|---|---|---|
| Content editors manage, with URLs, revisions, search | custom post type + post meta (register_post_type, update_post_meta) | never for this case |
| A few site-wide settings | options (get_option, autoload off for large values) | never |
| Per-user settings | user meta | never |
| Per-term data | term meta | never |
| High-volume rows, queues, logs, joins, unique constraints, rows nobody edits in wp-admin | none fits well | yes: migration + model |
Write the reason in the change when you choose a custom table.
config/database.php in the base path if present, otherwise Acorn's default (wordpress connection, prefix from $wpdb->prefix).app/Models) and migrations (database/migrations) in the base path.| Item | sage-theme | acorn-mu-plugin | radicle-app |
|---|---|---|---|
| Models | app/Models in the theme, App\Models | app/Models in the plugin, <Namespace>\Models | app/Models at the root, App\Models (the starter already ships models over WordPress tables) |
| Migrations, seeders | database/migrations, database/seeders in the theme | same folders in the plugin | same folders at the root |
Environment for migrate | app.env = WP_ENV, else production | same; projects without WP_ENV are always production, so migrate asks for confirmation or --force even locally | Bedrock-style WP_ENV is set per environment |
| Deploy hook | the theme's deploy script | the image or release script that starts the app | the project's deploy script |
Commands: write every command with the runner value from the session context filled in (for example lando wp acorn optimize:clear), never a bare wp/composer/php/npm, never the placeholder, never "prefix with lando if you use it". Commands that run in CI or a deploy script go in a separate block labelled with where they run.
acorn-scaffolding or plain WordPress APIs.{{runner.acorn}} make:migration create_form_submissions_table. In up() use the unprefixed name (Schema::create('form_submissions', …)); the connection adds the prefix, giving wp_form_submissions. Always write down(). Details: references/migrations.md.{{runner.acorn}} migrate (add --force when app.env is production), then {{runner.acorn}} migrate:status. The log table is migrations on the same connection (wp_migrations with the default prefix); migrate:install creates it if missing.{{runner.acorn}} make:model FormSubmission (Acorn 6.2 has make:model; it has no make:factory, so do not pass --factory or --all). Set $table without the prefix only when the name differs from the plural snake case, list $fillable, declare $casts. For WordPress tables: $table = 'posts', $primaryKey = 'ID' (or meta_id, term_id, umeta_id), public $timestamps = false. Details: references/models.md.wp_insert_post(), update_post_meta(), wp_update_user() and friends so hooks, caches and revisions stay correct. Use Eloquent for reads there, and for reads and writes on your own tables.clean_*_cache(); better, do not write there.database/seeders ({{runner.acorn}} make:seeder, {{runner.acorn}} db:seed --class=…). Factories need fakerphp/faker as a dev dependency and hand-written classes: references/factories-seeders.md.{{runner.acorn}} migrate --force once per release, after the new code is in place and caches are rebuilt (optimize), before traffic switches. With several instances, run it from one job or one instance only, and keep migrations backward compatible with the previous release while both run.{{runner.acorn}} migrate:status shows every migration as Ran.{{runner.wp}} db query "SHOW TABLES LIKE '%form_submissions'" lists the table exactly once, with the expected prefix (a wp_wp_ hit means a doubled prefix).{{runner.wp}} eval 'var_dump(App\Models\FormSubmission::query()->count());' (with your namespace) runs without SQL errors. Acorn providers boot for every WP-CLI command, so facades and models work inside wp eval.{{runner.test}} against a test database, never the shared one.| Symptom | Cause | Fix |
|---|---|---|
Table 'db.wp_wp_x' doesn't exist | $table or Schema::create() includes the prefix, which the connection adds again | Use unprefixed names everywhere on the wordpress connection |
Unknown column 'updated_at' | WordPress tables have no Laravel timestamps | public $timestamps = false |
find() returns null on posts or users | Default primary key id | $primaryKey = 'ID' |
migrate stops with "Application in production" | app.env resolves to production (no WP_ENV) | Pass --force when you intend to run it; set WP_ENV where the project supports it |
Migration table not found | Fresh database or other connection | {{runner.acorn}} migrate:install, check DB_CONNECTION |
Command "make:factory" is not defined | Acorn does not register the factory generator | Write the factory class by hand |
Call to undefined function fake() | fakerphp/faker not installed | {{runner.composer}} require --dev fakerphp/faker in the base path |
| Edited post meta does not show on the site | Write bypassed WordPress, object cache still holds the old value | Write through update_post_meta(), or clean_post_cache() after the write |
| Mass assignment error | Attribute not in $fillable | Add it; do not use $guarded = [] |
| Two instances run the same migration at once | Migrations run on every container start | Move migrate --force to one release job |
dropColumn, migrate:fresh, migrate:reset, db:wipe, migrate:rollback on production): stop and ask.DB: ask first and name the WordPress API you are bypassing and why.acorn-background. Endpoints over them: acorn-routes-api.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub hekivo/kivo-wise --plugin kivo-wise25 skills in this plugin
/acf-nativeUse when building or reviewing ACF field behaviour or the post save flow - validate before publish, required/maxlength settings, hiding a field (conditional_logic), dynamic choices, running code after save - acf/validate_value, acf/load_field, acf/prepare_field, acf/save_post, acf.getField, wp_insert_post_data, save_post - including projects where ACF may not be installed (Radicle). Maps each need to the native mechanism verified in local source. For ACF Composer scaffolding use acorn-scaffolding; for escaping ACF output use wp-security-escaping./acorn-backgroundUse when work must run outside the request, on a schedule, or be logged in an Acorn project - WP-Cron vs Action Scheduler vs Laravel queues (make:job, ShouldQueue, queue:work, failed_jobs), console commands (make:command, wp acorn <command>), Schedule::command and schedule:run from system cron, Laravel Redis and Cache vs transients, logging channels (Log::, LOG_CHANNEL, stderr, storage/logs). For tables use acorn-data; for object cache tuning use wp-performance./acorn-livewireUse when creating, wiring or fixing a Livewire 4 component in an Acorn app - make:livewire --class, app/Livewire, wire:model modifiers (.live, .blur, .debounce), wire:key, attributes (#[Locked]/#[Computed]/#[Validate]/#[On]), lifecycle hooks, @livewireScripts, the /livewire-<hash>/update route, installing livewire/livewire on Radicle. For errors that start after a deploy (419, RangeError, stale HTML) use roots-debugging; for JSON endpoints use acorn-routes-api; for Alpine-only UI use tailwind-vite-assets./acorn-routes-apiUse when adding or fixing an HTTP endpoint or virtual page in an Acorn project - Acorn routes (routes/web.php, routes/api.php, withRouting, Route::get, controllers, middleware, route:list) versus register_rest_route (permission_callback, /wp-json, X-WP-Nonce); webhooks, JSON APIs, CORS, throttle, API-key or JWT auth, "Target class [auth] does not exist", 404 on a defined route. For Livewire use acorn-livewire; for models use acorn-data; for nonces and capabilities in depth use wp-security-escaping./acorn-scaffoldingUse when generating a new artifact in an Acorn project - a Gutenberg block (ACF Composer acf:block, InnerBlocks, $styles, or a native block.json block via make:block), a post type or taxonomy (Poet config/poet.php, config/post-types.php), an ACF field group, partial or options page (acf:field, acf:options), a provider, View Composer, Blade component or command (make:provider, make:composer, make:component). For changing existing Acorn code use acorn-stack; for ACF hooks use acf-native; for block CSS and JS use tailwind-vite-assets./acorn-stackUse when changing how Acorn boots or is wired on a Sage theme, Acorn mu-plugin or Radicle root - Application::configure(), withProviders(), withRouting(), ACORN_BASEPATH, base_path(), provider register() vs boot(), where providers are registered (functions.php, config/app.php, composer.json extra.acorn.providers), config publishing, optimize:clear, "'acorn' is not a registered wp command". For generating providers, blocks or composers use acorn-scaffolding; for hook timing use wp-hooks-lifecycle; for unexplained breakage use roots-debugging.Other plugins' skills for the same job