skills/rubysmithing-analyse/SKILL.md
Ruby-targeted analysis skill implementing Gemba Walk (code archaeology, docs-vs-reality gaps), Muda waste analysis (dead methods, N+1 queries, unused gems, over-engineering), Root-Cause Tracing (backward call-chain from symptom to source), and Five Whys (iterative causal drilling). Use when user asks "why is this failing", "trace this bug", "root cause", "what's wasting cycles", "dead code audit", "gemba", "muda", "pre-refactor investigation", or reports a Zeitwerk error, circuit_breaker trip, or slow query. Auto-selects method from context. Produces findings keyed to rubysmithing-refactor pattern names for direct handoff to /rubysmithing:refactor.
npx skillsauth add b08x/rubysmithing rubysmithing-analyseInstall 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.
Ruby-targeted diagnostic analysis. Identifies why problems exist and where
they originate — the step before /rubysmithing:refactor fixes them and
/rubysmithing:report verifies the result.
rubysmithing-analyse/SKILL.md
references/analyse-methods.md — Full method templates, Ruby instrumentation
idioms, Muda category mappings, Gemba
observation checklist, defense-in-depth pattern
Load references/analyse-methods.md immediately when executing any method.
Select the method from context signals. Accept explicit flags to override.
| Signal | Method |
|:-------|:-------|
| Error/exception, stack trace provided, "why is this failing", "why does X error" | Root-Cause Tracing |
| "what's slow", "bloated", "wasting", "dead code", "unused", "over-engineered" | Muda Analysis |
| "how does this work", "what does this actually do", "pre-refactor", unfamiliar area | Gemba Walk |
| "why", "why did this happen", recurring issue with no obvious cause | Five Whys |
| --trace flag | Root-Cause Tracing (explicit) |
| --muda flag | Muda Analysis (explicit) |
| --gemba flag | Gemba Walk (explicit) |
| --why flag | Five Whys (explicit) |
When the signal is ambiguous, default to Gemba Walk and state the assumption.
.rb, .gemspec, Gemfile) → analyse that file"Go see the actual code." Gemba Walk bridges the gap between assumed and actual behavior — critical before refactoring anything unfamiliar.
Process:
puts/p debug lines left infrozen_string_literal, scattered config that should be tty-configFull observation checklist in references/analyse-methods.md — Gemba section.
Map the 7 waste types to Ruby code artifacts. Prioritize by impact.
| Waste Type | Ruby Code Manifestation |
|:-----------|:------------------------|
| Overproduction | Dead methods, unused public API, speculative abstractions, unused initializer args |
| Waiting | Synchronous calls that should use Async { }, missing circuit_breaker wrapping |
| Transportation | Redundant object transformations, repeated serialization/deserialization layers |
| Over-processing | Duplicated dry-schema contracts, excessive validation, over-instrumented logging |
| Inventory | Commented-out code, stale feature flags, unused Gemfile dependencies |
| Motion | Missing Zeitwerk compliance forcing manual require, config scattered across files |
| Defects | RuboCop violations, missing frozen_string_literal, silent rescue clauses |
Output: waste type → instances found (file:line) → estimated impact → refactor-patterns.md key.
Full category mappings with examples in references/analyse-methods.md — Muda section.
Trace bugs backward through the call chain to find the original trigger. Never fix where the error appears — find where the bad value originated.
Process:
Ruby instrumentation idioms (use $stderr — not logger, which may be suppressed in tests):
$stderr.puts caller.join("\n") # full call chain
$stderr.puts method(:foo).source_location.inspect # where method is defined
$stderr.puts self.class # unexpected receiver type
Common Ruby trace patterns:
NameError: uninitialized constant Foo → which file was expected → Zeitwerk loader config → inflector → actual file path on diskcircuit_breaker opens → which external call → what error → configured threshold → configuration source (env var, tty-config, hardcoded)Sequel::Error deep in pipeline → N+1 origin → model association → eager loading omissiondry-schema contract violation → which field → upstream transformer → input boundaryFull tracing template and defense-in-depth pattern in references/analyse-methods.md — Root-Cause section.
Iteratively ask "why" to move from surface symptom to systemic root cause. Particularly useful for recurring issues (same error type across multiple files/sessions).
Process:
Ruby-specific stopping points (systemic causes worth stopping at):
.rubocop.yml (process gap)circuit_breaker policy absent in a class that makes external calls (architectural gap)METHOD: [Gemba Walk | Muda Analysis | Root-Cause Tracing | Five Whys]
TARGET: [file path | directory | snippet]
CONVENTION TARGET: [RuboCop | StandardRB | Rubysmith | community idioms]
[Method findings — structured per method above]
ACTIONABLE NEXT STEPS:
- [Finding] → /rubysmithing:refactor [file] (pattern: [refactor-pattern-key])
- [Finding] → /rubysmithing:report --advisory for full QA assessment
- [Finding] → manual intervention required ([describe why])
For Root-Cause Tracing, include the trace chain explicitly:
SYMPTOM → IMMEDIATE CAUSE → [intermediate steps] → ORIGINAL TRIGGER
Fix at: [source location]
Defense layers: [file:line guard 1] / [file:line guard 2] / [boundary validation]
Findings reference named patterns from
rubysmithing-refactor/references/refactor-patterns.md wherever a match exists.
This enables direct handoff: the refactor agent receives a pre-keyed issue list
rather than freeform descriptions.
When analysis reveals issues beyond the current target scope (architectural
drift, systematic convention gaps, missing DI boundaries), suggest
/rubysmithing:report for a full SIFT assessment. Analysis and report are
complementary: analyse answers why, SIFT answers how bad and what next.
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