MCPInstall
caffeinelabs avatar

extension-user-approval

Approval-based user management.

Installs
31.5K
Last 24h
+186
Trending rank
#1289
Security
Pass

Install

Works with every agent the skills CLI supports.

npx skills add https://github.com/caffeinelabs/skills --skill extension-user-approval
  1. 01

    Install

    Run the command in your project. The CLI asks which agents to install for.

  2. 02

    Describe the task

    Ask your agent for something this skill covers. It loads extension-user-approval automatically when relevant.

  3. 03

    Review the result

    The agent follows the SKILL.md steps, scripts and references bundled with the skill.

Security audits

Independent scans of the skill's instructions and bundled files, each dated to when it ran.

Gen Agent Trust Hub PassSAFE ·This skill provides approval-based user management for the Caffeine AI platform. It utilizes vendor-owned Motoko libraries to handle user requests and administrative approvals safely.· Audited
Socket PassNo alerts· Audited
Snyk PassLOW ·Risk: LOW · No issues· Audited
ZeroLeaks PassNONE ·Score: 93/100 · 2 sections analyzed· Audited

SKILL.md

The instructions your agent reads when the skill is triggered.

User Approval

User approval extension for Caffeine AI.

Overview

This skill adds approval-based user management. Users request access; admins approve or reject. Approved users gain access to protected features.

Prerequisite: You must follow extension-authorization first, as this integration depends on it.

Backend

Module API

The prefabricated module mo:caffeineai-user-approval/approval provides low-level approval state management. Do not modify it.

import AccessControl "mo:caffeineai-authorization/access-control";

module {
    public type ApprovalStatus = {
        #approved;
        #rejected;
        #pending;
    };

    public type UserApprovalState = { /* internal state */ };

    public func initState(accessControlState: AccessControl.AccessControlState) : UserApprovalState;

    public func isApproved(state : UserApprovalState, caller : Principal) : Bool;
    public func requestApproval(state : UserApprovalState, caller : Principal);
    public func setApproval(state : UserApprovalState, user : Principal, approval : ApprovalStatus);
    public func removeApproval(state : UserApprovalState, user : Principal);

    public type UserApprovalInfo = {
        principal : Principal;
        status : ApprovalStatus;
    };

    public func listApprovals(state : UserApprovalState) : [UserApprovalInfo];
}

Setup in main.mo

include MixinUserApproval(accessControlState, approvalState) MUST be placed in main.mo, not in a custom mixin file. Declare approvalState at actor top level and pass it into the mixin. The mixin provides these public endpoints automatically:

  • isCallerApproved()
  • requestApproval()
  • setApproval(user, status)
  • removeApproval(user)
  • listApprovals()

Keep approvalState in scope for custom approval guards in app-specific endpoints.

Do NOT redeclare any of the mixin-provided functions.

import AccessControl "mo:caffeineai-authorization/access-control";
import MixinAuthorization "mo:caffeineai-authorization/MixinAuthorization";
import MixinUserApproval "mo:caffeineai-user-approval/MixinUserApproval";
import UserApproval "mo:caffeineai-user-approval/approval";
import Runtime "mo:core/Runtime";

actor {
  let accessControlState : AccessControl.AccessControlState;
  include MixinAuthorization(accessControlState, null);
  let approvalState : UserApproval.UserApprovalState;
  include MixinUserApproval(accessControlState, approvalState);

  // Example custom endpoint with an approval guard:
  // public shared ({ caller }) func protectedFeature() : async () {
  //     if (not (UserApproval.isApproved(approvalState, caller) or AccessControl.hasPermission(accessControlState, caller, #admin))) {
  //         Runtime.trap("Unauthorized: Only approved users can perform this action");
  //     };
  // };
};

The migration chain head — UserApproval.initState depends on the access-control state, so compute it in order inside the migration body:

import AccessControl "mo:caffeineai-authorization/access-control";
import UserApproval "mo:caffeineai-user-approval/approval";

module {
  type NewActor = {
    accessControlState : AccessControl.AccessControlState;
    approvalState : UserApproval.UserApprovalState;
  };

  public func migration(_old : {}) : NewActor {
    let accessControlState = AccessControl.initState();
    {
      accessControlState;
      approvalState = UserApproval.initState(accessControlState);
    };
  };
};

On initState, existing admins are automatically approved. All other users are pending.

The anonymous principal is never approved: requestApproval and setApproval trap for it, and isCallerApproved returns false. isCallerApproved also returns false, rather than trapping, for a signed-in caller that has not registered yet.

IMPORTANT: Apply the right authorization and/or approval check to each custom public function.

Frontend

Approval-based user management:

User Approval Flow

  • Check approval status (isCallerApproved)
  • If not approved, show option to request approval (requestApproval). Show it only to signed-in users; it traps for the anonymous principal
  • Block access to main features for non-approved users
  • Admins have access to all features of the application
  • Display approval status clearly in the UI

Admin Dashboard

For admin users, provide a dashboard to:

  • List all users with their approval status (listApprovals)
  • Approve or reject users (setApproval). A rejected user cannot request approval again
  • Remove a user's entry (removeApproval), so they can request approval again
  • View and assign user roles (using getCallerUserRole and assignCallerUserRole)

Backend Integration

The backend already implements the following functionality. The full interface can be found in <backend-interface>

// Check if current user is approved, admins are always approved isCallerApproved(): Promise<boolean>;

// Submit approval request requestApproval(): Promise<void>;

// Get all users and their approval status (admin only) listApprovals(): Promise<Array<UserApprovalInfo>>;

// Approve or reject a user (admin only) setApproval(user: Principal, status: ApprovalStatus): Promise<void>;

// Delete a user's approval entry, so they can request approval again (admin only) removeApproval(user: Principal): Promise<void>;

// Assign a role to a user (admin only) assignCallerUserRole(user: Principal, role: UserRole): Promise<void>;

// Get current role for a specific user getCallerUserRole(): Promise<UserRole>;

FAQ

What does the extension-user-approval skill do?

Approval-based user management.

How do I install extension-user-approval?

Run npx skills add https://github.com/caffeinelabs/skills --skill extension-user-approval in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/extension-user-approval/ (personal) or .claude/skills/extension-user-approval/ (project).

Which AI agents can use extension-user-approval?

Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.

Is extension-user-approval safe to install?

Security partners have reviewed it: Gen Agent Trust Hub passed; Socket passed; Snyk passed; ZeroLeaks passed. As with any skill, read the SKILL.md and bundled scripts before installing.

Who maintains extension-user-approval?

It is published by caffeinelabs in caffeinelabs/skills. It has 31,499 recorded installs.

More from caffeinelabs/skills

View all →

Support for organising events/meetings and sending invitations by email.

caffeinelabs avatar

extension-stripe

caffeinelabs/skills

Payment support based on Stripe, supporting credit cards and debit cards. Checkout and session status use HTTP outcalls. For inbound Stripe webhooks (POST to the canister), also load extension-http-endpoints.

Backend & APIs31.6K installs
caffeinelabs avatar

extension-qr-code

caffeinelabs/skills

QR code scanner using the camera.

31.6K installs
caffeinelabs avatar

extension-email-marketing

caffeinelabs/skills

Send personalised marketing emails to subscribers with an unsubscribe link.

Marketing & SEO31.6K installs
caffeinelabs avatar

extension-camera

caffeinelabs/skills

Web-camera support.

31.5K installs
caffeinelabs avatar

extension-authorization

caffeinelabs/skills

Authorization system with role-based access control. Must-have for all apps that manage personal or access-restricted data.

31.5K installs

Popular other skills

View category →
heygen-com avatar

hyperframes-cli

heygen-com/hyperframes

The HyperFrames CLI by job - scaffold, check, look at frames, edit the timeline, preview, render locally or in the cloud, publish, project history - plus reading its JSON and recovering from build or render failures.

1.6M installs
mattpocock avatar

triage

mattpocock/skills

Move issues and external PRs through a state machine of triage roles, categorise, verify, grill if needed, and write agent-ready briefs.

1.1M installs
mattpocock avatar

ask-matt

mattpocock/skills

Ask which skill or flow fits your situation. A router over the skills in this repo.

849.4K installs
mattpocock avatar

to-questionnaire

mattpocock/skills

Turn a decision you can't fully answer into a questionnaire for someone else to fill in.

578.1K installs
mattpocock avatar

wait-what

mattpocock/skills

Stop. That last message did not land: re-pitch it.

529.3K installs
mattpocock avatar

loop-me

mattpocock/skills

Grill me about specs for the workflows I want to build, within this workspace.

499.3K installs