Claude-skill-registry-data managing-databases
Generates secure, owner-only admin dashboards for PostgreSQL or MongoDB. Capable of handling schema definitions, operational tasks, and basic CRUD, with flexible security models.
install
source · Clone the upstream repo
git clone https://github.com/majiayu000/claude-skill-registry-data
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry-data "$T" && mkdir -p ~/.claude/skills && cp -r "$T/data/managing-databases" ~/.claude/skills/majiayu000-claude-skill-registry-data-managing-databases && rm -rf "$T"
manifest:
data/managing-databases/SKILL.mdsource content
Database Admin Generator
When to use this skill
- When the user asks for an "Admin Panel", "Dashboard", or "Internal Tool" for their database.
- When the user needs to visualize or manipulate data in PostgreSQL or MongoDB.
- When the user demands high security for managing sensitive data.
Workflow
- Requirement Check:
- DB Type: PostgreSQL or MongoDB?
- Scope: Structural (Schema/Models) or Operational (Raw SQL/Backups)?
- Auth: Hardcoded (Env Var) or Identity (OAuth)?
- Architecture Setup:
- Scaffold a Next.js application (App Router).
- Install core libs:
(SQL) orprisma
(Mongo), plus UI components (Shadcn/UI recommended).mongoose
- Security Implementation:
- Create a global
to block ALL routes unless authenticated.middleware.ts - If Hardcoded: Check a session cookie against
.ADMIN_PASSWORD - If Identity: Integrate NextAuth.js with
whitelist.ALLOWED_EMAILS
- Create a global
- Feature Build:
- Schema Mode: specialized pages for "Table Editor" or "Collection Manager".
- Ops Mode: "Query Playground" and "Health/Metrics" pages.
- Final Polish:
- Add "System Status" indicator.
- Ensure strict Content Security Policy headers.
Instructions
1. Database Connection Patterns
- PostgreSQL: Always utilize Prisma ORM for type safety on the admin side.
- Ops Mode: Allow raw parameterized queries via
.prisma.$queryRaw
- Ops Mode: Allow raw parameterized queries via
- MongoDB: Use Mongoose for schema definitions if "Structural" is requested; use raw
for "Ops" to allow unrestricted aggregation pipelines.MongoClient
2. Security Patterns
- The "Ironclad" Middleware:
// middleware.ts export function middleware(req) { const session = getSession(req); if (!session || !isOwner(session.user)) { return new Response("Unauthorized Access Prohibited", { status: 403 }); } } - Env Validation: Fail build immediately if
orADMIN_SECRET
is missing.DATABASE_URL
3. UI/UX Guidelines
- Aesthetics: Use "Dark Mode" by default for admin tools (reduces eye strain for Ops).
- Feedback: Every destructive action (Drop Table, Delete Many) MUST have a "Type the name to confirm" modal.
- Data Density: Use compact tables with expandable rows for JSON/BSON data.