一键导入
rails-controller-docs
Generate comprehensive markdown documentation for a Rails controller, including actions, routes, request/response formats, and business logic.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Generate comprehensive markdown documentation for a Rails controller, including actions, routes, request/response formats, and business logic.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Draft a structured commit message for all uncommitted changes, auto-detecting project type (React, Rails, or generic).
Create a comprehensive, well-structured README.md file for the project.
Generate a comprehensive .gitignore file at the project root covering common environments, frameworks, and operating systems.
Review a GitHub Pull Request using the gh CLI and provide a comprehensive report with prioritized suggestions.
Review uncommitted local code changes and provide a prioritized report with suggested fixes.
Generate a formatted Slack standup update by summarizing entries from the last working day and today in a work log markdown file.
| name | rails-controller-docs |
| description | Generate comprehensive markdown documentation for a Rails controller, including actions, routes, request/response formats, and business logic. |
| disable-model-invocation | true |
Generate comprehensive markdown documentation for a Rails controller, including all actions, routes, request/response formats, authentication requirements, and business logic.
Follow these steps IN EXACT ORDER. DO NOT skip any step:
YOU MUST determine which controller file to document:
DO NOT proceed without a valid controller file path.
YOU MUST run: Read the entire controller file from start to finish.
Read these files if they exist (in order):
config/routes.rb - to get route definitionsUser.find, read app/models/user.rb)include Authenticatable)ApplicationController if referencedBefore generating documentation, identify:
before_action / after_action / around_action filtersCreate comprehensive documentation following the format specified below.
Output to Chat ONLY - DO NOT create files.
Use four backticks (````) for the outer markdown code block.
For each controller action, you MUST document:
The generated documentation should follow this structure:
# (Controller Name) Documentation
**Generated:** (Current Date)
**Controller:** `(path/to/controller.rb)`
## Overview
(Brief description of what this controller manages)
## Authentication & Authorization
(Describe authentication requirements, filters, and authorization policies)
Example:
- Requires authentication for all actions via `authenticate_user!`
- Admin access required for destroy action
- Uses CanCanCan for authorization
---
## Actions
### 1. (Action Name) (e.g., index)
**HTTP Method:** `GET`
**Route:** `(route path, e.g., /api/v1/users)`
**Purpose:** (What this action does)
#### Authentication
- (Authentication requirements)
#### Parameters
**Query Parameters:**
| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| `page` | Integer | No | 1 | Page number for pagination |
| `per_page` | Integer | No | 25 | Number of items per page |
**Path Parameters:**
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `id` | Integer/String | Yes | Resource identifier |
#### Request Example
```http
GET /api/v1/users?page=1&per_page=25
Authorization: Bearer (token)
```
For POST/PUT/PATCH requests:
```json
{
"user": {
"name": "John Doe",
"email": "john@example.com",
"role": "admin"
}
}
```
#### Response
**Success Response (200/201):**
```json
{
"data": {
"id": 1,
"type": "user",
"attributes": {
"name": "John Doe",
"email": "john@example.com",
"role": "admin",
"created_at": "2025-10-29T10:00:00Z"
}
},
"meta": {
"page": 1,
"per_page": 25,
"total": 100
}
}
```
**Error Responses:**
_401 Unauthorized:_
```json
{
"error": "Authentication required"
}
```
_422 Unprocessable Entity:_
```json
{
"errors": {
"email": ["has already been taken"],
"name": ["can't be blank"]
}
}
```
#### Business Logic
- (Describe key business logic, validations, or data transformations)
- (List any important conditionals or branching logic)
- (Note any performance considerations)
#### Side Effects
- **Database:** (Describe any create, update, or delete operations)
- **External Services:** (List any API calls, webhooks, or third-party integrations)
- **Background Jobs:** (Note any enqueued jobs)
- **Notifications:** (Mention emails, push notifications, etc.)
#### Error Handling
- (How errors are caught and handled)
- (What error responses are returned)
---
(Repeat the above structure for each action)
---
## Models Referenced
- `(ModelName)` - (Brief description of relationship)
- `(AnotherModel)` - (Brief description of relationship)
## Concerns & Modules
- `(ConcernName)` - (What it provides)
## Key Validations
- (List important validations from the controller or models)
## Security Considerations
- (List any security-related implementations)
- (Note CSRF protection, parameter sanitization, etc.)
## Notes
- (Any additional notes, TODOs, or caveats)
- (Known issues or limitations)