create-mockdb-repository

Implement an in-memory MockDB repository with CRUD operations and paginated queries.

1|Updated May 21, 2025
One-click install
npx skills add https://github.com/madooei/backend-template --skill create-mockdb-repository
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: create-mockdb-repository
Source: https://github.com/madooei/backend-template/tree/main/.claude/skills/create-mockdb-repository
Command: npx skills add https://github.com/madooei/backend-template --skill create-mockdb-repository

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides an in-memory MockDB repository implementation to accelerate development and testing by simulating a data layer without a real database.

Core Features & Use Cases

  • In-memory data store using an array
  • CRUD operations (create, read, update, delete)
  • Paginated, filtered queries with sorting
  • Useful for unit tests, fixtures, and prototyping

Quick Start

Create src/repositories/mockdb/{entity}.mockdb.repository.ts and implement the MockDb{Entity}Repository class following the reference pattern.

Frequently Asked Questions about create-mockdb-repository

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create an in-memory repository for TypeScript unit testing?

You can create an in-memory repository for TypeScript unit testing by implementing a MockDB repository class that uses an array to simulate a data layer. This provides fast CRUD operations and test fixtures without requiring a real database.

What is the best way to mock a data layer for fast prototyping?

The best way to mock a data layer for fast prototyping is to use an in-memory MockDB repository. It simulates database interactions using an array, allowing you to perform paginated, filtered queries with sorting without the overhead of database setup.

Does the in-memory MockDB repository support CRUD operations and paginated queries?

Yes, the in-memory MockDB repository supports full CRUD operations including create, read, update, and delete. It also handles paginated, filtered queries with sorting, alongside specific methods like findAll, findById, and a clear helper with consistent timestamps.

How do I set up a mock repository interface for test fixtures?

To set up a mock repository interface for test fixtures, create a file at src/repositories/mockdb/{entity}.mockdb.repository.ts and implement the MockDb{Entity}Repository class following the reference pattern to provide consistent data access across your tests.

When should I use an in-memory database over a real database for testing?

You should use an in-memory database over a real database when you need fast prototyping, unit tests, and test fixtures across repository interfaces. It eliminates the latency and setup requirements of a real database, accelerating development cycles.