| name | eventaservo-yard-docs |
| description | Creates or updates YARD documentation for Ruby classes and methods per project rules. Use when the user asks for YARD docs, Ruby docstrings, or when adding or changing classes or methods that need documentation. All YARD text must be in English. |
YARD Documentation in Eventaservo
When to apply
- When creating or changing classes, modules, or methods in
app/, lib/, or config/.
- When the user asks to document code, add YARD, or add "docstrings" in Ruby.
- During code review, when suggesting documentation for public APIs or services.
Language
All YARD documentation must be in English (project default per AGENTS.md). Summaries, descriptions, and tag text must be written in English.
Structure by element
Class or module
- First line: One-sentence summary (what it is / responsibility).
- Blank line and, if needed, paragraphs explaining flow, preconditions, or exceptions.
- Tags (when relevant):
@example for typical usage on public APIs (services, factories, presenters).
@see ClassName for related classes/modules (max 3–5).
class Create < ApplicationService
Method (public or private)
All methods — public and private — must be documented (per AGENTS.md).
- First line: One-sentence summary.
- Blank line and, if needed, details (special behavior, edge cases).
- Required tags:
@param name [Type] Description for each argument (keyword or positional).
- A blank line before
@return.
@return [Type] Description (always; use [void] when there is no meaningful return value).
Common types: String, Integer, Boolean, Hash, Array, BigDecimal, nil, or class name (User, Event, ApplicationService::Response). For "may be nil": [String, nil].
def call
Private methods / helpers
Same pattern: one-line summary, optional description, @param and @return. No @example unless it is a complex shared helper.
private
def allowed_attributes(kwargs)
kwargs.slice(*ALLOWED_ATTRIBUTES)
end
Methods with **kwargs
Use Hash notation for kwargs:
def build(**kwargs)
attr_reader / attr_writer / attr_accessor
Do NOT document these — keep them on a single line without comments:
attr_reader :text, :user, :loggable
attr_reader :text
ApplicationService Response pattern
Services inherit from ApplicationService and return ApplicationService::Response:
def call
success(user)
rescue => e
failure(e.message)
end
The Response struct has .success?, .payload, and .error attributes.
Rules
- Consistency: Match the style of the file you are editing.
- Language: All descriptions and tag text in English.
- Brevity: Clear, concise summaries; add detail only when it adds value.
- Types: Use correct YARD types; avoid vague docs like "returns something".
- Blank line before
@return: Always separate params from return with a blank # line.
- Do not document:
attr_reader, attr_writer, or attr_accessor; generated or pure-delegate code.
- Do not use the
@api tag (not used in this project).
- frozen_string_literal: Always include
# frozen_string_literal: true at the top of Ruby files (per AGENTS.md).
Quick checklist
For full tag and type reference, see reference.md.