| name | admin |
| description | This skill should be used when designing and implementing administrative backend systems. It covers dashboard design, user management, data statistics, system configuration, and backup functionality for web applications. |
| depends | ["real.md","cog.md"] |
| generates | ["spec-admin.md"] |
Admin Backend Design
Overview
This skill guides the design and implementation of administrative backend systems. To create effective admin panels, define the admin role, design dashboard layouts, implement user management, and configure system monitoring.
Note for AI Agents: The generated spec document is designed to be consumed by AI agents (especially Claude Code) to ensure consistent admin implementation and reduce trial-and-error during development.
Prerequisites
Before using this skill, ensure the following foundation documents exist:
- real.md - Reality Constraints Document
- cog.md - Cognitive Model Document
If these documents do not exist, invoke the 00-meta skill first to generate them.
Pre-execution Checklist
[ ] real.md exists in project root or .42cog directory
[ ] cog.md exists in project root or .42cog directory
[ ] Read real.md to understand admin-related constraints (e.g., first-user-admin rule)
[ ] Read cog.md to understand admin agent definition and permissions
Context Loading
From cog.md, extract:
- Admin agent definition and identification method
- Admin-managed entities and their relationships
- Permission model and access control rules
From real.md, extract:
- Security constraints for admin operations
- Data access and modification rules
- First-user-admin rule if applicable
When to Use This Skill
- Designing admin dashboard interfaces
- Implementing user management functionality
- Creating system statistics and monitoring views
- Building backup and recovery features
- Defining admin access control policies
Process
Phase 1: Define Admin Role
To establish the admin role:
-
Identification Method
- How to identify admin users (role field, permissions table)
- How first admin is created (first registration, manual assignment)
-
Responsibilities
- User account management
- System statistics viewing
- Global configuration management
- Data backup and recovery
-
Access Control
- Routes requiring admin access
- API endpoints with admin-only permissions
- Actions restricted to admins
Admin Role Definition Template:
## Admin Role
**Identification:**
- Field: `role = 'admin'`
- Assignment: First registered user automatically becomes admin
**Permissions:**
| Resource | Create | Read | Update | Delete |
|----------|--------|------|--------|--------|
| Users | - | ✓ | ✓ | - |
| Stats | - | ✓ | - | - |
| Config | - | ✓ | ✓ | - |
| Backups | ✓ | ✓ | - | ✓ |
Phase 2: Design Dashboard
The dashboard provides system overview at a glance.
Key Metrics to Display:
| Metric | Description | Update Frequency |
|---|
| Total Users | Registered user count | Real-time |
| Active Users | Users active in last 24h | Hourly |
| Total Conversations | All conversation count | Real-time |
| Messages Today | Messages sent today | Real-time |
| System Health | Service status | Every minute |
Dashboard Layout:
┌─────────────────────────────────────────────────────┐
│ Dashboard │
├──────────┬──────────┬──────────┬──────────┐ │
│ Users │ Active │ Convos │ Messages │ │
│ 156 │ 42 │ 1,234 │ 5,678 │ │
│ ↑12% │ ↑8% │ ↑15% │ ↑23% │ │
├──────────┴──────────┴──────────┴──────────┤ │
│ │ │
│ [Usage Trend Chart] │ │
│ │ │
├────────────────────────────────────────────┤ │
│ [Recent Activity Log] │ │
└────────────────────────────────────────────┘ │
Time Range Filters:
- Today
- This Week
- This Month
- Custom Range
Phase 3: Implement User Management
User List Features:
| Feature | Description |
|---|
| Pagination | Display 20 users per page |
| Search | Search by email, name |
| Filter | Filter by role, status |
| Sort | Sort by registration date, activity |
User List Columns:
| Column | Type | Sortable | Notes |
|--------|------|----------|-------|
| ID | UUID | No | Truncated display |
| Email | String | Yes | Primary identifier |
| Name | String | Yes | Optional |
| Role | Enum | Yes | user/admin |
| Status | Enum | Yes | active/disabled |
| Created | DateTime | Yes | Registration date |
| Last Login | DateTime | Yes | Last activity |
| Actions | Buttons | No | View/Edit/Disable |
User Actions:
| Action | Description | Confirmation Required |
|---|
| View Details | Show user profile and activity | No |
| Change Role | Toggle admin/user | Yes |
| Disable Account | Prevent login | Yes |
| Enable Account | Restore access | No |
Constraints:
- Cannot disable own account
- Cannot remove last admin
Phase 4: System Configuration
Configuration Categories:
-
Site Settings
- Site name and description
- Registration policy (open/closed/invite)
- Default user quotas
-
API Defaults
- Default API configurations
- Rate limiting settings
- Timeout values
-
Security Settings
- Session timeout
- Password requirements
- Login attempt limits
Configuration Template:
## Site Configuration
| Setting | Type | Default | Description |
|---------|------|---------|-------------|
| site_name | String | "42chat" | Display name |
| registration | Enum | open | open/closed/invite |
| session_timeout | Integer | 86400 | Seconds |
Phase 5: Backup Management
Backup Features:
| Feature | Description |
|---|
| Manual Backup | Trigger immediate backup |
| Scheduled Backup | Configure automatic backups |
| Backup List | View backup history |
| Download | Download backup files |
| Restore | Restore from backup |
Backup Scope:
- User accounts
- Conversations and messages
- API configurations
- Prompt templates
- System settings
Restore Process:
- Select backup to restore
- Preview affected data
- Confirm restoration (requires password)
- Execute restore
- Verify system state
Admin Page Structure
/admin
├── /dashboard # Overview and statistics
├── /users # User management
│ └── /[id] # User details
├── /conversations # Conversation overview
├── /settings # System configuration
└── /backups # Backup management
Security Guidelines
-
Route Protection
- All
/admin/* routes require authentication
- Verify admin role on every request
- Log all admin actions
-
Sensitive Data Display
- API keys show masked (sk-****1234)
- Passwords never displayed
- Personal data access logged
-
Dangerous Operations
- Require confirmation dialog
- Some require password re-entry
- Cannot be undone warnings
Output Template
To generate admin specification:
# Admin Backend Specification
## Access Control
[Define admin identification and permissions]
## Dashboard
[Define metrics and layout]
## User Management
[Define list, search, actions]
## Configuration
[Define settings categories]
## Backup
[Define backup strategy]
## Security
[Define protection measures]
Integration with Other Skills
| Skill | Relationship |
|---|
| system-architecture | Input: provides route structure |
| database-design | Input: provides data schema |
| ui-design | Collaboration: defines admin UI |
| quality-assurance | Output: provides admin test cases |