skill-rails-upgrade – skill Khác cho agent AI
Phân tích ứng dụng Rails và đưa ra đánh giá nâng cấp
Cài skill skill-rails-upgrade bằng một lệnh
Chọn công cụ bạn đang dùng, copy lệnh và dán vào terminal. Skill sẽ nằm trong thư mục skills của công cụ đó và sẵn sàng dùng ở phiên làm việc tiếp theo.
Claude Code
mkdir -p ~/.claude/skills && curl -fsSL https://skill.dn1nguoi.com/z/skill-rails-upgrade-179a4.tgz | tar xz -C ~/.claude/skills
Gọi trong Claude Code: /skill-rails-upgrade – rồi mô tả công việc bạn muốn làm.
Codex
mkdir -p ~/.codex/skills && curl -fsSL https://skill.dn1nguoi.com/z/skill-rails-upgrade-179a4.tgz | tar xz -C ~/.codex/skills
Gọi trong Codex: $skill-rails-upgrade – rồi mô tả công việc bạn muốn làm.
Hermes Agent
mkdir -p ~/.hermes/skills && curl -fsSL https://skill.dn1nguoi.com/z/skill-rails-upgrade-179a4.tgz | tar xz -C ~/.hermes/skills
Gọi trong Hermes Agent: /skill-rails-upgrade – rồi mô tả công việc bạn muốn làm.
DeepSeek
mkdir -p ~/.deepcode/skills && curl -fsSL https://skill.dn1nguoi.com/z/skill-rails-upgrade-179a4.tgz | tar xz -C ~/.deepcode/skills
Gọi trong DeepSeek: /skill-rails-upgrade – rồi mô tả công việc bạn muốn làm.
Nội dung SKILL.md
Nội dung SKILL.md gốc bằng tiếng Anh.
When to Use This Skill
Analyze Rails apps and provide upgrade assessments
Use this skill when working with analyze rails apps and provide upgrade assessments.
Rails Upgrade Analyzer
Analyze the current Rails application and provide a comprehensive upgrade assessment with selective file merging.
Assessment is read-only by default. Dependency changes, generated files, migrations and application startup require the requested implementation scope. Confirm the database/environment before running application commands; use a disposable development database and tested restore for migrations.
Step 1: Verify Rails Application
Check that we're in a Rails application by looking for these files:
Gemfile(must exist and contain 'rails')config/application.rb(Rails application config)config/environment.rb(Rails environment)
If any of these are missing or don't indicate a Rails app, stop and inform the user this doesn't appear to be a Rails application.
Step 2: Get Current Rails Version
Extract the current Rails version from:
1. First, check Gemfile.lock for the exact installed version (look for rails (x.y.z))
2. If not found, check Gemfile for the version constraint
Report the exact current version (e.g., 7.1.3).
Step 3: Find Latest Rails Version
Use the GitHub CLI to fetch the latest Rails release:
gh api repos/rails/rails/releases/latest --jq '.tag_name'This returns the latest stable version tag (e.g., v8.0.1). Strip the 'v' prefix for comparison.
Also check recent tags to understand the release landscape:
gh api repos/rails/rails/tags --jq '.[0:10] | .[].name'Step 4: Determine Upgrade Type
Compare current and latest versions to classify the upgrade:
- Patch upgrade: Same major.minor, different patch (e.g., 7.1.3 → 7.1.5)
- Minor upgrade: Same major, different minor (e.g., 7.1.3 → 7.2.0)
- Major upgrade: Different major version (e.g., 7.1.3 → 8.0.0)
Step 5: Fetch Upgrade Guide
Use WebFetch to get the official Rails upgrade guide:
URL: https://guides.rubyonrails.org/upgrading_ruby_on_rails.html
Look for sections relevant to the version jump. The guide is organized by target version with sections like:
- "Upgrading from Rails X.Y to Rails X.Z"
- Breaking changes
- Deprecation warnings
- Configuration changes
- Required migrations
Extract and summarize the relevant sections for the user's specific upgrade path.
Step 6: Fetch Rails Diff
Use WebFetch to get the diff between versions from railsdiff.org:
URL: https://railsdiff.org/{current_version}/{target_version}
For example: https://railsdiff.org/7.1.3/8.0.0
This shows:
- Changes to default configuration files
- New files that need to be added
- Modified initializers
- Updated dependencies
- Changes to bin/ scripts
Summarize the key file changes.
Step 7: Check JavaScript Dependencies
Rails applications often include JavaScript packages that should be updated alongside Rails. Check for and report on these dependencies.
7.1: Identify JS Package Manager
Check which package manager the app uses:
# Check for package.json (npm/yarn)
ls package.json 2>/dev/null
# Check for importmap (Rails 7+)
ls config/importmap.rb 2>/dev/null7.2: Check Rails-Related JS Packages
If package.json exists, check for these Rails-related packages:
# Extract current versions of Rails-related packages
cat package.json | grep -E '"@hotwired/|"@rails/|"stimulus"|"turbo-rails"' || echo "No Rails JS packages found"Key packages to check:
| Package | Purpose | Version Alignment |
|---------|---------|-------------------|
| @hotwired/turbo-rails | Turbo Drive/Frames/Streams | Should match Rails version era |
| @hotwired/stimulus | Stimulus JS framework | Generally stable across Rails versions |
| @rails/actioncable | WebSocket support | Should match Rails version |
| @rails/activestorage | Direct uploads | Should match Rails version |
| @rails/actiontext | Rich text editing | Should match Rails version |
| @rails/request.js | Rails UJS replacement | Should match Rails version era |
7.3: Check for Updates
For npm/yarn projects, check for available updates:
# Using npm
npm outdated @hotwired/turbo-rails @hotwired/stimulus @rails/actioncable @rails/activestorage 2>/dev/null
# Or check latest versions directly
npm view @hotwired/turbo-rails version 2>/dev/null
npm view @rails/actioncable version 2>/dev/null7.4: Check Importmap Pins (if applicable)
If the app uses importmap-rails, check config/importmap.rb for pinned versions:
cat config/importmap.rb | grep -E 'pin.*turbo|pin.*stimulus|pin.*@rails' || echo "No importmap pins found"To update importmap pins:
bin/importmap pin @hotwired/turbo-rails
bin/importmap pin @hotwired/stimulus7.5: JS Dependency Summary
Include in the upgrade summary:
### JavaScript Dependencies
**Package Manager**: [npm/yarn/importmap/none]
| Package | Current | Latest | Action |
|---------|---------|--------|--------|
| @hotwired/turbo-rails | 8.0.4 | 8.0.12 | Update recommended |
| @rails/actioncable | 7.1.0 | 8.0.0 | Update with Rails |
| ... | ... | ... | ... |
**Recommended JS Updates:**
- Run `npm update @hotwired/turbo-rails` (or yarn equivalent)
- Run `npm update @rails/actioncable @rails/activestorage` to match Rails version---
Step 8: Generate Upgrade Summary
Provide a comprehensive summary including all findings from Steps 1-7:
Version Information
- Current version: X.Y.Z
- Latest version: A.B.C
- Upgrade type: [Patch/Minor/Major]
Upgrade Complexity Assessment
Rate the upgrade as Small, Medium, or Large based on:
| Factor | Small | Medium | Large |
|--------|-------|--------|-------|
| Version jump | Patch only | Minor version | Major version |
| Breaking changes | None | Few, well-documented | Many, significant |
| Config changes | Minimal | Moderate | Extensive |
| Deprecations | None active | Some to address | Many requiring refactoring |
| Dependencies | Compatible | Some updates needed | Major dependency updates |
Key Changes to Address
List the most important changes the user needs to handle:
1. Configuration file updates
2. Deprecated methods/features to update
3. New required dependencies
4. Database migrations needed
5. Breaking API changes
Recommended Upgrade Steps
1. Update test suite and ensure passing
2. Review deprecation warnings in current version
3. Update Gemfile with new Rails version
4. Run bundle update rails
5. Update JavaScript dependencies (see JS Dependencies section)
6. DO NOT run rails app:update directly - use the selective merge process below
7. Run database migrations
8. Run test suite
9. Review and update deprecated code
Resources
- Rails Upgrade Guide: https://guides.rubyonrails.org/upgrading_ruby_on_rails.html
- Rails Diff: https://railsdiff.org/{current}/{target}
- Release Notes: https://github.com/rails/rails/releases/tag/v{target}
---
When to Use This Skill
Analyze Rails apps and provide upgrade assessments
Use this skill when working with analyze rails apps and provide upgrade assessments.
Step 9: Selective File Update (replaces rails app:update)
Prefer a reviewed selective merge when local customization matters. rails app:update may prompt about conflicts, but it is not a substitute for reviewing generated diffs. Never assume generated defaults are safe to overwrite.
9.1: Detect Local Customizations
Before any upgrade, identify files with local customizations:
# Check for uncommitted changes
git status
# This lists only uncommitted differences, NOT all customization from Rails defaults.
# Compare the complete tracked files against a clean app generated with the
# exact current Rails version/options before declaring a file uncustomized.
git diff HEAD --name-only -- config/ bin/ public/Create a mental list of files in these categories:
- Custom config files: Files with project-specific settings (i18n, mailer, etc.)
- Modified bin scripts: Scripts with custom behavior (bin/dev with foreman, etc.)
- Standard files: Files that haven't been customized
9.2: Analyze Required Changes from Railsdiff
Based on the railsdiff output from Step 6, categorize each changed file:
| Category | Action | Example |
|----------|--------|---------|
| New files | Create directly | config/initializers/new_framework_defaults_X_Y.rb |
| Unchanged locally | Safe to overwrite | public/404.html (if not customized) |
| Customized locally | Manual merge needed | config/application.rb, bin/dev |
| Comment-only changes | Usually skip | Minor comment updates in config files |
9.3: Create Upgrade Plan
Present the user with a clear upgrade plan:
## Upgrade Plan: Rails X.Y.Z → A.B.C
### New Files (will be created):
- config/initializers/new_framework_defaults_A_B.rb
- bin/ci (new CI script)
### Safe … (nội dung đầy đủ có trong gói tải về)
Skill liên quan
- skill-router – Dùng khi người dùng chưa chắc nên dùng skill nào hoặc bắt đầu từ đâu. Hỏi người dùng…
- skill-sentinel – Kiểm toán và phát triển hệ sinh thái skill. Chất lượng code, bảo mật, chi phí, khoảng…
- slack-gif-creator – Bộ công cụ và kiến thức hỗ trợ tạo GIF động được tối ưu cho Slack.
- sleep-analyzer – Phân tích dữ liệu giấc ngủ, nhận diện kiểu ngủ, đánh giá chất lượng giấc ngủ và đưa ra…
- slo-implementation – Khung làm việc để định nghĩa và triển khai các chỉ số mức dịch vụ (SLI), mục tiêu mức…
- smart-contract-formal-verification – Sổ đăng ký xác minh hình thức các bất biến (invariant) cho Foundry và Soroban: quy tắc…
- smart-contract-upgrade-governance – Sổ đăng ký quản trị nâng cấp WASM trên Soroban: mã băm bytecode thực thi được, độ trễ di…
- sops-encryption – Mã hóa tệp và cấu hình bằng Mozilla SOPS.