authz · rainmanjam — Claude Code skill: what it does, how to install
Guides access control architecture by separating permission decisions from enforcement.
npx skills add rainmanjam/poka-yoke --skill authz -a claude-codeWhat authz does
The skill establishes conventions for permission logic. Its core rule dictates that any routine evaluating whether an actor can execute an operation must never execute that operation itself. Isolating the check eliminates scattered boolean logic and turns ambiguous conditions into dedicated, explicit rules with closed-by-default outcomes.
It insists on passing the actor explicitly as an argument instead of reaching into ambient context. When background jobs call functions relying on global state, the result is a runtime null crash rather than a clean permission rejection. Typed identifiers for resources prevent swapped argument bugs at compile time.
A clear test of this design is whether authorization rules can run against an input-output matrix without a live server. Coupling rules to transport or database sessions breaks testability immediately.
What it helps with
- Separate authorization decisions from business action execution
- Eliminate scattered inline boolean checks across handlers
- Build serverless unit tests covering denied access cases
- Prevent ambient context lookups for current actor identities
Example prompts for the agent
- Review permission checks in
src/services/billing.tsagainst the authz skill - Refactor document deletion rules to avoid reading the actor from global session state
- Generate an actor-action-resource decision matrix for the new workspace endpoint
How to install authz
1Skills CLI (Vercel)
npx skills add rainmanjam/poka-yoke --skill authz -a claude-code2Manually: put the files in place
~/.claude/skills/authz/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/authz/
1Skills CLI (Vercel)
npx skills add rainmanjam/poka-yoke --skill authz -a codex2Manually: put the files in place
.agents/skills/authz/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add rainmanjam/poka-yoke --skill authz -a cursor2Manually: put the files in place
.cursor/skills/authz/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install rainmanjam/poka-yoke authz2Manually: put the files in place
.github/skills/authz/SKILL.md1Skills CLI (Vercel)
npx skills add rainmanjam/poka-yoke --skill authz -a gemini-cli2Platform CLI
gemini skills install https://github.com/rainmanjam/poka-yoke --path benchmarks/controls/clean-code/skills/authzManually: put the files in place
.devin/skills/authz/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add rainmanjam/poka-yoke --skill authz -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about authz
How to install authz in Claude Code?
Run npx skills add rainmanjam/poka-yoke --skill authz -a claude-code in your terminal.
What does the authz skill do?
It guides AI agents to write clean, auditable access control logic that fails closed and isolates decisions from execution.
Why does authz forbid reading the actor from global state?
Ambient user objects fail silently in background workers or queue tasks, turning access failures into unrelated null reference bugs.
Source text
SKILL.md · MIT
--- name: authz description: >- Permission and access-control code. Structure, clarity and testability of authorisation logic: where the decision lives, how it is named, and keeping it separable from the code that acts on it. --- # Authz: Structuring Access Control Authorisation code is where structural sloppiness costs most, because a permission check that is hard to read is a permission check nobody re-reads. The discipline here is the ordinary one, applied somewhere the consequences are unusual. ## Put the decision in one place **Separate deciding from enforcing.** A function that answers "may this actor do this thing to this resource" should not also perform the thing. Once separated, the decision can be tested exhaustively, listed, audited, and reused by a second caller without dragging the action along. **One vocabulary for actors, actions and resources.** If some code says `user`, some says `account`, and some says `principal`, a reader cannot tell whether they are the same concept. Pick the words and use them everywhere, including in the database columns. **Avoid boolean soup.** `if (user.isAdmin || (user.isOwner && !resource.locked))` scattered across twelve call sites is twelve places to update and twelve chances to differ. Name the rule once: `canEditResource(user, resource)`. **Make the decision total.** A function returning `true`, `false` or `undefined` will be used as though `undefined` is one of the other two. Return a decision that covers every case, and make the default deny rather than allow, because a missing branch should fail closed. ## Structure that makes the check hard to skip **Take the actor as a parameter, never from ambient context.** A function reaching for a global `currentUser` can be called from a background job that has none, and the failure will be a `null` reference in an unrelated place rather than an authorisation error. **Pass the actor down the call chain rather than re-fetching it.** Re-fetching invites two layers to disagree about who the actor is. **Keep the resource identity typed.** A function taking two adjacent strings for `resourceId` and `ownerId` accepts them in either order. Distinct types make the transposition a compile error rather than a security incident. ## Make it testable, then test the negative cases The structural test of an authorisation design is whether you can write a table of `(actor, action, resource) -> expected` cases and run it without a server. If you cannot, the decision is tangled with transport, persistence or session handling, and the first thing to fix is that tangle rather than any individual rule. The cases that matter are the ones that should be denied. A test suite that only covers permitted actions passes just as happily against a function that returns `true` unconditionally. ## What good output looks like - **Name the decision function and its signature.** Where the decision lives is most of the design. - **Show one call site**, because whether the check is easy to skip is visible from the caller. - **List the rules as a table** when there is more than one actor kind. Prose describing a matrix is harder to check than the matrix. - **Say what is deliberately permitted.** A review that lists only denials leaves the reader unsure whether the permitted set was considered. ## What to avoid **Checks distributed across layers with no owner.** A rule enforced in the controller, the service and the query, differently, is three rules. **Comments as enforcement.** `// only admins should call this` is not a check. **Roles as a substitute for a decision.** `if (role === "admin")` scattered around means adding a role requires finding every site. Ask what the role *permits* and name that. **Reviewing the policy instead of the code.** Whether marketing should see billing data is a question for whoever owns that; whether the code expresses the intended answer legibly is this review.
© rainmanjam · MIT · rainmanjam/poka-yoke
Similar skills
All skills for Security →authz by other authors comes first.