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 context when the target file uses non-stdlib gems, to ensure type annotations reflect verified API shapes.
Semantic analysis-powered YARD documentation generator. Transforms Ruby code into comprehensive, immediately usable developer resources with precise implementation guidance.
Activate on any mention of:
.rb + documentation requestSkip activation for: README generation, project overview docs, non-Ruby files.
Before generating type annotations, check whether the target file uses non-stdlib gems.
If gem-specific types appear in method signatures or return values (e.g., RubyLLM::Chat,
Sequel::Dataset, Async::Task, Dry::Schema::Result):
@param and @return tags.context
and note # type annotation based on stale cache — verify before publishing inline.Skip this step for: stdlib-only files, Lite Mode tasks, gems already resolved this session.
.rb extension (warn if missing but proceed).yardopts file to maintain project YARD configurationUse Ruby parser to extract:
Analyze code implementation to infer:
Extract method purpose from:
Generate complete YARD comment blocks with:
##
# [Clear behavioral description in active voice]
#
# [Extended description with usage context and important notes]
#
# @param [PreciseType] param_name Description with usage context and constraints
# @param [Type, nil] optional_param Description including default behavior patterns
# @return [SpecificType] Comprehensive description with type structure details
# @raise [ExceptionClass] Specific conditions that trigger this exception
# @example Basic usage pattern
# realistic_method_call(actual_values)
# # => expected_output_with_type
# @example Advanced scenario with blocks
# complex_usage_pattern do |yielded_value|
# # practical block implementation
# end
# @since version_number (if determinable from git history)
# @see RelatedClass#related_method (if cross-references detected)
String, Integer, Hash{Symbol => Object}Array<Hash{String => Symbol}>#to_s, #each, #callString, nil for conditional returnsString, Symbol for flexible parametersCreate realistic, working code examples:
Provide completion summary:
Load references/yard-patterns.md for comprehensive YARD tag usage patterns,
type annotation standards, example generation guidelines, and common
documentation anti-patterns to avoid.