spree-resource

Generate Spree models, migrations, and API endpoints with Rails generators.

4|Updated Jun 9, 2026
One-click install
npx skills add https://github.com/spree/agent-skills --skill spree-resource
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: spree-resource
Source: https://github.com/spree/agent-skills/tree/main/skills/spree-resource
Command: npx skills add https://github.com/spree/agent-skills --skill spree-resource

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

This Skill streamlines the process of adding new models, database tables, and API endpoints to Spree projects, reducing manual effort and speeding up development.

Core Features & Use Cases

  • Model Generation: Automatically create models, migrations, and controllers for new resources.
  • API Endpoint Creation: Generate Store and Admin API controllers, serializers, and routes.
  • Customization: Offers flags to control the scope of generated components (e.g., Store API, Admin API, soft deletes).
  • Use Case: When you need to add a new product model with an API endpoint to your Spree store, this Skill can generate all the necessary components with a single command.

Quick Start

Generate a new product model and API endpoint with the following command: spree generate api_resource Product name:string:uniq active:boolean --writable.

Frequently Asked Questions about spree-resource

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

FAQPage Schema
How do I add new models and API endpoints to my Spree Rails project?

To add new models and API endpoints to a Spree project, use an automated generator that creates database migrations, controllers, serializers, and routes in a single command. This streamlines Rails development by reducing manual setup effort for new resources.

What is the best way to generate a Spree API resource with specific attributes?

The best way to generate a Spree API resource is by running a command like `spree generate api_resource Product name:string:uniq active:boolean --writable`. This command automatically creates the model, database migration, and Store API controllers for the specified attributes.

Do I need the Spree gem installed to generate new Store and Admin API controllers?

Yes, you need the Spree gem installed in your Rails environment. The generation process relies on Spree and Rails generators to automatically create the required Store API and Admin API controllers, serializers, and database migrations for your new resources.

Can I customize what components are generated when adding a new model to Spree?

Yes, you can customize the generation scope by passing specific flags in the command. These flags allow you to control whether the generator includes the Store API, Admin API, or soft deletes when creating the new Spree models and endpoints.

Does generating Spree models and migrations automatically create the API routes?

Yes, generating Spree models and migrations automatically creates the API routes. The generator handles the full integration by adding Store and Admin API controllers, serializers, and the corresponding routing configurations seamlessly into your Rails project.