br4zz4:seed

Creates and reviews idempotent database seeds and test factories across Rails, Phoenix, Django, and React stacks.

Updated May 25, 2025
One-click install
npx skills add https://github.com/oporpino/commons --skill br4zz4-seed-oporpino
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: br4zz4:seed
Source: https://github.com/oporpino/commons/tree/main/ai/shared/skills/br4zz4%3Aseed
Command: npx skills add https://github.com/oporpino/commons --skill br4zz4-seed-oporpino

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? New features often ship without matching seed data or test factories, leaving the development environment empty and tests unable to build realistic records. This Skill enforces a consistent workflow so every feature gets factories for tests and idempotent seeds for the dev environment. ## Core Features & Use Cases - Factory creation and review: Adds or updates one factory per model with traits covering meaningful states, using FactoryBot (Rails), factory.ex (Phoenix), factory_boy (Django), or TypeScript fixtures (React). - Idempotent seed generation: Writes dev-only seeds guarded by environment checks and find-or-create patterns so repeated runs never duplicate data. - Procfile.dev integration and seed summary: Ensures a setup: entry runs migrations plus seeds, and appends a summary block printing per-model counts and seeded user credentials. - Use Case: After implementing a new invoicing feature in a Rails app, run this Skill to generate the FactoryBot factories, add guarded seed records for each invoice state, wire seeds into Procfile.dev, and verify idempotency by running seeds twice. ## Quick Start Ask the AI to create or review the factories and seeds for the feature you just implemented, following the stack-specific paths and idempotency rules.

Frequently Asked Questions about br4zz4:seed

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

FAQPage Schema
How do I create idempotent database seeds in Rails?▼

Idempotent Rails seeds wrap each record in Model.find_or_create_by!(...) and start the file with return unless Rails.env.development?. Running the seed twice then produces no duplicates or errors, which you verify by executing make run.seed twice.

What is the difference between factories and seeds?▼

Factories build data for tests, while seeds populate the development environment, and both are required for every feature. Factories live in paths like test/factories/<model>.rb, while seeds live in db/seeds/ or the stack equivalent.

Where do seed files go in Phoenix and Django projects?▼

Phoenix seeds go in priv/repo/seeds.exs with factories in test/support/factory.ex. Django seeds use <app>/fixtures/<model>.json or scripts/seed.py, with factories in <app>/tests/factories.py using factory_boy.

Should seeds run in production environments?▼

No, seeds must be dev-only and guarded with checks like Rails.env.development?, Mix.env() != :dev, or settings.DEBUG. They should be added to Procfile.dev via a setup entry, never to the production Procfile release command.

Why do my seeds create duplicate records on rerun?▼

Duplicates happen when seeds use plain create calls instead of guarded lookups. Use find_or_create_by! in Ruby, on_conflict: :nothing in Elixir, or get_or_create in Django so repeated runs skip existing records.