dbx-regenerate
Regenerate DBX code after making changes to .dbx schema files. Runs code generation, shows diff summary, validates compilation, and reports any errors.
Install
mkdir -p .claude/skills/dbx-regenerate && curl -L -o skill.zip "https://mcp.directory/api/skills/download/3776" && unzip -o skill.zip -d .claude/skills/dbx-regenerate && rm skill.zipInstalls to .claude/skills/dbx-regenerate
About this skill
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, CockroachDB, and Spanner
- 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 implementations: Separate implementations for PostgreSQL, CockroachDB, and Spanner
- Transaction support:
WithTx()methods for transactions - Error handling: Wrapped errors with proper error codes
Example Workflow
User modified: satellite/satellitedb/dbx/user.dbx - added last_login timestamp field
Regeneration output:
DBX regenerated successfully!
Changes:
- Modified: User model (added field: last_login)
- New methods: Update_User_LastLogin_By_Id
- Lines changed: +156 -12
Generated methods:
- User.LastLogin field added
- User_LastLogin_Field type added
- Update methods now include last_login in optional fields
Compilation: ✓ Success
Next steps:
1. Review the diff to ensure changes are correct
2. Create a migration to add the last_login column
3. Run tests to ensure compatibility
Notes
- DBX generation can take 10-30 seconds depending on system performance
- The generated file is ~1.9 MB and ~50,000 lines of code
- Always regenerate after modifying ANY .dbx file
- The generator is located in
satellite/satellitedb/dbx/gen/main.go - DBX supports PostgreSQL, CockroachDB, and Spanner from the same schema
- Generated code includes monkit instrumentation for metrics
- All errors are wrapped with
errs.Class("satellitedb")
Tips
- Use
git diffto see exactly what changed before committing - If regeneration seems slow, check for syntax errors first
- Keep .dbx files focused - one file per logical domain (users, projects, etc.)
- Test generated code with all supported backends if possible
- DBX errors are usually specific - read them carefully for the fix
More by storj
View all skills by storj →You might also like
flutter-development
aj-geddes
Build beautiful cross-platform mobile apps with Flutter and Dart. Covers widgets, state management with Provider/BLoC, navigation, API integration, and material design.
drawio-diagrams-enhanced
jgtolentino
Create professional draw.io (diagrams.net) diagrams in XML format (.drawio files) with integrated PMP/PMBOK methodologies, extensive visual asset libraries, and industry-standard professional templates. Use this skill when users ask to create flowcharts, swimlane diagrams, cross-functional flowcharts, org charts, network diagrams, UML diagrams, BPMN, project management diagrams (WBS, Gantt, PERT, RACI), risk matrices, stakeholder maps, or any other visual diagram in draw.io format. This skill includes access to custom shape libraries for icons, clipart, and professional symbols.
ui-ux-pro-max
nextlevelbuilder
"UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient."
godot
bfollington
This skill should be used when working on Godot Engine projects. It provides specialized knowledge of Godot's file formats (.gd, .tscn, .tres), architecture patterns (component-based, signal-driven, resource-based), common pitfalls, validation tools, code templates, and CLI workflows. The `godot` command is available for running the game, validating scripts, importing resources, and exporting builds. Use this skill for tasks involving Godot game development, debugging scene/resource files, implementing game systems, or creating new Godot components.
nano-banana-pro
garg-aayush
Generate and edit images using Google's Nano Banana Pro (Gemini 3 Pro Image) API. Use when the user asks to generate, create, edit, modify, change, alter, or update images. Also use when user references an existing image file and asks to modify it in any way (e.g., "modify this image", "change the background", "replace X with Y"). Supports both text-to-image generation and image-to-image editing with configurable resolution (1K default, 2K, or 4K for high resolution). DO NOT read the image file first - use this skill directly with the --input-image parameter.
fastapi-templates
wshobson
Create production-ready FastAPI projects with async patterns, dependency injection, and comprehensive error handling. Use when building new FastAPI applications or setting up backend API projects.
Related MCP Servers
Browse all serversShadow-CLJS Build Monitor tracks ClojureScript builds in real time, showing statuses, warnings, errors, and file-specifi
Browser Use lets LLMs and agents access and scrape any website in real time, making web scraping and web page scraping e
Optimize your codebase for AI with Repomix—transform, compress, and secure repos for easier analysis with modern AI tool
Connect Blender to Claude AI for seamless 3D modeling. Use AI 3D model generator tools for faster, intuitive, interactiv
Mobile Next offers fast, seamless mobile automation for iOS and Android. Automate apps, extract data, and simplify mobil
Boost Postgres performance with Postgres MCP Pro—AI-driven index tuning, health checks, and safe, intelligent SQL optimi
Stay ahead of the MCP ecosystem
Get weekly updates on new skills and servers.