Skip to content
cccskills
FreePublished on GitHub

repositories-and-data-access

Implement repository interfaces for data persistence and abstraction over database operations using Bun ORM.

The English summary is being prepared. Showing the original description.

Authula/authula273 stars(GitHub 273 + cccskills 0)

Run score Not tested

See how to install

Files included (2)

  • SKILL.md1.9 KB
  • examples/bun_todo_repository.go2.0 KB

SKILL.md (original)

Review the instructions the agent will receive before you install.

Repositories & Data Access

When to use this skill

  • Create data access layer abstractions for entities
  • Implement Bun-based repositories for database operations
  • Define repository interfaces that services depend on
  • Add transaction support (WithTx) to repositories

Key principles

  1. Interface segregation: One repository interface per domain model
  2. Bun ORM: Use Bun for type-safe database operations
  3. Transaction support: Every repository implements WithTx(tx bun.IDB)
  4. Context-aware: All operations accept context.Context
  5. No business logic: Repositories only handle CRUD; logic lives in services

Pattern

Repositories are data access only:

  • Define interface with CRUD operations (Create, GetByID, Update, Delete)
  • Implement with Bun in bun_*.go files
  • Accept bun.IDB at construction (not concrete *bun.DB)
  • Return interfaces from constructors
  • Missing records return nil, nil for single queries; empty slice for batch queries

Example

See examples/bun_todo_repository.go for:

  • ITodoRepository interface definition
  • bunTodoRepository Bun implementation
  • CRUD and batch query patterns

Common mistakes

  1. Returning errors for missing records (use nil instead)
  2. Forgetting WithTx() method
  3. Putting business logic in repositories
  4. Not passing context to Scan/Exec
  5. Repository-to-repository calls instead of service orchestration

References

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

Wire dependencies using constructor-based dependency injection throughout services, repositories, and handlers.

The English summary is being prepared. Showing the original description.

Authula/authula273Updated Oct 24, 2026

Use this skill when answering questions, explaining concepts, writing technical responses, reviewing code, or helping with development tasks. Communicate in clear, simple, standard English. Keep answers concise and focused, remove unnecessary filler and repetition, explain technical ideas in plain language, and structure information so it is easy to read and understand. When showing code, present it clearly with enough context for the developer to understand what it does and where it belongs.

The English summary is being prepared. Showing the original description.

Authula/authula273Updated Oct 24, 2026

A relentless interview to sharpen a plan or design.

The English summary is being prepared. Showing the original description.

Authula/authula273Updated Oct 24, 2026

Grill the user relentlessly about a plan, decision, or idea. Use when the user wants to stress-test their thinking, or uses any 'grill' trigger phrases.

The English summary is being prepared. Showing the original description.

Authula/authula273Updated Oct 24, 2026

Implement HTTP handlers that parse requests, invoke use cases, and format responses following REST conventions.

The English summary is being prepared. Showing the original description.

Authula/authula273Updated Oct 24, 2026

Compact the current conversation into a handoff document for another agent to pick up.

The English summary is being prepared. Showing the original description.

Authula/authula273Updated Oct 24, 2026

See all skills by Authula

Report a problem with this skill