.claude/skills/dbx-regenerate/SKILL.md
Regenerate DBX code after making changes to .dbx schema files. Runs code generation, shows diff summary, validates compilation, and reports any errors.
npx skillsauth add storj/storj dbx-regenerateInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
You are helping regenerate the DBX-generated code after changes to .dbx schema files.
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:
Follow these steps to regenerate DBX code:
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.
Execute the code generation:
cd satellite/satellitedb/dbx && go generate
This runs the DBX compiler which:
satellitedb.dbx.go fileExpected output: Should see messages about code generation progress.
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:
Create_, Get_, Update_, Delete_ methods)Ensure the generated code compiles successfully:
go build ./satellite/satellitedb/dbx
If compilation succeeds, the regeneration was successful.
Provide a clear summary to the user:
If successful:
users table")If errors occurred:
Error pattern: parse error, unexpected token, invalid syntax
Cause: Incorrect .dbx syntax (missing commas, invalid field types, etc.)
Fix:
Error pattern: already defined, duplicate definition
Cause: Model or query defined multiple times across .dbx files
Fix:
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
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
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, countFix: Use a valid query pattern from the list above
Error pattern: circular dependency, import cycle
Cause: .dbx files referencing each other in a circular way
Fix: Restructure the models to remove circular references
After successful regeneration, remind the user to:
make llint LINT_TARGET=./satellite/satellitedb/dbx
The satellitedb.dbx.go file contains:
User_Id_Field)WithTx() methods for transactionsUser 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
satellite/satellitedb/dbx/gen/main.goerrs.Class("satellitedb")git diff to see exactly what changed before committingtesting
Run unit tests that require the Spanner emulator. Use this skill when the user wants to run tests in packages like satellite/metabase, satellite/metainfo, or any other tests that interact with Spanner. Automatically handles checking for and configuring the Spanner emulator environment.
development
Run unit tests that require PostgreSQL. Use this skill when the user wants to run tests with PostgreSQL database backend. Automatically handles checking for and configuring a PostgreSQL Docker container.
development
Interact with Storj Gerrit team code collaboration service, which we just called it gerrit, when the user ask to do it
development
Maintainer-only workflow for handling GitHub Secret Scanning alerts on OpenClaw. Use when Codex needs to triage, redact, clean up, and resolve secret leakage found in issue comments, issue bodies, PR comments, or other GitHub content.