Back to all reviewers

Write complete API examples

rails/rails
Based on 5 comments
Ruby

Always provide complete, context-rich code examples in API documentation. Examples should show the full usage context and avoid abbreviated or partial code snippets that may confuse developers.

Documentation Ruby

Reviewer Prompt

Always provide complete, context-rich code examples in API documentation. Examples should show the full usage context and avoid abbreviated or partial code snippets that may confuse developers.

Key guidelines:

  • Show the complete context (e.g., wrapping code in create_table blocks)
  • Avoid interactive prompts (like irb>)
  • Use proper formatting tags for code containing spaces ()
  • Include realistic variable names and values

Example:

# โŒ Unclear context
t.bigint :account_id

# โœ… Complete context
create_table :subscriptions do |t|
  t.bigint :account_id
  t.bigint :event_ids, array: true, default: []
end
5
Comments Analyzed
Ruby
Primary Language
Documentation
Category

Source Discussions