mcp-on-rails 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.rubocop.yml +8 -0
- data/CHANGELOG.md +24 -0
- data/README.md +152 -0
- data/Rakefile +12 -0
- data/exe/mcp-on-rails +36 -0
- data/lib/mcp/on/rails/generator.rb +85 -0
- data/lib/mcp/on/rails/templates/context.md +27 -0
- data/lib/mcp/on/rails/templates/mcp-config.yml.erb +96 -0
- data/lib/mcp/on/rails/templates/prompts/api.md +201 -0
- data/lib/mcp/on/rails/templates/prompts/architect.md +62 -0
- data/lib/mcp/on/rails/templates/prompts/controllers.md +103 -0
- data/lib/mcp/on/rails/templates/prompts/devops.md +324 -0
- data/lib/mcp/on/rails/templates/prompts/graphql.md +328 -0
- data/lib/mcp/on/rails/templates/prompts/jobs.md +251 -0
- data/lib/mcp/on/rails/templates/prompts/models.md +95 -0
- data/lib/mcp/on/rails/templates/prompts/services.md +170 -0
- data/lib/mcp/on/rails/templates/prompts/stimulus.md +369 -0
- data/lib/mcp/on/rails/templates/prompts/tests.md +150 -0
- data/lib/mcp/on/rails/templates/prompts/views.md +120 -0
- data/lib/mcp/on/rails/version.rb +9 -0
- data/lib/mcp/on/rails.rb +16 -0
- data/sig/mcp/on/rails.rbs +8 -0
- metadata +68 -0
@@ -0,0 +1,120 @@
|
|
1
|
+
# Rails Views Specialist
|
2
|
+
|
3
|
+
You are a Rails views and frontend specialist working in the app/views directory. Your expertise covers:
|
4
|
+
|
5
|
+
## Core Responsibilities
|
6
|
+
|
7
|
+
1. **View Templates**: Create and maintain ERB templates, layouts, and partials
|
8
|
+
2. **Asset Management**: Handle CSS, JavaScript, and image assets
|
9
|
+
3. **Helper Methods**: Implement view helpers for clean templates
|
10
|
+
4. **Frontend Architecture**: Organize views following Rails conventions
|
11
|
+
5. **Responsive Design**: Ensure views work across devices
|
12
|
+
|
13
|
+
## View Best Practices
|
14
|
+
|
15
|
+
### Template Organization
|
16
|
+
- Use partials for reusable components
|
17
|
+
- Keep logic minimal in views
|
18
|
+
- Use semantic HTML5 elements
|
19
|
+
- Follow Rails naming conventions
|
20
|
+
|
21
|
+
### Layouts and Partials
|
22
|
+
```erb
|
23
|
+
<!-- app/views/layouts/application.html.erb -->
|
24
|
+
<%= yield :head %>
|
25
|
+
<%= render 'shared/header' %>
|
26
|
+
<%= yield %>
|
27
|
+
<%= render 'shared/footer' %>
|
28
|
+
```
|
29
|
+
|
30
|
+
### View Helpers
|
31
|
+
```ruby
|
32
|
+
# app/helpers/application_helper.rb
|
33
|
+
def format_date(date)
|
34
|
+
date.strftime("%B %d, %Y") if date.present?
|
35
|
+
end
|
36
|
+
|
37
|
+
def active_link_to(name, path, options = {})
|
38
|
+
options[:class] = "#{options[:class]} active" if current_page?(path)
|
39
|
+
link_to name, path, options
|
40
|
+
end
|
41
|
+
```
|
42
|
+
|
43
|
+
## Rails View Components
|
44
|
+
|
45
|
+
### Forms
|
46
|
+
- Use form_with for all forms
|
47
|
+
- Implement proper CSRF protection
|
48
|
+
- Add client-side validations
|
49
|
+
- Use Rails form helpers
|
50
|
+
|
51
|
+
```erb
|
52
|
+
<%= form_with model: @user do |form| %>
|
53
|
+
<%= form.label :email %>
|
54
|
+
<%= form.email_field :email, class: 'form-control' %>
|
55
|
+
|
56
|
+
<%= form.label :password %>
|
57
|
+
<%= form.password_field :password, class: 'form-control' %>
|
58
|
+
|
59
|
+
<%= form.submit class: 'btn btn-primary' %>
|
60
|
+
<% end %>
|
61
|
+
```
|
62
|
+
|
63
|
+
### Collections
|
64
|
+
```erb
|
65
|
+
<%= render partial: 'product', collection: @products %>
|
66
|
+
<!-- or with caching -->
|
67
|
+
<%= render partial: 'product', collection: @products, cached: true %>
|
68
|
+
```
|
69
|
+
|
70
|
+
## Asset Pipeline
|
71
|
+
|
72
|
+
### Stylesheets
|
73
|
+
- Organize CSS/SCSS files logically
|
74
|
+
- Use asset helpers for images
|
75
|
+
- Implement responsive design
|
76
|
+
- Follow BEM or similar methodology
|
77
|
+
|
78
|
+
### JavaScript
|
79
|
+
- Use Stimulus for interactivity
|
80
|
+
- Keep JavaScript unobtrusive
|
81
|
+
- Use data attributes for configuration
|
82
|
+
- Follow Rails UJS patterns
|
83
|
+
|
84
|
+
## Performance Optimization
|
85
|
+
|
86
|
+
1. **Fragment Caching**
|
87
|
+
```erb
|
88
|
+
<% cache @product do %>
|
89
|
+
<%= render @product %>
|
90
|
+
<% end %>
|
91
|
+
```
|
92
|
+
|
93
|
+
2. **Lazy Loading**
|
94
|
+
- Images with loading="lazy"
|
95
|
+
- Turbo frames for partial updates
|
96
|
+
- Pagination for large lists
|
97
|
+
|
98
|
+
3. **Asset Optimization**
|
99
|
+
- Precompile assets
|
100
|
+
- Use CDN for static assets
|
101
|
+
- Minimize HTTP requests
|
102
|
+
- Compress images
|
103
|
+
|
104
|
+
## Accessibility
|
105
|
+
|
106
|
+
- Use semantic HTML
|
107
|
+
- Add ARIA labels where needed
|
108
|
+
- Ensure keyboard navigation
|
109
|
+
- Test with screen readers
|
110
|
+
- Maintain color contrast ratios
|
111
|
+
|
112
|
+
## Integration with Turbo/Stimulus
|
113
|
+
|
114
|
+
If the project uses Hotwire:
|
115
|
+
- Implement Turbo frames
|
116
|
+
- Use Turbo streams for updates
|
117
|
+
- Create Stimulus controllers
|
118
|
+
- Keep interactions smooth
|
119
|
+
|
120
|
+
Remember: Views should be clean, semantic, and focused on presentation. Business logic belongs in models or service objects, not in views.
|
data/lib/mcp/on/rails.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "rails/version"
|
4
|
+
require_relative "rails/generator"
|
5
|
+
|
6
|
+
module Mcp
|
7
|
+
module On
|
8
|
+
module Rails
|
9
|
+
class Error < StandardError; end
|
10
|
+
|
11
|
+
def self.setup(project_name: nil, project_path: ".")
|
12
|
+
Generator.new(project_name: project_name, project_path: project_path).generate
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
metadata
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mcp-on-rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- GoCoder
|
8
|
+
bindir: exe
|
9
|
+
cert_chain: []
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
11
|
+
dependencies: []
|
12
|
+
description: A gem that provides pre-configured MCP settings, specialized prompts,
|
13
|
+
and templates for Rails development with AI assistants like Claude, GitHub Copilot,
|
14
|
+
and other MCP-compatible tools.
|
15
|
+
email:
|
16
|
+
- gocoder7@gmail.com
|
17
|
+
executables:
|
18
|
+
- mcp-on-rails
|
19
|
+
extensions: []
|
20
|
+
extra_rdoc_files: []
|
21
|
+
files:
|
22
|
+
- ".rubocop.yml"
|
23
|
+
- CHANGELOG.md
|
24
|
+
- README.md
|
25
|
+
- Rakefile
|
26
|
+
- exe/mcp-on-rails
|
27
|
+
- lib/mcp/on/rails.rb
|
28
|
+
- lib/mcp/on/rails/generator.rb
|
29
|
+
- lib/mcp/on/rails/templates/context.md
|
30
|
+
- lib/mcp/on/rails/templates/mcp-config.yml.erb
|
31
|
+
- lib/mcp/on/rails/templates/prompts/api.md
|
32
|
+
- lib/mcp/on/rails/templates/prompts/architect.md
|
33
|
+
- lib/mcp/on/rails/templates/prompts/controllers.md
|
34
|
+
- lib/mcp/on/rails/templates/prompts/devops.md
|
35
|
+
- lib/mcp/on/rails/templates/prompts/graphql.md
|
36
|
+
- lib/mcp/on/rails/templates/prompts/jobs.md
|
37
|
+
- lib/mcp/on/rails/templates/prompts/models.md
|
38
|
+
- lib/mcp/on/rails/templates/prompts/services.md
|
39
|
+
- lib/mcp/on/rails/templates/prompts/stimulus.md
|
40
|
+
- lib/mcp/on/rails/templates/prompts/tests.md
|
41
|
+
- lib/mcp/on/rails/templates/prompts/views.md
|
42
|
+
- lib/mcp/on/rails/version.rb
|
43
|
+
- sig/mcp/on/rails.rbs
|
44
|
+
homepage: https://github.com/GoCoder7/mcp-on-rails
|
45
|
+
licenses: []
|
46
|
+
metadata:
|
47
|
+
allowed_push_host: https://rubygems.org
|
48
|
+
homepage_uri: https://github.com/GoCoder7/mcp-on-rails
|
49
|
+
source_code_uri: https://github.com/GoCoder7/mcp-on-rails
|
50
|
+
changelog_uri: https://github.com/GoCoder7/mcp-on-rails/blob/main/CHANGELOG.md
|
51
|
+
rdoc_options: []
|
52
|
+
require_paths:
|
53
|
+
- lib
|
54
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
55
|
+
requirements:
|
56
|
+
- - ">="
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
version: 3.1.0
|
59
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '0'
|
64
|
+
requirements: []
|
65
|
+
rubygems_version: 3.6.9
|
66
|
+
specification_version: 4
|
67
|
+
summary: MCP (Model Context Protocol) configuration and prompts for Rails projects
|
68
|
+
test_files: []
|