repository-guide

Implement Backend.AI repository patterns with six core operations and multi-tenant scope handling.

662|179|Updated Oct 6, 2016
One-click install
npx skills add https://github.com/lablup/backend.ai --skill repository-guide
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: repository-guide
Source: https://github.com/lablup/backend.ai/tree/main/.claude/skills/repository-guide
Command: npx skills add https://github.com/lablup/backend.ai --skill repository-guide

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides a structured blueprint for implementing standard repository patterns in Backend.AI, enabling consistent data access, testability, and scalable multi-tenant support.

Core Features & Use Cases

  • 6 core operations: create, get, search, update, delete, purge, plus batch variants (batch_update, batch_delete, batch_purge).
  • Pattern-driven architecture: demonstrates how repositories delegate to DB sources, use scope objects for multi-tenant filtering, and maintain clean public APIs.
  • Use case examples: common domain repositories such as user groups, projects, and domain entities are shown with concrete implementations that support testing with real databases.

Quick Start

Begin by studying the repository pattern examples under src/ai/backend/manager/repositories, adapt the base utilities to your domain, and write tests following the tdd-guide workflow.

Frequently Asked Questions about repository-guide

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

FAQPage Schema
How do I implement a repository pattern for multi-tenant data access in Backend.AI?

To implement a multi-tenant repository pattern in Backend.AI, use base utilities like Creator, Querier, and Updater to delegate DB sources and apply scope objects for tenant filtering. This ensures consistent operations and clean public APIs across domain-specific repositories.

What standard CRUD operations should a Backend.AI repository include?

A standard Backend.AI repository includes six core operations: create, get, search, update, delete, and purge, along with batch variants like batch_update and batch_delete. These operations ensure consistent data access and testability across domain entities.

How do I test repository patterns in Backend.AI with real databases?

To test repository patterns in Backend.AI with real databases, follow the tdd-guide workflow and write tests that reflect the repository pattern in __init__ initializations. This approach validates consistent operations and scope handling in multi-tenant environments.

Does the Backend.AI repository pattern support batch operations?

Yes, the Backend.AI repository pattern supports batch operations including batch_update, batch_delete, and batch_purge. These batch variants extend the six core CRUD operations to handle bulk data modifications efficiently within domain-specific repositories.

Can I use Backend.AI repositories for domain entities like user groups and projects?

Yes, you can use Backend.AI repositories for domain entities like user groups and projects. The blueprint provides concrete implementations that delegate to DB sources and support testing with real databases for these common domain use cases.

What base utilities are required to build a Backend.AI repository?

Building a Backend.AI repository requires base utilities such as Creator, Querier, BatchQuerier, Updater, and Purger. These utilities handle standardized data access operations and maintain clean public APIs for multi-tenant scope filtering.