[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-2bc4d514-ca83-4820-8e9b-f10feb62014e":3,"$fQf22jxGp2-vFZJmFS_IQWTV4NtehGFwLADNmoZmIBR0":43},{"id":4,"title":5,"description":6,"categoryId":7,"moduleId":8,"tags":9,"prompt":10,"icon":11,"source":12,"sourceUrl":13,"authorId":14,"authorName":15,"isPublic":16,"stars":17,"runs":18,"createdAt":19,"updatedAt":19,"module":20,"category":27,"packages":34},"2bc4d514-ca83-4820-8e9b-f10feb62014e","skill-rails-upgrade","分析Rails应用程序并提供升级评估","cat_life_career","mod_other","sickn33,other","---\nname: skill-rails-upgrade\ndescription: \"Analyze Rails apps and provide upgrade assessments\"\nrisk: safe\nsource: \"https:\u002F\u002Fgithub.com\u002Frobzolkos\u002Fskill-rails-upgrade\"\ndate_added: \"2026-02-27\"\n---\n\n## When to Use This Skill\n\nAnalyze Rails apps and provide upgrade assessments\n\nUse this skill when working with analyze rails apps and provide upgrade assessments.\n# Rails Upgrade Analyzer\n\nAnalyze the current Rails application and provide a comprehensive upgrade assessment with selective file merging.\n\n## Step 1: Verify Rails Application\n\nCheck that we're in a Rails application by looking for these files:\n- `Gemfile` (must exist and contain 'rails')\n- `config\u002Fapplication.rb` (Rails application config)\n- `config\u002Fenvironment.rb` (Rails environment)\n\nIf 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.\n\n## Step 2: Get Current Rails Version\n\nExtract the current Rails version from:\n1. First, check `Gemfile.lock` for the exact installed version (look for `rails (x.y.z)`)\n2. If not found, check `Gemfile` for the version constraint\n\nReport the exact current version (e.g., `7.1.3`).\n\n## Step 3: Find Latest Rails Version\n\nUse the GitHub CLI to fetch the latest Rails release:\n\n```bash\ngh api repos\u002Frails\u002Frails\u002Freleases\u002Flatest --jq '.tag_name'\n```\n\nThis returns the latest stable version tag (e.g., `v8.0.1`). Strip the 'v' prefix for comparison.\n\nAlso check recent tags to understand the release landscape:\n\n```bash\ngh api repos\u002Frails\u002Frails\u002Ftags --jq '.[0:10] | .[].name'\n```\n\n## Step 4: Determine Upgrade Type\n\nCompare current and latest versions to classify the upgrade:\n\n- **Patch upgrade**: Same major.minor, different patch (e.g., 7.1.3 → 7.1.5)\n- **Minor upgrade**: Same major, different minor (e.g., 7.1.3 → 7.2.0)\n- **Major upgrade**: Different major version (e.g., 7.1.3 → 8.0.0)\n\n## Step 5: Fetch Upgrade Guide\n\nUse WebFetch to get the official Rails upgrade guide:\n\nURL: `https:\u002F\u002Fguides.rubyonrails.org\u002Fupgrading_ruby_on_rails.html`\n\nLook for sections relevant to the version jump. The guide is organized by target version with sections like:\n- \"Upgrading from Rails X.Y to Rails X.Z\"\n- Breaking changes\n- Deprecation warnings\n- Configuration changes\n- Required migrations\n\nExtract and summarize the relevant sections for the user's specific upgrade path.\n\n## Step 6: Fetch Rails Diff\n\nUse WebFetch to get the diff between versions from railsdiff.org:\n\nURL: `https:\u002F\u002Frailsdiff.org\u002F{current_version}\u002F{target_version}`\n\nFor example: `https:\u002F\u002Frailsdiff.org\u002F7.1.3\u002F8.0.0`\n\nThis shows:\n- Changes to default configuration files\n- New files that need to be added\n- Modified initializers\n- Updated dependencies\n- Changes to bin\u002F scripts\n\nSummarize the key file changes.\n\n## Step 7: Check JavaScript Dependencies\n\nRails applications often include JavaScript packages that should be updated alongside Rails. Check for and report on these dependencies.\n\n### 7.1: Identify JS Package Manager\n\nCheck which package manager the app uses:\n\n```bash\n# Check for package.json (npm\u002Fyarn)\nls package.json 2>\u002Fdev\u002Fnull\n\n# Check for importmap (Rails 7+)\nls config\u002Fimportmap.rb 2>\u002Fdev\u002Fnull\n```\n\n### 7.2: Check Rails-Related JS Packages\n\nIf `package.json` exists, check for these Rails-related packages:\n\n```bash\n# Extract current versions of Rails-related packages\ncat package.json | grep -E '\"@hotwired\u002F|\"@rails\u002F|\"stimulus\"|\"turbo-rails\"' || echo \"No Rails JS packages found\"\n```\n\n**Key packages to check:**\n\n| Package | Purpose | Version Alignment |\n|---------|---------|-------------------|\n| `@hotwired\u002Fturbo-rails` | Turbo Drive\u002FFrames\u002FStreams | Should match Rails version era |\n| `@hotwired\u002Fstimulus` | Stimulus JS framework | Generally stable across Rails versions |\n| `@rails\u002Factioncable` | WebSocket support | Should match Rails version |\n| `@rails\u002Factivestorage` | Direct uploads | Should match Rails version |\n| `@rails\u002Factiontext` | Rich text editing | Should match Rails version |\n| `@rails\u002Frequest.js` | Rails UJS replacement | Should match Rails version era |\n\n### 7.3: Check for Updates\n\nFor npm\u002Fyarn projects, check for available updates:\n\n```bash\n# Using npm\nnpm outdated @hotwired\u002Fturbo-rails @hotwired\u002Fstimulus @rails\u002Factioncable @rails\u002Factivestorage 2>\u002Fdev\u002Fnull\n\n# Or check latest versions directly\nnpm view @hotwired\u002Fturbo-rails version 2>\u002Fdev\u002Fnull\nnpm view @rails\u002Factioncable version 2>\u002Fdev\u002Fnull\n```\n\n### 7.4: Check Importmap Pins (if applicable)\n\nIf the app uses importmap-rails, check `config\u002Fimportmap.rb` for pinned versions:\n\n```bash\ncat config\u002Fimportmap.rb | grep -E 'pin.*turbo|pin.*stimulus|pin.*@rails' || echo \"No importmap pins found\"\n```\n\nTo update importmap pins:\n```bash\nbin\u002Fimportmap pin @hotwired\u002Fturbo-rails\nbin\u002Fimportmap pin @hotwired\u002Fstimulus\n```\n\n### 7.5: JS Dependency Summary\n\nInclude in the upgrade summary:\n\n```\n### JavaScript Dependencies\n\n**Package Manager**: [npm\u002Fyarn\u002Fimportmap\u002Fnone]\n\n| Package | Current | Latest | Action |\n|---------|---------|--------|--------|\n| @hotwired\u002Fturbo-rails | 8.0.4 | 8.0.12 | Update recommended |\n| @rails\u002Factioncable | 7.1.0 | 8.0.0 | Update with Rails |\n| ... | ... | ... | ... |\n\n**Recommended JS Updates:**\n- Run `npm update @hotwired\u002Fturbo-rails` (or yarn equivalent)\n- Run `npm update @rails\u002Factioncable @rails\u002Factivestorage` to match Rails version\n```\n\n---\n\n## Step 8: Generate Upgrade Summary\n\nProvide a comprehensive summary including all findings from Steps 1-7:\n\n### Version Information\n- Current version: X.Y.Z\n- Latest version: A.B.C\n- Upgrade type: [Patch\u002FMinor\u002FMajor]\n\n### Upgrade Complexity Assessment\n\nRate the upgrade as **Small**, **Medium**, or **Large** based on:\n\n| Factor | Small | Medium | Large |\n|--------|-------|--------|-------|\n| Version jump | Patch only | Minor version | Major version |\n| Breaking changes | None | Few, well-documented | Many, significant |\n| Config changes | Minimal | Moderate | Extensive |\n| Deprecations | None active | Some to address | Many requiring refactoring |\n| Dependencies | Compatible | Some updates needed | Major dependency updates |\n\n### Key Changes to Address\n\nList the most important changes the user needs to handle:\n1. Configuration file updates\n2. Deprecated methods\u002Ffeatures to update\n3. New required dependencies\n4. Database migrations needed\n5. Breaking API changes\n\n### Recommended Upgrade Steps\n\n1. Update test suite and ensure passing\n2. Review deprecation warnings in current version\n3. Update Gemfile with new Rails version\n4. Run `bundle update rails`\n5. Update JavaScript dependencies (see JS Dependencies section)\n6. **DO NOT run `rails app:update` directly** - use the selective merge process below\n7. Run database migrations\n8. Run test suite\n9. Review and update deprecated code\n\n### Resources\n\n- Rails Upgrade Guide: https:\u002F\u002Fguides.rubyonrails.org\u002Fupgrading_ruby_on_rails.html\n- Rails Diff: https:\u002F\u002Frailsdiff.org\u002F{current}\u002F{target}\n- Release Notes: https:\u002F\u002Fgithub.com\u002Frails\u002Frails\u002Freleases\u002Ftag\u002Fv{target}\n\n---\n\n\n### When to Use This Skill\n\nAnalyze Rails apps and provide upgrade assessments\n\nUse this skill when working with analyze rails apps and provide upgrade assessments.\n## Step 9: Selective File Update (replaces `rails app:update`)\n\n**IMPORTANT:** Do NOT run `rails app:update` as it overwrites files without considering local customizations. Instead, follow this selective merge process:\n\n### 9.1: Detect Local Customizations\n\nBefore any upgrade, identify files with local customizations:\n\n```bash\n# Check for uncommitted changes\ngit status\n\n# List config files that differ from a fresh Rails app\n# These are the files we need to be careful with\ngit diff HEAD --name-only -- config\u002F bin\u002F public\u002F\n```\n\nCreate a mental list of files in these categories:\n- **Custom config files**: Files with project-specific settings (i18n, mailer, etc.)\n- **Modified bin scripts**: Scripts with custom behavior (bin\u002Fdev with foreman, etc.)\n- **Standard files**: Files that haven't been customized\n\n### 9.2: Analyze Required Changes from Railsdiff\n\nBased on the railsdiff output from Step 6, categorize each changed file:\n\n| Category | Action | Example |\n|----------|--------|---------|\n| **New files** | Create directly | `config\u002Finitializers\u002Fnew_framework_defaults_X_Y.rb` |\n| **Unchanged locally** | Safe to overwrite | `public\u002F404.html` (if not customized) |\n| **Customized locally** | Manual merge needed | `config\u002Fapplication.rb`, `bin\u002Fdev` |\n| **Comment-only changes** | Usually skip | Minor comment updates in config files |\n\n### 9.3: Create Upgrade Plan\n\nPresent the user with a clear upgrade plan:\n\n```\n## Upgrade Plan: Rails X.Y.Z → A.B.C\n\n### New Files (will be created):\n- config\u002Finitializers\u002Fnew_framework_defaults_A_B.rb\n- bin\u002Fci (new CI script)\n\n### Safe to Update (no local customizations):\n- public\u002F400.html\n- public\u002F404.html\n- public\u002F500.html\n\n### Needs Manual Merge (local customizations detected):\n- config\u002Fapplication.rb\n  └─ Local: i18n configuration\n  └─ Rails: [describe new Rails changes if any]\n\n- config\u002Fenvironments\u002Fdevelopment.rb\n  └─ Local: letter_opener mailer config\n  └─ Rails: [describe new Rails changes]\n\n- bin\u002Fdev\n  └─ Local: foreman + Procfile.dev setup\n  └─ Rails: changed to simple ruby script\n\n### Skip (comment-only or irrelevant changes):\n- config\u002Fpuma.rb (only comment changes)\n```\n\n### 9.4: Execute Upgrade Plan\n\nAfter user confirms the plan:\n\n#### For New Files:\nCreate them directly using the content from railsdiff or by extracting from a fresh Rails app:\n\n```bash\n# Generate a temporary fresh Rails app to extract new files\ncd \u002Ftmp && rails new rails_template --skip-git --skip-bundle\n# Then copy needed files\n```\n\nOr use the Rails generator for specific files:\n```bash\nbin\u002Frails app:update:configs  # Only updates config files, still interactive\n```\n\n#### For Safe Updates:\nOverwrite these files as they have no local customizations.\n\n#### For Manual Merges:\nFor each file needing merge, show the user:\n\n1. **Current local version** (their customizations)\n2. **New Rails default** (from railsdiff)\n3. **Suggested merged version** that:\n   - Keeps all local customizations\n   - Adds only essential new Rails functionality\n   - Removes deprecated settings\n\nExample merge for `config\u002Fapplication.rb`:\n```ruby\n# KEEP local customizations:\nconfig.i18n.available_locales = [:de, :en]\nconfig.i18n.default_locale = :de\nconfig.i18n.fallbacks = [:en]\n\n# ADD new Rails 8.1 settings if needed:\n# (usually none required - new defaults come via new_framework_defaults file)\n```\n\n### 9.5: Handle Active Storage Migrations\n\nAfter file updates, run any new migrations:\n\n```bash\nbin\u002Frails db:migrate\n```\n\nCheck for new migrations that were added:\n```bash\nls -la db\u002Fmigrate\u002F | tail -10\n```\n\n### 9.6: Verify Upgrade\n\nAfter completing the merge:\n\n1. Start the Rails server and check for errors:\n   ```bash\n   bin\u002Fdev  # or bin\u002Frails server\n   ```\n\n2. Check the Rails console:\n   ```bash\n   bin\u002Frails console\n   ```\n\n3. Run the test suite:\n   ```bash\n   bin\u002Frails test\n   ```\n\n4. Review deprecation warnings in logs\n\n---\n\n## Step 10: Finalize Framework Defaults\n\nAfter verifying the app works:\n\n1. Review `config\u002Finitializers\u002Fnew_framework_defaults_X_Y.rb`\n2. Enable each new default one by one, testing after each\n3. Once all defaults are enabled and tested, update `config\u002Fapplication.rb`:\n   ```ruby\n   config.load_defaults X.Y  # Update to new version\n   ```\n4. Delete the `new_framework_defaults_X_Y.rb` file\n\n---\n\n\n### When to Use This Skill\n\nAnalyze Rails apps and provide upgrade assessments\n\nUse this skill when working with analyze rails apps and provide upgrade assessments.\n## Error Handling\n\n- If `gh` CLI is not authenticated, instruct the user to run `gh auth login`\n- If railsdiff.org doesn't have the exact versions, try with major.minor.0 versions\n- If the app is already on the latest version, congratulate the user and note any upcoming releases\n- If local customizations would be lost, ALWAYS stop and show the user what would be overwritten before proceeding\n\n## Key Principles\n\n1. **Never overwrite without checking** - Always check for local customizations first\n2. **Preserve user intent** - Local customizations exist for a reason\n3. **Minimal changes** - Only add what's necessary for the new Rails version\n4. **Transparency** - Show the user exactly what will change before doing it\n5. **Reversibility** - User should be able to `git checkout` to restore if needed\n\n## Limitations\n- Use this skill only when the task clearly matches the scope described above.\n- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.\n- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.\n","","imported","https:\u002F\u002Fgithub.com\u002Fsickn33\u002Fantigravity-awesome-skills","user_system_seed","SkillOPIC",true,231,941,"2026-05-16 13:40:53",{"id":8,"name":21,"slug":22,"icon":23,"description":24,"sort":25,"createdAt":26},"其他","other","mdi-page-next-outline","其他类型Skill",5,"2026-05-16 12:53:40",{"id":7,"name":28,"slug":29,"icon":30,"description":31,"moduleId":8,"sort":32,"skillCount":33,"createdAt":26},"职场发展","career","mdi-briefcase-outline","面试准备、简历优化、职业规划",4,575,[35],{"id":36,"skillId":4,"version":37,"fileName":38,"fileSize":39,"filePath":40,"fileHash":41,"manifest":42,"createdAt":19},"97d52659-5cf2-4192-9ec6-199a2bb86ed7","1.0.0","skill-rails-upgrade.zip",4850,"uploads\u002Fskills\u002F2bc4d514-ca83-4820-8e9b-f10feb62014e\u002Fskill-rails-upgrade.zip","955c8b32c84cb23a7bdad144fc7ff425bd553bb7d495a7db35029a69bf7af53d","[{\"path\":\"SKILL.md\",\"isDirectory\":false,\"size\":12696}]",{"code":44,"message":45,"data":46},200,"success",{"items":47,"stats":48,"page":51},[],{"averageRating":49,"totalRatings":49,"ratingCounts":50},0,[49,49,49,49,49],{"limit":52,"offset":49,"hasMore":53,"nextOffset":52,"ratedOnly":16},15,false]