permissions-procedure

Declares access control for Connect procedures and admin panel sections using permission decorators.

1|Updated Jan 14, 2024
One-click install
npx skills add https://github.com/Eyhenij/rt-tools --skill permissions-procedure-eyhenij
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: permissions-procedure
Source: https://github.com/Eyhenij/rt-tools/tree/main/.claude/skills/permissions-procedure
Command: npx skills add https://github.com/Eyhenij/rt-tools --skill permissions-procedure-eyhenij

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? When building Connect procedures or closing admin panel sections, developers often misplace access checks — duplicating declarations, checking rights inside handlers, or hanging guards on whole route groups — causing startup failures or inconsistent menu and page access. This Skill provides the exact pattern for declaring permissions correctly. ## Core Features & Use Cases - Procedure Access Decorators: Apply exactly one of @RequiresPermission, @RequiresAuth, @PublicProcedure, or @OptionalAuthProcedure on a Connect procedure class so the interceptor enforces access before the handler runs. - Standardized Refusals: Returns Code.Unauthenticated for missing sign-in and Code.PermissionDenied for missing rights, with unknown procedures denied by default. - Admin Panel Gating: Closes a menu item and its address with a single declaration combining the user's right and a section flag, avoiding divergent duplicate declarations. - Use Case: When creating a new Connect procedure like LinkBookingProcedure, decorate it with @RequiresPermission('chat:manage') so only signed-in users with that right can invoke it, without writing any check inside handle. ## Quick Start Ask the assistant to apply the permissions pattern when creating a new Connect procedure or closing an admin panel section with a right and a flag.

Frequently Asked Questions about permissions-procedure

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

FAQPage Schema
How do I restrict a Connect procedure to users with a specific permission?

Add the @RequiresPermission('<resource>:<action>') decorator to the procedure class alongside @Injectable() and @ConnectProcedure(). The interceptor checks the right before the procedure body runs, so no check belongs inside handle.

Which decorator should I use for public or optional-auth procedures?

Use @PublicProcedure('<reason>') for guests without sign-in, @OptionalAuthProcedure('<reason>') when a guest is allowed but a token is read if present, and @RequiresAuth('<reason>') for any signed-in person. The reason argument is only for code readers.

What error does a Connect procedure return without authentication?

The interceptor answers Code.Unauthenticated when a sign-in is missing where one is needed, and Code.PermissionDenied when the user is signed in but lacks the right. Procedures unknown to the interceptor are also denied by default.

Why does my application fail to start with two access decorators?

A procedure must carry exactly one access declaration. Adding two decorators on one procedure prevents the application from coming up, and the failure only surfaces at startup, so keep a single declaration per procedure.

How do I close an admin panel section with a right and a flag?

Declare the menu item and address once in the single declaration the header and guard read from. An item with a flag is declared without rights or address; once a screen exists, remove the flag and add the rights.

When should I not check permissions inside the procedure handler?

Never check rights inside handle, because the interceptor enforces access before the body runs. Also avoid hanging a guard on a whole protected route group, since it runs once per page load and misses moves between sections.