test-database-feature
БесплатноБез исполняемых скриптовНе проверенRun repository integration tests against a local MySQL database for the RAPID backend. Use after implementing new repository methods, modifying Prisma…
Об этом скилле
Test Database Feature
Prerequisites
1. Start Local Database
docker-compose -f assets/local/docker-compose.yml up -d
Database: localhost:3306, DB: rapid_db, User: rapid_user, Password: rapid_password
2. Setup Prisma
cd backend
npm run prisma:generate
npm run prisma:migrate
Repository Integration Test Pattern
Repository tests MUST connect to actual database (not mocks).
import { describe, it, expect, beforeEach, afterAll } from 'vitest';
import { PrismaClient } from '@prisma/client';
import { makeYourRepository } from '../domain/repository';
const prisma = new PrismaClient();
describe('YourRepository Integration Tests', () => {
beforeEach(async () => {
await prisma.yourModel.deleteMany();
});
afterAll(async () => {
await prisma.$disconnect();
});
it('should create and retrieve entity', async () => {
const repo = makeYourRepository(prisma);
const entity = { id: 'test-1', name: 'Test Entity' };
await repo.storeEntity({ entity });
const retrieved = await repo.findEntityById('test-1');
expect(retrieved).not.toBeNull();
expect(retrieved?.name).toBe('Test Entity');
});
});
Test Organization
backend/src/api/features/{feature}/__tests__/
├── repository-integration.test.ts # Database integration tests
├── usecase.test.ts # Use case unit tests (mocked repo)
└── handlers.test.ts # Handler unit tests (mocked usecase)
Running Tests
cd backend
npm test # All tests
npm run test -- {test-name} # Specific test suite
npm run test:watch # Watch mode
npm run test:coverage # With coverage
Quick Commands
| Task | Command |
|---|---|
| Start DB | docker-compose -f assets/local/docker-compose.yml up -d |
| Stop DB | docker-compose -f assets/local/docker-compose.yml down |
| Reset DB | Add -v to down, then up + migrate |
| Run migrations | cd backend && npm run prisma:migrate |
| Prisma Studio | cd backend && npm run prisma:studio (http://localhost:5555) |
Success Criteria
- Docker container running
- Migrations applied
- All repository integration tests pass
- Ready to run
/build-and-formatfor final verification
Установить test-database-feature в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл test-database-feature?
Run repository integration tests against a local MySQL database for the RAPID backend. Use after implementing new repository methods, modifying Prisma database schema, testing use cases that depend on database access, or verifying data access patterns.
Как установить скилл test-database-feature?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл test-database-feature запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic