dbx-regenerate
БесплатноБез исполняемых скриптовНе проверенRegenerate DBX code after making changes to .dbx schema files. Runs code generation, shows diff summary, validates compilation, and reports any errors.
от storj★ 3 286 звёзд на GitHubОб этом скилле
DBX Regenerate
You are helping regenerate the DBX-generated code after changes to .dbx schema files.
Overview
DBX (Database Extension) is Storj's schema-first ORM that generates Go code from .dbx schema files. When developers modify .dbx files in satellite/satellitedb/dbx/, the generated code in satellitedb.dbx.go must be regenerated.
This skill:
- Runs the DBX code generator
- Shows a summary of what changed
- Validates the generated code compiles
- Reports any errors with helpful context
Instructions
Follow these steps to regenerate DBX code:
1. Check for Modified .dbx Files
First, check which .dbx files have been modified (optional but helpful for context):
git status satellite/satellitedb/dbx/
This helps understand what schema changes triggered the regeneration.
2. Run DBX Code Generation
Execute the code generation:
cd satellite/satellitedb/dbx && go generate
This runs the DBX compiler which:
- Parses all .dbx schema files
- Generates SQL for PostgreSQL and CockroachDB
- Produces Go code with type-safe methods
- Creates the ~50,000 line
satellitedb.dbx.gofile
Expected output: Should see messages about code generation progress.
3. Show Diff Summary
After generation completes, show a summary of what changed:
git diff --stat satellite/satellitedb/dbx/satellitedb.dbx.go
Also show a preview of the changes:
git diff satellite/satellitedb/dbx/satellitedb.dbx.go | head -100
What to look for:
- New methods added (e.g.,
Create_,Get_,Update_,Delete_methods) - Modified method signatures
- New model structs
- Changes to existing queries
4. Validate Compilation
Ensure the generated code compiles successfully:
go build ./satellite/satellitedb/dbx
If compilation succeeds, the regeneration was successful.
5. Report Results
Provide a clear summary to the user:
If successful:
- Confirm DBX regeneration completed
- Summarize what changed (e.g., "Added 3 new methods for the
userstable") - Show key new/modified methods
- Confirm compilation succeeded
- Suggest next steps (e.g., "You may want to create a database migration for the schema changes")
If errors occurred:
- Show the full error output
- Identify which .dbx file has the issue (look for file references in error)
- Explain the error in plain language
- Suggest fixes based on common DBX errors (see below)
Common DBX Errors and Fixes
Syntax Error in .dbx File
Error pattern: parse error, unexpected token, invalid syntax
Cause: Incorrect .dbx syntax (missing commas, invalid field types, etc.)
Fix:
- Check the .dbx file line number mentioned in the error
- Verify syntax matches DBX documentation patterns
- Common issues: missing commas between fields, invalid field type names, incorrect query syntax
Duplicate Model/Query Definition
Error pattern: already defined, duplicate definition
Cause: Model or query defined multiple times across .dbx files
Fix:
- Search for the duplicate definition across all .dbx files
- Remove or rename the duplicate
- Ensure model names are unique across all .dbx files
Invalid Field Type
Error pattern: unknown type, invalid type
Cause: Using a field type that DBX doesn't recognize
Valid DBX types:
text,blob,int,int64,uint,uint64bool,timestamp,float64utimestamp(microsecond timestamp)
Fix: Change the field type to a valid DBX type
Missing Primary Key
Error pattern: no primary key defined
Cause: Table definition missing a primary key
Fix: Add a primary key using ( key <field> ) in the model definition
Invalid Query Pattern
Error pattern: invalid query, unknown read pattern
Cause: Using an incorrect query pattern name
Valid patterns:
read one,read all,read first,read paged,read limitoffset,read scalarupdate,delete,create,count
Fix: Use a valid query pattern from the list above
Circular Dependency
Error pattern: circular dependency, import cycle
Cause: .dbx files referencing each other in a circular way
Fix: Restructure the models to remove circular references
Post-Regeneration Checklist
After successful regeneration, remind the user to:
- Review the diff: Check that generated changes match expectations
- Create migration: If schema changed, create database migration files
- Run linter: Ensure generated code passes linting
make llint LINT_TARGET=./satellite/satellitedb/dbx - Commit changes: Commit both .dbx changes and generated code together
Understanding the Generated Code
The satellitedb.dbx.go file contains:
- Model structs: Go representations of database tables
- Field types: Type-safe field constructors (e.g.,
User_Id_Field) - CRUD methods: Auto-generated database operations
- **Backend implementa
Установить dbx-regenerate в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл dbx-regenerate?
Regenerate DBX code after making changes to .dbx schema files. Runs code generation, shows diff summary, validates compilation, and reports any errors.
Как установить скилл dbx-regenerate?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл dbx-regenerate запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic