superpowers-sage:acorn-routes

Implement Acorn routes for WordPress/Sage with middleware and model binding.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

Acorn routing in a Sage/Bedrock WordPress project can easily break permalink behavior, conflict with rewrite rules, or mis-handle middleware, model binding, and JSON responses.

Core Features & Use Cases

  • Route-first endpoint design: create clean Acorn routes in routes/web.php and routes/api.php for HTML pages and JSON APIs without touching functions.php.
  • Controller-structured routing: use controller classes (resource controllers, API controllers, invokable controllers) and always name routes so route() helpers and redirects work reliably.
  • Middleware, model binding, and API correctness: apply Laravel middleware for auth/access control, leverage route model binding (including slug bindings), and ensure API clients receive proper JSON responses (including Accept: application/json) with rate limiting and token auth.

Quick Start

Generate a resource controller for JSON endpoints by running: bash skills/acorn-routes/scripts/create-controller.sh ProjectController --api

Frequently Asked Questions about superpowers-sage:acorn-routes

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

FAQPage Schema
How do I create Acorn routes in WordPress without breaking permalinks?

To create Acorn routes safely, define them in routes/web.php or routes/api.php and use route-group prefixing to avoid rewrite rule conflicts. This prevents breaking WordPress permalink behavior while adding custom endpoints.

How do I return JSON API responses from an Acorn route in Sage?

Acorn routes can return JSON API responses by using controller classes structured for APIs and ensuring clients send the Accept: application/json header. The Skill generates API controllers to handle these responses correctly with proper middleware.

Does Acorn routing support Laravel route model binding for WordPress posts?

Acorn routing supports optional route model binding for both Eloquent models and WordPress posts, including slug bindings. This allows automatic resolution of models from route parameters within your controller methods.

How do I generate a resource controller for Acorn routes?

Generate a resource controller for Acorn routes by running the create-controller.sh script with the desired controller name and the --api flag. This creates a structured controller class for your JSON endpoints.

Can I use Laravel middleware for auth and rate limiting in Acorn routes?

Acorn routes support Laravel middleware chains for authentication and access control, along with rate limiting and token auth. This secures your custom JSON endpoints within the WordPress environment.

Why are my Acorn controller routes failing after caching?

Controller-based Acorn routes must be cache-safe to function after caching. Verify your routes using Lando acorn route:list and route:cache commands, ensuring all routes are properly named for reliable redirects.