authz · rainmanjam — скилл для Claude Code: что делает и как установить
Помогает проектировать и проверять логику авторизации, отделяя принятие решений от их исполнения.
npx skills add rainmanjam/poka-yoke --skill authz -a claude-codeЧто делает authz
Скилл задаёт правила для кода разграничения доступа. Главный принцип прост: функция, отвечающая на вопрос «разрешено ли действие», не должна сама выполнять это действие. Такой подход убирает путаницу условий вроде длинных цепочек булевых флагов и собирает правила в единые именованные функции вроде canEditResource(user, resource) с запретом по умолчанию.
Инструкции требуют передавать актора явным параметром, а не доставать его из глобального контекста. Без этого фоновые задачи рискуют упасть с ошибкой null. Идентификаторы ресурсов и владельцев должны быть типизированы, чтобы случайная перестановка аргументов в коде приводила к ошибке компиляции, а не к инциденту безопасности.
Правило оценки архитектуры строгое: если матрицу прав нельзя протестировать обычной таблицей кейсов без запуска сервера, значит, авторизация запутана с транспортом или сессиями.
Какие задачи решает
- Разделить вычисление прав и фактическое выполнение действия
- Заменить разрозненные булевы проверки едиными правилами
- Спроектировать проверяемые без сервера тесты на отказ в доступе
- Исключить чтение текущего пользователя из неявного контекста
Примеры запросов агенту
- Проверь логику проверки прав в
src/services/billing.tsпо скиллу authz - Спроектируй функцию проверки прав для удаления документов без использования глобального контекста
- Составь таблицу разрешений и отказов для ролей в модуле управления проектами
Как установить authz
1Через Skills CLI (Vercel)
npx skills add rainmanjam/poka-yoke --skill authz -a claude-code2Вручную: положить файлы
~/.claude/skills/authz/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/authz/
1Через Skills CLI (Vercel)
npx skills add rainmanjam/poka-yoke --skill authz -a codex2Вручную: положить файлы
.agents/skills/authz/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add rainmanjam/poka-yoke --skill authz -a cursor2Вручную: положить файлы
.cursor/skills/authz/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install rainmanjam/poka-yoke authz2Вручную: положить файлы
.github/skills/authz/SKILL.md1Через Skills CLI (Vercel)
npx skills add rainmanjam/poka-yoke --skill authz -a gemini-cli2Командой платформы
gemini skills install https://github.com/rainmanjam/poka-yoke --path benchmarks/controls/clean-code/skills/authzВручную: положить файлы
.devin/skills/authz/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Через Skills CLI (Vercel)
npx skills add rainmanjam/poka-yoke --skill authz -a opencodeClaude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов
Вопросы о authz
Как установить authz в Claude Code?
Выполните команду npx skills add rainmanjam/poka-yoke --skill authz -a claude-code в терминале.
Что делает скилл authz?
Он направляет модель при проектировании и аудите кода авторизации, требуя явных параметров, отказа по умолчанию и изолированных от инфраструктуры проверок.
Какие требования скилл предъявляет к тестированию прав?
Логику доступа должно быть возможно протестировать без поднятия веб-сервера, обязательно покрывая сценарии с запретом действий.
Исходный текст
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
Похожие скиллы
Все скиллы по теме «Безопасность» →Сначала — authz от других авторов.