action-policy-coder

Automate ActionPolicy policy creation, scoping, and GraphQL/ActionCable integration for Rails authorization.

47|11|Updated Nov 26, 2025
One-click install
npx skills add https://github.com/majesticlabs-dev/majestic-marketplace --skill action-policy-coder
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: action-policy-coder
Source: https://github.com/majesticlabs-dev/majestic-marketplace/tree/main/plugins/majestic-rails/skills/action-policy-coder
Command: npx skills add https://github.com/majesticlabs-dev/majestic-marketplace --skill action-policy-coder

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Proactive authorization with ActionPolicy, including policies, scopes, caching, and GraphQL/ActionCable integration.

Core Features & Use Cases

  • Policy classes with inheritance and rules
  • Authorization in controllers and scopes with allowed_to?
  • Caching for performance
  • I18n for localized failure messages
  • GraphQL and ActionCable integration

Quick Start

Create a PostPolicy with index?/show?/update? rules and use authorize! in the controller.

Frequently Asked Questions about action-policy-coder

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

FAQPage Schema
How do I set up authorization policies in a Rails application?▼

Authorization policies in Rails define rules for what users can do. Create policy classes with methods like index?, show?, and update?, then use authorize! in controllers to enforce them. ActionPolicy automates this pattern with templates and inheritance support.

Can I use authorization policies with GraphQL?▼

Yes, ActionPolicy integrates with GraphQL. Apply policies to GraphQL resolvers and fields using the same authorize! and allowed_to? methods you use in controllers, enabling consistent authorization across your GraphQL API.

How do I scope database queries based on authorization rules?▼

Use relation_scope hooks in your policies to automatically filter records based on what the current user is allowed to access. This prevents N+1 queries and keeps authorization logic centralized in policy classes.

What's the best way to cache authorization decisions in Rails?▼

ActionPolicy provides caching hooks to store authorization results and avoid repeated policy checks. Configure caching in your policy classes to reduce overhead, especially for frequently-checked rules in high-traffic applications.

Does ActionPolicy support localized failure messages?▼

Yes, ActionPolicy integrates with I18n to provide translated authorization failure messages. Define localized strings in your locale files and ActionPolicy automatically uses them when authorization rules are denied.

How do I test authorization policies in Rails?▼

ActionPolicy provides testing patterns and helpers to verify policy rules work correctly. Write tests that check which actions are allowed or denied for different user roles, ensuring authorization logic is reliable before deployment.