Database Reset & Seed

VerifiedCaution

This skill resets a database to a clean state and optionally seeds it with test data. It supports MongoDB and PostgreSQL projects, performing backup, drop, migration, and seeding steps. Use it when you need a fresh database for development or testing after running migrations.

Sby Skills Guide Bot
DevelopmentIntermediate
6/2/2026
Claude Code
#database#reset#seed#migration#development

Recommended for

Automated summary

Resets and seeds a development database with test data, including a backup step before destructive operations.

Strengths

  • Supports both MongoDB and PostgreSQL
  • Automatically creates a backup before resetting
  • Runs migrations and seeds via configured scripts

Limitations

  • Only works for projects listed in its configuration
  • Does not handle remote or cloud databases
  • Requires CLI tools like mongodump, psql, or Prisma to be installed
When to use it

When you need a clean, consistent database state for development or testing.

When not to use it

Never use on production databases; for simple migrations without a reset, use a dedicated migration command.

Security analysis

Caution
Quality score90/100

Uses bash to execute database management commands, including destructive operations like dropping databases. Skill includes warnings to avoid production use and suggests backup, but the operations are powerful and could cause data loss if misapplied.

No concerns found

How this analysis is made

Examples

Reset database for eruditiontx-services-mvp
Reset and seed the database for eruditiontx-services-mvp
Reset database for a Prisma project
Reset the database for notaryo.ph with fresh seed data
General database reset with confirmation
Reset the current project's database and seed it with test data

name: db-reset description: Reset and seed database for development or testing. Use when needing fresh database state, running migrations, or seeding test data. argument-hint: [project-name] disable-model-invocation: true allowed-tools: Bash, Read, Glob

Database Reset & Seed

Reset databases to a clean state and optionally seed with test data.

Arguments

  • $ARGUMENTS: Project name (optional - uses current directory if not specified)

IMPORTANT WARNINGS

  • NEVER run on production databases
  • Always backup before reset
  • Confirm with user before destructive operations

Database Configurations

| Project | Database | Connection | Seed Script | |---------|----------|------------|-------------| | eruditiontx-services-mvp | MongoDB | mongodb://localhost:27017/eruditiontx_db | scripts/seed.py | | mathmatterstx-services | MongoDB | mongodb://localhost:27017/mathmatters_db | scripts/seed.py | | notaryo.ph | PostgreSQL | .env.local DATABASE_URL | prisma/seed.ts | | bocs-turbo | Various | Per app config | Per app |

Execution Steps

1. Backup Current Database

MongoDB:

mongodump --db=$DB_NAME --out=./backup/$(date +%Y%m%d_%H%M%S)

PostgreSQL:

pg_dump $DATABASE_URL > ./backup/$(date +%Y%m%d_%H%M%S).sql

2. Reset Database

MongoDB:

mongosh --eval "use $DB_NAME; db.dropDatabase();"
# or with authentication
mongosh mongodb://localhost:27017/$DB_NAME --eval "db.dropDatabase();"

PostgreSQL (Prisma):

npx prisma migrate reset --force
# This drops, recreates, and runs all migrations

3. Run Migrations

MongoDB (Beanie): Beanie auto-creates collections from models. No explicit migration needed.

PostgreSQL (Prisma):

npx prisma migrate deploy
# or for development
npx prisma migrate dev

4. Seed Database

Python Projects:

# If seed script exists
uv run python scripts/seed.py
# or
uv run python -m app.database.seed

Prisma Projects:

npx prisma db seed
# Runs the seed script defined in package.json

Test Database Reset

For running tests with clean database:

Python (pytest):

# Create test database
mongosh --eval "use eruditiontx_test_db; db.dropDatabase();"

# Run tests (they should seed their own fixtures)
uv run pytest --db-reset

JavaScript:

# Usually handled by test setup
npm run test:db-reset

Common Seed Data

User Roles (Erudition Projects)

  • Admin users
  • Staff users
  • Teacher users
  • Student users

Sample Data

  • Test schools/organizations
  • Sample questions/content
  • Test transactions

Output Format

Database Reset: [project-name]
Database Type: [MongoDB/PostgreSQL]
Database Name: [db-name]

1. Creating backup...
   Backup saved: ./backup/[timestamp]

2. Dropping database...
   Database dropped.

3. Running migrations...
   [Migration output]

4. Seeding data...
   [Seed output]

Database reset complete!
Records created:
  - Users: X
  - [Other models]: Y

Recovery

If something goes wrong:

# MongoDB
mongorestore --db=$DB_NAME ./backup/[timestamp]/$DB_NAME

# PostgreSQL
psql $DATABASE_URL < ./backup/[timestamp].sql

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/database-reset-seed-mmh8qqdv/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/database-reset-seed-mmh8qqdv' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/database-reset-seed-mmh8qqdv/download' --output '.skill-downloads/database-reset-seed-mmh8qqdv/SKILL.md.part' && mv '.skill-downloads/database-reset-seed-mmh8qqdv/SKILL.md.part' '.skill-downloads/database-reset-seed-mmh8qqdv/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

Tools declared by the author (check availability in your agent): Bash, Read, Glob

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/database-reset-seed-mmh8qqdv/SKILL.md' && test -s '.skill-downloads/database-reset-seed-mmh8qqdv/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/db-reset' && cp -R '.skill-downloads/database-reset-seed-mmh8qqdv' '.claude/skills/db-reset'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/database-reset-seed-mmh8qqdv'

openskills read 'database-reset-seed-mmh8qqdv'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/database-reset-seed-mmh8qqdv/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills