Skip to content
rails-technical-writer logo

Rails Technical Writer

rails-technical-writer

Technical documentation specialist for Rails projects. Use when writing README files, API documentation, setup guides, architectural decisions, code comments, or user-facing documentation. Focuses on clarity, completeness, and maintainability.

SKILL.md

Full skill instructions

Rails Technical Writer

Create clear, comprehensive documentation for Rails applications.

When to Use This Skill

  • Writing or updating README.md
  • Documenting API endpoints
  • Creating setup/​installation guides
  • Writing architectural decision records (ADRs)
  • Documenting complex features or workflows
  • Adding inline code documentation
  • Creating migration guides
  • Documenting deployment processes

Quick Templates

README.md

# Project Name

Brief description of what the application does.

## Features

- User authentication with email confirmation
- Role-based authorization (admin, user)
- Real-time notifications with Turbo Streams

## Tech Stack

- **Framework**: Ruby on Rails 7.1
- **Database**: PostgreSQL 15
- **Frontend**: ViewComponent, Hotwire, Tailwind CSS
- **Background Jobs**: Solid Queue
- **Testing**: RSpec, FactoryBot, Capybara

## Prerequisites

- Ruby 3.3.0
- PostgreSQL 15+
- Node.js 20+

## Setup

```bash
# Install dependencies
bundle install
yarn install

# Database setup
bundle exec rails db:create db:migrate

# Start server
bin/​dev

Testing

bundle exec rspec

License

MIT License


### API Endpoint Documentation

```ruby
# @api public
# @endpoint GET /​api/​v1/​users
# @description List all users with pagination
#
# @param [Integer] page Page number (default: 1)
# @param [Integer] per_page Items per page (default: 25)
#
# @response 200 [Array<User>] List of users
# @response_example
#   {
#     "users": [
#       { "id": 1, "name": "John", "email": "[email protected]" }
#     ],
#     "meta": { "current_page": 1, "total_pages": 10 }
#   }
#
# @error 401 Unauthorized
# @error 422 Invalid parameters
def index
  @users = policy_scope(User).page(params[:page])
  render json: UsersSerializer.new(@users)
end

Architecture Decision Record (ADR)

# ADR 001: Use ActiveInteraction for Business Logic

## Status
Accepted

## Context
We need a pattern for encapsulating business logic with:
- Clear input/​output contracts
- Built-in validation
- Composability
- Testability

## Decision
Use ActiveInteraction for all business logic operations.

## Consequences

### Positive
- Built-in type checking and validation
- Self-documenting interface
- Composable via `compose` method
- Consistent error handling

### Negative
- Additional gem dependency
- Team needs to learn new pattern

## Implementation
- Add `gem "active_interaction"` to Gemfile
- Create interactions in `app/​interactions/`
- Follow naming: `Namespace::Verb` (e.g., `Users::Create`)

## Examples
See `app/​interactions/​users/​create.rb`

Code Documentation

# Processes a payment and updates order status.
#
# Steps:
# 1. Validates payment method is active
# 2. Charges the payment gateway
# 3. Updates order status to "paid"
# 4. Sends confirmation email
#
# @param order [Order] The order to process
# @param payment_method [PaymentMethod] Payment method to charge
# @return [Boolean] true if successful
# @raise [PaymentGatewayError] if gateway unavailable
#
# @example
#   processor.process_payment(order, payment_method)
#
def process_payment(order, payment_method)
  return false unless payment_method.active?

  result = gateway.charge(
    amount: order.total,
    source: payment_method.token
  )

  if result.success?
    order.update!(status: :paid)
    OrderMailer.payment_confirmation(order).deliver_later
    true
  else
    order.errors.add(:base, result.error_message)
    false
  end
end

Documentation Best Practices

Writing Style

✅ Do:

  • Use active voice: "The system validates..."
  • Be concise: "Creates a user" not "This method creates a user record"
  • Include examples with code snippets
  • Structure with clear headings
  • Keep documentation updated

❌ Avoid:

  • Passive voice
  • Outdated information
  • Obvious comments: i++ // increment i
  • Commented-out code (use git instead)

When to Add Comments

Comment:

  • ✓ Why, not what (explain reasoning)
  • ✓ Complex algorithms or business logic
  • ✓ Workarounds for bugs
  • ✓ Performance optimizations
  • ✓ Security considerations
  • ✓ Public API methods

Don't comment:

  • ✗ Obvious code
  • ✗ Redundant information
  • ✗ Changelog info (use git)

README Structure

Essential sections (in order):

  1. Project name + description
  2. Features - What it does
  3. Tech stack - Technologies used
  4. Prerequisites - Requirements
  5. Setup - Installation steps
  6. Usage - How to run
  7. Testing - How to test
  8. Deployment - How to deploy
  9. Contributing - Guidelines
  10. License - Legal info

Feature Documentation

# Feature Name

## Overview
Brief description of the feature.

## Implementation

### Key Components
- `Model` - Handles data
- `Interaction` - Business logic
- `Controller` - HTTP interface

### How It Works

1. User performs action
2. Controller calls interaction
3. Interaction validates and processes
4. Result returned to user

## Usage

```ruby
# Example code
result = Features::DoSomething.run(params)

Testing

RSpec.describe Features::DoSomething do
  it "works correctly" do
    # test code
  end
end

Gotchas

  • Important consideration #1
  • Important consideration #2

## Documentation Checklist

When making changes, update:

- [ ] README.md (if features/​setup changed)
- [ ] API docs (if API endpoints changed)
- [ ] Inline comments (for complex logic)
- [ ] ADR (for architectural decisions)
- [ ] CHANGELOG (for all user-facing changes)
- [ ] Migration guide (for breaking changes)

## OpenAPI/​Swagger Format

```yaml
# swagger/​v1/​swagger.yaml
openapi: 3.0.0
info:
  title: MyApp API
  version: 1.0.0

paths:
  /​api/​v1/​users:
    get:
      summary: List users
      parameters:
        - name: page
          in: query
          schema:
            type: integer
            default: 1
      responses:
        '200':
          description: Successful
          content:
            application/​json:
              schema:
                type: object
                properties:
                  users:
                    type: array
                    items:
                      $ref: '#/​components/​schemas/​User'

components:
  schemas:
    User:
      type: object
      properties:
        id:
          type: integer
        name:
          type: string
        email:
          type: string

Markdown Conventions

Use consistent formatting:

  • # H1 for main title
  • ## H2 for sections
  • ### H3 for subsections
  • ```ruby for code blocks with syntax
  • **bold** for emphasis
  • - bullet for unordered lists
  • 1. number for ordered lists
  • [link text](url) for links

YARD Documentation (Ruby)

# @!group User Management

# Creates a new user account
# @param [Hash] attributes User attributes
# @option attributes [String] :email User email
# @option attributes [String] :password User password
# @return [User, nil] Created user or nil
# @raise [ValidationError] if invalid
def create_user(attributes)
  # implementation
end

# @!endgroup

Good vs Bad Examples

Good Documentation

## Email Verification Flow

When a user registers:

1. User submits registration form
2. System creates user with `confirmed_at: nil`
3. System generates unique confirmation token
4. System sends confirmation email with link
5. User clicks link in email
6. System verifies token and sets `confirmed_at`

**Security notes:**
- Tokens expire after 24 hours
- Tokens are single-use only
- Rate limiting applied

Bad Documentation

## Email stuff

User gets email. Click link. Done.

Reference Documentation

For comprehensive templates and detailed examples:

  • Full documentation guide: technical-writing-reference.md (complete templates, setup guides, all platforms)

Remember: Good documentation is:

  • Clear - Easy to understand
  • Complete - All necessary information
  • Current - Reflects actual code
  • Concise - No unnecessary detail
  • Consistent - Follows same structure

More Security skills

supabase logo
Security

supabase

Handles the full Supabase workflow from schema changes to deployment, with built-in security guardrails that catch common traps like RLS...

2.7K 308.9K
View

Comprehensive guides and best practices for Neon Serverless Postgres, covering setup, connection methods, authentication, and platform APIs.

98 216.2K
View

Guide for setting up and using Firebase Authentication. Use this skill when the user's app requires user sign-in, user management, or secure data access using auth rules.

462 163.8K
View

A skill to evaluate how secure Firestore security rules are. Use this when Firestore security rules are updated to ensure that the generated rules are extremely secure and robust.

462 127.7K
View

Official skill for integrating Firebase AI Logic (Gemini API) into web applications. Covers setup, multimodal inference, structured output, and security.

462 125.1K
View

Complete Better Auth server and client setup with database adapters, session management, plugins, and security configuration.

222 118.2K
View

Deploy and manage projects on Vercel using token-based authentication. Use when working with Vercel CLI using access tokens rather than interactive login — e.g. "deploy to vercel", "set up vercel", "add environment variables to vercel".

31.9K 116.1K
View
cloudflare logo
Security

cloudflare

Complete Cloudflare platform integration with decision trees for compute, storage, AI, networking, security, and infrastructure-as-code.

3K 110.7K
View

Run Azure compliance and security audits with azqr plus Key Vault expiration checks. Covers best-practice assessment, resource review, policy/compliance validation, and security posture checks. WHEN: compliance scan, security audit, BEFORE running azqr (compliance cli tool), Azure best practices, Key Vault expiration check, expired certificates, expiring secrets, orphaned resources, compliance assessment.

253 103K
View
gws-gmail logo
Security

gws-gmail

Send, read, and manage Gmail messages, drafts, labels, and account settings.

31.2K 78.9K
View

Comprehensive website auditing across 230+ rules in 21 categories including SEO, performance, security, and accessibility.

94 72.3K
View
gws-shared logo
Security

gws-shared

Shared authentication, CLI syntax, and output formatting patterns for gws Google Workspace commands.

31.2K 63.4K
View

Security AI tools

StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
GeoSpy logo
Security

GeoSpy

GeoSpy: Pricing, Features, FAQs, and Alternatives for AI Teams

Free
View

Detect AI-generated voices to protect against audio fraud.

Paid
View

Ensure Your Content's Originality with AI Plagiarism Checker

Freemium
View
Img Upscaler logo
Security

Img Upscaler

Upscale images by 400% without quality loss

Freemium
View
AICheatCheck logo
Security

AICheatCheck

Accurately Detect AI-Generated Content with TheChecker.AI

Free
View
D
Security

Detect GPT

Chrome extension that detects and flags AI-generated content

Free
View