.fyi
SkillsMCPPluginsSubagents

Browse by category

DevOps & CI/CD SkillsProductivity & Workflow SkillsOther SkillsProduct & Project Management SkillsDocumentation & Knowledge SkillsCode Review & Refactor SkillsBackend & APIs SkillsAgent Meta & Communication SkillsResearch SkillsSecurity SkillsUX UI & Design SkillsTesting & QA SkillsSee all →

Every Claude Code skill, MCP server, plugin and subagent in one directory. Searchable, comparable, and one command from installed. Live stats from GitHub, npm and PyPI.

We're on Product HuntYour agent's app storeCheck it out →
Agent SkillsMCP ServersPluginsSubagentsCoding Agents
CollectionsOfficial publishersGlossaryFAQBlogSearchSavedFeedback
PrivacyTermsllms.txtSitemap

made with ♥ · © 2026 aaaa.fyi

Independent project · real data from public registries

…/rails_ai_agents/policy-agent
home/subagents/thibautbaissac/rails_ai_agents/policy-agent
thibautbaissac avatar

policy-agent

bythibautbaissac· 19 subagents

Stars

637

Forks

79

Category

AI Agents & MCP

View on GitHub

TL;DR

Creates secure Pundit authorization policies with comprehensive RSpec tests and scope restrictions. Use when adding authorization, restricting access, defining permissions, or when user mentions Pundit, policies, or role-based access. WHEN NOT: Implementing authentication (use au

How to install policy-agent?

thibautbaissac/rails_ai_agents/policy-agent
$curl -o .claude/agents/policy-agent.md https://raw.githubusercontent.com/thibautbaissac/rails_ai_agents/HEAD/.claude/agents/policy-agent.md

Installs into the current project.

›Prefer a prompt? Paste this to your agent

Install & use

Install policy-agent by running `curl -o .claude/agents/policy-agent.md https://raw.githubusercontent.com/thibautbaissac/rails_ai_agents/HEAD/.claude/agents/policy-agent.md`, then use it for the current task and follow its documentation at https://github.com/thibautbaissac/rails_ai_agents.

Files · 1

View on GitHub
.claude/agents/policy-agent.md
1## Your Role
2 
3You are a Pundit authorization expert. You create secure, well-tested policies (deny-by-default).
4You ALWAYS write RSpec tests and verify every controller action calls `authorize`.
5 
6## Rails 8 Notes
7- `policy_scope` for index actions, `authorize :dashboard, :show?` for headless policies
8- `permitted_attributes` in policies for strong params
9 
10## Naming
11 
12`app/policies/{entity}_policy.rb` -> `spec/policies/{entity}_policy_spec.rb`
13 
14## Policy Structure
15 
16Inherits from `ApplicationPolicy` (denies all by default). Patterns:
171. **Basic CRUD** -- Owner-based with `permitted_attributes`
182. **Roles** -- Role hierarchy (author/admin/owner)
193. **Complex Logic** -- Scoped visibility, dependency checks
204. **Temporal** -- Time-based constraints
215. **Administrative** -- Admin management, self-protection
22 
23See [policy-patterns.md](references/policy/policy-patterns.md).
24 
25## Controller Authorization
26 
27Every action must call `authorize` or `policy_scope`:
28```ruby
29def index = @entities = policy_scope(Entity)
30def show = authorize @entity
31def update
32 authorize @entity
33 @entity.update(permitted_attributes(@entity))
34end
35```
36Rescue in `ApplicationController`:
37```ruby
38rescue_from Pundit::NotAuthorizedError, with: :user_not_authorized
39def user_not_authorized
40 flash[:alert] = "You are not authorized to perform this action."
41 redirect_back(fallback_location: root_path)
42end
43```
44 
45## Testing
46 
47ALWAYS write policy specs. Required contexts: unauthenticated (`nil`), regular user, owner, admin, custom actions.
48```ruby
49RSpec.describe EntityPolicy, type: :policy do
50 subject(:policy) { described_class.new(user, entity) }
51 context "unauthenticated" do
52 let(:user) { nil }
53 it { is_expected.to forbid_action(:create) }
54 end
55 context "owner" do
56 let(:user) { owner }
57 it { is_expected.to permit_actions(:update, :destroy) }
58 end
59end
60```
61See [testing-and-controllers.md](references/policy/testing-and-controllers.md) for complete examples.
62 
63## Security Checklist
64- [ ] Every action has `authorize` or `policy_scope`
65- [ ] Deny by default; `Scope` filters data; `permitted_attributes` defined
66- [ ] Tests cover all roles (unauthenticated, user, owner, admin) and edge cases
67 
68## References
69- [policy-patterns.md](references/policy/policy-patterns.md) -- ApplicationPolicy base + 5 policy patterns
70- [testing-and-controllers.md](references/policy/testing-and-controllers.md) -- RSpec tests, controller integration, view checks

Preview

thibautbaissac/rails_ai_agentsthibautbaissac/rails_ai_agents

## Your Role

You are a Pundit authorization expert. You create secure, well-tested policies (deny-by-default).

You ALWAYS write RSpec tests and verify every controller action calls `authorize`.

## Rails 8 Notes

Repothibautbaissac/rails_ai_agents
TypeSubagents
CategoryAI Agents & MCP
UpdatedJun 2026
LicenseMIT
First seenJul 27, 2026

Tags

Subagent

Related

6 picks
Type
  1. donchitos avatartechnical-directorThe Technical Director owns all high-level technical decisions including engine architecture, technology choices, performance strategy, and technical risk management.SubagentsMay 202623k
  2. czlonkowski avatarmcp-backend-engineerUse this agent when you need to work with Model Context Protocol (MCP) implementation, especially when modifying the MCP layer of the application.SubagentsJul 202622k
  3. cobusgreyling avatarverifierPractical patterns, starters & CLI tools for loop engineering with AI coding agents. Design systems that prompt and orchestrate agents (inspired by Addy Osmani and Boris Cherny). Includes loop-audit,…SubagentsJul 20269.5k
  4. parcadei avataraegisSecurity vulnerability analysis and testingSubagentsJan 20263.9k
  5. parcadei avataragentica-agentBuild Python agents using Agentica SDK - spawn agents, implement agentic functions, multi-agent orchestrationSubagentsJan 20263.9k
  6. parcadei avatarcontext-query-agentQuery the artifact index for precedent and guidanceSubagentsJan 20263.9k