Back to Skills

extension-data-viewer

Admin-only paginated viewer for stable canister state. Use whenever the user asks for a viewer, dashboard, debug panel, or admin browse over backend data — users, items, orders, logs, or any stable Map/Set/Array/VarArray/List/Stack/Queue. Pre-installed in every Caffeine app via the `caffeineai-data-viewer` mops package; this skill explains what it does and how to keep using it correctly.

Updated 6/26/2026

Security Assessment

Safe(100/100)
Security Score100/100

About extension-data-viewer

The data viewer is an admin-only, paginated inspection extension for the stable canister state of Caffeine AI apps. Every Caffeine app already ships with the caffeineai-data-viewer mops package and the moc --generate-view-queries flag enabled, so the feature is pre-installed rather than something you add. When the actor body contains include MixinViews(), the compiler auto-exposes a controller-only __<var> query for every stable variable of a supported type, giving operators a way to browse users, items, orders, logs, or any backing collection without writing bespoke endpoints.

Supported types map to specific query signatures: Map.Map<K, V> exposes (?K, ?Nat) -> [(K, V)], Set.Set<K> exposes (?K, ?Nat) -> [K], and the sequence types [V], [var V], List.List<V>, Stack.Stack<V>, and Queue.Queue<V> expose (?Nat, ?Nat) -> [V]. A null cursor starts from the beginning and a null count returns everything from the cursor onward, supporting simple pagination. Each generated query traps on any non-controller caller, so the queries are strictly for admin dashboards and debug viewers and never for user-facing endpoints. The Lintoko rule include-mixin-views errors if the actor is missing include MixinViews(), since removing the include disables every auto-generated viewer.

Use this extension whenever a request calls for a viewer, dashboard, debug panel, or admin browse over backend data. The doc sets out firm rules: never use the __<var> queries as a substitute for public list/feed/search methods (those still need normal public query func definitions), never declare an actor member whose name begins with __ because it collides with generated queries or a reserved prefix, and remember that pure/immutable collections (pure/Map, pure/Set, pure/List, pure/Queue) are not supported because the viewer is mutable-only by design. The intended workflow is simply to declare a stable variable of a supported type and let the matching __<var> query appear automatically.

FAQ

Do I need to add or wire up anything to use the data viewer?

No. The caffeineai-data-viewer package and the include are already wired into the template; you just declare a stable variable of a supported type and the __<var> query appears automatically.

Which collection types are supported?

Map.Map, Set.Set, plain and var arrays ([V], [var V]), List.List, Stack.Stack, and Queue.Queue are supported. Pure immutable collections such as pure/Map, pure/Set, pure/List, and pure/Queue are not supported because the viewer is mutable-only.

Can I use the generated __<var> queries as public API endpoints?

No. The generated queries trap on any non-controller caller, so they are admin/debug only; user-facing list, feed, or search methods still have to be written normally as public query func.

How does pagination work in the generated queries?

Each query takes a cursor and a count; a null cursor starts at the beginning of the collection and a null count returns everything from the cursor onward.

Why must I avoid actor members whose names start with __?

Names beginning with __ either collide with an auto-generated viewer query or hit a reserved prefix, so the doc forbids declaring such members.

Install extension-data-viewer

Download and extract the skill files to your .claude/skills/ directory.

Quick Setup:

  1. Copy the skill folder to .claude/skills/
  2. Claude will automatically detect and use the skill