skills/rubysmithing-context/SKILL.md
Gem API verification sub-skill for Ruby development. Automatically activates on first mention of any Ruby gem — especially ruby_llm, sequel, async, bubbletea, dspy.rb, pgvector, huh, dry-schema, circuit_breaker, fast-mcp, or informers — and resolves current method signatures and usage examples via Context7 MCP before code is generated. Results are cached for the session and persisted to SQLite across sessions. If Context7 resolution fails or is rate-limited, falls back to the tiered degradation protocol (stale cache → gem-registry ID → WARNING block) rather than silently guessing. Pairs with rubysmithing, rubysmithing-genai, and rubysmithing-tui as a prerequisite step.
npx skillsauth add b08x/rubysmithing rubysmithing-contextInstall 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.
Context7-powered gem API resolver. Fires before any library-specific code is written. Caches results for the session and persists them to SQLite across sessions. Fails loudly — never silently. Degrades gracefully when Context7 is unreachable.
Activate on first mention of any gem not in Ruby stdlib. Priority gems that always warrant a fresh lookup (API surface changes frequently):
ruby_llm, ruby_llm-mcp, ruby_llm-schemabubbletea, lipgloss, huh, gum, ntcharts, bubblezonedspy.rb, dspy-ruby_llmsequel (plugin API especially)async, falconcircuit_breakerfast-mcpinformersdry-schema, dry-typesSkip lookup for: stdlib, gems already resolved this session, Lite Mode tasks.
Before any Context7 or SQLite call, check if the gem has been resolved in this session. Track resolved gems mentally as:
session_cache = {
"ruby_llm" => { context7_id: "/crmne/ruby_llm", resolved: true },
"sequel" => { context7_id: "/jeremyevans/sequel", resolved: true }
}
If cached → use cached result directly, skip Steps 2–4.
Before calling Context7, check ~/.rubysmithing/context_cache.db:
result=$(ruby $CLAUDE_PLUGIN_ROOT/skills/rubysmithing-context/scripts/context_cache.rb fetch GEMNAME --json)
# {"status":"fresh",...} → use cached entry, add to session cache, skip Steps 3–4
# {"status":"miss"} → proceed to Step 3
If status is "fresh" → use context7_id, method_sigs, and example fields directly,
add to session cache, skip Steps 3–4.
Use Context7:resolve-library-id with the gem name.
Check references/gem-registry.md first — if the gem is listed, use the pre-mapped
Context7 ID directly without a resolve call.
Use Context7:query-docs with a targeted query — not just the gem name.
Query format: "[gem] [specific pattern]"
Examples:
"ruby_llm chat streaming tool calling"
"sequel dataset filter pgvector similarity"
"async fiber barrier timeout"
"bubbletea model update view lifecycle"
"huh form group select input validation"
"circuit_breaker circuit breaker threshold reset"
"dspy.rb chain of thought signature module"
Extract: method signatures, parameter names, minimal working example, deprecation warnings or breaking changes noted in docs.
Store the resolved result in both session cache and SQLite persistent cache:
ruby $CLAUDE_PLUGIN_ROOT/skills/rubysmithing-context/scripts/context_cache.rb store GEMNAME CONTEXT7_ID \
'[".method_one(arg:)", ".method_two"]' \
'GemClass.new.call'
Also add to session cache mentally. If exit 1, log and continue — session cache still holds the result for this session.
Return to the requesting skill:
When Context7 is unreachable (network timeout, 5xx error) or rate-limited (429), apply the following tiered degradation — do not block code generation.
result=$(ruby $CLAUDE_PLUGIN_ROOT/skills/rubysmithing-context/scripts/context_cache.rb stale GEMNAME --json)
# Exit 0 = fresh → use result normally
# Exit 2 = stale → use result, inject result["warning"] block above generated code,
# flag every method call with # stale-cache
# Exit 1 = miss → proceed to Tier 2
The "warning" field in the JSON is pre-formatted by staleness_warning — inject it verbatim
above the generated code block. Flag every method call from the stale gem with # stale-cache.
Add to session cache with stale: true so downstream skills know.
If no SQLite entry at all, check references/gem-registry.md for a pre-mapped
Context7 ID and attempt a single retry with that ID directly, bypassing resolve step.
If retry succeeds → store the result via Bash store command (see Step 5) and proceed normally. If retry fails → continue to Tier 3.
No stale cache, no registry retry success. Inject the full unverified block:
# [WARNING: Unverified API Syntax]
# Context7 could not resolve documentation for: [gem_name]
# The following code is based on training data and MAY be outdated or incorrect.
# Verify against: https://rubygems.org/gems/[gem_name] before use.
# Run: bundle exec ruby -e "require '[gem_name]'; puts [GemClass].instance_methods"
# to inspect the actual available API.
Flag every method call from the unverified gem with # unverified inline comment.
If Context7 returns a rate limit signal: note it to the user, apply Tier 1 or Tier 2 immediately, and do not retry Context7 again within the same session for the rate-limited gem. Let the session cache serve subsequent requests.
If Context7 resolves but returns no documentation match for the gem:
Do not silently fall back to training data.
Apply Tier 3 (Unverified block) and proceed with best-effort generation,
flagging every method call from the unverified gem with # unverified.
Load references/gem-registry.md for the full curated gem → Context7 ID mapping,
architectural plane assignments, project archetype → gem set lookup, and
last_verified dates for registry staleness detection.
For frequently used gems, a local SQLite cache via Sequel prevents repeated
Context7 lookups across separate sessions. The cache lives at:
~/.rubysmithing/context_cache.db
Schema (managed by scripts/context_cache.rb):
create_table(:gem_cache) do
String :gem_name, null: false, unique: true
String :context7_id, null: false
Text :method_sigs # JSON array of signature strings
Text :example # minimal working code example
Time :resolved_at, null: false
Integer :ttl_days, default: 7
end
Cache invalidation: TTL of 7 days per gem (configurable per-entry).
Stale entries are not evicted automatically — they serve as Tier 1 fallback data
when Context7 is unavailable. Evict manually with cache.evict(gem_name) after
a successful refresh.
Check the persistent cache before any Context7 MCP call. If the cache file doesn't exist, create it on first use — do not error.
Human-readable (pp) output by default; add --json for machine-readable output.
# Fresh fetch — respects TTL (7 days); returns miss if absent or expired
ruby scripts/context_cache.rb fetch <gem> [--json]
# Alias for fetch (backward compat)
ruby scripts/context_cache.rb check <gem> [--json]
# Stale fetch — ignores TTL; returns any entry regardless of age
ruby scripts/context_cache.rb stale <gem> [--json]
# Upsert resolved entry; sigs_json is a JSON array string, example is a single-quoted string
ruby scripts/context_cache.rb store <gem> <context7_id> [sigs_json] [example]
# List all cached gems with age and staleness status
ruby scripts/context_cache.rb list [--json]
# Remove entry to force fresh lookup on next use
ruby scripts/context_cache.rb evict <gem>
Exit codes:
| Command | Exit 0 | Exit 1 | Exit 2 | |---------------|-----------------|--------------|---------------------| | fetch / check | entry found | miss / error | — | | stale | found + fresh | miss | found but stale | | store | stored ok | parse error | — | | list / evict | always 0 | — | — |
--json output shapes (fetch/check hit):
{"status":"fresh","gem_name":"ruby_llm","context7_id":"/crmne/ruby_llm",
"method_sigs":[".chat(...)"],"example":"...","resolved_at":"2026-03-11",
"age_days":7.0,"ttl_days":7}
Miss: {"status":"miss"}
stale hit (exit 2): same shape + "status":"stale" + "warning":"<pre-formatted block>"
store: {"status":"stored","gem_name":"ruby_llm"} (or Stored: ruby_llm without --json)
list --json: JSON array of entry objects with string keys.
development
--- name: rubysmithing description: Convention-aware Ruby code generator for the terminal-native AI orchestration stack (dotenv, tty-config, zeitwerk, async, dry-schema, sequel, journald-logger, circuit_breaker, parallel, concurrent-ruby). Use for generating Ruby classes, modules, Rake tasks, config wiring, boot layer code, data pipelines, POROs, error class hierarchies, parallel processing workers, content parsers, and Gemfile decisions. Applies project-detected conventions (RuboCop, StandardRB
development
YARD documentation generator with semantic analysis for Ruby files. Automatically activates on requests to generate, add, or improve YARD documentation. Uses AST parsing and type inference to generate comprehensive @param, @return, @example, and @raise tags. Maintains consistency with existing project documentation patterns and YARD configuration. Generates production-grade documentation that eliminates usage pitfalls and accelerates correct method implementation. Requires rubysmithing-context when the target file uses non-stdlib gems, to ensure type annotations reflect verified API shapes.
data-ai
--- name: rubysmithing-tui description: Terminal UI scaffolder and advisor for Ruby projects using the Charm/Bubble ecosystem. Activates on any mention of: TUI, terminal UI, terminal interface, terminal app, BubbleTea, bubbletea, Lipgloss, lipgloss, Bubbles, bubbles (UI components), Huh, huh form, form validation, Gum, gum prompts, NTCharts, charts, data visualization, Bubblezone, Glamour, glamour rendering, markdown display, Harmonica, harmonica animations, spring physics, smooth transitions, a
tools
--- name: rubysmithing-scaffold description: Ruby project scaffolder using rubysmith (apps, tools, scripts) or gemsmith (publishable gems). Activates on any mention of: scaffold a project, scaffold a gem, new ruby project, new gem, create gem, bootstrap project, rubysmith, gemsmith, generate project skeleton, project template, set up a new ruby app, start a ruby tool, start a ruby script, create a new gem for rubygems, initialize ruby project, rubysmith build, gemsmith build, new ruby