/iblai-vibe:iblai-vibe-creditfrom ibl.ai vibe
Adds the ibl.ai credit balance widget to a Next.js app's navbar, showing plan badge, remaining credits, and actions like Upgrade, Change Plan, Manage Usage, or Add Credits via Stripe.
Ships in ibl.ai vibe. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Add the ibl.ai credit balance widget to your app's top navigation: a credit-card icon button (a dot on it when the balance runs low), and a dropdown with the remaining credits, what was consumed, when it resets, the auto-recharge status, the plan badge and the one action the person can take next. The widget is rendered by the SDK — do not build a custom version.

| Who | Badge (in the dropdown) | Buttons in the dropdown |
|---|---|---|
| A free-trial user (signed in on the main organization only, not its admin) | Trial | Upgrade — opens the plan picker (Free, Pro, Max, Ultra); choosing Free creates their own workspace, a paid plan goes through Stripe checkout first |
| An admin of an organization on a plan | the plan's name (Free, Pro, Max, Ultra, as the backend names it) | Change Plan (the picker in change mode, when the backend sends plan_key), Manage Usage (auto recharge), Add Credits |
Add Credits is one flow: pick $20, $50 or $100 (or "Other amount"), and
with no card on file Stripe's customer portal takes one, returns to the page,
and the charge goes through on the way back (the widget completes it). A
refused charge (expired card…) shows the reason with an Update Payment
Method button. Upgrade / Change Plan open UpgradePackageModal,
the same plan picker the 402 flow uses (/iblai-vibe-credit-exhaustion).
Common setup (brand, conventions, env files, verification): see docs/skill-setup.md.
Do NOT add custom styles, colors, or CSS overrides to the <CreditBalance>
component. It ships with its own styling, including the button, its
low-balance dot, the dropdown panel and the buttons. Wrapping it, restyling it, or swapping
the icon will break the flows and visual consistency across ibl.ai apps.
The widget MUST follow the canonical integration:
@iblai/iblai-js/web-containers (the
framework-agnostic bundle — NOT /next, NOT /sso)redirectUrl: window.location.origin (where Stripe returns —
origin only, never .href or a path)enabled: explicit trueisPlatformNavbarCreditBalanceVisible
(Step 3) — not a hand-rolled checkclassName: do not pass a className prop unless you have a
layout reason. Never use it to swap the icon, change colors, or
override the size| Property | Value |
|---|---|
| Trigger | An icon button with a credit-card icon (accessible name "N credits remaining"), provided by the SDK |
| Status dot | None while the balance is healthy; a small dot on the button when it is low (amber, 10 credits or fewer) or critical (red, 1 or fewer) |
| Panel width | w-[320px] dropdown |
| Position in navbar | Right side, between the page links and the notification bell |
/iblai-vibe-auth)/iblai-vibe-navbar)@iblai/iblai-js@^3.6.0 — the plan picker, Change Plan and the one-trip
Add Credits flow are not in releases before 2.73.0subscription, topBanner and appleRestriction
slices and the app mounts SubscriptionConfigProvider
(/iblai-vibe-credit-exhaustion Step 1; vibe-starter ships both)@source directives configured (Step 1 below)currentTenant.show_paywall === true) or
is the main organization, where free-trial users live. Elsewhere the rule
in Step 3 hides the widget.This skill does not generate any new files — it wires <CreditBalance>
from the SDK into the existing navbar. It adds:
<CreditBalance> element inside the navbar's right-side cluster@source directives in iblai-styles.css so Tailwind
generates the SDK's internal classesvibe-starter ships all three in components/navbar/nav-bar.tsx.
The widget's chip and panel use Tailwind utility classes authored inside the
SDK's compiled JS. Tailwind v4 will not generate those classes unless the
SDK's source/ directories are listed as @source.
Open app/iblai-styles.css (or app/globals.css if styles live there)
and ensure BOTH directives are present:
@source "../node_modules/@iblai/iblai-js/dist/web-containers/source";
@source "../node_modules/@iblai/iblai-js/dist/web-containers/source/next";
If the app scans through a lib/iblai/sdk symlink instead (some older
scaffolds ship one), the equivalent is:
@source "../lib/iblai/sdk/web-containers/source";
@source "../lib/iblai/sdk/web-containers/source/next";
Both lines are required. After editing, restart the dev server. Verify the build picks up the classes:
rm -rf .next && pnpm build
grep -ohF -e 'z-9999' -e 'w-\[320px\]' .next/static/chunks/*.css | sort -u
You should see both z-9999 and w-\[320px\] (the panel's classes) in the
generated CSS.
Inside your navbar component (components/navbar/nav-bar.tsx or
equivalent), import from the framework-agnostic bundle:
import {
CreditBalance,
NotificationDropdown,
isPlatformNavbarCreditBalanceVisible,
} from '@iblai/iblai-js/web-containers';
import { useUserIsOnTrial } from '@iblai/iblai-js/web-utils';
Do NOT import from @iblai/iblai-js/web-containers/next. The credit
component does not require Next.js primitives, and keeping all SDK widgets
on the same import path simplifies the component graph.
isPlatformNavbarCreditBalanceVisible is the rule the OS navbar uses
(PlatformNavbar runs it for its creditBalance config): billing is on
(config.stripeEnabled()), the organization sells credits
(show_paywall) or is the platform's main organization, the viewer is an
admin acting as one (isLiveAdmin: isAdmin && adminMode behind a
User/Admin switch, plain isAdmin without one) or a free-trial user, and
they are signed in. Place the widget before the notification bell:
// components/navbar/credit-balance-widget.tsx
'use client';
import {
CreditBalance,
isPlatformNavbarCreditBalanceVisible,
} from '@iblai/iblai-js/web-containers';
import { useSubscriptionConfig, useUserIsOnTrial } from '@iblai/iblai-js/web-utils';
import config from '@/lib/iblai/config';
interface CreditBalanceWidgetProps {
tenantKey: string;
/** The entry for `tenantKey` in the signed-in user's `tenants`. */
currentTenant?: { key?: string | null; show_paywall?: boolean | null } | null;
username: string;
email: string;
/**
* An admin acting as one: `isAdmin && adminMode` behind a User/Admin
* switch (`/iblai-vibe-admin`), plain `isAdmin` in an app without one.
*/
isLiveAdmin: boolean;
}
export function CreditBalanceWidget({
tenantKey,
currentTenant,
username,
email,
isLiveAdmin,
}: CreditBalanceWidgetProps) {
const userOnFreeTrial = useUserIsOnTrial();
// The platform's main organization (`main`): where free-trial users live
// and the only one that lists and changes plans. Never this app's.
const { mainTenantKey: platformMainOrg } = useSubscriptionConfig();
const visible = isPlatformNavbarCreditBalanceVisible({
tenantKey,
currentTenant,
stripeEnabled: config.stripeEnabled(),
isLiveAdmin,
userOnFreeTrial,
mainPlatformKey: platformMainOrg,
currentUserEmail: email,
username,
});
if (!visible || !username || !email) return null;
return (
<CreditBalance
tenant={tenantKey}
enabled={true}
username={username}
mainPlatformKey={platformMainOrg}
currentUserEmail={email}
redirectUrl={window.location.origin}
/>
);
}
vibe-starter inlines the same rule in components/navbar/nav-bar.tsx, with
isAdmin && adminMode from its User/Admin switch (lib/iblai/admin-mode.tsx,
/iblai-vibe-admin); useUserIsOnTrial is the SDK's: one organization, the
platform's main one, not its admin, billing on.
| Prop | Source | Notes |
|---|---|---|
tenant | Resolved org key (e.g. from resolveAppTenant()) | The organization the user is acting under — billing is per-organization |
enabled | Always true | The component itself returns null if enabled is false; pass true so it renders when the rule above passes |
redirectUrl | window.location.origin | Where Stripe returns after checkout or the customer portal. Always use origin (not href or a path) so the return lands on a stable route; the widget then completes a pending Add Credits on its own |
mainPlatformKey | useSubscriptionConfig().mainTenantKey | The platform's main organization (main on hosted ibl.ai): where free-trial users live and the only one that lists and changes plans. Never this app's organization (NEXT_PUBLIC_MAIN_TENANT_KEY) |
currentUserEmail | From userData in localStorage (user_email / email) | Stripe Checkout pre-fills with this |
username | From userData (user_nicename / username) | Used for the Stripe customer portal userId |
| Prop | Default | Notes |
|---|---|---|
className | (none) | Reserved for layout adjustments only. Do NOT use it to override the icon, colors, or sizing |
enabled | true | Pass false to programmatically hide the widget without unmounting it (rarely useful — prefer the rule above) |
The widget MUST only render when ALL of the following are true — and the SDK's rule says exactly this, so use it rather than restating it:
config.stripeEnabled() (NEXT_PUBLIC_STRIPE_ENABLED,
default true). An app whose organization is not billed this way turns it
off and gets no widget, no plan picker and no credits gate.currentTenant.show_paywall, or
it is the platform's main organization (main), where free-trial users
live. Elsewhere the billing endpoints answer nothing
useful and the panel would show a permanent error state./iblai-vibe-credit-exhaustion).username and email
populated from localStorage).Do not gate solely on enabled — the SDK's enabled prop hides the
rendered output but does not skip the billing query.
Run /iblai-vibe-ops-test before telling the user the work is ready, and give
every page, control and state this skill added its own checkpoint — one Playwright
test titled <ID> · … in e2e/journeys/, listed in e2e/coverage.json;
pnpm e2e:coverage must pass. Then:
Start the dev server, log in as an organization admin, and confirm:
If the panel renders without its layout utilities, the SDK source folders are not being scanned — go back to Step 1.
@iblai/iblai-js/web-containers/next
works for some bundles but ties the credit widget to Next-specific
primitives unnecessarily. Use the plain web-containers path.redirectUrl={window.location.href}: Stripe sends the person back to
this URL. Using .href re-opens whatever modal or query state was active
when the flow started, and the pending Add Credits (carried as query
parameters on the way back) can be replayed. Always use .origin.@source "../.../source/next": the most common cause of
"the widget looks wrong" — Tailwind isn't generating the SDK's classes
because only one of the two source paths is scanned.className to swap icons or colors: don't. The component
is a contract; downstream apps depend on it being visually consistent.isPlatformNavbarCreditBalanceVisible.mainPlatformKey: the SDK's main organization is
the platform's (main), where free-trial users live and the only one that
offers plans. With the app's own organization in the slot, Change Plan is
refused (404), every admin sees the widget whether or not the organization
sells credits, and members are sent to the plan picker. Read it from
useSubscriptionConfig(), never from NEXT_PUBLIC_MAIN_TENANT_KEY.SubscriptionConfigProvider: the credits switch, openBillingTab
and the plan bullets then fall back to the SDK's (the OS's) defaults. Mount
it once (/iblai-vibe-credit-exhaustion).For the full prop surface and the underlying billing data shape, see:
CreditBalance — @iblai/iblai-js/web-containers
tenant, username, mainPlatformKey, currentUserEmail,
redirectUrl, className?, enabled?, open? / onOpenChange? (let
another control open the panel) and sheet? (the panel as a bottom
sheet with no button of its own, for a phone header that opens it
through open)UpgradePackageModal (the plan picker) and the Add Credits
dialog itself; completes a pending Add Credits on return from StripeisPlatformNavbarCreditBalanceVisible(config) and the
PlatformNavbarCreditBalanceConfig type — @iblai/iblai-js/web-containersuseUserIsOnTrial, useIsStripeActivated — @iblai/iblai-js/web-utilsuseGetAccountBillingInfoQuery from the
data layer (plan_key / plan_name name the plan; absent on a trial) —
no manual data fetching is requireduseStripeUpgrade (plans,
loadPlans, choosePlan, changePlan) — @iblai/iblai-js/web-utilsuseCreateStripeCustomerPortalMutation; a top-up charges the card on file
through useTriggerAutoRechargeMutationREST twin: /iblai-api-billing.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub iblai/base --plugin iblai-vibe166 skills in this plugin
/iblai-api-agent-accessManage role-based access to an ibl.ai agent via the platform API — list role policies, search users/groups, and grant/revoke editor, chat, or analytics_viewer roles for users, groups, and emails. Use when controlling who can edit, chat with, or view analytics for an agent./iblai-api-agent-auditRead an ibl.ai agent's audit log via the platform API — a who-changed-what trail filterable by action, actor email, and date range. Read-only. Use when investigating configuration changes to an agent./iblai-api-agent-chatSet up live chat with a deployed ibl.ai agent by wiring the hosted iblai-api-agent-chat MCP server into the project (.mcp.json / claude mcp add) using the .env Api-Token and a chosen agent's unique id, or by signing in from claude.ai, ChatGPT or Claude Desktop with only the URL. Use to enable runtime conversations with an agent, and to list or disconnect the apps a user has connected. The actual chatting then happens through the MCP server's tools.Other plugins' skills for the same job