policy-patterns

Implements POMDP-based reward shaping for LLM agents with formal guarantees.

1|Updated Jan 8, 2026
One-click install
npx skills add https://github.com/LaunchPadLab/ai-bank --skill policy-patterns
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: policy-patterns
Source: https://github.com/LaunchPadLab/ai-bank/tree/main/claude/skills/policy-patterns
Command: npx skills add https://github.com/LaunchPadLab/ai-bank --skill policy-patterns

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill solves the challenge of implementing correct, least-privilege authorization with Pundit by providing repeatable policy structure, role-based patterns, scoped access, and test-driven workflows for Rails applications.

Core Features & Use Cases

  • Authorization policy patterns: Create consistent ApplicationPolicy bases, CRUD permission methods, and reusable Scope resolution for collections.
  • Role + custom action modeling: Implement policies that support roles (visitor/user/owner/admin) and custom actions like moderate/approve/cancel/flag.
  • Temporal and dependency logic: Encode booking windows, cancellation deadlines, and “no destructive changes when dependencies exist” rules.
  • TDD-first approach: Guide you to write policy tests first (RED/GREEN), then wire controllers with authorize and policy_scope.

Quick Start

Ask your AI to help you implement a new Pundit policy for a Rails resource with role-based permissions, scoped index visibility, and TDD policy tests first.

Frequently Asked Questions about policy-patterns

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

FAQPage Schema
How do I implement role-based access control in Rails with Pundit?

Role-based access control in Rails with Pundit is implemented by creating an ApplicationPolicy base, defining CRUD permission methods for typical user roles, and using a deny-by-default policy structure to enforce least-privilege authorization.

How do I prevent cross-account data leaks in Pundit policy scopes?

Preventing cross-account data leaks in Pundit policy scopes requires implementing a Scope#resolve method that filters collection visibility based on the current user's role and account boundaries.

What is the best way to test Pundit authorization policies in Rails?

The best way to test Pundit authorization policies in Rails is a TDD-first workflow where you write focused policy tests first (RED/GREEN) that cover permitted attributes, custom actions, and role-based permissions before wiring controllers.

Can Pundit handle custom actions and temporal constraints like booking windows?

Pundit can handle custom actions like moderate, approve, cancel, and flag, as well as temporal and dependency-based constraints such as booking windows, cancellation deadlines, and rules preventing destructive changes when dependencies exist.

How do I wire Rails controllers to use Pundit policy scopes and authorization?

Wiring Rails controllers to use Pundit involves calling authorize for CRUD permissions and policy_scope for scoped collection authorization, ensuring controller actions enforce the deny-by-default policy structure.