Skip to content

hackbrasil-2026-bora/OiTenta / .agents/skills/module-repository

module-repository

Unverified

Cria contratos de repositório padronizados para agregados dos módulos de negócio, reaproveitando interfaces compartilhadas de persistência e gerando também uma implementação em memória para apoiar testes dos casos de uso.

references/few-shots/fake-user.repository.example.ts

View on GitHub
import { PageResult } from "@poupig/shared";
import { User, UserPageParams, UserRepository } from "../../src";

export class FakeUserRepository implements UserRepository {
  private readonly storage = new Map<string, User>();

  constructor(initialUsers: User[] = []) {
    for (const user of initialUsers) {
      this.storage.set(user.id, user);
    }
  }

  get users(): User[] {
    return Array.from(this.storage.values());
  }

  async create(data: User): Promise<User> {
    this.storage.set(data.id, data);
    return data;
  }

  async update(data: User): Promise<User> {
    if (!this.storage.has(data.id)) {
      throw new Error(`User with id "${data.id}" was not found.`);
    }

    this.storage.set(data.id, data);
    return data;
  }

  async delete(id: string): Promise<void> {
    this.storage.delete(id);
  }

  async findById(id: string): Promise<User | null> {
    return this.storage.get(id) ?? null;
  }

  async findPage(params: UserPageParams): Promise<PageResult<User>> {
    const page = Math.max(params.page, 1);
    const perPage = Math.max(params.perPage, 1);
    const start = (page - 1) * perPage;
    const items = this.users.slice(start, start + perPage);

    return {
      items,
      page,
      perPage,
      total: this.storage.size,
    };
  }
}
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 198kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 194kUpdated Claude CodeCodexVerifiedInstall