claude-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/.rspec +3 -0
- data/CHANGELOG.md +26 -0
- data/CONTRIBUTING.md +152 -0
- data/Gemfile +7 -0
- data/LICENSE +21 -0
- data/README.md +180 -0
- data/Rakefile +9 -0
- data/claude-on-rails.gemspec +45 -0
- data/examples/README.md +165 -0
- data/lib/claude_on_rails/configuration.rb +21 -0
- data/lib/claude_on_rails/project_analyzer.rb +159 -0
- data/lib/claude_on_rails/swarm_builder.rb +192 -0
- data/lib/claude_on_rails/version.rb +3 -0
- data/lib/claude_on_rails.rb +25 -0
- data/lib/generators/claude_on_rails/swarm/swarm_generator.rb +91 -0
- data/lib/generators/claude_on_rails/swarm/templates/CLAUDE.md.erb +101 -0
- data/lib/generators/claude_on_rails/swarm/templates/prompts/architect.md +48 -0
- data/lib/generators/claude_on_rails/swarm/templates/prompts/controllers.md +87 -0
- data/lib/generators/claude_on_rails/swarm/templates/prompts/models.md +80 -0
- data/lib/generators/claude_on_rails/swarm/templates/prompts/services.md +170 -0
- data/lib/generators/claude_on_rails/swarm/templates/prompts/tests.md +150 -0
- data/lib/generators/claude_on_rails/swarm/templates/swarm.yml.erb +94 -0
- metadata +196 -0
@@ -0,0 +1,159 @@
|
|
1
|
+
module ClaudeOnRails
|
2
|
+
class ProjectAnalyzer
|
3
|
+
attr_reader :root_path
|
4
|
+
|
5
|
+
def initialize(root_path)
|
6
|
+
@root_path = root_path
|
7
|
+
end
|
8
|
+
|
9
|
+
def analyze
|
10
|
+
{
|
11
|
+
api_only: api_only?,
|
12
|
+
test_framework: detect_test_framework,
|
13
|
+
has_graphql: has_graphql?,
|
14
|
+
has_turbo: has_turbo?,
|
15
|
+
has_devise: has_devise?,
|
16
|
+
has_sidekiq: has_sidekiq?,
|
17
|
+
javascript_framework: detect_javascript_framework,
|
18
|
+
database: detect_database,
|
19
|
+
deployment: detect_deployment_method,
|
20
|
+
custom_patterns: detect_custom_patterns
|
21
|
+
}
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def api_only?
|
27
|
+
application_rb = File.join(root_path, 'config', 'application.rb')
|
28
|
+
return false unless File.exist?(application_rb)
|
29
|
+
|
30
|
+
File.read(application_rb).include?('config.api_only = true')
|
31
|
+
end
|
32
|
+
|
33
|
+
def detect_test_framework
|
34
|
+
if File.exist?(File.join(root_path, 'spec'))
|
35
|
+
'RSpec'
|
36
|
+
elsif File.exist?(File.join(root_path, 'test'))
|
37
|
+
'Minitest'
|
38
|
+
else
|
39
|
+
nil
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def has_graphql?
|
44
|
+
gemfile_path = File.join(root_path, 'Gemfile')
|
45
|
+
return false unless File.exist?(gemfile_path)
|
46
|
+
|
47
|
+
gemfile_content = File.read(gemfile_path)
|
48
|
+
gemfile_content.include?('graphql') ||
|
49
|
+
File.exist?(File.join(root_path, 'app', 'graphql'))
|
50
|
+
end
|
51
|
+
|
52
|
+
def has_turbo?
|
53
|
+
gemfile_path = File.join(root_path, 'Gemfile')
|
54
|
+
return false unless File.exist?(gemfile_path)
|
55
|
+
|
56
|
+
gemfile_content = File.read(gemfile_path)
|
57
|
+
gemfile_content.include?('turbo-rails') ||
|
58
|
+
gemfile_content.include?('stimulus-rails') ||
|
59
|
+
File.exist?(File.join(root_path, 'app', 'javascript', 'controllers'))
|
60
|
+
end
|
61
|
+
|
62
|
+
def has_devise?
|
63
|
+
gemfile_path = File.join(root_path, 'Gemfile')
|
64
|
+
return false unless File.exist?(gemfile_path)
|
65
|
+
|
66
|
+
File.read(gemfile_path).include?('devise')
|
67
|
+
end
|
68
|
+
|
69
|
+
def has_sidekiq?
|
70
|
+
gemfile_path = File.join(root_path, 'Gemfile')
|
71
|
+
return false unless File.exist?(gemfile_path)
|
72
|
+
|
73
|
+
File.read(gemfile_path).include?('sidekiq')
|
74
|
+
end
|
75
|
+
|
76
|
+
def detect_javascript_framework
|
77
|
+
package_json = File.join(root_path, 'package.json')
|
78
|
+
return 'importmap' unless File.exist?(package_json)
|
79
|
+
|
80
|
+
content = File.read(package_json)
|
81
|
+
case
|
82
|
+
when content.include?('webpack')
|
83
|
+
'webpack'
|
84
|
+
when content.include?('esbuild')
|
85
|
+
'esbuild'
|
86
|
+
when content.include?('vite')
|
87
|
+
'vite'
|
88
|
+
else
|
89
|
+
'importmap'
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
def detect_database
|
94
|
+
database_yml = File.join(root_path, 'config', 'database.yml')
|
95
|
+
return 'sqlite3' unless File.exist?(database_yml)
|
96
|
+
|
97
|
+
content = File.read(database_yml)
|
98
|
+
case
|
99
|
+
when content.include?('postgresql')
|
100
|
+
'postgresql'
|
101
|
+
when content.include?('mysql2')
|
102
|
+
'mysql'
|
103
|
+
when content.include?('sqlite3')
|
104
|
+
'sqlite3'
|
105
|
+
else
|
106
|
+
'unknown'
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
def detect_deployment_method
|
111
|
+
# Check for various deployment configurations
|
112
|
+
return 'kubernetes' if File.exist?(File.join(root_path, 'k8s')) ||
|
113
|
+
File.exist?(File.join(root_path, 'kubernetes'))
|
114
|
+
return 'docker' if File.exist?(File.join(root_path, 'Dockerfile'))
|
115
|
+
return 'capistrano' if File.exist?(File.join(root_path, 'Capfile'))
|
116
|
+
return 'heroku' if File.exist?(File.join(root_path, 'Procfile'))
|
117
|
+
return 'kamal' if File.exist?(File.join(root_path, 'config', 'deploy.yml'))
|
118
|
+
|
119
|
+
'unknown'
|
120
|
+
end
|
121
|
+
|
122
|
+
def detect_custom_patterns
|
123
|
+
patterns = {}
|
124
|
+
|
125
|
+
# Check for service objects
|
126
|
+
if File.directory?(File.join(root_path, 'app', 'services'))
|
127
|
+
patterns[:has_services] = true
|
128
|
+
end
|
129
|
+
|
130
|
+
# Check for form objects
|
131
|
+
if File.directory?(File.join(root_path, 'app', 'forms'))
|
132
|
+
patterns[:has_forms] = true
|
133
|
+
end
|
134
|
+
|
135
|
+
# Check for presenters/decorators
|
136
|
+
if File.directory?(File.join(root_path, 'app', 'presenters')) ||
|
137
|
+
File.directory?(File.join(root_path, 'app', 'decorators'))
|
138
|
+
patterns[:has_presenters] = true
|
139
|
+
end
|
140
|
+
|
141
|
+
# Check for query objects
|
142
|
+
if File.directory?(File.join(root_path, 'app', 'queries'))
|
143
|
+
patterns[:has_queries] = true
|
144
|
+
end
|
145
|
+
|
146
|
+
# Check for policies (authorization)
|
147
|
+
if File.directory?(File.join(root_path, 'app', 'policies'))
|
148
|
+
patterns[:has_policies] = true
|
149
|
+
end
|
150
|
+
|
151
|
+
# Check for serializers
|
152
|
+
if File.directory?(File.join(root_path, 'app', 'serializers'))
|
153
|
+
patterns[:has_serializers] = true
|
154
|
+
end
|
155
|
+
|
156
|
+
patterns
|
157
|
+
end
|
158
|
+
end
|
159
|
+
end
|
@@ -0,0 +1,192 @@
|
|
1
|
+
module ClaudeOnRails
|
2
|
+
class SwarmBuilder
|
3
|
+
attr_reader :project_analysis
|
4
|
+
|
5
|
+
def initialize(project_analysis)
|
6
|
+
@project_analysis = project_analysis
|
7
|
+
end
|
8
|
+
|
9
|
+
def build
|
10
|
+
{
|
11
|
+
version: 1,
|
12
|
+
swarm: {
|
13
|
+
name: "Rails Development Team",
|
14
|
+
main: "architect",
|
15
|
+
instances: build_instances
|
16
|
+
}
|
17
|
+
}
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def build_instances
|
23
|
+
instances = {}
|
24
|
+
|
25
|
+
# Always include architect
|
26
|
+
instances[:architect] = build_architect
|
27
|
+
|
28
|
+
# Core agents
|
29
|
+
instances[:models] = build_models_agent
|
30
|
+
instances[:controllers] = build_controllers_agent
|
31
|
+
|
32
|
+
# Conditional agents
|
33
|
+
unless project_analysis[:api_only]
|
34
|
+
instances[:views] = build_views_agent
|
35
|
+
end
|
36
|
+
|
37
|
+
if project_analysis[:api_only]
|
38
|
+
instances[:api] = build_api_agent
|
39
|
+
end
|
40
|
+
|
41
|
+
if project_analysis[:has_graphql]
|
42
|
+
instances[:graphql] = build_graphql_agent
|
43
|
+
end
|
44
|
+
|
45
|
+
if project_analysis[:has_turbo] && !project_analysis[:api_only]
|
46
|
+
instances[:stimulus] = build_stimulus_agent
|
47
|
+
end
|
48
|
+
|
49
|
+
# Supporting agents
|
50
|
+
instances[:services] = build_services_agent
|
51
|
+
instances[:jobs] = build_jobs_agent
|
52
|
+
|
53
|
+
if project_analysis[:test_framework]
|
54
|
+
instances[:tests] = build_tests_agent
|
55
|
+
end
|
56
|
+
|
57
|
+
instances[:devops] = build_devops_agent
|
58
|
+
|
59
|
+
instances
|
60
|
+
end
|
61
|
+
|
62
|
+
def build_architect
|
63
|
+
connections = ["models", "controllers"]
|
64
|
+
connections << "views" unless project_analysis[:api_only]
|
65
|
+
connections << "api" if project_analysis[:api_only]
|
66
|
+
connections << "graphql" if project_analysis[:has_graphql]
|
67
|
+
connections << "services"
|
68
|
+
connections << "jobs"
|
69
|
+
connections << "tests" if project_analysis[:test_framework]
|
70
|
+
connections << "devops"
|
71
|
+
|
72
|
+
{
|
73
|
+
description: "Rails architect coordinating #{project_analysis[:api_only] ? 'API' : 'full-stack'} development",
|
74
|
+
directory: ".",
|
75
|
+
model: ClaudeOnRails.configuration.default_model,
|
76
|
+
connections: connections,
|
77
|
+
prompt_file: ".claude-on-rails/prompts/architect.md",
|
78
|
+
vibe: ClaudeOnRails.configuration.vibe_mode
|
79
|
+
}
|
80
|
+
end
|
81
|
+
|
82
|
+
def build_models_agent
|
83
|
+
{
|
84
|
+
description: "ActiveRecord models, migrations, and database optimization specialist",
|
85
|
+
directory: "./app/models",
|
86
|
+
model: ClaudeOnRails.configuration.default_model,
|
87
|
+
allowed_tools: %w[Read Edit Write Bash Grep Glob LS],
|
88
|
+
prompt_file: ".claude-on-rails/prompts/models.md"
|
89
|
+
}
|
90
|
+
end
|
91
|
+
|
92
|
+
def build_controllers_agent
|
93
|
+
connections = ["services"]
|
94
|
+
connections << "api" if project_analysis[:api_only]
|
95
|
+
|
96
|
+
{
|
97
|
+
description: "Rails controllers, routing, and request handling specialist",
|
98
|
+
directory: "./app/controllers",
|
99
|
+
model: ClaudeOnRails.configuration.default_model,
|
100
|
+
connections: connections.empty? ? nil : connections,
|
101
|
+
allowed_tools: %w[Read Edit Write Bash Grep Glob LS],
|
102
|
+
prompt_file: ".claude-on-rails/prompts/controllers.md"
|
103
|
+
}.compact
|
104
|
+
end
|
105
|
+
|
106
|
+
def build_views_agent
|
107
|
+
connections = []
|
108
|
+
connections << "stimulus" if project_analysis[:has_turbo]
|
109
|
+
|
110
|
+
{
|
111
|
+
description: "Rails views, layouts, partials, and asset pipeline specialist",
|
112
|
+
directory: "./app/views",
|
113
|
+
model: ClaudeOnRails.configuration.default_model,
|
114
|
+
connections: connections.empty? ? nil : connections,
|
115
|
+
allowed_tools: %w[Read Edit Write Bash Grep Glob LS],
|
116
|
+
prompt_file: ".claude-on-rails/prompts/views.md"
|
117
|
+
}.compact
|
118
|
+
end
|
119
|
+
|
120
|
+
def build_api_agent
|
121
|
+
{
|
122
|
+
description: "RESTful API design, serialization, and versioning specialist",
|
123
|
+
directory: "./app/controllers/api",
|
124
|
+
model: ClaudeOnRails.configuration.default_model,
|
125
|
+
allowed_tools: %w[Read Edit Write Bash Grep Glob LS],
|
126
|
+
prompt_file: ".claude-on-rails/prompts/api.md"
|
127
|
+
}
|
128
|
+
end
|
129
|
+
|
130
|
+
def build_graphql_agent
|
131
|
+
{
|
132
|
+
description: "GraphQL schema, resolvers, and mutations specialist",
|
133
|
+
directory: "./app/graphql",
|
134
|
+
model: ClaudeOnRails.configuration.default_model,
|
135
|
+
allowed_tools: %w[Read Edit Write Bash Grep Glob LS],
|
136
|
+
prompt_file: ".claude-on-rails/prompts/graphql.md"
|
137
|
+
}
|
138
|
+
end
|
139
|
+
|
140
|
+
def build_stimulus_agent
|
141
|
+
{
|
142
|
+
description: "Stimulus.js controllers and Turbo integration specialist",
|
143
|
+
directory: "./app/javascript",
|
144
|
+
model: ClaudeOnRails.configuration.default_model,
|
145
|
+
allowed_tools: %w[Read Edit Write Bash Grep Glob LS],
|
146
|
+
prompt_file: ".claude-on-rails/prompts/stimulus.md"
|
147
|
+
}
|
148
|
+
end
|
149
|
+
|
150
|
+
def build_services_agent
|
151
|
+
{
|
152
|
+
description: "Service objects, business logic, and design patterns specialist",
|
153
|
+
directory: "./app/services",
|
154
|
+
model: ClaudeOnRails.configuration.default_model,
|
155
|
+
allowed_tools: %w[Read Edit Write Bash Grep Glob LS],
|
156
|
+
prompt_file: ".claude-on-rails/prompts/services.md"
|
157
|
+
}
|
158
|
+
end
|
159
|
+
|
160
|
+
def build_jobs_agent
|
161
|
+
{
|
162
|
+
description: "Background jobs, ActiveJob, and async processing specialist",
|
163
|
+
directory: "./app/jobs",
|
164
|
+
model: ClaudeOnRails.configuration.default_model,
|
165
|
+
allowed_tools: %w[Read Edit Write Bash Grep Glob LS],
|
166
|
+
prompt_file: ".claude-on-rails/prompts/jobs.md"
|
167
|
+
}
|
168
|
+
end
|
169
|
+
|
170
|
+
def build_tests_agent
|
171
|
+
test_dir = project_analysis[:test_framework] == 'RSpec' ? './spec' : './test'
|
172
|
+
|
173
|
+
{
|
174
|
+
description: "#{project_analysis[:test_framework]} testing, factories, and test coverage specialist",
|
175
|
+
directory: test_dir,
|
176
|
+
model: ClaudeOnRails.configuration.default_model,
|
177
|
+
allowed_tools: %w[Read Edit Write Bash Grep Glob LS],
|
178
|
+
prompt_file: ".claude-on-rails/prompts/tests.md"
|
179
|
+
}
|
180
|
+
end
|
181
|
+
|
182
|
+
def build_devops_agent
|
183
|
+
{
|
184
|
+
description: "Deployment, Docker, CI/CD, and production configuration specialist",
|
185
|
+
directory: "./config",
|
186
|
+
model: ClaudeOnRails.configuration.default_model,
|
187
|
+
allowed_tools: %w[Read Edit Write Bash Grep Glob LS],
|
188
|
+
prompt_file: ".claude-on-rails/prompts/devops.md"
|
189
|
+
}
|
190
|
+
end
|
191
|
+
end
|
192
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require "claude_on_rails/version"
|
2
|
+
require "claude_on_rails/configuration"
|
3
|
+
require "claude_on_rails/project_analyzer"
|
4
|
+
require "claude_on_rails/swarm_builder"
|
5
|
+
|
6
|
+
module ClaudeOnRails
|
7
|
+
class Error < StandardError; end
|
8
|
+
|
9
|
+
class << self
|
10
|
+
attr_accessor :configuration
|
11
|
+
|
12
|
+
def configure
|
13
|
+
self.configuration ||= Configuration.new
|
14
|
+
yield(configuration) if block_given?
|
15
|
+
end
|
16
|
+
|
17
|
+
def analyze_project(root_path = Rails.root)
|
18
|
+
ProjectAnalyzer.new(root_path).analyze
|
19
|
+
end
|
20
|
+
|
21
|
+
def build_swarm(project_analysis)
|
22
|
+
SwarmBuilder.new(project_analysis).build
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,91 @@
|
|
1
|
+
require "rails/generators/base"
|
2
|
+
|
3
|
+
module ClaudeOnRails
|
4
|
+
module Generators
|
5
|
+
class SwarmGenerator < Rails::Generators::Base
|
6
|
+
source_root File.expand_path("templates", __dir__)
|
7
|
+
|
8
|
+
class_option :api_only, type: :boolean, default: false,
|
9
|
+
desc: "Generate swarm for API-only Rails application"
|
10
|
+
|
11
|
+
class_option :skip_tests, type: :boolean, default: false,
|
12
|
+
desc: "Skip test agent in swarm configuration"
|
13
|
+
|
14
|
+
class_option :graphql, type: :boolean, default: false,
|
15
|
+
desc: "Include GraphQL specialist agent"
|
16
|
+
|
17
|
+
class_option :turbo, type: :boolean, default: true,
|
18
|
+
desc: "Include Turbo/Stimulus specialist agents"
|
19
|
+
|
20
|
+
def analyze_project
|
21
|
+
say "Analyzing Rails project structure...", :green
|
22
|
+
@project_analysis = ClaudeOnRails.analyze_project(Rails.root)
|
23
|
+
|
24
|
+
# Auto-detect features
|
25
|
+
@api_only = options[:api_only] || @project_analysis[:api_only]
|
26
|
+
@has_graphql = options[:graphql] || @project_analysis[:has_graphql]
|
27
|
+
@has_turbo = options[:turbo] && !@api_only
|
28
|
+
@skip_tests = options[:skip_tests]
|
29
|
+
@test_framework = @project_analysis[:test_framework]
|
30
|
+
|
31
|
+
say "Project type: #{@api_only ? 'API-only' : 'Full-stack Rails'}", :cyan
|
32
|
+
say "Test framework: #{@test_framework}", :cyan if @test_framework
|
33
|
+
say "GraphQL detected: #{@has_graphql ? 'Yes' : 'No'}", :cyan
|
34
|
+
end
|
35
|
+
|
36
|
+
def create_swarm_config
|
37
|
+
say "Generating swarm configuration...", :green
|
38
|
+
template "swarm.yml.erb", "swarm.yml"
|
39
|
+
end
|
40
|
+
|
41
|
+
def create_claude_md
|
42
|
+
say "Creating CLAUDE.md configuration...", :green
|
43
|
+
template "CLAUDE.md.erb", "CLAUDE.md"
|
44
|
+
end
|
45
|
+
|
46
|
+
def create_agent_prompts
|
47
|
+
say "Setting up agent-specific prompts...", :green
|
48
|
+
directory "prompts", ".claude-on-rails/prompts"
|
49
|
+
end
|
50
|
+
|
51
|
+
def update_gitignore
|
52
|
+
say "Updating .gitignore...", :green
|
53
|
+
append_to_file ".gitignore", "\n# ClaudeOnRails\n.claude-on-rails/sessions/\nswarm.log\n"
|
54
|
+
end
|
55
|
+
|
56
|
+
def display_next_steps
|
57
|
+
say "\n✅ ClaudeOnRails swarm configuration created!", :green
|
58
|
+
say "\nNext steps:", :yellow
|
59
|
+
say "1. Review and customize swarm.yml for your project"
|
60
|
+
say "2. Install claude-swarm if not already installed:"
|
61
|
+
say " gem install claude-swarm", :cyan
|
62
|
+
say "3. Start your Rails development swarm:"
|
63
|
+
say " claude-swarm orchestrate", :cyan
|
64
|
+
say "\nExample usage:"
|
65
|
+
say ' claude "Add user authentication with social login"', :cyan
|
66
|
+
say "\nThe swarm will automatically coordinate the implementation across all layers!"
|
67
|
+
end
|
68
|
+
|
69
|
+
private
|
70
|
+
|
71
|
+
def agents
|
72
|
+
@agents ||= build_agent_list
|
73
|
+
end
|
74
|
+
|
75
|
+
def build_agent_list
|
76
|
+
list = ["architect"]
|
77
|
+
list << "models"
|
78
|
+
list << "controllers"
|
79
|
+
list << "views" unless @api_only
|
80
|
+
list << "api" if @api_only
|
81
|
+
list << "graphql" if @has_graphql
|
82
|
+
list << "stimulus" if @has_turbo
|
83
|
+
list << "services"
|
84
|
+
list << "jobs"
|
85
|
+
list << "tests" unless @skip_tests
|
86
|
+
list << "devops"
|
87
|
+
list
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
@@ -0,0 +1,101 @@
|
|
1
|
+
# <%= Rails.application.class.module_parent_name %> Rails Development with ClaudeOnRails
|
2
|
+
|
3
|
+
This project uses ClaudeOnRails to create an intelligent swarm of AI agents specialized in different aspects of Rails development.
|
4
|
+
|
5
|
+
## Project Overview
|
6
|
+
|
7
|
+
- **Application**: <%= Rails.application.class.module_parent_name %>
|
8
|
+
- **Rails Version**: <%= Rails.version %>
|
9
|
+
- **Ruby Version**: <%= RUBY_VERSION %>
|
10
|
+
- **Type**: <%= @api_only ? 'API-only' : 'Full-stack Rails application' %>
|
11
|
+
- **Test Framework**: <%= @test_framework || 'Not detected' %>
|
12
|
+
<% if @has_graphql -%>
|
13
|
+
- **GraphQL**: Enabled
|
14
|
+
<% end -%>
|
15
|
+
|
16
|
+
## How to Use
|
17
|
+
|
18
|
+
Simply describe what you want to build or fix, and the swarm will automatically coordinate the implementation:
|
19
|
+
|
20
|
+
```bash
|
21
|
+
# Start the swarm
|
22
|
+
claude-swarm orchestrate
|
23
|
+
|
24
|
+
# Then just describe your task
|
25
|
+
claude "Add user authentication with email confirmation"
|
26
|
+
claude "Optimize the dashboard queries that are running slowly"
|
27
|
+
claude "Create an API endpoint for mobile app integration"
|
28
|
+
```
|
29
|
+
|
30
|
+
## Swarm Architecture
|
31
|
+
|
32
|
+
The following specialized agents work together to implement your requests:
|
33
|
+
|
34
|
+
- **Architect**: Coordinates all development and makes high-level decisions
|
35
|
+
- **Models**: Handles ActiveRecord models, migrations, and database design
|
36
|
+
- **Controllers**: Manages request handling, routing, and controller logic
|
37
|
+
<% unless @api_only -%>
|
38
|
+
- **Views**: Creates and maintains views, layouts, and partials
|
39
|
+
<% end -%>
|
40
|
+
<% if @api_only -%>
|
41
|
+
- **API**: Designs RESTful endpoints and handles serialization
|
42
|
+
<% end -%>
|
43
|
+
<% if @has_graphql -%>
|
44
|
+
- **GraphQL**: Manages GraphQL schemas, types, and resolvers
|
45
|
+
<% end -%>
|
46
|
+
<% if @has_turbo -%>
|
47
|
+
- **Stimulus**: Implements interactive features with Stimulus controllers
|
48
|
+
<% end -%>
|
49
|
+
- **Services**: Extracts business logic into service objects
|
50
|
+
- **Jobs**: Handles background processing and async tasks
|
51
|
+
<% unless @skip_tests -%>
|
52
|
+
- **Tests**: Ensures comprehensive test coverage with <%= @test_framework %>
|
53
|
+
<% end -%>
|
54
|
+
- **DevOps**: Manages deployment and production configurations
|
55
|
+
|
56
|
+
## Project Conventions
|
57
|
+
|
58
|
+
### Code Style
|
59
|
+
- Follow Rails conventions and best practices
|
60
|
+
- Use RuboCop for Ruby style enforcement
|
61
|
+
- Prefer clarity over cleverness
|
62
|
+
- Write self-documenting code
|
63
|
+
|
64
|
+
### Testing
|
65
|
+
<% if @test_framework == 'RSpec' -%>
|
66
|
+
- RSpec for all tests
|
67
|
+
- Factory Bot for test data
|
68
|
+
- Request specs for API endpoints
|
69
|
+
- System specs for user interactions
|
70
|
+
<% else -%>
|
71
|
+
- Minitest for all tests
|
72
|
+
- Fixtures or factories for test data
|
73
|
+
- Integration tests for user flows
|
74
|
+
- Unit tests for models and services
|
75
|
+
<% end -%>
|
76
|
+
|
77
|
+
### Git Workflow
|
78
|
+
- Feature branches for new work
|
79
|
+
- Descriptive commit messages
|
80
|
+
- PR reviews before merging
|
81
|
+
- Keep main branch deployable
|
82
|
+
|
83
|
+
## Custom Patterns
|
84
|
+
|
85
|
+
Add your project-specific patterns and conventions here:
|
86
|
+
|
87
|
+
```yaml
|
88
|
+
# Example: Custom service object pattern
|
89
|
+
Services:
|
90
|
+
Pattern: Command pattern with Result objects
|
91
|
+
Location: app/services/
|
92
|
+
Naming: VerbNoun (e.g., CreateOrder, SendEmail)
|
93
|
+
Testing: Unit tests with mocked dependencies
|
94
|
+
```
|
95
|
+
|
96
|
+
## Notes
|
97
|
+
|
98
|
+
- This configuration was generated by ClaudeOnRails
|
99
|
+
- Customize agent prompts in `.claude-on-rails/prompts/`
|
100
|
+
- Update this file with project-specific conventions
|
101
|
+
- The swarm learns from your codebase patterns
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# Rails Architect Agent
|
2
|
+
|
3
|
+
You are the lead Rails architect coordinating development across a team of specialized agents. Your role is to:
|
4
|
+
|
5
|
+
## Primary Responsibilities
|
6
|
+
|
7
|
+
1. **Understand Requirements**: Analyze user requests and break them down into actionable tasks
|
8
|
+
2. **Coordinate Implementation**: Delegate work to appropriate specialist agents
|
9
|
+
3. **Ensure Best Practices**: Enforce Rails conventions and patterns across the team
|
10
|
+
4. **Maintain Architecture**: Keep the overall system design coherent and scalable
|
11
|
+
|
12
|
+
## Your Team
|
13
|
+
|
14
|
+
You coordinate the following specialists:
|
15
|
+
- **Models**: Database schema, ActiveRecord models, migrations
|
16
|
+
- **Controllers**: Request handling, routing, API endpoints
|
17
|
+
- **Views**: UI templates, layouts, assets (if not API-only)
|
18
|
+
- **Services**: Business logic, service objects, complex operations
|
19
|
+
- **Tests**: Test coverage, specs, test-driven development
|
20
|
+
- **DevOps**: Deployment, configuration, infrastructure
|
21
|
+
|
22
|
+
## Decision Framework
|
23
|
+
|
24
|
+
When receiving a request:
|
25
|
+
1. Analyze what needs to be built or fixed
|
26
|
+
2. Identify which layers of the Rails stack are involved
|
27
|
+
3. Plan the implementation order (typically: models → controllers → views/services → tests)
|
28
|
+
4. Delegate to appropriate specialists with clear instructions
|
29
|
+
5. Synthesize their work into a cohesive solution
|
30
|
+
|
31
|
+
## Rails Best Practices
|
32
|
+
|
33
|
+
Always ensure:
|
34
|
+
- RESTful design principles
|
35
|
+
- DRY (Don't Repeat Yourself)
|
36
|
+
- Convention over configuration
|
37
|
+
- Test-driven development
|
38
|
+
- Security by default
|
39
|
+
- Performance considerations
|
40
|
+
|
41
|
+
## Communication Style
|
42
|
+
|
43
|
+
- Be clear and specific when delegating to specialists
|
44
|
+
- Provide context about the overall feature being built
|
45
|
+
- Ensure specialists understand how their work fits together
|
46
|
+
- Summarize the complete implementation for the user
|
47
|
+
|
48
|
+
Remember: You're the conductor of the Rails development orchestra. Your job is to ensure all parts work in harmony to deliver high-quality Rails applications.
|