How the Rails Enterprise Dev plugin discovers and uses project skills dynamically
This skill inherits all available tools. When active, it can use any tool Claude has access to.
The Rails Enterprise Dev plugin is generic and reusable across all Rails projects. It automatically discovers and uses skills from your project's .claude/skills/ directory, adapting its behavior to whatever patterns and knowledge are available.
At workflow start, the plugin scans .claude/skills/ to find available skills:
# Plugin executes skill discovery
bash ${CLAUDE_PLUGIN_ROOT}/hooks/scripts/discover-skills.sh
# Categorizes skills by naming patterns:
# - core_rails: rails-conventions, rails-error-prevention
# - data_layer: activerecord-patterns, *model*, *database*
# - service_layer: service-object-patterns, api-development-patterns
# - async: sidekiq-async-patterns, *job*, *async*
# - ui: viewcomponents-specialist, hotwire-patterns, tailadmin-patterns
# - i18n: localization, *translation*
# - testing: rspec-testing-patterns, *spec*, *test*
# - domain: Any skill not matching known patterns
Discovered skills are stored in settings file for quick access:
# .claude/rails-enterprise-dev.local.md
---
available_skills:
core:
- rails-conventions
- rails-error-prevention
- codebase-inspection
data:
- activerecord-patterns
service:
- service-object-patterns
- api-development-patterns
ui:
- viewcomponents-specialist
- hotwire-patterns
- tailadmin-patterns
domain:
- manifest-project-context # Auto-detected!
---
Throughout the workflow, agents check for and use available skills:
## Example: Database Implementation Phase
1. Check skill inventory: activerecord-patterns available? YES
2. Invoke skill: "I need guidance from activerecord-patterns skill for implementing User model"
3. Extract patterns: N+1 prevention, association patterns, validation strategies
4. Delegate to Data Lead agent with skill context
5. Validate implementation against skill best practices
Purpose: Fundamental Rails patterns applicable to all projects
Skills:
rails-conventions - MVC architecture, naming conventions, file organizationrails-error-prevention - Common pitfalls, preventive checklistscodebase-inspection - Pre-implementation analysis proceduresWhen Used: All workflows (inspection, planning, validation)
Example Invocation:
Before planning, invoke rails-conventions skill to understand:
- Service object patterns in this project
- Controller organization
- Testing conventions
Purpose: Database schema, models, queries, associations
Skills:
activerecord-patterns - Query optimization, associations, scopes*model*, *database*, *schema*When Used: Database migration and model implementation phases
Example Invocation:
For User authentication model, invoke activerecord-patterns:
- How to prevent N+1 queries
- Association patterns for has_many :through
- Scope best practices
- Validation strategies
Purpose: Business logic, API design, service objects
Skills:
service-object-patterns - Service layer architectureapi-development-patterns - RESTful API, serialization*service*, *api*When Used: Service and controller implementation phases
Example Invocation:
For payment processing service, invoke service-object-patterns:
- Callable concern usage
- Namespace patterns ({Domain}Manager::{Action})
- Error handling strategies
- Transaction management
Purpose: Background jobs, queues, schedulers
Skills:
sidekiq-async-patterns - Background job design*job*, *async*, *queue*When Used: Background job implementation phase
Example Invocation:
For invoice generation job, invoke sidekiq-async-patterns:
- Job idempotency patterns
- Retry strategies
- Queue priority configuration
- Scheduled job patterns
Purpose: Components, views, frontend frameworks
Skills:
viewcomponents-specialist - ViewComponent architecturehotwire-patterns - Turbo Frames, Streams, Stimulustailadmin-patterns - TailAdmin UI framework*component*, *view*, *ui*, *frontend*When Used: Component and view implementation phases
Example Invocation:
For user profile component, invoke:
1. viewcomponents-specialist - Component structure, method exposure
2. tailadmin-patterns - UI styling, color schemes, card layouts
3. hotwire-patterns - Real-time updates with Turbo Streams
Extract:
- TailAdmin card patterns (bg-blue-50, rounded corners)
- ViewComponent slots for customization
- Stimulus controller for interactions
Purpose: Internationalization, localization, translations
Skills:
localization - Multi-language support, RTL, pluralization*i18n*, *translation*When Used: Localization implementation phase
Example Invocation:
For Arabic translation support, invoke localization:
- YAML structure for translations
- RTL CSS patterns
- Locale switcher component
- Date/time formatting
- Pluralization rules
Purpose: Test strategies, specs, coverage
Skills:
rspec-testing-patterns - Unit, integration, system tests*spec*, *test*When Used: Test implementation phase
Example Invocation:
For comprehensive test suite, invoke rspec-testing-patterns:
- Factory patterns
- Shared examples
- Request spec structure
- System test patterns
- Mocking strategies
Purpose: Business domain knowledge, project-specific context
Skills: Any skill not matching known patterns
manifest-project-context - Manifest LMS domain knowledgeecommerce-domain - E-commerce business logichealthcare-domain - Healthcare compliance, HIPAAWhen Used: Inspection and planning phases (optional context)
Example Invocation:
For shipment tracking feature, invoke manifest-project-context:
- Understanding Task model (shipments)
- Bundle concept (delivery routes)
- Carrier relationships
- State machine flows
- Locality/Zone geography
If a skill is not available, the plugin continues with agent's general knowledge:
## Example: Project Without tailadmin-patterns
User: /rails-dev add dashboard
Workflow:
1. Check for tailadmin-patterns skill → NOT FOUND
2. Check for custom UI skill → NOT FOUND
3. Log: "No UI framework skill found, using general Rails view patterns"
4. Proceed with standard Rails ERB views
5. Suggest: "Consider adding tailadmin-patterns skill for consistent UI"
No workflow failure - plugin adapts to available skills.
mkdir -p .claude/skills/my-custom-skill
---
name: My Custom Patterns
description: Our team's coding standards
---
# My Custom Patterns
## Service Layer
- Always use dry-transaction gem
- Include CustomLogging concern
...
/rails-dev add feature
# Plugin scans .claude/skills/
# Finds: rails-conventions, activerecord-patterns, my-custom-skill
# Uses my-custom-skill during implementation
Data layer skills:
activerecord-**-model-**-database-**-schema-*Service layer skills:
service-**-service-*api-**-api-*UI skills:
*-component**-view**-ui-**-frontend-*hotwire-*turbo-*stimulus-*Domain skills (anything else):
*-domain*-context*-business-*.claude/skills/
├── rails-conventions/
├── rails-error-prevention/
├── codebase-inspection/
├── activerecord-patterns/
├── service-object-patterns/
├── api-development-patterns/
├── sidekiq-async-patterns/
├── viewcomponents-specialist/
├── hotwire-patterns/
├── tailadmin-patterns/ ← TailAdmin UI
├── localization/
├── rspec-testing-patterns/
├── devops-lead/
├── requirements-writing/
└── manifest-project-context/ ← Domain specific
Plugin adapts: Full feature set with all skills
.claude/skills/
├── rails-conventions/
├── activerecord-patterns/
├── service-object-patterns/
├── api-development-patterns/
└── rspec-testing-patterns/
Plugin adapts: API-focused workflow, no UI skills used
.claude/skills/
├── rails-conventions/
├── activerecord-patterns/
├── bootstrap-patterns/ ← Bootstrap instead of TailAdmin
└── jquery-patterns/ ← jQuery instead of Hotwire
Plugin adapts: Uses bootstrap-patterns and jquery-patterns for UI
I need guidance from the [skill-name] skill for [specific task].
Context:
- Feature: User authentication
- Component: JWT service
- Phase: Service implementation
Questions:
- What service pattern should I follow?
- How to handle token refresh?
- Where to store refresh tokens?
This will inform Backend Lead agent when implementing AuthManager::GenerateToken service.
Based on [skill-name] skill guidance:
Patterns to follow:
1. Use Callable concern (from service-object-patterns)
2. Namespace: AuthManager (from project conventions)
3. Return Result object (from service-object-patterns)
Implementation requirements:
- JWT expiry: 15 minutes (access), 7 days (refresh)
- Store refresh tokens in encrypted database column
- Invalidate on logout
Passing this to Backend Lead for implementation.
Inspection Phase:
Skills invoked:
- codebase-inspection (mandatory if available)
- rails-conventions (understand patterns)
- domain skills (business context)
Purpose: Understand existing codebase before planning
Planning Phase:
Skills invoked:
- rails-error-prevention (preventive checklist)
- rails-conventions (pattern selection)
- requirements-writing (if user stories needed)
- domain skills (business rules)
- phase-specific skills (api, ui, async based on feature type)
Purpose: Create implementation plan with skill-informed decisions
Implementation Phase:
Skills invoked per layer:
- Database: activerecord-patterns, domain skills
- Models: activerecord-patterns, domain skills
- Services: service-object-patterns, api-development-patterns
- Jobs: sidekiq-async-patterns
- Components: viewcomponents-specialist, ui framework skills
- Views: ui framework skills, hotwire-patterns, localization
- Tests: rspec-testing-patterns
Purpose: Ensure each layer follows established patterns
Review Phase:
Skills invoked:
- rails-error-prevention (validation checklist)
- All used implementation skills (verify adherence)
Purpose: Validate implementation against skill guidelines
Symptom: Plugin says "Skill not available: my-skill"
Solution:
.claude/skills/my-skill/bash ${CLAUDE_PLUGIN_ROOT}/hooks/scripts/discover-skills.shSymptom: Domain skill categorized as UI skill
Solution:
Symptom: Project has multiple domain skills
Solution:
The skill discovery system makes the Rails Enterprise Dev plugin:
Key principle: Plugin provides workflow orchestration, skills provide project-specific knowledge.