From refinery
Use when interrogating the codebase to understand an entity, its fields, relationships, and data flows. Use when user says 'analyze data model', 'analizar modelo', 'understand entity', 'check schema', or asks about a specific entity or database field.
npx claudepluginhub weorbitant/workbench-dev --plugin refineryThis skill is limited to using the following tools:
Read `${CLAUDE_PLUGIN_ROOT}/config.yaml`.
Fetches up-to-date documentation from Context7 for libraries and frameworks like React, Next.js, Prisma. Use for setup questions, API references, and code examples.
Retrieves current documentation, API references, and code examples for libraries, frameworks, SDKs, CLIs, and services via Context7 CLI. Ideal for API syntax, configs, migrations, and setup queries.
Uses ctx7 CLI to fetch current library docs, manage AI coding skills (install/search/generate), and configure Context7 MCP for AI editors.
Read ${CLAUDE_PLUGIN_ROOT}/config.yaml.
If it does not exist, this skill can still operate on the codebase directly. Log a warning but continue.
Check if config defines any custom code paths or conventions that should guide the search (e.g., specific directories for models, migrations, etc.).
From $ARGUMENTS, extract the entity or field name to investigate.
If no argument provided, ask the user what entity or field they want to understand.
Store as {entity}.
Search the codebase for the entity definition:
ORM models — Search for class/interface definitions matching {entity}:
**/*{entity}*.* (case-insensitive approach — try variations)class {Entity}, interface {Entity}, @Entity.*{entity}, model {Entity}src/models/, src/entities/, app/models/, prisma/schema.prismaDatabase schemas — Search migrations and schema files:
CREATE TABLE.*{entity}, createTable.*{entity}, tableName.*{entity}**/migrations/**DTOs and types — Search for data transfer objects:
{Entity}Dto, {Entity}Input, {Entity}Response, {Entity}TypeIf multiple matches found, present them and ask the user which one to focus on.
For each field found in the entity definition, answer these questions:
| Pregunta | Cómo encontrarlo |
|---|---|
| What does this field mean? | Check comments, JSDoc, variable name semantics |
| Where does the data originate? | Grep for assignments to this field |
| Who/what generates it? | Check constructors, factory methods, seed data |
| Under what condition is it created? | Check create methods, POST endpoints |
| When/how does it mutate? | Grep for update/set operations on this field |
| What validations exist? | Check decorators, validators, constraints |
| What are the possible values? | Check enums, unions, DB constraints |
| Is it nullable? | Check schema definition, TypeScript types |
| Is it indexed? | Check migration files, schema decorators |
Build a comprehensive field table:
| Campo | Tipo | Nullable | Default | Validaciones | Origen | Mutaciones |
|---|---|---|---|---|---|---|
| {field} | {type} | {yes/no} | {value} | {rules} | {source} | {when/how} |
If the entity involves configuration or environment variables, also investigate:
| Config | Dónde se define | Valor por defecto | Dónde se usa | Qué pasa si falta |
|---|
Search for:
process.env.{RELATED_VARS}Search for references to the entity from other files:
{entity}Id, {entity}_id, references in migrations@ManyToOne, @OneToMany, @ManyToMany, belongsTo, hasMany, referencesBuild a relationship map:
{Entity} ──1:N──▶ {RelatedEntity}
{Entity} ◀──N:1── {ParentEntity}
{Entity} ──N:M──▶ {OtherEntity} (via {JoinTable})
Search migration files for this entity:
**/migrations/**{entity}, {table_name}List all migrations that touch this entity, in chronological order:
Find all API endpoints and consumers that read or write this entity:
For each consumer:
| Endpoint/Consumer | Método | Lee campos | Escribe campos | Validaciones |
|---|---|---|---|---|
| {path} | {GET/POST/...} | {fields} | {fields} | {rules} |
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🗃️ DATA MODEL ANALYSIS: {Entity}
Source: {file_path}
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
━━ CAMPOS ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
{field table from Step 3}
━━ ORIGEN DE DATOS ━━━━━━━━━━━━━━━━━━━━━━━━━━━
{For each field: where data comes from and how it is generated}
━━ RELACIONES ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
{relationship map from Step 5}
━━ VALIDACIONES ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
{All validation rules found, grouped by field}
━━ MIGRACIONES ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
{chronological migration history from Step 6}
━━ ENDPOINTS / CONSUMERS ━━━━━━━━━━━━━━━━━━━━━
{consumer table from Step 7}
━━ PREGUNTAS ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
{Questions that could not be answered from code alone}
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━