跳到正文
Skillpedia
API 与服务器(后端)48k · #5797

skill-rails-upgrade

它能做什么

这个工具会分析你的 Rails 项目,帮你把它升级到更新的版本。它会检查你当前使用的版本,找到最新可用的版本,并告诉你升级需要做哪些关键改动。

适用场景

  • ✓当你想把 Rails 项目更新到更新的版本时。
  • ✓想了解这次升级大概需要多少工作量时。
  • ✓想检查升级 Rails 时是否也需要更新 JavaScript 依赖时。

技能链接

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/skill-rails-upgrade/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/skill-rails-upgrade/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“分析我的 Rails 项目,并告诉我如何把它升级到最新版本。”

每周 5 个新技能,1 分钟读完。

工作原理

这个工具会先检查你项目里的文件,确认它是一个 Rails 应用。然后,它会判断你正在使用的版本,以及最新可用的版本是什么。接着,它会对比两者,并查找升级所需的相关改动信息。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

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.

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/null

7.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/null

7.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:


…
常见问题

它是怎么知道最新的 Rails 版本的?

它会使用 GitHub CLI 这个工具,从 Rails 官方的 GitHub 仓库中查看最新发布的版本。

什么是“破坏性变更”?

指新版本中可能导致你现有代码无法正常运行的改动。这个工具会尽量找出这些改动,并提醒你注意。

它会自动帮我升级项目吗?

不会,这个工具只负责分析并给出报告。实际的升级工作需要你自己手动完成。

详情

作者的原始描述

Analyze Rails apps and provide upgrade assessments

repo: sickn33/agentic-awesome-skills

热度

GitHub 星标
48k
排名
#5797
许可证
MIT
更新时间
2026/10/15

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能