agentleFS
greenstevestergreenstevester/fastlane-skill/skills/setup-fastlane/SKILL.md

setup-fastlane

Skill43 starsChanged 7 days agoMITView on GitHub

Set up Fastlane for an iOS or macOS app, or check that an existing Fastlane setup still works. Use this whenever a project has a fastlane/Fastfile, Gemfile or Gemfile.lock and the task touches them, even if nobody says "setup". That covers testing a dependency-bot pull request (Dependabot, Renovate) that bumps a gem in Gemfile.lock, any Gemfile or Gemfile.lock change, reinstalling bundler, bundler errors (Bundler::GemNotFound, "extensions are not built", "Could not find 'bundler'"), `bundle exec fastlane` failing, and fastlane that won't load or won't list its lanes. Also use it for a first-time setup that installs fastlane, writes the Appfile and Fastfile, and finds the app's bundle ID and team ID.

  • Installs packages

The file

Show its rules and text

We split this skill into the rules it gives an agent

13 rules. About 0 are common, 4 are distinctive, and 9 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 9

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    New setup: No Fastfile or Gemfile yet.

    line 14
  2. Very specific:

    Read the MODE: line, then follow the matching section.

    line 30
  3. Very specific:

    Use this when the check prints MODE: CHECK EXISTING SETUP.

    line 39
  4. Very specific:

    When a Gemfile lists fastlane, the Gemfile.lock decides which fastlane version runs, and bundler is the only thing that honours it.

    line 45
  5. Very specific:

    Run bundler at the version in the BUNDLED WITH line at the bottom of Gemfile.lock.

    line 50
  6. Distinctive:

    If the check flagged System Ruby, tell the user, and put Homebrew Ruby first in PATH for each command only:

    line 60
  7. Very specific:

    If the project has no Gemfile, run FASTLANE_SKIP_UPDATE_CHECK=1 fastlane lanes instead.

    line 88
  8. Very specific:

    Use this when the check prints MODE: NEW SETUP.

    line 117
  9. Very specific:

    If the check found a project.yml, the project is generated by XcodeGen.

    line 143
  10. Very specific:

    If the project has a Gemfile, put bundle exec in front of each fastlane command.

    line 237
  11. Very specific:

    Use the full name from Gemfile.lock.

    line 266
  12. Distinctive:

    Code signing issues?: Ask: "Set up Match for code signing"

    line 276
  13. Distinctive:

    Need screenshots?: Ask: "Automate my App Store screenshots"

    line 277

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Fastlane Setup and Health Check

This skill does one of two jobs, and the environment check below decides which:

  • Check an existing setup. The project already has a Fastfile or a Gemfile. Confirm it still loads, report what passed, and change nothing.
  • New setup. No Fastfile or Gemfile yet. Install fastlane and write the config files.

Environment Check

!bash "${CLAUDE_SKILL_DIR}/scripts/env-check.sh" 2>&1 || true

Argument given to the skill (may be empty): $ARGUMENTS

The check searches from the current folder, up to six folders deep, so a session that starts at a repo root still finds an app folder like project/product/ios-app. The argument is not passed to the line above, because a backtick in it would break the skill load. If the argument names a folder, or the check found nothing or the wrong project, rerun it with the app folder:

bash "${CLAUDE_SKILL_DIR}/scripts/env-check.sh" path/to/app-folder

Read the MODE: line, then follow the matching section. Use the bundle ID the check labels as the app's. Test targets have their own IDs (.tests, .uitests), and a plain grep of project.pbxproj often returns one of those first. If the check lists several candidates, ask the user which one is the app.


Check an Existing Setup

Use this when the check prints MODE: CHECK EXISTING SETUP. The project's Fastlane setup is someone's working configuration, so the job is to confirm it loads. Don't write an Appfile or a Fastfile, don't run fastlane init, and don't edit the Gemfile.

1. Use the project's own bundler and fastlane

When a Gemfile lists fastlane, the Gemfile.lock decides which fastlane version runs, and bundler is the only thing that honours it. A bare fastlane command runs whichever copy is first on PATH, usually Homebrew's /opt/homebrew/bin/fastlane, and skips the pinned one. A check run that way proves nothing about the project's setup.

Run bundler at the version in the BUNDLED WITH line at the bottom of Gemfile.lock. The check prints it. For BUNDLED WITH 2.4.22, the commands start with bundle _2.4.22_.

2. Run under the right Ruby

The Bash tool in Claude Code often starts with macOS System Ruby (/usr/bin/ruby, Ruby 2.6) first on PATH, even when the user's terminal uses Homebrew Ruby. Gems installed for Homebrew Ruby don't load under System Ruby. Bundler then fails with Bundler::GemNotFound, extensions are not built, or Could not find 'bundler' (2.4.22).

If the check flagged System Ruby, tell the user, and put Homebrew Ruby first in PATH for each command only:

PATH="/opt/homebrew/opt/ruby/bin:$PATH" bundle _2.4.22_ check --dry-run

(Intel Macs use /usr/local/opt/ruby/bin.) Never edit ~/.zshrc, ~/.zprofile, ~/.bash_profile or any other shell config file; the user decides how their shell starts. Don't install gems into System Ruby either, and never with sudo.

3. Run the checks

From the folder that holds fastlane/ (the check prints the exact commands):

PATH="/opt/homebrew/opt/ruby/bin:$PATH" BUNDLE_FROZEN=true bundle _2.4.22_ check --dry-run
PATH="/opt/homebrew/opt/ruby/bin:$PATH" BUNDLE_FROZEN=true FASTLANE_SKIP_UPDATE_CHECK=1 \
  bundle _2.4.22_ exec fastlane lanes
  • BUNDLE_FROZEN=true makes bundler refuse to rewrite Gemfile.lock.
  • --dry-run stops bundle check from writing the lockfile when it passes.
  • FASTLANE_SKIP_UPDATE_CHECK=1 hides fastlane's "new version available" banner.
  • fastlane lanes loads fastlane, its plugins and the Fastfile, so a broken or missing gem in that set shows up here. It runs no lane. A gem that an action loads only when it runs (for example mini_magick for frameit) shows up only when that lane runs, so say so in the report.

If the project has no Gemfile, run FASTLANE_SKIP_UPDATE_CHECK=1 fastlane lanes instead.

If bundle check says gems are missing, as it will after a pull request bumps a gem, ask the user before installing them. BUNDLE_FROZEN=true bundle _2.4.22_ install installs the gems on this Mac and leaves Gemfile.lock alone.

If the pinned bundler isn't installed for Homebrew Ruby, ask before running PATH="/opt/homebrew/opt/ruby/bin:$PATH" gem install bundler -v 2.4.22.

4. Report and stop

Report each check as passed or failed, with the versions used. The values below are an example from one project; report the ones you found:

CheckResult
Ruby/opt/homebrew/opt/ruby/bin/ruby 4.0.x (System Ruby was first on PATH)
Bundler2.4.22, from BUNDLED WITH
bundle checkpassed
fastlane (from Gemfile.lock)2.232.2
fastlane lanespassed, 26 lanes

Then list anything that needs the user's decision, such as missing gems or a bundler version to install. Leave the project's files as they were.


New Setup

Use this when the check prints MODE: NEW SETUP.

Step 1: Install Fastlane

With no Gemfile in the project, install fastlane with Homebrew:

brew install fastlane

Homebrew's fastlane carries its own Ruby and gems, so there is no Ruby version or Gemfile to manage. Teams that want every machine and CI run on the same fastlane version can add a Gemfile later. The existing-setup checks above then apply.

Bundler 4 history: fastlane 2.230.0 and earlier required bundler below 3.0, so they failed to load once Bundler 4.0 arrived in December 2025 (fastlane issue #29817). fastlane 2.231.0, released 16 January 2026, accepts Bundler 4 (pull request #29813). A project locked to fastlane 2.230.0 or older still needs bundler 2.x.

Step 2: Create Configuration Files

Fill the placeholders from the environment check: the app's bundle ID (not a test target's) and the team ID. Ask the user for their Apple ID email.

If the check found a project.yml, the project is generated by XcodeGen. Any project change (bundle ID, team, signing) goes in project.yml followed by xcodegen generate. Don't tell the user to edit project.pbxproj, because the next generate overwrites it. The same goes for increment_build_number in the lanes below: it writes the build number into project.pbxproj, and the next generate puts back whatever project.yml says. Tell the user, and let them choose between keeping the build number in project.yml or passing one in with increment_build_number(build_number: …) from a source that survives a regenerate, such as latest_testflight_build_number + 1.

fastlane/Appfile

app_identifier("{{BUNDLE_ID}}")  # Your bundle ID
apple_id("{{APPLE_ID}}")         # Your Apple ID email
team_id("{{TEAM_ID}}")           # Your team ID

fastlane/Fastfile

default_platform(:ios)

platform :ios do
  desc "Run tests"
  lane :test do
    scan(scheme: "{{SCHEME}}")
  end

  desc "Upload to TestFlight (internal testers)"
  lane :beta do |options|
    increment_build_number unless options[:skip_build_increment]
    gym(scheme: "{{SCHEME}}", export_method: "app-store")
    pilot(skip_waiting_for_build_processing: true)
  end

  desc "Upload to TestFlight and distribute to external testers"
  lane :beta_external do |options|
    increment_build_number
    gym(scheme: "{{SCHEME}}", export_method: "app-store")
    pilot(
      distribute_external: true,
      groups: ["External Testers"],
      changelog: options[:changelog] || "Bug fixes and improvements",
      skip_waiting_for_build_processing: false
    )
  end

  desc "Submit the latest TestFlight build for App Store review"
  lane :release do
    deliver(
      build_number: latest_testflight_build_number.to_s,
      submit_for_review: true,
      automatic_release: false,
      force: true,
      skip_binary_upload: true,
      skip_metadata: false,
      skip_screenshots: false
    )
  end

  desc "Build, upload, and submit a fresh build to the App Store"
  lane :release_full do |options|
    increment_version_number(version_number: options[:version]) if options[:version]
    increment_build_number
    gym(scheme: "{{SCHEME}}", export_method: "app-store")
    deliver(
      submit_for_review: true,
      automatic_release: options[:auto_release] == true,
      force: true
    )
  end
end

Replace {{SCHEME}} with your app's scheme name (usually the app name).

Step 3: Set Up Metadata (Optional)

Download your existing App Store listing:

fastlane deliver download_metadata
fastlane deliver download_screenshots

This creates fastlane/metadata/ with editable text files for your app description, keywords, etc.

You're Done

# Verify setup
fastlane lanes

# Run your first lane
fastlane ios test

If the project has a Gemfile, put bundle exec in front of each fastlane command.

CommandWhat it does
fastlane ios testRun tests
fastlane ios betaBuild + TestFlight
fastlane ios releaseBuild + App Store
fastlane deliver download_metadataFetch App Store listing

When rubygems.org Can't Be Reached

This is a workaround, not a fix. The cause was never found.

Symptom: gem install and bundle install hang with no output, while curl -I https://rubygems.org answers straight away. Ask the user before installing anything this way, and run each command with Homebrew Ruby first in PATH, as in the checks above.

  1. Install bundler from the local gem cache. Ruby keeps the .gem files it has downloaded:
    ls "$(gem env gemdir)/cache/" | grep bundler
    gem install --local "$(gem env gemdir)/cache/bundler-2.4.22.gem"
  2. Download each missing gem with curl, then install it from the file:
    curl -fL -o /tmp/<name>-<version>.gem https://rubygems.org/downloads/<name>-<version>.gem
    gem install --local --ignore-dependencies /tmp/<name>-<version>.gem
    Use the full name from Gemfile.lock. Gems built for one platform carry it in the name, for example nokogiri-1.18.9-arm64-darwin. --ignore-dependencies stops gem from trying the network for dependencies. It also stops it from checking them, so run bundle _<version>_ check --dry-run afterwards to find any that are still missing.

Next Steps

  • Code signing issues? Ask: "Set up Match for code signing"
  • Need screenshots? Ask: "Automate my App Store screenshots"
  • CI/CD setup? See Xcode Cloud guide

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.