scaffold-policy

📁 iurygdeoliveira/labsis-kit 📅 Jan 24, 2026
3
总安装量
3
周安装量
#62121
全站排名
安装命令
npx skills add https://github.com/iurygdeoliveira/labsis-kit --skill scaffold-policy

Agent 安装分布

claude-code 2
windsurf 1
trae 1
opencode 1
codex 1
antigravity 1

Skill 文档

Laravel Policy Scaffold Skill

Use this skill when defining authorization logic.

Rules

1. User Type

  • Always type hint the User model explicitly: public function update(User $user, Post $post): bool.

2. Permissions vs Roles

  • Prefer Permissions: Use $user->can('update posts') rather than hardcoded role checks like $user->role == 'admin'.
  • Super Admin: Remember that specific packages (like Spatie Permission) might handle Super Admin auto-approval via Gate. Ensure before() method usage if manual override is needed.

3. Filament Integration

  • Filament relies heavily on Policies. Ensure all methods (viewAny, view, create, update, delete, restore, forceDelete) are implemented.
  • Return false by default for methods that shouldn’t be accessed.
public function viewAny(User $user): bool
{
    return $user->can('view_any_post');
}