rails-docs-search
# Rails Docs Search
What this skill does
# Rails Docs Search
---
name: rails-docs-search
description: Searches Rails Guides for conceptual documentation using Ref (primary) or WebFetch (fallback) with reference mappings
version: 1.2.0
author: Rails Workflow Team
tags: [rails, documentation, guides, search, ref]
priority: 3
---
## Purpose
Fetches conceptual documentation from official Rails Guides based on topics. Returns relevant guide sections with version-appropriate URLs.
**Replaces**: `mcp__rails__search_docs` MCP tool
## Usage
**Auto-invoked** when agents need Rails concepts:
```
Agent: "How do I implement Action Cable subscriptions?"
*invokes rails-docs-search topic="action_cable"*
```
**Manual invocation**:
```
@rails-docs-search topic="active_record_associations"
@rails-docs-search topic="routing"
```
## Supported Topics
See `reference.md` for complete topic list. Common topics:
### Core Concepts
- `getting_started` - Rails basics and first app
- `active_record_basics` - ORM fundamentals
- `routing` - URL patterns and routes
- `controllers` - Request/response handling
- `views` - Templates and rendering
### Advanced Features
- `active_record_associations` - Relationships (has_many, belongs_to)
- `active_record_validations` - Data validation
- `active_record_callbacks` - Lifecycle hooks
- `action_mailer` - Email sending
- `action_cable` - WebSockets
### Testing & Security
- `testing` - Rails testing guide
- `security` - Security best practices
- `debugging` - Debugging techniques
### Deployment & Configuration
- `configuring` - Application configuration
- `asset_pipeline` - Asset management
- `caching` - Performance caching
## Search Process
### Step 1: Version Detection
```
Invokes: @rails-version-detector
Result: Rails 7.1.3
Maps to: https://guides.rubyonrails.org/v7.1/
```
### Step 2: Topic Mapping
```
Input: topic="active_record_associations"
Lookup: reference.md → "association_basics.html"
URL: https://guides.rubyonrails.org/v7.1/association_basics.html
```
### Step 3: Content Fetch
**Method 1: Context7 (Fastest)**:
```
Tool: context7_fetch
Query: "Rails [version] [topic]"
```
**Method 2: Ref (Token-Efficient)**:
```
Tool: ref_search_documentation
Query: "Rails [version] [topic] documentation"
Then: ref_read_url
```
**Method 3: Tavily (Search)**:
```
Tool: tavily_search
Query: "Rails [version] [topic] guide"
```
**Method 4: WebFetch (Fallback)**:
```
Tool: WebFetch
URL: [constructed URL from reference.md]
Prompt: "Extract sections about [specific query]"
Note: WebFetch has a built-in 15-minute cache for faster responses
when repeatedly accessing the same URL within a session.
```
### Step 4: Response Formatting
```markdown
## Rails Guide: Active Record Associations (v7.1)
### belongs_to
A `belongs_to` association sets up a one-to-one connection...
### has_many
A `has_many` association indicates a one-to-many connection...
Source: https://guides.rubyonrails.org/v7.1/association_basics.html
```
## Reference Lookup
**Topic → Guide URL mapping** in `reference.md`:
```yaml
active_record_associations:
title: "Active Record Associations"
url_path: "association_basics.html"
version_support: "all"
keywords: [has_many, belongs_to, has_one, through]
routing:
title: "Rails Routing"
url_path: "routing.html"
version_support: "all"
keywords: [routes, resources, namespace]
```
## Output Format
### Success Response
```markdown
## Rails Guide: [Topic Title] (v[X.Y])
[Fetched content from guide...]
### Key Points
- [Summary point 1]
- [Summary point 2]
**Source**: [full URL]
**Version**: [Rails version]
```
### Not Found Response
```markdown
## Topic Not Found: [topic]
Available topics:
- getting_started
- active_record_basics
- routing
[...more topics...]
Try: @rails-docs-search topic="[one of above]"
```
### Version Mismatch Warning
```markdown
## Rails Guide: [Topic] (v7.1)
⚠️ **Note**: Guide is for Rails 7.1, but project uses Rails 6.1.
Some features may not be available in your version.
[Content...]
```
## Implementation Details
**Tools used** (in order of preference):
1. **@rails-version-detector** - Get project Rails version
2. **Read** - Load `reference.md` topic mappings
3. **context7_fetch** (primary) - Fetch curated docs via Context7 MCP
4. **ref_search_documentation** (secondary) - Search Rails docs via Ref MCP
5. **tavily_search** (tertiary) - Optimized search via Tavily MCP
6. **WebFetch** (fallback) - Fetch guide content if MCPs not available
7. **Grep** (optional) - Search local cached guides if available
**Optional dependencies**:
- **context7-mcp**: Fastest, curated documentation
- **ref-tools-mcp**: Token-efficient documentation search
- **tavily-mcp**: Optimized search for LLMs
- If neither installed: Falls back to WebFetch (still works!)
**URL construction**:
```
Base: https://guides.rubyonrails.org/
Versioned: https://guides.rubyonrails.org/v7.1/
Guide: https://guides.rubyonrails.org/v7.1/routing.html
```
**Version handling**:
- Rails 8.x → `/v8.0/` (or latest if 8.0 not published)
- Rails 7.1.x → `/v7.1/`
- Rails 7.0.x → `/v7.0/`
- Rails 6.1.x → `/v6.1/`
**Caching strategy**:
- Cache fetched guide content for session
- Re-fetch if version changes
- Cache key: `{topic}:{version}`
**Prompt Caching (Opus 4.5 Optimized)**:
- Use 1-hour cache duration for extended thinking tasks
- Documentation content is stable - leverage longer cache windows
- Cache prefix: Include Rails version in system prompt for cache reuse
- Reduces token costs significantly for repeated lookups
## Error Handling
**Network failure**:
```markdown
⚠️ Failed to fetch guide from rubyonrails.org
Fallback: Check local knowledge or ask user for clarification.
URL attempted: [URL]
```
**Invalid topic**:
```markdown
❌ Unknown topic: "[topic]"
Did you mean: [closest match from reference.md]?
See available topics: @rails-docs-search list
```
**Version not supported**:
```markdown
⚠️ Rails [version] guides not available.
Using closest version: [fallback version]
Some information may differ from your Rails version.
```
## Integration
**Auto-invoked by**:
- All 7 Rails agents when they need conceptual information
- @rails-architect for architecture decisions
- User questions about "How do I..." or "What is..."
**Complements**:
- @rails-api-lookup (this skill = concepts, that skill = API details)
- @rails-pattern-finder (this skill = theory, that skill = code examples)
## Special Features
### Multi-topic search
```
@rails-docs-search topic="routing,controllers"
→ Fetches both guides and combines relevant sections
```
### Keyword search within topic
```
@rails-docs-search topic="active_record_associations" keyword="polymorphic"
→ Focuses on polymorphic association sections only
```
### List available topics
```
@rails-docs-search list
→ Returns all available topics from reference.md
```
## Testing
**Test cases**:
1. Topic="routing" + Rails 7.1 → Fetches v7.1 routing guide
2. Topic="unknown" → Returns error with suggestions
3. Network down → Graceful fallback
4. Rails 8.0 (future) → Uses latest available version
5. Multiple topics → Combines results
## Notes
- Guides content fetched live (not stored in plugin)
- Reference mappings maintained in `reference.md`
- Version-appropriate URLs ensure accuracy
- WebFetch tool handles HTML → Markdown conversion
- This skill focuses on **concepts**, use @rails-api-lookup for **API signatures**
Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.