sm-model-extension

Extend SourceMonitor engine models with host-defined concerns and validations.

3|Updated Oct 16, 2025
One-click install
npx skills add https://github.com/dchuk/source_monitor --skill sm-model-extension
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sm-model-extension
Source: https://github.com/dchuk/source_monitor/tree/main/.claude/skills/sm-model-extension
Command: npx skills add https://github.com/dchuk/source_monitor --skill sm-model-extension

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Extend SourceMonitor engine models from a host application by applying host-defined concerns and validations to engine models without monkey-patching.

Core Features & Use Cases

  • Extend multiple engine models (Source, Item, FetchLog, HealthCheckLog, etc.) via config models, including adding concerns, validations, scopes, associations, and table name prefixes.
  • Safe, idempotent reload of extensions via ModelExtensions.reload!, with deduplication of concerns and isolated validations.
  • Example: In a host app, register concerns that add validations and associations to engine models, and optionally override table_name_prefix.

Quick Start

Register a host concern and load it via SourceMonitor.configure to extend the engine models.

Frequently Asked Questions about sm-model-extension

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

FAQPage Schema
How do I extend Rails engine models from a host app without monkey-patching?

To extend Rails engine models without monkey-patching, apply host-defined concerns and validations through a coordinated registration system. This mechanism enforces idempotent application, ensuring safe separation of concerns during runtime without modifying engine source code directly.

What is the best way to add validations and associations to engine models in Ruby?

The best way to add validations and associations to engine models is registering host concerns via configuration. This approach coordinates reloading and deduplication of extensions, safely applying validations while keeping engine and host application logic isolated.

Can I safely reload model extensions in a Rails host application?

Yes, you can safely reload model extensions in a Rails host application. The reload mechanism applies deduplication of concerns and isolated validations, enforcing idempotent application so re-running extensions does not duplicate logic or break runtime behavior.

Does this model extension approach work with multiple SourceMonitor engine models?

Yes, this model extension approach works with multiple SourceMonitor engine models including Source, Item, FetchLog, and HealthCheckLog. You can add concerns, validations, scopes, associations, and override table name prefixes across these models via host configuration.

Why do my duplicated concerns cause issues when extending engine models?

Duplicated concerns cause issues because repeated application stacks identical validations and associations. The deduplication mechanism prevents this by isolating validations and enforcing idempotent application during extension reloads, ensuring each concern applies only once across engine models.