claude-on-rails 0.1.1 → 0.1.3

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.
@@ -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.
@@ -6,89 +6,109 @@ swarm:
6
6
  architect:
7
7
  description: "Rails architect coordinating <%= @api_only ? 'API' : 'full-stack' %> development for <%= Rails.application.class.module_parent_name %>"
8
8
  directory: .
9
- model: claude-3-5-haiku-20250110
9
+ model: opus
10
10
  connections: [<%= agents.reject { |a| a == 'architect' }.join(', ') %>]
11
11
  prompt_file: .claude-on-rails/prompts/architect.md
12
12
  vibe: true
13
+ <% if File.directory?(Rails.root.join("app/models")) %>
13
14
 
14
15
  models:
15
16
  description: "ActiveRecord models, migrations, and database optimization specialist"
16
17
  directory: ./app/models
17
- model: claude-3-5-haiku-20250110
18
+ model: opus
18
19
  allowed_tools: [Read, Edit, Write, Bash, Grep, Glob, LS]
19
20
  prompt_file: .claude-on-rails/prompts/models.md
21
+ <% end %>
22
+ <% if File.directory?(Rails.root.join("app/controllers")) %>
20
23
 
21
24
  controllers:
22
25
  description: "Rails controllers, routing, and request handling specialist"
23
26
  directory: ./app/controllers
24
- model: claude-3-5-haiku-20250110
25
- connections: [services<%= ', api' if @api_only %>]
27
+ model: opus
28
+ <% connections = [] %>
29
+ <% connections << 'services' if File.directory?(Rails.root.join("app/services")) %>
30
+ <% connections << 'api' if @api_only && File.directory?(Rails.root.join("app/controllers/api")) %>
31
+ <% if connections.any? %>
32
+ connections: [<%= connections.join(', ') %>]
33
+ <% end %>
26
34
  allowed_tools: [Read, Edit, Write, Bash, Grep, Glob, LS]
27
35
  prompt_file: .claude-on-rails/prompts/controllers.md
28
- <% unless @api_only %>
36
+ <% end %>
37
+ <% if !@api_only && File.directory?(Rails.root.join("app/views")) %>
29
38
 
30
39
  views:
31
40
  description: "Rails views, layouts, partials, and asset pipeline specialist"
32
41
  directory: ./app/views
33
- model: claude-3-5-haiku-20250110
34
- connections: [<%= 'stimulus' if @has_turbo %>]
42
+ model: opus
43
+ <% if @has_turbo && File.directory?(Rails.root.join("app/javascript")) %>
44
+ connections: [stimulus]
45
+ <% end %>
35
46
  allowed_tools: [Read, Edit, Write, Bash, Grep, Glob, LS]
36
47
  prompt_file: .claude-on-rails/prompts/views.md
37
48
  <% end %>
38
- <% if @api_only %>
49
+ <% if @api_only && File.directory?(Rails.root.join("app/controllers/api")) %>
39
50
 
40
51
  api:
41
52
  description: "RESTful API design, serialization, and versioning specialist"
42
53
  directory: ./app/controllers/api
43
- model: claude-3-5-haiku-20250110
54
+ model: opus
44
55
  allowed_tools: [Read, Edit, Write, Bash, Grep, Glob, LS]
45
56
  prompt_file: .claude-on-rails/prompts/api.md
46
57
  <% end %>
47
- <% if @has_graphql %>
58
+ <% if @has_graphql && File.directory?(Rails.root.join("app/graphql")) %>
48
59
 
49
60
  graphql:
50
61
  description: "GraphQL schema, resolvers, and mutations specialist"
51
62
  directory: ./app/graphql
52
- model: claude-3-5-haiku-20250110
63
+ model: opus
53
64
  allowed_tools: [Read, Edit, Write, Bash, Grep, Glob, LS]
54
65
  prompt_file: .claude-on-rails/prompts/graphql.md
55
66
  <% end %>
56
- <% if @has_turbo %>
67
+ <% if @has_turbo && File.directory?(Rails.root.join("app/javascript")) %>
57
68
 
58
69
  stimulus:
59
70
  description: "Stimulus.js controllers and Turbo integration specialist"
60
71
  directory: ./app/javascript
61
- model: claude-3-5-haiku-20250110
72
+ model: opus
62
73
  allowed_tools: [Read, Edit, Write, Bash, Grep, Glob, LS]
63
74
  prompt_file: .claude-on-rails/prompts/stimulus.md
64
75
  <% end %>
76
+ <% if File.directory?(Rails.root.join("app/services")) %>
65
77
 
66
78
  services:
67
79
  description: "Service objects, business logic, and design patterns specialist"
68
80
  directory: ./app/services
69
- model: claude-3-5-haiku-20250110
81
+ model: opus
70
82
  allowed_tools: [Read, Edit, Write, Bash, Grep, Glob, LS]
71
83
  prompt_file: .claude-on-rails/prompts/services.md
84
+ <% end %>
85
+ <% if File.directory?(Rails.root.join("app/jobs")) %>
72
86
 
73
87
  jobs:
74
88
  description: "Background jobs, ActiveJob, and async processing specialist"
75
89
  directory: ./app/jobs
76
- model: claude-3-5-haiku-20250110
90
+ model: opus
77
91
  allowed_tools: [Read, Edit, Write, Bash, Grep, Glob, LS]
78
92
  prompt_file: .claude-on-rails/prompts/jobs.md
79
- <% unless @skip_tests %>
93
+ <% end %>
94
+ <% if !@skip_tests %>
95
+ <% test_dir = @test_framework == 'RSpec' ? 'spec' : 'test' %>
96
+ <% if File.directory?(Rails.root.join(test_dir)) %>
80
97
 
81
98
  tests:
82
99
  description: "<%= @test_framework %> testing, factories, and test coverage specialist"
83
- directory: ./<%= @test_framework == 'RSpec' ? 'spec' : 'test' %>
84
- model: claude-3-5-haiku-20250110
100
+ directory: ./<%= test_dir %>
101
+ model: opus
85
102
  allowed_tools: [Read, Edit, Write, Bash, Grep, Glob, LS]
86
103
  prompt_file: .claude-on-rails/prompts/tests.md
87
104
  <% end %>
105
+ <% end %>
106
+ <% if File.directory?(Rails.root.join("config")) %>
88
107
 
89
108
  devops:
90
109
  description: "Deployment, Docker, CI/CD, and production configuration specialist"
91
110
  directory: ./config
92
- model: claude-3-5-haiku-20250110
111
+ model: opus
93
112
  allowed_tools: [Read, Edit, Write, Bash, Grep, Glob, LS]
94
- prompt_file: .claude-on-rails/prompts/devops.md
113
+ prompt_file: .claude-on-rails/prompts/devops.md
114
+ <% end %>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: claude-on-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Obie Fernandez
@@ -161,11 +161,17 @@ files:
161
161
  - lib/claude_on_rails/version.rb
162
162
  - lib/generators/claude_on_rails/swarm/swarm_generator.rb
163
163
  - lib/generators/claude_on_rails/swarm/templates/CLAUDE.md.erb
164
+ - lib/generators/claude_on_rails/swarm/templates/prompts/api.md
164
165
  - lib/generators/claude_on_rails/swarm/templates/prompts/architect.md
165
166
  - lib/generators/claude_on_rails/swarm/templates/prompts/controllers.md
167
+ - lib/generators/claude_on_rails/swarm/templates/prompts/devops.md
168
+ - lib/generators/claude_on_rails/swarm/templates/prompts/graphql.md
169
+ - lib/generators/claude_on_rails/swarm/templates/prompts/jobs.md
166
170
  - lib/generators/claude_on_rails/swarm/templates/prompts/models.md
167
171
  - lib/generators/claude_on_rails/swarm/templates/prompts/services.md
172
+ - lib/generators/claude_on_rails/swarm/templates/prompts/stimulus.md
168
173
  - lib/generators/claude_on_rails/swarm/templates/prompts/tests.md
174
+ - lib/generators/claude_on_rails/swarm/templates/prompts/views.md
169
175
  - lib/generators/claude_on_rails/swarm/templates/swarm.yml.erb
170
176
  homepage: https://github.com/obie/claude-on-rails
171
177
  licenses: