admin-dashboard — Claude Code skill: admin panels and internal tools
Extends an admin dashboard, developer portal and operations console with new tabs, metrics, monitoring and user management.
npx skills add curiositech/some_claude_skills --skill admin-dashboard -a claude-codeWhat admin-dashboard does
The skill lays out how the admin dashboard is built and walks you through adding a tab to it. It covers the existing tabs (Overview, Funnel, Page Views, Users, Access Requests, Allowed Emails, Email Templates), where each one pulls data from, and the planned ones: Production Health, Error Tracking, External Services, AI Analytics, Audit Logs.
Adding a tab takes three edits: write the tab component, register it in the tabs array, wire it into renderTabContent. For the backend there is an endpoint template with requireAdmin(), a rate limiter and an audit log call. A StatCard component and SWR-based polling are included too.
The patterns are tied to one codebase: paths like src/app/admin/page.tsx, tables adminUsers, auditLog, pageViews, modules @/db/secure-db and @/lib/hipaa/audit. On a different project structure you will be rewriting the examples. The error display sample also insists on keeping user IDs and PHI out of the output, so check that before pasting it into your own code.
What it helps with
- add a new tab to an existing admin dashboard
- build a stats endpoint with admin checks and rate limiting
- surface API latency and external service status
- log admin actions to an audit trail
- show aggregated errors without user identifiers
Example prompts for the agent
- Add a Production Health tab to the admin dashboard with latency and uptime metrics
- Create an
/api/admin/metricsendpoint with admin check and audit logging - List errors grouped by type and path, with no user IDs
How to install admin-dashboard
1Skills CLI (Vercel)
npx skills add curiositech/some_claude_skills --skill admin-dashboard -a claude-code2Manually: put the files in place
~/.claude/skills/admin-dashboard/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/admin-dashboard/
1Skills CLI (Vercel)
npx skills add curiositech/some_claude_skills --skill admin-dashboard -a codex2Manually: put the files in place
.agents/skills/admin-dashboard/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add curiositech/some_claude_skills --skill admin-dashboard -a cursor2Manually: put the files in place
.cursor/skills/admin-dashboard/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install curiositech/some_claude_skills admin-dashboard2Manually: put the files in place
.github/skills/admin-dashboard/SKILL.md1Skills CLI (Vercel)
npx skills add curiositech/some_claude_skills --skill admin-dashboard -a gemini-cli2Platform CLI
gemini skills install https://github.com/curiositech/some_claude_skills --path .claude/skills/admin-dashboardManually: put the files in place
.devin/skills/admin-dashboard/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add curiositech/some_claude_skills --skill admin-dashboard -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about admin-dashboard
How do I install admin-dashboard in Claude?
Run npx skills add curiositech/some_claude_skills --skill admin-dashboard -a claude-code. The skill file lands at ~/.claude/skills/admin-dashboard/SKILL.md.
What does admin-dashboard do?
It helps you extend an admin dashboard and internal tooling: new tabs, metrics, monitoring and user management, following the patterns already used in the project.
Which project structure does the skill assume?
One with src/app/admin/page.tsx, tables adminUsers, auditLog, pageViews and modules @/db/secure-db, @/lib/hipaa/audit. On another codebase the examples need adapting.
Source text
SKILL.md · MIT
---
name: admin-dashboard
description: Extend and modify the admin dashboard, developer portal, and operations console. Use when adding new admin tabs, metrics, monitoring features, or internal tools. Activates for dashboard development,
analytics, user management, and internal tooling.
allowed-tools: Read,Write,Edit,Bash(npm:*,npx:*)
metadata:
category: Productivity & Meta
tags:
- dashboard
- admin
- internal-tools
pairs-with:
- skill: reactive-dashboard-performance
reason: Performance optimization patterns keep admin dashboards responsive under heavy data loads
- skill: supabase-admin
reason: Admin dashboards typically display and manage Supabase-backed data and user records
- skill: logging-observability
reason: Admin consoles surface the metrics and logs that observability systems collect
---
# Admin & Developer Suite Development
This skill helps you extend the admin dashboard and build internal tools following the established patterns.
## Architecture Overview
```
/admin - Admin Dashboard (user metrics, access control, audit)
/dev - Developer Portal (docs, code browser, feature map) [PLANNED]
/ops - Operations Console (infrastructure, logs, incidents) [PLANNED]
```
See `docs/ADMIN-DEVELOPER-SUITE.md` for the full design specification.
## Current Admin Dashboard Structure
Location: `src/app/admin/page.tsx`
### Existing Tabs
| Tab | Purpose | Data Source |
|-----|---------|-------------|
| Overview | Quick stats (users, check-ins, messages) | `/api/admin/stats` |
| Funnel | User engagement waterfall | `/api/admin/stats` |
| Page Views | Analytics by page path | `/api/admin/stats` |
| Users | User roster with activity | `/api/admin/stats` |
| Access Requests | Pending/approved/denied requests | `/api/admin/access-requests` |
| Allowed Emails | Email whitelist management | `/api/admin/allowed-emails` |
| Email Templates | Preview system emails | Local data |
### Planned Tabs (from design)
| Tab | Purpose | Status |
|-----|---------|--------|
| Production Health | API latency, Core Web Vitals | Pending |
| Error Tracking | HIPAA-safe error aggregation | Pending |
| External Services | Anthropic, DB, Push status | Pending |
| AI Analytics | Conversation metrics, tokens | Pending |
| Audit Logs | HIPAA compliance viewer | Pending |
## Adding a New Admin Tab
### 1. Create the Tab Content Component
```typescript
// In src/app/admin/page.tsx, add a new tab component
function ProductionHealthTab() {
const [metrics, setMetrics] = useState<APIMetrics | null>(null);
const [loading, setLoading] = useState(true);
useEffect(() => {
async function fetchMetrics() {
const res = await fetch('/api/admin/metrics');
const data = await res.json();
setMetrics(data);
setLoading(false);
}
fetchMetrics();
}, []);
if (loading) return <div>Loading...</div>;
return (
<div className="space-y-6">
<div className="grid grid-cols-4 gap-4">
<StatCard label="Uptime" value={metrics.uptime} />
<StatCard label="Avg Latency" value={`${metrics.avgLatency}ms`} />
<StatCard label="Errors (24h)" value={metrics.errorCount} />
<StatCard label="Active Users" value={metrics.activeUsers} />
</div>
{/* More content */}
</div>
);
}
```
### 2. Add the Tab to the Tab List
```typescript
const tabs = [
{ id: 'overview', label: 'Overview' },
{ id: 'health', label: 'Production Health' }, // NEW
{ id: 'funnel', label: 'Funnel' },
// ...
];
```
### 3. Add the Tab Content Renderer
```typescript
function renderTabContent(tabId: string) {
switch (tabId) {
case 'overview':
return <OverviewTab stats={stats} />;
case 'health':
return <ProductionHealthTab />; // NEW
// ...
}
}
```
## Creating Admin API Endpoints
### Pattern: Admin Stats Endpoint
```typescript
// src/app/api/admin/metrics/route.ts
import { requireAdmin } from '@/db/secure-db';
import { createRateLimiter } from '@/lib/rate-limit';
import { logAdminAction } from '@/lib/hipaa/audit';
const rateLimiter = createRateLimiter({
windowMs: 60000,
maxRequests: 60,
keyPrefix: 'admin:metrics'
});
export async function GET(request: Request) {
// 1. Check admin access
const admin = await requireAdmin();
if (!admin) {
return Response.json({ error: 'Forbidden' }, { status: 403 });
}
// 2. Apply rate limiting
const rateLimitResult = await rateLimiter.check(admin.id);
if (!rateLimitResult.allowed) {
return Response.json(
{ error: 'Rate limit exceeded' },
{ status: 429, headers: rateLimitResult.headers }
);
}
// 3. Log admin action
await logAdminAction(
admin.id,
AuditAction.ADMIN_STATS_VIEW,
'metrics',
null
);
// 4. Fetch and return data
const metrics = await getAPIMetrics();
return Response.json(metrics);
}
```
## Key Patterns
### StatCard Component
```typescript
function StatCard({
label,
value,
trend,
status
}: {
label: string;
value: string | number;
trend?: 'up' | 'down' | 'neutral';
status?: 'good' | 'warning' | 'error';
}) {
return (
<div className="rounded-lg border bg-card p-4">
<div className="text-sm text-muted-foreground">{label}</div>
<div className="text-2xl font-bold">{value}</div>
{trend && <TrendIndicator direction={trend} />}
{status && <StatusBadge status={status} />}
</div>
);
}
```
### Data Fetching Pattern
```typescript
// Use SWR or React Query for real-time updates
import useSWR from 'swr';
function useAdminMetrics() {
const { data, error, isLoading } = useSWR(
'/api/admin/metrics',
fetcher,
{ refreshInterval: 30000 } // Refresh every 30s
);
return { metrics: data, error, isLoading };
}
```
### HIPAA-Safe Error Display
```typescript
// Never show user-specific error details
function ErrorList({ errors }: { errors: AggregatedError[] }) {
return (
<div>
{errors.map(error => (
<div key={error.hash}>
<span className="font-mono">{error.type}</span>
<span>{error.path}</span>
<span>{error.count} occurrences</span>
<span>{error.affectedUsers} users</span>
{/* NO user IDs, NO error messages with PHI */}
</div>
))}
</div>
);
}
```
## Database Tables for Admin Features
Existing tables:
- `adminUsers` - Admin role assignments
- `allowedEmails` - Email whitelist
- `accessRequests` - Access request queue
- `auditLog` - HIPAA audit trail
- `pageViews` - Navigation analytics
Planned tables (from design):
- `api_metrics` - API timing data
- `app_errors` - Aggregated errors
- `service_health` - External service status
- `conversation_analytics` - AI chat metadata
- `incidents` - Incident tracking
## Access Control
```typescript
// Always use requireAdmin() for admin routes
import { requireAdmin } from '@/db/secure-db';
// For super-admin only features
const admin = await requireAdmin();
if (admin.role !== 'super_admin') {
return Response.json({ error: 'Super admin required' }, { status: 403 });
}
```
## Testing Admin Features
```typescript
// Mock admin authentication for tests
vi.mock('@/db/secure-db', () => ({
requireAdmin: vi.fn().mockResolvedValue({
id: 'test-admin',
role: 'admin'
})
}));
describe('Admin Metrics Endpoint', () => {
it('returns metrics for authenticated admin', async () => {
const response = await GET(mockRequest);
expect(response.status).toBe(200);
});
it('returns 403 for non-admin', async () => {
vi.mocked(requireAdmin).mockResolvedValueOnce(null);
const response = await GET(mockRequest);
expect(response.status).toBe(403);
});
});
```
## Design Resources
- Full design spec: `docs/ADMIN-DEVELOPER-SUITE.md`
- Design system: Use existing components from `src/components/ui/`
- Colors: Follow therapeutic palette (navy, teal, coral, cream)
© curiositech · MIT · curiositech/some_claude_skills