agentleFS
fpindejfpindej/netrock/.claude/skills/add-permission/SKILL.md

add-permission

Skill234 starsChanged 3 months agoMITView on GitHub

Add a permission constant across backend and frontend

4 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

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

  • 0

    Common

    Most of the 3 edited versions we read keep these.

  • 0

    Distinctive

    This author's own choices. Worth a look.

  • 6

    Very specific

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

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

    Add public const string field to the appropriate nested class in src/backend/MyProject.Application/Identity/Constants/AppPermissions.cs:

    line 12
  2. Very specific:

    Add [RequirePermission(AppPermissions.Orders.View)] to the relevant controller actions

    line 21
  3. Very specific:

    Add matching constants to src/frontend/src/lib/utils/permissions.ts:

    line 27
  4. Very specific:

    Use in components: hasPermission(user, Permissions.Orders.View)

    line 34
  5. Very specific:

    If adding a new admin page: register it in adminRoutes in $lib/config/routes.ts (path + permission), then guard in +page.server.ts:

    line 35
  6. Very specific:

    If adding a sidebar nav item: use adminRoutes.orders.path and .permission for the nav item in AppSidebar.svelte - items are filtered …

    line 39

“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “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

Adds a permission constant across backend and frontend.

Steps

Backend:

  1. Add public const string field to the appropriate nested class in src/backend/MyProject.Application/Identity/Constants/AppPermissions.cs:
    public static class Orders
    {
        public const string View = "orders.view";
        public const string Manage = "orders.manage";
    }
    AppPermissions.All discovers permissions via reflection - no manual registration needed.
  2. Add [RequirePermission(AppPermissions.Orders.View)] to the relevant controller actions
  3. (Optional) Add the permission to a role's DefaultPermissions in AppRoles.Definitions (src/backend/MyProject.Application/Identity/Constants/AppRoles.cs) - the startup seeder applies it additively
  4. Verify: dotnet build src/backend/MyProject.slnx

Frontend:

  1. Add matching constants to src/frontend/src/lib/utils/permissions.ts:
    Orders: {
        View: 'orders.view',
        Manage: 'orders.manage',
    },
  2. Use in components: hasPermission(user, Permissions.Orders.View)
  3. If adding a new admin page: register it in adminRoutes in $lib/config/routes.ts (path + permission), then guard in +page.server.ts:
    if (!hasPermission(user, adminRoutes.orders.permission)) throw redirect(303, routes.dashboard);
  4. If adding a sidebar nav item: use adminRoutes.orders.path and .permission for the nav item in AppSidebar.svelte - items are filtered per-permission, not as a group
  5. Verify: cd src/frontend && pnpm run test && pnpm run format && pnpm run lint && pnpm run check

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.