- Home
- Skills
- APIs & Backend
- Agency Admin CRM
Agency Admin CRM
Secure admin dashboard and lead CRM with RBAC, audit logs, and injection-protected CSV exports.
$9.99
Agency Admin CRM
Example session with this skill installed
Scaffold the admin lead dashboard with RBAC and a CSV export route that prevents formula injection.
- Read your context and instructions
- Compiled the agency admin crm
I have scaffolded the Admin Portal infrastructure. This includes the server-side RBAC middleware, the lead management API routes with audit logging, and the secure CSV export utility.
Admin CRM Implementation
API Route: Secure Lead Export
// /app/api/admin/leads/export/route.ts
import { NextResponse } from 'next/server';
import { getServerSession } from 'next-auth';
import { prisma } from '@/lib/prisma';
import { authOptions } from '@/lib/auth';
export async function GET() {
const session = await getServerSession(authOptions);
if (!session || session.user.role !== 'ADMIN') {
return new NextResponse('Unauthorized', { status: 403 });
}
const leads = await prisma.lead.findMany({
select: { email: true, name: true, status: true, score: true }
});
const headers = ['Name', 'Email', 'Status', 'Score'];
// Apply formula injection protection
const sanitize = (val: string | number) => {
const str = String(val);
return /^[=+\-@\t\r]/.test(str) ? `'${str}` : str;
};
const csvContent = [
headers.join(','),
...leads.map(l => [
sanitize(l.name),
sanitize(l.email),
sanitize(l.status),
l.score
].join(','))
].join('\n');
await prisma.auditLog.create({
data: {
action: 'LEADS_EXPORTED',
userId: session.user.id,
entity: 'LEAD'
}
});
return new NextResponse(csvContent, {
headers: {
'Content-Type': 'text/csv',
'Content-Disposition': 'attachment; filename=leads-export.csv'
}
});
}
Lead Pipeline Table Component
| Feature | Implementation Detail | Role Access |
|---|---|---|
| KPI Cards | Displays Total, Qualified, and Pipeline % | VIEWER+ |
| Status Update | PATCH /api/admin/leads/[id] | MANAGER+ |
| Audit Trail | Logs changes to LEAD_STATUS_UPDATED | ADMIN |
| CSV Export | Sanitized output for Excel/Sheets | ADMIN |
Next steps
- Run
npx prisma generateto ensure theAuditLogandLeadmodels are synced. - Update your
middleware.tsto include the new/adminroute protection patterns. - Test the CSV export with a lead name starting with
=to verify sanitization.
Connects securely to your tools. The creator never sees your data.
About this skill
Lead management often collapses into messy spreadsheets or insecure, improvised dashboards. This skill builds a hardened internal Admin Portal and CRM designed specifically for agency and SaaS teams to manage inbound leads and chat transcripts.
What it does
- Role-Based Access Control enforces strict permissions for
ADMIN,MANAGER, andVIEWERroles across all pages and API routes. - Lead Pipeline Management provides a filterable interface to track leads from
NEWtoWON/LOSTwith scoring and source tracking. - Secure CSV Export generates lead reports with built-in protection against CSV formula-injection attacks.
- Audit Logging records every status change, lead assignment, and export event for internal accountability.
- Transcript Integration links leads to specific AI chat sessions for full context during follow-up.
How it works
- Auth Verification checks your existing Auth.js or session implementation to wrap
/adminroutes in server-side guards. - Schema Integration maps the lead, user, and audit log models using your Prisma schema.
- API Implementation builds paginated, validated CRUD endpoints for lead updates and internal notes.
- UI Scaffolding generates the dashboard KPI cards, filterable tables, and lead detail drawers.
Frameworks & tools
Built for TypeScript environments using Next.js (App Router), Prisma ORM, and Auth.js/NextAuth. It utilizes bcryptjs or argon2 for password security and Zod for schema validation.
Why this beats prompting it yourself
Writing secure RBAC and sanitizing CSV exports is tedious and error-prone. This skill ensures that sensitive lead data never leaks through unshielded API routes and that every administrative action is logged by default.
Use cases
- Building a protected dashboard to manage leads captured by an AI chatbot.
- Adding a secure internal portal for sales managers to assign leads to team members.
- Implementing a compliant audit trail for lead deletions and bulk exports.
Known limitations
Requires an existing Prisma schema and a functioning authentication provider to be present in the codebase. Does not include frontend styling for non-Tailwind projects.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 8 days ago
- Software
- tsc
Node.jsPostgreSQLtypscript
Permissions
What's inside
Frequently Asked Questions
New in APIs & Backend
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for APIs & Backend.