Manages Ruby on Rails projects end-to-end: new apps, setup, development, debugging, tests, maintenance, upgrades, deployment, favicon/site-icon setup, and database dump/restore. Uses a canonical reference project for upgrade tasks.
Ships in tramway-skill. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Use this skill as an operational playbook. Prefer small, safe, verifiable changes over big-bang edits. At every stage, the user can skip any proposed step; respect skips, note risks briefly, and continue with the remaining workflow.
This skill runs in two environments. Behavior differs for file loading:
Codex — agents/*.md files are loaded natively by the Codex agents system. The "load agents/X.md" instructions work without extra steps.
Claude Code — agents/*.md files are NOT auto-loaded. Whenever this document says "load agents/X.md", you MUST use the Read tool to read that file before continuing. Resolve the path relative to the directory containing this SKILL.md file (<skill-directory>/agents/X.md) — this works no matter how the skill was installed (plugin marketplace, manual copy, or repository checkout). If the skill directory cannot be determined from context, try these common locations in order:
~/.claude/skills/tramway-skill/agents/X.md
skills/tramway-skill/agents/X.md
Do NOT skip loading agents files. They contain mandatory rules for the active surface area. If a file cannot be read, report the error to the user instead of silently continuing.
Version policy:
VERSION at the root of this skill directory.VERSION file and show the version to the user as the first output, before any other response. Format: tramway-skill v<version>. Read VERSION relative to this SKILL.md's directory. If that directory is unknown, try ~/.claude/skills/tramway-skill/VERSION, then ~/.codex/skills/tramway-skill/VERSION, then any repository-local skills/tramway-skill/VERSION.tramway-skill version, read and report that VERSION value.Command policy:
.ruby-version, Gemfile, Dockerfile, ruby -v); if it is older than the patched release of its line (or on an unpatched line), warn the user explicitly and recommend upgrading. Repeat the reminder in the final summary if the project is still on a vulnerable version.dip only in the local development environment. Never use or suggest dip for production, staging, or CI commands, scripts, jobs, deploy hooks, or operational runbooks.dip. Do not use docker or docker-compose directly for project operations. Use dip as the main interface for project commands.rails new ... only when creating a brand-new Rails project (before dip setup exists).gem install rails before project creation.dip (for example, dip bundle install, dip bundle add ..., dip bundle outdated).dip is missing in local development, explicitly offer the user to install it with gem install dip.dip. Do not use host-installed PostgreSQL, Redis, Node/Yarn, or other project services for Rails project operations unless the user explicitly asks for a non-container setup.docker volume reset is allowed only inside the imported/adapted script/dump/restore flow if needed to match the reference local restore behavior. In this project's own convention, the top-level entry point is bin/dump -d ENVIRONMENT, not ./dump ENVIRONMENT.dip reports that a required port is already in use or a container cannot be created because a name is already used, pause the task. Ask the user to free the needed resources, or explain the project-local configuration changes needed to use different ports/container names and wait for confirmation before changing them.bundle, bin/rails, bin/rspec, docker, or docker-compose commands for local development project operations.View policy:
.erb templates..erb, migrate it to .haml as part of the change when safe.tailwindcss-rails gem for Tailwind integration.app/helpers/; put UI markup in views or ViewComponents, JavaScript in Stimulus or separate .js files, and CSS in Tailwind or separate .css files.content_tag or similar helpers. Use explicit tag syntax such as %p for <p>, %span for <span>, and so on.[, ], /, (, ), or , into shorthand form on the tag itself, for example %p.inline-flex.w-fit.items-center instead of %p{ class: 'inline-flex w-fit items-center' }.<div> elements in HAML, use the bare shorthand class syntax like .class1.class2 instead of %div.class1.class2. Keep only complex class names in the class: hash alongside other attributes.Testing policy:
dip rspec (not direct rspec/bin/rspec). In CI, use CI-native test commands and services; do not use dip.Secrets policy:
.env*, secret manager) or in repository/CI secret storage.agents/recipes/save-rails-secrets-1password.md.1Password as the recommended option because this skill already has implemented and tested guidance for it; also mention alternatives such as Bitwarden..env* files, clearly warn that this is not safe, the keys may be lost with the machine or filesystem, and recovery may be impossible without backups.Host environment policy:
.bashrc, .zshrc, .psqlrc, .irbrc, and similar shell/editor/database client config files.This skill includes focused guidance under agents/. Keep the main workflow in this file, then load only the matching guidance files for the active task.
Load files only when needed:
agents/rails.md for Rails conventions, migrations, models, routes, seeds, configuration, services, and deployment command shape.agents/testing.md when adding or changing specs, factories, feature coverage, or Tramway entity page tests.agents/ui.md when changing Haml views, ViewComponents, Tailwind, page layout, buttons, tables, flashes, or form markup.agents/tramway.md is mandatory when the task touches CRUD, create/update forms, decorators, entities, components, or Tramway-specific controller/view patterns.agents/integrations.md when the task touches third-party services, service objects, background jobs, controller orchestration, or external APIs.agents/documentation.md when the task changes a user-visible feature or workflow that should be reflected in docs/users/.agents/recipes.md when the user asks for a usual implementation pattern or the task clearly matches an existing feature recipe. After opening the index, load only the specific recipe file that matches the feature.agents/recipes/create-rails-project.md when the user asks to create a new Rails project. Claude Code: Read agents/recipes/create-rails-project.md relative to this SKILL.md's directory; if that directory is unknown, try ~/.claude/skills/tramway-skill/agents/recipes/create-rails-project.md, then skills/tramway-skill/agents/recipes/create-rails-project.md.agents/recipes/deployment-recipe.md when the user asks to implement deployment, update deployment, or add deployment during new-project setup. Claude Code: Read agents/recipes/deployment-recipe.md relative to this SKILL.md's directory; if that directory is unknown, try ~/.claude/skills/tramway-skill/agents/recipes/deployment-recipe.md, then skills/tramway-skill/agents/recipes/deployment-recipe.md.agents/recipes/save-rails-secrets-1password.md when the user asks how to save config/master.key, Rails credentials keys, staging/production secrets, or deployment secrets, and whenever create/update/deployment work introduces or touches those secrets. Claude Code: Read agents/recipes/save-rails-secrets-1password.md relative to this SKILL.md's directory; if that directory is unknown, try ~/.claude/skills/tramway-skill/agents/recipes/save-rails-secrets-1password.md, then skills/tramway-skill/agents/recipes/save-rails-secrets-1password.md.agents/recipes/add-flash-messages.md when the user asks to add, fix, render, or standardize flash messages or notifications. Claude Code: Read agents/recipes/add-flash-messages.md relative to this SKILL.md's directory; if that directory is unknown, try ~/.claude/skills/tramway-skill/agents/recipes/add-flash-messages.md, then skills/tramway-skill/agents/recipes/add-flash-messages.md.agents/recipes/favicon.md when the user asks to add, update, generate, use, place, wire, or standardize favicons, browser tab icons, Apple touch icons, Android/PWA icons, or a web app manifest. Also load it when the user mentions a file such as favicon.png, favicon.ico, icon.png, logo.png, or an uploaded/provided image that should be used as the site's favicon or browser tab icon. Claude Code: Read agents/recipes/favicon.md relative to this SKILL.md's directory; if that directory is unknown, try ~/.claude/skills/tramway-skill/agents/recipes/favicon.md, then skills/tramway-skill/agents/recipes/favicon.md.<resource>#show that calls <event_or_method> for the object", load agents/recipes.md and then agents/recipes/state-change-recipe.md before designing routes or controller actions.agents/recipes/pagination.md when the user asks to add pagination to any list of records. Claude Code: Read agents/recipes/pagination.md relative to this SKILL.md's directory; if that directory is unknown, try ~/.claude/skills/tramway-skill/agents/recipes/pagination.md, then skills/tramway-skill/agents/recipes/pagination.md.agents/product_design.md is mandatory whenever a task adds, changes, or reviews a model's attributes (columns, data/jsonb keys, derived fields) — load it before designing the attribute so duplicate or overlapping attributes get caught and proposed for consolidation instead of created.agents/rails-versions.md is mandatory during Start-of-Skill Context Check (see "0) Start-of-Skill Context Check"), new project creation, and Rails/dependency update or upgrade work, to apply or gate version-specific best practices.Usage rules:
agents/*.md file by default.SKILL.md.agents/recipes/ and link it from agents/recipes.md.Use https://github.com/purple-magic/base_project as the main reference for baseline project structure and configuration.
Rules:
main branch.<project_name>/current repo values).base_project).https://github.com/purple-magic/base_project.
18a. Never save, or ask the user to save, non-secret values (for example APP_NAME, KAMAL_REGISTRY_USERNAME, TELEGRAM_BOT_USERNAME, hostnames, regions, fingerprints) in 1Password or any password manager. Only real secrets go there; see "Secret vs Non-Secret" in agents/recipes/save-rails-secrets-1password.md.Implement deployment, treat that as an explicit request to add or update deployment configuration.Implement deployment, always check and implement all of these areas together:
staging and productionstaging and production through the hosting provider's API or CLI, driven by bin/setup -d <environment> and bin/remove_fully -d <environment> (no Terraform)bin/setup, bin/deploy, bin/logs, bin/console, bin/remove, bin/remove_fully (Ruby, see agents/recipes/deployment-recipe.md "Deployment Management Scripts") for infra/deploy management, not Makefile targetsAGENTS.md/CLAUDE.md updated so agents use those bin/ scripts instead of raw kamal commands (see agents/recipes/deployment-recipe.md "Deployment Management Scripts" rule 9)Implement deployment, use the same approach as the reference project and use the reference project files/configuration as the source whenever they are applicable to the current project.Implement deployment, treat partial deployment setup as incomplete until all five areas above are covered or explicitly skipped by the user..gitignore, AGENTS.md, bin/setup/bin/deploy/bin/logs/bin/console/bin/remove/bin/remove_fully, deployment configuration, and server provisioning scripts in addition to the usual app/tooling review.update deployment, treat that as an explicit request to apply all applicable deployment-related setup from the reference project, including deployment configuration, bin/setup/bin/deploy/bin/logs/bin/console/bin/remove/bin/remove_fully, AGENTS.md/CLAUDE.md deployment-command guidance, and the server-provisioning flow (including migrating a leftover terraform/ setup away from Terraform).
27a. For Implement deployment and update deployment, before editing any file, follow "Tooling Preflight" in agents/recipes/deployment-recipe.md: detect which required tools the user already has (kamal, docker, hosting provider CLI, gh, op, ssh key, etc.), show what is missing or not authenticated, and offer to install the missing ones right away (with approval, exact command shown). After installing, follow "Guided Tool Setup": authenticate (prefer browser/OAuth login or an MCP server over pasted tokens) and configure dependent values (SSH keys, region/size/image, DNS) right away. Offer server creation through a provider MCP server or browser console as an alternative to bin/setup (see "Creating Servers Without bin/setup"), and always remind the user that servers are paid and need usage monitoring..kamal/secrets must not contain shell if statements. Keep conditional secret resolution in project scripts or external secret tooling, and keep .kamal/secrets as a simple declarative secret-loading file.Implement dump, implement dump and restore, dump database to local environment, dump database, or equivalent, treat that as an explicit request to add the reference-project database dump/restore workflow, adapted to this project's own command convention. Use the same operator experience as the reference project but with the final entry point relocated and reshaped: the user runs bin/dump -d ENVIRONMENT and the remote database is dumped, downloaded, and restored into the local development database.main and adapt them to the current project:
dump (adapt into bin/dump, taking -d ENVIRONMENT instead of a positional ENVIRONMENT argument)script/dump/prepare_secrets.rbscript/dump/restoreconfig/database.yml only as needed to determine local/remote database naming and credential shape.bin/dump -d <environment> (not ./dump <environment>).ruby script/dump/prepare_secrets.rb "$ENVIRONMENT".MAIN_HOST can come from the project's recorded server data (.kamal/servers.yml, see agents/recipes/deployment-recipe.md) or environment variable.prepare_secrets.rb, inspect how the current project's Kamal deployment already gets secrets and use that same source for database host/user/password/name.kamal app exec -d "$ENVIRONMENT" and pg_dump --format=custom --encoding=UTF8 --no-owner.docker run, always add --log-driver none so Docker does not copy the dump stdout into the container log and fill the server disk.scp.pg_restore --clean --if-exists --no-owner into the development database.EXCLUDED_TABLES=(...) approach in dump, placed into bin/dump.pg_dump as --exclude-table-data=<table> so table schemas are restored but their rows are skipped.bin/dump -d <environment>; do not add table names as command-line arguments unless the reference project changes to that approach.base_project_storage with the current Kamal storage volume name;base_project_development with the current project's development database;root@$MAIN_HOST..kamal/servers.yml, local environment variables, or confirmed local secret storage following the secrets policy.bin/dump with bash -n bin/dump;ruby -c script/dump/prepare_secrets.rb and ruby -c script/dump/restore;bin/dump prints usage or exits predictably when -d / an environment is not provided.Before any other step, determine whether the current working directory is a Rails project. Determine this only by checking for these paths:
config/application.rbconfig.ruGemfileDo not list or scan all files in the directory for this detection step.
Do not describe technical detection details to the user. Only state the conclusion.
If inside a Rails project, tell the user you figured out you are in a Rails project and list what you can do there, for example:
Immediately after this, load agents/rails-versions.md and check the project's Rails version (from Gemfile.lock's rails (X.Y.Z) line, or Gemfile if Gemfile.lock is absent):
8.1.4, tell the user that this skill's Rails-version best-practice guidance currently only covers Rails 8.1.4 and higher, so no version-specific suggestions will be applied for their current version.8.1.4 or higher, apply the matching guidance from agents/rails-versions.md for that version during feature, update/upgrade, and maintenance work.If not inside a Rails project, tell the user you figured out you are not in a Rails project and that you can create a best-practice, fully configured Rails project with:
If Rails project detection passed, inspect before changing anything:
test -f Gemfile
test -f config.ru
test -f config/application.rb
ls -la
Detect key rails signals:
Gemfile, Gemfile.lockconfig/application.rb, config/environments/*config/database.yml, db/schema.rb or db/structure.sqlspec/, test/, CI configdip.yml, dip*, Procfile*, docker-compose*Choose execution path from project tooling. Use dip as the default command runner only for local development. For production, staging, and CI, use the environment's native commands and service definitions; do not use dip.
Run the smallest setup path first:
dip bundle install
dip rails db:prepare
If unavailable, run equivalent steps:
dip bundle install
dip rails db:prepare
Verify app boots:
dip rails runner 'puts Rails.version'
dip rails zeitwerk:check
If setup fails, capture exact command, error, and missing dependency before attempting fixes.
If dip is not available in local development, ask user whether to install it and use:
gem install dip
When asked to create a new Rails project, load agents/recipes/create-rails-project.md and follow it as the authoritative workflow.
That recipe includes the required repository, reference-project import, local dip setup, HAML/Tailwind baseline, deployment handoff, and mandatory config/master.key storage guidance.
If the new project setup creates, reads, rotates, or references config/master.key or config/credentials/*.key, also load agents/recipes/save-rails-secrets-1password.md and run that recipe before continuing past the secret-handling step.
Treat a request like Implement deployment as a full deployment-systems task, not a narrow single-file change.
Load agents/recipes/deployment-recipe.md and follow its "Implement deployment" path. Also load agents/recipes/save-rails-secrets-1password.md before requesting, configuring, or documenting RAILS_MASTER_KEY, config/master.key, Rails credentials keys, staging secrets, production secrets, provider tokens, or repository secrets.
Treat a request like update deployment as a deployment-sync task against the reference project.
Load agents/recipes/deployment-recipe.md and follow its "Update deployment" path. Also load agents/recipes/save-rails-secrets-1password.md if the update touches secret storage, repository secrets, Rails credentials, or .kamal/secrets.
Treat a request like Implement dump, implement dump and restore, or dump database to local environment as an operations-tooling task based on the reference project.
Load agents/rails.md for database and deployment command conventions. Also load agents/integrations.md if the current dump/restore flow depends on external providers or deployment secrets.
Required scope:
config/database.ymlconfig/deploy.ymlconfig/deploy.<environment>.yml.kamal/secrets*config/secrets*bin/kamal.kamal/servers.yml (gitignored recorded server data)dip.ymlbin/dump, dump, or script/dump/main:
dumpscript/dump/prepare_secrets.rbscript/dump/restorebin/dump -d ENVIRONMENT.
bin/dump, not at the repository root as dump.-d flag (e.g. bin/dump -d production) instead of a positional argument.prepare_secrets.rb responsible for resolving MAIN_HOST, DB_HOST, POSTGRES_DB, POSTGRES_PASSWORD, and POSTGRES_USER.config/deploy*.yml env.clear, env.secret, accessories, builder/registry secrets, .kamal/secrets*, config/secrets*, bin/kamal, and any scripts those files call.prepare_secrets.rb to read database secrets through the same mechanism Kamal already uses: Rails credentials, .kamal/secrets, 1Password/op, dotenv, repository/env variables, or another project-local secret command..kamal/servers.yml via KamalCli, or the MAIN_HOST environment variable).dump script's static EXCLUDED_TABLES=(...) pattern inside bin/dump. Put the user's chosen excluded tables there, together with applicable reference defaults.pg_restore.root.bin/dump -d ENVIRONMENT for validation unless the user explicitly confirms they want to overwrite local data.bash -n bin/dumpruby -c script/dump/prepare_secrets.rbruby -c script/dump/restoretest -x bin/dumpbin/dump -d <environment>;Load the smallest matching set from agents/ before implementation:
agents/testing.md for spec conventions and coverage shapeagents/ui.md for views/components/forms/layout workagents/tramway.md is mandatory for any CRUD flow, including index, show, new, edit, create, update, and destroyagents/integrations.md for services/jobs/external APIsagents/documentation.md when the feature is user-visibleagents/recipes.md plus one matching recipe when the feature matches an existing implementation patternagents/recipes/state-change-recipe.md when the user asks for a button that calls a record method or event and the purpose is to move that record through a business state, even if the user does not use the word "state".erb.Load the same focused agents/ files as feature work, but only for the surfaces touched by the bug. Add agents/documentation.md only if the bugfix changes visible behavior or user workflow documentation.
Load only the agents/ files that match the code surface being refactored so the refactor preserves the established patterns for that layer.
Start with fast, deterministic signals:
dip rails routes | head
dip rails runner 'puts ActiveRecord::Base.connection_db_config.database'
For failing tests:
dip rspec path/to/spec.rb:123
dip rspec --seed <seed>
For runtime issues:
development, test, production).Avoid speculative rewrites before reproduction is stable.
Rules:
Before merge:
dip rails db:migrate
dip rails db:rollback STEP=1
dip rails db:migrate
If project uses structure.sql, ensure dump is updated by project convention.
Prefer incremental upgrades:
agents/rails-versions.md and apply any best practices listed for the new version. If the new version is lower than 8.1.4, tell the user this skill has no version-specific guidance for it yet.For each bump:
tramway gem, get the target tramway version first and replace the version in the project's Gemfile explicitly instead of leaving it implicit.tramway gem version was upgraded, it is mandatory to run dip rails g tramway:install in local development right after the bundle update step before broader validation.Use:
dip bundle outdated
dip brakeman -q
dip rubocop
If command wrappers exist in project, use them instead.
Use this feature whenever the user asks for update, upgrade, or periodic maintenance.
Procedure:
main branch (no local clone)..env* provider tokens, unencrypted .env* files, or another local approach).config/master.key or config/credentials/*.key, explicitly warn that these files are mandatory recovery material, are ignored by git, and must be saved in a secure place before secret-related update work continues. Load and run agents/recipes/save-rails-secrets-1password.md when the user asks for help saving them or when new staging/production secrets must be stored.1Password first because it is implemented and tested via this skill.Bitwarden and other secure methods the user prefers as acceptable alternatives.tramway gem version and replace the project's Gemfile tramway version with that exact version when needed.tramway gem version changed to a newer version, running dip rails g tramway:install in local development is mandatory and must happen before the rest of the update validation..gitignoreAGENTS.mdbin/setup, bin/deploy, bin/logs, bin/console, bin/remove, bin/remove_fully, lib/kamal_cli.rb, lib/server_provider.rbconfig/deploy.yml, config/deploy.staging.yml, config/deploy.production.ymllib/server_provider.rb (and any leftover terraform/ directory that still needs migrating).gitignore, AGENTS.md, and deployment-related updates are applicable, apply/adapt them as part of the project update instead of skipping them by default. When deployment files are included, load agents/recipes/deployment-recipe.md..erb)..gitignore, AGENTS.md, bin/setup/bin/deploy/bin/logs/bin/console/bin/remove/bin/remove_fully, deployment, and server-provisioning updates were applied or skipped and why.CI parity rule during updates/upgrades:
.github/workflows aligned with applicable updates from the reference project.Discord.Minimum validation:
dip rails zeitwerk:check
dip rails db:prepare
dip rspec
Before release:
After release:
When reporting progress:
Use concrete file paths and commands. Avoid vague "should work" conclusions.
Load only what is needed:
references/commands.mdreferences/checklists.mdCHANGELOG.md (opens in a new tab)VERSION (opens in a new tab)agents/documentation.md (opens in a new tab)agents/integrations.md (opens in a new tab)agents/openai.yaml (opens in a new tab)agents/product_design.md (opens in a new tab)agents/rails-versions.md (opens in a new tab)agents/rails.md (opens in a new tab)agents/recipes.md (opens in a new tab)agents/recipes/add-flash-messages.md (opens in a new tab)agents/recipes/copy-feature.md (opens in a new tab)agents/recipes/create-feature.md (opens in a new tab)agents/recipes/create-rails-project.md (opens in a new tab)agents/recipes/deployment-recipe.md (opens in a new tab)agents/recipes/favicon.md (opens in a new tab)agents/recipes/pagination.md (opens in a new tab)agents/recipes/save-rails-secrets-1password.md (opens in a new tab)agents/recipes/set-form.md (opens in a new tab)agents/recipes/state-change-recipe.md (opens in a new tab)agents/recipes/tramway-chat-lazy-loading.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
/tramway-skill:tramway-skillfrom tramway-skill
npx claudepluginhub purple-magic/tramway-skill --plugin tramway-skill