gorm-write-plugins

Implement gorm.Plugin interfaces and register callbacks via db.Use.

Updated Apr 4, 2026
One-click install
npx skills add https://github.com/liurida/gorm-development-skill --skill gorm-write-plugins
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: gorm-write-plugins
Source: https://github.com/liurida/gorm-development-skill/tree/main/write_plugins
Command: npx skills add https://github.com/liurida/gorm-development-skill --skill gorm-write-plugins

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill enables developers to extend GORM by creating reusable plugins that register custom callbacks and alter core behaviors in a centralized, maintainable way.

Core Features & Use Cases

  • Plugin interface and lifecycle: Implement the gorm.Plugin interface and initialize it to hook into GORM's lifecycle.
  • Callback customization: Register, order, and manage callbacks to customize Create, Query, Update, and Delete flows across apps.
  • Global extensibility: Attach plugins at the gorm.DB level to apply consistent behavior across environments with db.Use.
  • Example: Build a plugin that enforces a naming convention or logs operations globally for audits.

Quick Start

Register a plugin by implementing the Plugin interface and registering it with your DB via db.Use(&MyPlugin{}), then initialize callbacks in the Initialize method.

Frequently Asked Questions about gorm-write-plugins

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

FAQPage Schema
How do I write a custom GORM plugin to extend ORM behavior?

To write a custom GORM plugin, implement the gorm.Plugin interface and register it using db.Use. You can then hook into the lifecycle and wire callbacks via the global db.Callback API to alter core operations.

What is the best way to register global callbacks for GORM database instances?

Registering global callbacks for GORM database instances involves attaching a plugin at the *gorm.DB level using db.Use. This applies consistent behavior across environments by managing Create, Query, Update, and Delete flows centrally.

Can I hook into GORM lifecycle events to log operations for audits?

Yes, you can hook into GORM lifecycle events to log operations for audits by implementing the Plugin interface. Initialize custom callbacks within the plugin to intercept and record database operations globally.

How do you order and manage callbacks in GORM to customize Create and Query flows?

You order and manage callbacks in GORM to customize Create and Query flows via the global db.Callback API. This allows precise registration and sequencing of custom logic during core ORM operations.

Do I need to implement a specific interface to create reusable GORM extensions?

Yes, you need to implement the gorm.Plugin interface to create reusable GORM extensions. This interface initializes your logic and centralizes callback registration for consistent behavior across apps.