rmnr
DocsTourSlicesBest PracticeAgentsInstall

Command Palette

Search for a command to run...

New

Slice · AI prompt

User Management

Members · invites · roles · teams · hierarchy · access matrix — tabbed, permission-gated. Props-driven.

Resource detail View source
Copy this prompt into Claude / Codex / Cursor
user-management.prompt.mdmarkdown
# Install `user-management` — User Management

> Members · invites · roles · teams · hierarchy · access matrix — tabbed, permission-gated. Props-driven.

📚 Knowledge base : https://resource.rahmanef.com/llms.txt
📦 Slice detail   : https://resource.rahmanef.com/slices/user-management
🧠 JSON catalog   : https://resource.rahmanef.com/api/knowledge?slice=user-management
🔗 Source         : https://github.com/rahmanef63/resource-site/tree/main/frontend/slices/user-management

## 1. Install

```bash
npx rahman-resources add user-management
# alias: npx rr add user-management
```

The CLI copies `frontend/slices/user-management/` into your project + augments `.env.example` + installs npm deps automatically. Run it from your project root.

## 2. What it ships

- shadcn primitives: `avatar`, `badge`, `button`, `checkbox`, `dialog`, `dropdown-menu`, `input`, `label`, `select`, `switch`, `table`, `tabs`, `textarea`
- peer slices (cascade install):
  - `rbac-roles` — Roles + resolved permissions + convex permission helpers (requirePermission, getActorPermissions).
  - `convex-auth` — Member identity (name/email/avatar) joined from the users table.
- convex feature paths: `convex/features/user_management`

## 3. Wire it up

Run `npx rr add user-management` (pulls rbac-roles + convex-auth). Frontend: <MembersPanel members={useQuery(api["features/user_management/query"].listMembers,{tenantId})} roles={ROLE_PRESETS.map(r=>({slug:r.slug,name:r.name,color:r.color}))} currentPerms={actorPerms} onUpdateRole={useMutation(...updateMemberRole)} onRemove={useMutation(...removeMember)} onInvite={openInvite} />. Wire roles + currentPerms from rbac-roles at the app level — the slice itself imports no other slice. Convex: spread userManagementTables; listMembers/mutations gate via rbac-roles requirePermission.

## Rules of engagement

- shadcn-only UI primitives. No raw `<button>` / `<dialog>` / native date or file inputs.
- 200-line hard cap per source file (extract neighbours when over).
- All Convex queries hit an index (`.withIndex(...)`); never bare `.collect()`.
- Public mutations/queries declare `args:` validators + authz.
- Full ruleset: https://resource.rahmanef.com/best-practice

The agent will fetch /llms.txt for the full ruleset and use /api/knowledge for the JSON catalog.