spree-decorators

Generate decorators to extend Spree models and controllers without forking.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

This Skill helps users extend existing Spree models and controllers without forking, making customization easier and maintaining structural changes.

Core Features & Use Cases

  • Extend Models and Controllers: Add associations, validations, scopes, methods, and prepend hooks to Spree classes.
  • Use Cases: Use this Skill to enhance Spree functionality by adding new methods to models, customizing admin controllers, or modifying existing behavior.
  • Avoid Forking: Instead of modifying Spree source code, extend functionality with decorators, which can be overridden during upgrades.

Quick Start

Generate a decorator for Spree::Product with spree generate model_decorator Spree::Product.

Frequently Asked Questions about spree-decorators

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

FAQPage Schema
How do I extend Spree models without forking the core codebase?

You can extend Spree models without forking by using decorators to add associations, validations, scopes, and methods directly to Spree classes. This approach cleanly maintains customizations during framework upgrades without altering the core source code.

What is a Spree decorator and when do I need to use one?

A Spree decorator is a mechanism that allows you to modify and extend Spree models and controllers without altering the source code. You need to use one when adding new methods, validations, or prepend hooks to existing Spree classes.

How do I generate a decorator for a Spree product model?

To generate a decorator for a Spree product model, run the command spree generate model_decorator Spree::Product. This creates the necessary file structure to start adding associations, validations, and custom methods to your Spree class.

Can I customize Spree admin controllers without modifying the source code?

Yes, you can customize Spree admin controllers without modifying the source code by using decorators. Decorators allow you to prepend hooks and modify existing behavior in controllers while keeping the core Spree structure intact.

What is the best way to maintain Spree customizations during upgrades?

The best way to maintain Spree customizations during upgrades is to use decorators instead of forking. Decorators extend functionality by adding methods and validations separately, ensuring overrides are preserved when the core Spree codebase updates.

What are the limitations of using decorators for Spree controller modification?

While decorators extend Spree controllers without forking, they require careful management of prepend hooks and method overrides. Complex structural changes to Spree classes may still conflict with core updates if associations are heavily modified.