agentleFS
DobroslavRadosavljevicDobroslavRadosavljevic/cabrakan/.agents/skills/permix/SKILL.md

permix

Skill1 starsChanged 3 months agoMITView on GitHub

Build, review, debug, configure, migrate, teach, or plan Permix type-safe permissions with current docs and a full usage guide. Use for permix, createPermix, setup, check, template, dehydrate, hydrate, isReady, isReadyAsync, ~all/~any, ValidateDefinition, Rules, ReBAC closures, permix/react, permix/vue, permix/solid, permix/svelte, permix/next, permix/tanstack-start, permix/express, permix/hono, permix/elysia, permix/fastify, permix/node, permix/server, permix/trpc, permix/orpc, permix/drizzle, permix/effect, and Permix v3 to v4 migration.

The file

We split this skill into the rules it gives an agent

6 rules. About 0 are common, 2 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use this skill when work touches Permix permissions: definitions, setup/check, SSR hydration, UI adapters, server middleware, or v3→v4 …

    line 8
  2. Very specific:

    Import path: permix (core) vs subpaths (permix/react, permix/next, permix/express, …).

    line 14
  3. Distinctive:

    Prefer Permix v4 APIs (dot paths, action tuples).

    line 24
  4. Very specific:

    Verify with typecheck plus focused setup/check tests (and middleware 403 paths when server-integrated).

    line 25
  5. Very specific:

    Before any rules: check / dehydrate throw PermixNotReadyError (not false).

    line 34
  6. Distinctive:

    Prefer repository-owned commands.

    line 43

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Permix

Use this skill when work touches Permix permissions: definitions, setup/check, SSR hydration, UI adapters, server middleware, or v3→v4 migration.

Workflow

  1. Inspect the local Permix surface:
    • Package version (permix@4.x preferred; current stable snapshot 4.1.2).
    • Import path: permix (core) vs subpaths (permix/react, permix/next, permix/express, …).
    • Definition shape: action tuples / { name, type, required? } vs legacy v3 { action, dataType }.
    • Where enforcement runs (server middleware vs client UX) and whether SSR dehydrate/hydrate is used.
  2. For day-to-day how-to, follow usage-guide.md first.
  3. Refresh docs when versions drift or the task is migration/SSR/integration-specific. Start from source-map.md.
  4. Route deeper detail:
    • Core API, rules, check, template, ReBAC, errors: core-api.md.
    • React/Vue/Solid/Svelte, Next, TanStack Start, hydration: frameworks-ssr.md.
    • Express/Hono/Elysia/Fastify/Node/server/tRPC/oRPC/Drizzle/Effect: server-integrations.md.
    • v3→v4 breaking changes: migration-v4.md.
  5. Prefer Permix v4 APIs (dot paths, action tuples). Treat client checks as UX only — enforce on the server.
  6. Verify with typecheck plus focused setup/check tests (and middleware 403 paths when server-integrated).

Core Judgment

  • Flow: createPermix<Definition>() → setup(rules) → check('entity.action'[, data]).
  • Definitions are action lists (strings or { name, type?, required? }), optionally nested trees.
  • Rules are booleans or (data?) => boolean closures (capture the actor at setup time).
  • check returns boolean. Use callbacks for AND/OR; use '~all' / '~any' (or 'post.~all') for aggregates.
  • checkAsync is removed in v4 — await isReadyAsync() then check().
  • Before any rules: check / dehydrate throw PermixNotReadyError (not false).
  • Invalid path throws PermixRuleNotDefinedError.
  • SSR: dehydrate() → JSON booleans (functions become false) → client hydrate → must setup() again for function rules; hydrate alone does not set isReady.
  • Server: prefer per-request instances via integration middleware; do not share mutable singletons across concurrent requests.
  • Security: server enforcement is mandatory; hide UI with client checks only.
  • Engines: package declares node: >=22. Optional peer deps only for the adapters you import.

Verification

Prefer repository-owned commands. For meaningful Permix work, cover the relevant subset:

  • Typecheck paths ($inferPath), required: true data args, and shared ValidateDefinition / Rules.
  • Unit tests: allow/deny, entity-data rules with/without data, ~all/~any, callback composition, not-ready / missing-path errors.
  • SSR: dehydrate snapshot shape; client hydrate + re-setup; isReady gating in UI.
  • Server: setupMiddleware then checkMiddleware — assert 200 vs 403 / onForbidden.
  • Migration: no remaining check('entity', 'action'), checkAsync, Better Auth plugin, or entity+action UI props.

Report which checks ran, which did not, and any version assumptions that remain.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.