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
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 7d19830990a00a04cfd82d77d58b90a9c14360c12b7b3d621943a5619accbaee
|
4
|
+
data.tar.gz: 00b360935625d1a968f65d37eb14d6d0e6e938de659ff7dccefdee960a15e336
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6624ad97cb7329398feb4f36cf546d53773ec55d12df72476889a2341edb713170d7ea4f85e40900cb03fa4eea520aed950afe81986f6d9924979b12ed38c3ce
|
7
|
+
data.tar.gz: 10bc654a1de63174c784d75200f0df617612b01e83f9ed93a08cb1d0a5447a4b3707034778a0ab8803f2217bd5e33e4a421a45592141e713164372806a4c8bdf
|
data/.rspec
ADDED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
All notable changes to this project will be documented in this file.
|
4
|
+
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
7
|
+
|
8
|
+
## [0.1.0] - 2025-01-26
|
9
|
+
|
10
|
+
### Added
|
11
|
+
- Initial release of ClaudeOnRails
|
12
|
+
- Rails generator for creating swarm configurations
|
13
|
+
- Project structure analyzer to detect Rails patterns
|
14
|
+
- Intelligent agent topology based on project type
|
15
|
+
- Support for API-only and full-stack Rails applications
|
16
|
+
- Agent-specific prompts for different Rails domains
|
17
|
+
- Integration with claude-swarm for orchestration
|
18
|
+
- Automatic detection of testing frameworks (RSpec/Minitest)
|
19
|
+
- GraphQL and Turbo/Stimulus detection
|
20
|
+
- Customizable swarm configurations
|
21
|
+
|
22
|
+
### Architecture
|
23
|
+
- Leverages claude-swarm instead of manual persona management
|
24
|
+
- Agents work in specific directories (MVC separation)
|
25
|
+
- Automatic task delegation based on context
|
26
|
+
- Natural language interface for development tasks
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,152 @@
|
|
1
|
+
# Contributing to ClaudeOnRails
|
2
|
+
|
3
|
+
We love your input! We want to make contributing to ClaudeOnRails as easy and transparent as possible, whether it's:
|
4
|
+
|
5
|
+
- Reporting a bug
|
6
|
+
- Discussing the current state of the code
|
7
|
+
- Submitting a fix
|
8
|
+
- Proposing new features
|
9
|
+
- Becoming a maintainer
|
10
|
+
|
11
|
+
## We Develop with Github
|
12
|
+
|
13
|
+
We use GitHub to host code, to track issues and feature requests, as well as accept pull requests.
|
14
|
+
|
15
|
+
## We Use [Github Flow](https://guides.github.com/introduction/flow/index.html)
|
16
|
+
|
17
|
+
Pull requests are the best way to propose changes to the codebase:
|
18
|
+
|
19
|
+
1. Fork the repo and create your branch from `main`.
|
20
|
+
2. If you've added code that should be tested, add tests.
|
21
|
+
3. If you've changed APIs, update the documentation.
|
22
|
+
4. Ensure the test suite passes.
|
23
|
+
5. Make sure your code lints.
|
24
|
+
6. Issue that pull request!
|
25
|
+
|
26
|
+
## Any contributions you make will be under the MIT Software License
|
27
|
+
|
28
|
+
In short, when you submit code changes, your submissions are understood to be under the same [MIT License](http://choosealicense.com/licenses/mit/) that covers the project.
|
29
|
+
|
30
|
+
## Report bugs using Github's [issues](https://github.com/obie/claude-on-rails/issues)
|
31
|
+
|
32
|
+
We use GitHub issues to track public bugs. Report a bug by [opening a new issue](https://github.com/obie/claude-on-rails/issues/new).
|
33
|
+
|
34
|
+
**Great Bug Reports** tend to have:
|
35
|
+
|
36
|
+
- A quick summary and/or background
|
37
|
+
- Steps to reproduce
|
38
|
+
- Be specific!
|
39
|
+
- Give sample code if you can
|
40
|
+
- What you expected would happen
|
41
|
+
- What actually happens
|
42
|
+
- Notes (possibly including why you think this might be happening, or stuff you tried that didn't work)
|
43
|
+
|
44
|
+
## Development Setup
|
45
|
+
|
46
|
+
1. Clone the repository:
|
47
|
+
```bash
|
48
|
+
git clone https://github.com/obie/claude-on-rails.git
|
49
|
+
cd claude-on-rails
|
50
|
+
```
|
51
|
+
|
52
|
+
2. Install dependencies:
|
53
|
+
```bash
|
54
|
+
bundle install
|
55
|
+
```
|
56
|
+
|
57
|
+
3. Run tests:
|
58
|
+
```bash
|
59
|
+
bundle exec rspec
|
60
|
+
```
|
61
|
+
|
62
|
+
4. Run linting:
|
63
|
+
```bash
|
64
|
+
bundle exec rubocop
|
65
|
+
```
|
66
|
+
|
67
|
+
## Testing Your Changes
|
68
|
+
|
69
|
+
Before submitting a PR, test your changes in a real Rails project:
|
70
|
+
|
71
|
+
1. Create a test Rails app:
|
72
|
+
```bash
|
73
|
+
rails new test_app
|
74
|
+
cd test_app
|
75
|
+
```
|
76
|
+
|
77
|
+
2. Add your local gem:
|
78
|
+
```ruby
|
79
|
+
# Gemfile
|
80
|
+
gem 'claude-on-rails', path: '/path/to/your/claude-on-rails'
|
81
|
+
```
|
82
|
+
|
83
|
+
3. Run the generator:
|
84
|
+
```bash
|
85
|
+
bundle install
|
86
|
+
rails generate claude_on_rails:swarm
|
87
|
+
```
|
88
|
+
|
89
|
+
4. Verify the generated files work correctly
|
90
|
+
|
91
|
+
## Code Style
|
92
|
+
|
93
|
+
We use RuboCop with Rails-specific cops. Please ensure your code passes linting:
|
94
|
+
|
95
|
+
```bash
|
96
|
+
bundle exec rubocop
|
97
|
+
```
|
98
|
+
|
99
|
+
To auto-fix issues:
|
100
|
+
```bash
|
101
|
+
bundle exec rubocop -a
|
102
|
+
```
|
103
|
+
|
104
|
+
## Adding New Agent Types
|
105
|
+
|
106
|
+
If you want to add a new specialized agent:
|
107
|
+
|
108
|
+
1. Add detection logic to `ProjectAnalyzer`
|
109
|
+
2. Update `SwarmBuilder` to include the new agent
|
110
|
+
3. Create a prompt template in `lib/generators/claude_on_rails/swarm/templates/prompts/`
|
111
|
+
4. Update the generator to handle the new agent type
|
112
|
+
5. Add tests for your changes
|
113
|
+
|
114
|
+
Example:
|
115
|
+
```ruby
|
116
|
+
# In project_analyzer.rb
|
117
|
+
def has_action_cable?
|
118
|
+
File.exist?(File.join(root_path, 'app', 'channels'))
|
119
|
+
end
|
120
|
+
|
121
|
+
# In swarm_builder.rb
|
122
|
+
if project_analysis[:has_action_cable]
|
123
|
+
instances[:channels] = build_channels_agent
|
124
|
+
end
|
125
|
+
```
|
126
|
+
|
127
|
+
## Improving Agent Prompts
|
128
|
+
|
129
|
+
Agent prompts are crucial for swarm effectiveness. When improving prompts:
|
130
|
+
|
131
|
+
1. Keep them focused on their specific domain
|
132
|
+
2. Include Rails best practices
|
133
|
+
3. Add examples of good patterns
|
134
|
+
4. Specify what they should NOT do
|
135
|
+
5. Test with real-world scenarios
|
136
|
+
|
137
|
+
## Documentation
|
138
|
+
|
139
|
+
- Update README.md for user-facing changes
|
140
|
+
- Add examples to the examples/ directory
|
141
|
+
- Update CHANGELOG.md following [Keep a Changelog](https://keepachangelog.com/)
|
142
|
+
- Use YARD format for code documentation
|
143
|
+
|
144
|
+
## Pull Request Process
|
145
|
+
|
146
|
+
1. Update the README.md with details of changes to the interface
|
147
|
+
2. Update the CHANGELOG.md with your changes
|
148
|
+
3. The PR will be merged once you have the sign-off of at least one maintainer
|
149
|
+
|
150
|
+
## Questions?
|
151
|
+
|
152
|
+
Feel free to open an issue for any questions about contributing!
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2025 Obie Fernandez
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,180 @@
|
|
1
|
+
# ClaudeOnRails
|
2
|
+
|
3
|
+
A Rails development framework that leverages [claude-swarm](https://github.com/parruda/claude-swarm) to create an intelligent team of AI agents specialized in different aspects of Rails development.
|
4
|
+
|
5
|
+
Instead of managing personas manually, ClaudeOnRails automatically orchestrates a swarm of specialized agents that work together like a real development team. Simply describe what you want to build, and the swarm handles the rest.
|
6
|
+
|
7
|
+
## How It Works
|
8
|
+
|
9
|
+
ClaudeOnRails creates a team of specialized AI agents:
|
10
|
+
|
11
|
+
- **Architect**: Coordinates development and makes high-level decisions
|
12
|
+
- **Models**: Handles ActiveRecord, migrations, and database design
|
13
|
+
- **Controllers**: Manages routing and request handling
|
14
|
+
- **Views**: Creates UI templates and manages assets
|
15
|
+
- **Services**: Implements business logic and service objects
|
16
|
+
- **Tests**: Ensures comprehensive test coverage
|
17
|
+
- **DevOps**: Handles deployment and infrastructure
|
18
|
+
|
19
|
+
Each agent works in their specific domain (directory) and can collaborate with other agents to implement complex features.
|
20
|
+
|
21
|
+
## Installation
|
22
|
+
|
23
|
+
Add to your Rails application's Gemfile:
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
group :development do
|
27
|
+
gem 'claude-on-rails'
|
28
|
+
end
|
29
|
+
```
|
30
|
+
|
31
|
+
Then run:
|
32
|
+
|
33
|
+
```bash
|
34
|
+
bundle install
|
35
|
+
rails generate claude_on_rails:swarm
|
36
|
+
```
|
37
|
+
|
38
|
+
This will:
|
39
|
+
- Analyze your Rails project structure
|
40
|
+
- Generate a customized swarm configuration
|
41
|
+
- Create agent-specific prompts
|
42
|
+
- Set up your development environment
|
43
|
+
|
44
|
+
## Usage
|
45
|
+
|
46
|
+
### Start Your Development Swarm
|
47
|
+
|
48
|
+
```bash
|
49
|
+
# In your Rails project directory
|
50
|
+
claude-swarm orchestrate
|
51
|
+
```
|
52
|
+
|
53
|
+
### Natural Language Development
|
54
|
+
|
55
|
+
Once the swarm is running, just describe what you want to build in the Claude interface:
|
56
|
+
|
57
|
+
```
|
58
|
+
> Add user authentication with email confirmation
|
59
|
+
[The architect coordinates the implementation across all agents]
|
60
|
+
|
61
|
+
> Create a shopping cart with Stripe payment integration
|
62
|
+
[Complex features are automatically broken down and implemented]
|
63
|
+
|
64
|
+
> Optimize the dashboard - it's loading too slowly
|
65
|
+
[Performance improvements across the stack]
|
66
|
+
|
67
|
+
> Build a RESTful API for our mobile app with JWT auth
|
68
|
+
[API development with authentication]
|
69
|
+
```
|
70
|
+
|
71
|
+
The swarm automatically:
|
72
|
+
- Analyzes your request
|
73
|
+
- Delegates to appropriate specialists
|
74
|
+
- Implements across all layers (models, controllers, views, tests)
|
75
|
+
- Follows Rails best practices
|
76
|
+
- Ensures test coverage
|
77
|
+
|
78
|
+
## How It's Different
|
79
|
+
|
80
|
+
### Traditional Rails Development with AI
|
81
|
+
When using AI assistants for Rails development, you typically need to:
|
82
|
+
- Manually coordinate different aspects of implementation
|
83
|
+
- Switch contexts between models, controllers, views, and tests
|
84
|
+
- Ensure consistency across different parts of your application
|
85
|
+
- Remember to implement tests, security, and performance considerations
|
86
|
+
|
87
|
+
### ClaudeOnRails Approach
|
88
|
+
With ClaudeOnRails, you simply describe what you want in natural language:
|
89
|
+
```
|
90
|
+
> Create a user system with social login
|
91
|
+
```
|
92
|
+
|
93
|
+
The swarm automatically:
|
94
|
+
- Creates models with proper validations and associations
|
95
|
+
- Implements controllers with authentication logic
|
96
|
+
- Builds views with forms and UI components
|
97
|
+
- Adds comprehensive test coverage
|
98
|
+
- Handles security considerations
|
99
|
+
- Optimizes database queries
|
100
|
+
|
101
|
+
All coordinated by specialized agents working together.
|
102
|
+
|
103
|
+
## Project Structure
|
104
|
+
|
105
|
+
After running the generator, you'll have:
|
106
|
+
|
107
|
+
```
|
108
|
+
your-rails-app/
|
109
|
+
├── swarm.yml # Swarm configuration
|
110
|
+
├── CLAUDE.md # Project-specific Claude config
|
111
|
+
└── .claude-on-rails/
|
112
|
+
└── prompts/ # Agent-specific prompts
|
113
|
+
├── architect.md
|
114
|
+
├── models.md
|
115
|
+
├── controllers.md
|
116
|
+
└── ...
|
117
|
+
```
|
118
|
+
|
119
|
+
## Customization
|
120
|
+
|
121
|
+
### Swarm Configuration
|
122
|
+
|
123
|
+
The generated `swarm.yml` can be customized:
|
124
|
+
|
125
|
+
```yaml
|
126
|
+
instances:
|
127
|
+
architect:
|
128
|
+
description: "Your project-specific architect description"
|
129
|
+
connections: [models, controllers, custom_agent]
|
130
|
+
|
131
|
+
custom_agent:
|
132
|
+
description: "Specialized agent for your domain"
|
133
|
+
directory: ./app/custom
|
134
|
+
prompt_file: .claude-on-rails/prompts/custom.md
|
135
|
+
```
|
136
|
+
|
137
|
+
### Agent Prompts
|
138
|
+
|
139
|
+
Customize agent behavior by editing prompts in `.claude-on-rails/prompts/`:
|
140
|
+
- Add project-specific conventions
|
141
|
+
- Include domain knowledge
|
142
|
+
- Define coding standards
|
143
|
+
|
144
|
+
## Features
|
145
|
+
|
146
|
+
- **Automatic Agent Selection**: No need to choose which persona to use
|
147
|
+
- **Collaborative Implementation**: Agents work together like a real team
|
148
|
+
- **Rails-Aware**: Deep understanding of Rails conventions and best practices
|
149
|
+
- **Project Adaptation**: Detects your project structure and adapts accordingly
|
150
|
+
- **Test-Driven**: Automatic test generation for all code
|
151
|
+
- **Performance Focus**: Built-in optimization capabilities
|
152
|
+
|
153
|
+
## Requirements
|
154
|
+
|
155
|
+
- Ruby 2.7+
|
156
|
+
- Rails 6.0+
|
157
|
+
- [claude-swarm](https://github.com/parruda/claude-swarm) gem
|
158
|
+
- Claude Code CLI
|
159
|
+
|
160
|
+
## Examples
|
161
|
+
|
162
|
+
See the [examples](./examples) directory for:
|
163
|
+
- E-commerce platform development
|
164
|
+
- API-only applications
|
165
|
+
- Real-time features with Turbo/Stimulus
|
166
|
+
- Performance optimization workflows
|
167
|
+
|
168
|
+
## Contributing
|
169
|
+
|
170
|
+
We welcome contributions! Please see [CONTRIBUTING.md](./CONTRIBUTING.md) for guidelines.
|
171
|
+
|
172
|
+
## License
|
173
|
+
|
174
|
+
MIT License - see [LICENSE](./LICENSE) for details.
|
175
|
+
|
176
|
+
## Acknowledgments
|
177
|
+
|
178
|
+
- Powered by [claude-swarm](https://github.com/parruda/claude-swarm)
|
179
|
+
- Built for [Claude Code](https://github.com/anthropics/claude-code)
|
180
|
+
- Integrates with [Rails MCP Server](https://github.com/mariochavez/rails-mcp-server)
|
data/Rakefile
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
require_relative "lib/claude_on_rails/version"
|
2
|
+
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = "claude-on-rails"
|
5
|
+
spec.version = ClaudeOnRails::VERSION
|
6
|
+
spec.authors = ["Obie Fernandez"]
|
7
|
+
spec.email = ["obiefernandez@gmail.com"]
|
8
|
+
|
9
|
+
spec.summary = "Rails development framework powered by Claude swarm intelligence"
|
10
|
+
spec.description = "ClaudeOnRails leverages claude-swarm to create an intelligent team of AI agents specialized in different aspects of Rails development. Simply describe what you want to build, and the swarm handles the rest."
|
11
|
+
spec.homepage = "https://github.com/obie/claude-on-rails"
|
12
|
+
spec.license = "MIT"
|
13
|
+
spec.required_ruby_version = ">= 2.7.0"
|
14
|
+
|
15
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
16
|
+
spec.metadata["source_code_uri"] = spec.homepage
|
17
|
+
spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/main/CHANGELOG.md"
|
18
|
+
|
19
|
+
# Specify which files should be added to the gem when it is released.
|
20
|
+
spec.files = Dir.chdir(__dir__) do
|
21
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
22
|
+
(File.expand_path(f) == __FILE__) ||
|
23
|
+
f.start_with?(*%w[bin/ test/ spec/ features/ .git .circleci appveyor .github])
|
24
|
+
end
|
25
|
+
end
|
26
|
+
spec.bindir = "exe"
|
27
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
28
|
+
spec.require_paths = ["lib"]
|
29
|
+
|
30
|
+
# Runtime dependencies
|
31
|
+
spec.add_dependency "rails", ">= 6.0"
|
32
|
+
spec.add_dependency "claude-swarm", "~> 0.1"
|
33
|
+
|
34
|
+
# Development dependencies
|
35
|
+
spec.add_development_dependency "bundler", "~> 2.0"
|
36
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
37
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
38
|
+
spec.add_development_dependency "rspec-rails", "~> 5.0"
|
39
|
+
spec.add_development_dependency "rubocop", "~> 1.0"
|
40
|
+
spec.add_development_dependency "rubocop-rails", "~> 2.0"
|
41
|
+
spec.add_development_dependency "rubocop-rspec", "~> 2.0"
|
42
|
+
|
43
|
+
# For more information and examples about making a new gem, check out our
|
44
|
+
# guide at: https://bundler.io/guides/creating_gem.html
|
45
|
+
end
|
data/examples/README.md
ADDED
@@ -0,0 +1,165 @@
|
|
1
|
+
# ClaudeOnRails Examples
|
2
|
+
|
3
|
+
This directory contains examples of using ClaudeOnRails in different scenarios.
|
4
|
+
|
5
|
+
## Basic E-commerce Example
|
6
|
+
|
7
|
+
```bash
|
8
|
+
# In your Rails project
|
9
|
+
bundle add claude-on-rails --group development
|
10
|
+
rails generate claude_on_rails:swarm
|
11
|
+
|
12
|
+
# Start the swarm
|
13
|
+
claude-swarm orchestrate
|
14
|
+
```
|
15
|
+
|
16
|
+
Once the swarm is running, in the Claude interface:
|
17
|
+
```
|
18
|
+
> Create a product catalog with categories and search
|
19
|
+
> Add a shopping cart that persists between sessions
|
20
|
+
> Implement checkout with Stripe payment processing
|
21
|
+
> Add order history and tracking for customers
|
22
|
+
```
|
23
|
+
|
24
|
+
## API Development Example
|
25
|
+
|
26
|
+
```bash
|
27
|
+
# For an API-only Rails app
|
28
|
+
rails new my_api --api
|
29
|
+
cd my_api
|
30
|
+
bundle add claude-on-rails --group development
|
31
|
+
rails generate claude_on_rails:swarm
|
32
|
+
|
33
|
+
claude-swarm orchestrate
|
34
|
+
```
|
35
|
+
|
36
|
+
Then in the Claude interface:
|
37
|
+
```
|
38
|
+
> Create a RESTful API for a task management system
|
39
|
+
> Add JWT authentication with refresh tokens
|
40
|
+
> Implement rate limiting per API key
|
41
|
+
> Add GraphQL endpoint for complex queries
|
42
|
+
```
|
43
|
+
|
44
|
+
## Performance Optimization Example
|
45
|
+
|
46
|
+
In an existing Rails app with performance issues:
|
47
|
+
```bash
|
48
|
+
claude-swarm orchestrate
|
49
|
+
```
|
50
|
+
|
51
|
+
Then describe the performance issues:
|
52
|
+
```
|
53
|
+
> The dashboard is loading slowly with 500ms+ response times
|
54
|
+
|
55
|
+
The swarm will:
|
56
|
+
- Analyze database queries (Models agent)
|
57
|
+
- Optimize controller actions (Controllers agent)
|
58
|
+
- Implement caching strategies (Services agent)
|
59
|
+
- Add performance tests (Tests agent)
|
60
|
+
|
61
|
+
> Users report the search feature times out with large datasets
|
62
|
+
[Automatic optimization across the stack]
|
63
|
+
```
|
64
|
+
|
65
|
+
## Real-time Features Example
|
66
|
+
|
67
|
+
After starting the swarm:
|
68
|
+
```
|
69
|
+
> Add real-time notifications when users receive messages
|
70
|
+
> Create a live-updating dashboard with WebSocket updates
|
71
|
+
> Implement collaborative editing for documents
|
72
|
+
```
|
73
|
+
|
74
|
+
## Test-Driven Development Example
|
75
|
+
|
76
|
+
Building features test-first:
|
77
|
+
```
|
78
|
+
> Create a user registration system with email verification - write tests first
|
79
|
+
|
80
|
+
The swarm will:
|
81
|
+
1. Tests agent writes comprehensive specs
|
82
|
+
2. Models agent creates User model to pass tests
|
83
|
+
3. Controllers agent implements registration flow
|
84
|
+
4. Services agent handles email verification logic
|
85
|
+
5. Tests agent ensures 100% coverage
|
86
|
+
```
|
87
|
+
|
88
|
+
## Custom Agent Example
|
89
|
+
|
90
|
+
If your project has unique requirements, you can add custom agents:
|
91
|
+
|
92
|
+
```yaml
|
93
|
+
# swarm.yml
|
94
|
+
instances:
|
95
|
+
analytics:
|
96
|
+
description: "Analytics and reporting specialist"
|
97
|
+
directory: ./app/analytics
|
98
|
+
model: claude-3-5-haiku-20250110
|
99
|
+
allowed_tools: [Read, Edit, Write, Bash, Grep, Glob, LS]
|
100
|
+
prompt_file: .claude-on-rails/prompts/analytics.md
|
101
|
+
|
102
|
+
architect:
|
103
|
+
connections: [models, controllers, analytics] # Add to connections
|
104
|
+
```
|
105
|
+
|
106
|
+
Then in Claude:
|
107
|
+
```
|
108
|
+
> Create a comprehensive analytics dashboard with export capabilities
|
109
|
+
```
|
110
|
+
|
111
|
+
## Debugging Workflow Example
|
112
|
+
|
113
|
+
When encountering errors:
|
114
|
+
```
|
115
|
+
> NoMethodError in ProductsController#show - undefined method 'category' for nil:NilClass
|
116
|
+
|
117
|
+
The swarm will:
|
118
|
+
- Identify the error location
|
119
|
+
- Trace through the code path
|
120
|
+
- Fix the nil check
|
121
|
+
- Add tests to prevent regression
|
122
|
+
- Suggest defensive programming practices
|
123
|
+
```
|
124
|
+
|
125
|
+
## Migration and Refactoring Example
|
126
|
+
|
127
|
+
For large-scale refactoring:
|
128
|
+
```
|
129
|
+
> Refactor our fat User model - it has 500+ lines and 30+ methods
|
130
|
+
|
131
|
+
Coordinated refactoring:
|
132
|
+
- Architect plans the refactoring strategy
|
133
|
+
- Services agent extracts business logic
|
134
|
+
- Models agent keeps data integrity
|
135
|
+
- Tests agent ensures nothing breaks
|
136
|
+
- All changes are incremental and safe
|
137
|
+
```
|
138
|
+
|
139
|
+
## Tips for Best Results
|
140
|
+
|
141
|
+
1. **Be specific about requirements**
|
142
|
+
```
|
143
|
+
Good:
|
144
|
+
> Create user authentication with email/password, remember me, and password reset
|
145
|
+
|
146
|
+
Less effective:
|
147
|
+
> Add login
|
148
|
+
```
|
149
|
+
|
150
|
+
2. **Provide context for complex features**
|
151
|
+
```
|
152
|
+
> We're building a SaaS app. Add multi-tenant support with subdomain isolation
|
153
|
+
```
|
154
|
+
|
155
|
+
3. **Mention constraints or preferences**
|
156
|
+
```
|
157
|
+
> Build an admin panel using our existing ViewComponent architecture
|
158
|
+
```
|
159
|
+
|
160
|
+
4. **Ask for specific approaches**
|
161
|
+
```
|
162
|
+
> Implement caching using Redis for our product recommendations
|
163
|
+
```
|
164
|
+
|
165
|
+
Remember: The swarm works best when you describe what you want to achieve, not how to implement it. Let the specialized agents handle the implementation details!
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module ClaudeOnRails
|
2
|
+
class Configuration
|
3
|
+
attr_accessor :default_model, :vibe_mode, :session_directory, :log_directory
|
4
|
+
|
5
|
+
def initialize
|
6
|
+
@default_model = "claude-3-5-haiku-20250110"
|
7
|
+
@vibe_mode = true
|
8
|
+
@session_directory = ".claude-on-rails/sessions"
|
9
|
+
@log_directory = ".claude-on-rails/logs"
|
10
|
+
end
|
11
|
+
|
12
|
+
def to_h
|
13
|
+
{
|
14
|
+
default_model: default_model,
|
15
|
+
vibe_mode: vibe_mode,
|
16
|
+
session_directory: session_directory,
|
17
|
+
log_directory: log_directory
|
18
|
+
}
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|