[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7EQTH267WD4FYKSXP21MQYA":3,"skill-same:01M7EQTH267WD4FYKSXP21MQYA":83},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":39,"commitSha":40,"skillDirectory":41,"forksCount":42,"repositoryHtmlUrl":43,"repositoryHomepageUrl":6,"ownerHtmlUrl":44,"ownerBlogUrl":6,"ownerDescription":45,"updatedAt":46,"install":47,"resources":60},"01M7EQTH267WD4FYKSXP21MQYA","rails",null,"Use when building or maintaining a Ruby on Rails app — models, controllers, views, routes and migrations; ActiveRecord associations, scopes and query performance; Hotwire (Turbo and Stimulus) UI; Active Job or Solid Queue background work; and Rails tests. Covers N+1 queries, migration safety on live tables, and flaky system tests around Turbo Frames. NOT plain Ruby scripts, gems or CLIs with no Rails loaded (that is `ruby`).","lza6\u002FArmor-piercing-system-prompts","lza6","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F128880206?v=4","01M7EB3K7WPX5T28EJ2NVHE6EG","Chinese-tingfeng","01M7EB3K97E1KQ16QWKJMFNGX8",11,"MIT","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F04-安全渗透\u002Frails\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: rails\ndescription: \"Use when building or maintaining a Ruby on Rails app — models, controllers, views, routes and migrations; ActiveRecord associations, scopes and query performance; Hotwire (Turbo and Stimulus) UI; Active Job or Solid Queue background work; and Rails tests. Covers N+1 queries, migration safety on live tables, and flaky system tests around Turbo Frames. NOT plain Ruby scripts, gems or CLIs with no Rails loaded (that is `ruby`).\"\ntags: [rails, activerecord, hotwire, turbo, stimulus, solid-queue, minitest]\nrecommends: [ruby, postgresdb, testing-web, deployment, db-migrations]\nprofiles: []\norigin: risco\n---\n\n# Build Rails the omakase way\n\nWrite Rails the way a core-adjacent senior would: fat-enough models, skinny\ncontrollers, zero N+1, strong parameters, migrations that are reversible and safe on a\nlive table, and tests that exercise the request rather than the implementation. Lean\ninto the Rails 8 \"omakase\" defaults instead of fighting them — the framework already\nmade the boring choices for you.\n\nThis is **Rails the framework**: the MVC request cycle, ActiveRecord, Hotwire, Active\nJob, the Rails test stack. The moment code stops loading Rails — a plain script, a gem,\nan `Enumerable` refactor with no `ActiveRecord` in sight — it is no longer this skill.\nThat is `ruby` (see `..\u002Fruby\u002FSKILL.md`).\n\n## Target versions\n\n```text\nRails        8.1   (stable line, released 2025-10-22; 8.0 shipped 2024-11-07)\nRuby         3.4+  (floor for current Rails)\nJobs\u002Fqueue   Solid Queue   (default Active Job backend — database-backed, no Redis)\nCache        Solid Cache   (default cache store — database-backed)\nWebSockets   Solid Cable   (default Action Cable adapter — database-backed)\nAssets       Propshaft     (default; Sprockets is legacy)\nJS           Importmaps    (default; no Node build step required)\nDeploy       Kamal 2 + Thruster\nFront-end    Hotwire = Turbo 8 + Stimulus\nAuth         `rails generate authentication`  (built in; no Devise for basic auth)\n```\n\nA fresh Rails 8 app needs **no Redis and no Node**. Stop reaching for Sidekiq\u002FRedis or\na JS bundler by reflex — the Solid trifecta and Importmaps already cover the default\ncase. Rails 8.1 adds Active Job Continuations (resumable long jobs), Structured Event\nReporting, local CI via `config\u002Fci.rb`, and Markdown rendering.\n\n## When to use\n\n- Generating\u002Fediting anything under `app\u002F` (models, controllers, views, jobs, mailers,\n  channels), `config\u002Froutes.rb`, or `db\u002Fmigrate\u002F`.\n- ActiveRecord work: associations, scopes, validations, callbacks, `includes`\u002F`preload`\u002F\n  `eager_load`, query objects, migrations.\n- Hotwire UI: Turbo Frames\u002FStreams, morphing, Stimulus controllers, broadcasts.\n- Background work via Active Job \u002F Solid Queue; fragment caching via Solid Cache.\n- Rails testing: Minitest model\u002Fintegration\u002Fsystem tests, fixtures, RSpec + Capybara,\n  debugging flaky Turbo system tests.\n- Upgrading a Rails app or migrating off Redis\u002FSidekiq onto the Solid stack.\n\n## When NOT to use\n\n- Plain Ruby with no Rails loaded — scripts, gems, CLIs, Bundler packaging → `ruby`.\n- PHP\u002FLaravel → `laravel`. Python\u002FDjango → `django`. (Route by the language\u002Fframework\n  the file actually uses.)\n- Pure engine-level schema\u002Findex\u002Flocking depth not expressed as an AR migration →\n  `postgresdb` \u002F `mysql` \u002F `db-migrations`.\n- Host\u002Fcontainer\u002FCI provisioning (Kamal host setup, Docker, runners) → `deployment` \u002F\n  `docker` \u002F `github-actions`. This skill writes the Rails-side glue, then hands off.\n\n## The request cycle — where logic lives\n\nRoute → controller → model → view. Keep each layer doing one job.\n\n- **Controllers stay skinny.** A controller action finds\u002Fbuilds objects, calls one\n  domain method, and renders\u002Fredirects. Why: a controller fat with business rules is\n  untestable except through the full HTTP stack and impossible to reuse.\n- **Domain logic lives on the model.** Validations, scopes, state transitions, and\n  computed attributes belong on the AR class. Why: that is where the data and its\n  invariants already are.\n- **Extract a PORO\u002Fservice object only when** a method spans 2+ models or does external\n  IO (payment, email, third-party API). Don't pre-extract — a one-model method is just\n  a model method. Why: premature service objects scatter logic that AR would hold fine.\n\n```ruby\n# Good: skinny controller, domain logic on the model.\nclass PostsController \u003C ApplicationController\n  def create\n    @post = Current.user.posts.build(post_params)\n    if @post.publish   # model method owns the rule\n      redirect_to @post, notice: \"Published\"\n    else\n      render :new, status: :unprocessable_entity\n    end\n  end\n\n  private\n\n  def post_params\n    params.expect(post: [:title, :body])   # Rails 8 strong params\n  end\nend\n```\n\n## ActiveRecord\n\nAssociations, validations, and scopes are the vocabulary — use them before writing raw\nSQL or manual loops.\n\n```ruby\nclass Post \u003C ApplicationRecord\n  belongs_to :author, class_name: \"User\"\n  has_many :comments, dependent: :destroy\n\n  validates :title, presence: true, length: { maximum: 120 }\n  scope :published, -> { where.not(published_at: nil) }\n\n  def publish\n    update(published_at: Time.current)\n  end\nend\n```\n\n**Kill N+1 with eager loading.** The classic footgun is touching an association inside\na loop, firing one query per row.\n\n```ruby\n# Bad: 1 query for posts + 1 per post for its author (N+1).\nPost.published.each { |p| puts p.author.name }\n\n# Good: 2 queries total — posts, then all authors in one IN(...).\nPost.published.includes(:author).each { |p| puts p.author.name }\n```\n\nGate it: add the `bullet` gem in development, or mark a hot association\n`strict_loading` so an accidental lazy load raises instead of silently degrading.\n\n**Migrations must be reversible and safe on a live table.** A migration that locks a\nlarge table blocks every reader and writer for its duration.\n\n```ruby\n# Good: a Postgres index built without an exclusive table lock.\nclass AddIndexToPostsOnAuthor \u003C ActiveRecord::Migration[8.1]\n  disable_ddl_transaction!   # required — concurrent index can't run in a txn\n  def change\n    add_index :posts, :author_id, algorithm: :concurrently\n  end\nend\n```\n\nRules: never `add_column ..., default:` on a huge legacy table without checking your\nRails\u002FPostgres version handles it without a full rewrite; backfill data in batches with\n`find_each` or `update_all`, not one giant `UPDATE` in the migration; add the\n`strong_migrations` gem so unsafe operations fail in review, not in production.\n\nDeeper AR — query objects, `strict_loading`, counter caches, composite primary keys,\nadvisory locks, per-operation safe-migration recipes (add column, rename, backfill in\nbatches) — is in `references\u002Factiverecord.md`.\n\n## Hotwire\n\nHotwire is the default front-end: Turbo for navigation\u002Fupdates, Stimulus for behavior.\nReach for the lightest tool that does the job.\n\n| Need | Use | Why |\n|------|-----|-----|\n| Faster full-page navigation, no code | Turbo Drive (on by default) | Free; intercepts links\u002Fforms |\n| Replace one bounded region after an action | Turbo **Frame** | Scoped DOM swap, no JS |\n| Update several elements \u002F push from server | Turbo **Stream** | Targeted append\u002Freplace\u002Fremove + broadcasts |\n| Re-render a whole page and keep scroll\u002Ffocus | **Morphing** (Turbo 8) | Diffs the DOM; kills most custom Stream choreography |\n| Client behavior (toggle, copy, debounce) | Stimulus controller | Sprinkle, not a SPA |\n\nDefault to Turbo Drive and morphing; only hand-write a Turbo Stream when you need to\ntouch elements that morphing can't infer (e.g. prepend to a list from a broadcast).\n\n```javascript\n\u002F\u002F app\u002Fjavascript\u002Fcontrollers\u002Fclipboard_controller.js\nimport { Controller } from \"@hotwired\u002Fstimulus\"\n\nexport default class extends Controller {\n  static targets = [\"source\"]\n  static values = { successText: { type: String, default: \"Copied!\" } }\n\n  copy() {\n    navigator.clipboard.writeText(this.sourceTarget.value)\n  }\n}\n```\n\nWorked Frame\u002FStream\u002Fmorph examples, model broadcasting (`broadcasts_to`), Stimulus\nvalues\u002Ftargets\u002Foutlets, and how to system-test Turbo are in `references\u002Fhotwire.md`.\n\n## Background jobs & caching\n\nUse Active Job over **Solid Queue** (the Rails 8 default). Two non-negotiable rules:\n\n- **Jobs take serializable arguments — pass IDs, not records.** Why: a serialized AR\n  object goes stale between enqueue and run; an ID is re-fetched fresh.\n- **Jobs must be idempotent.** Why: retries and at-least-once delivery mean a job can\n  run twice; design so the second run is a no-op.\n\n```ruby\nclass CommentNotificationJob \u003C ApplicationJob\n  queue_as :default\n\n  def perform(comment_id)\n    comment = Comment.find_by(id: comment_id)\n    return unless comment   # idempotent: nothing to do if it's gone\n    CommentMailer.posted(comment).deliver_now\n  end\nend\n```\n\nFor genuinely long work (large backfills, bulk exports) use **Active Job Continuations**\n(Rails 8.1) so a job can checkpoint and resume instead of restarting from zero. Cache\nexpensive view fragments with the `cache` helper backed by Solid Cache:\n\n```erb\n\u003C% cache @post do %>\n  \u003C%= render @post.comments %>\n\u003C% end %>\n```\n\nDo **not** add Sidekiq\u002FRedis to a Rails 8 app unless a real, stated throughput or\nlatency requirement justifies the extra moving part. Solid Queue covers the default\ncase on the database you already run.\n\n## Testing\n\nMinitest + fixtures is the framework default; parallel execution is on by default.\nRSpec-rails (8.x) is the popular alternative. Pick one and exercise behavior through the\nrequest, never private methods.\n\n| Test type | Base class | Tests |\n|-----------|-----------|-------|\n| Model \u002F unit | `ActiveSupport::TestCase` | validations, scopes, domain methods |\n| Integration | `ActionDispatch::IntegrationTest` | a request → response, status, redirects |\n| System (browser) | `ApplicationSystemTestCase` | end-to-end UI incl. Turbo\u002FStimulus |\n| Job | `ActiveJob::TestCase` | enqueue + `perform` behavior |\n\nFixtures (default) are fast and load once; reach for factories (FactoryBot) only when\nper-test object variation gets unwieldy. **Flaky Turbo system test?** It's almost always\na timing race: never `sleep`. Use Capybara's auto-waiting matchers (`assert_selector`,\n`assert_text`, `assert_no_selector`) which retry until the DOM settles, and swap the\ndefault Selenium driver for **Cuprite or Playwright** to cut Turbo-timing flake.\n\nMinitest vs RSpec layout, fixtures gotchas, driver config, parallelization, and\nrequest-spec \u002F broadcast-testing patterns are in `references\u002Ftesting.md`.\n\n## Anti-patterns\n\n| Anti-pattern | Why it bites | Do instead |\n|--------------|--------------|------------|\n| Business logic in the controller | Untestable except through HTTP; not reusable | Push it onto the model; service object only for cross-model\u002FIO |\n| Callback soup (`after_save` chains for business rules) | Hidden order-dependent side effects, brutal to test | Explicit method called from the action; reserve callbacks for data hygiene |\n| Touching an association in a loop | N+1 — one query per row, silent in dev | `includes`\u002F`preload`\u002F`eager_load`; gate with `bullet`\u002F`strict_loading` |\n| Blocking DDL on a big live table | Locks readers + writers for the whole migration | `disable_ddl_transaction!` + `algorithm: :concurrently`; `strong_migrations` |\n| Passing AR records into jobs | Stale serialized state; fails on retry | Pass IDs, re-`find` inside `perform` |\n| Adding Sidekiq\u002FRedis to a Rails 8 app by reflex | A new daemon + dependency for nothing | Solid Queue is the default; add Sidekiq only for a stated need |\n| Queries or business logic in views | N+1 + logic you can't test | Prepare in controller\u002Fmodel; views only render |\n| Testing private methods | Locks tests to internals; refactors break green tests | Test observable behavior through the request |\n| Hand-rolled `fetch`\u002FJS for live updates | Reinvents what Turbo gives free | Turbo Stream or morphing |\n\n## Verify\n\nRun `scripts\u002Fverify.sh` inside a Rails app for a read-only static gate: it runs RuboCop\n(if rubocop-rails is configured) and `bin\u002Frails zeitwerk:check`, and greps for the\nstatically-detectable anti-patterns above (Sidekiq\u002FRedis in a default app, `.all.each`\nmass loads, a concurrent `add_index` missing `disable_ddl_transaction!`). It skips any\ncheck whose tooling is absent and exits non-zero only on a hard violation.\n","# Build Rails the omakase way\n\nWrite Rails the way a core-adjacent senior would: fat-enough models, skinny\ncontrollers, zero N+1, strong parameters, migrations that are reversible and safe on a\nlive table, and tests that exercise the request rather than the implementation. Lean\ninto the Rails 8 \"omakase\" defaults instead of fighting them — the framework already\nmade the boring choices for you.\n\nThis is **Rails the framework**: the MVC request cycle, ActiveRecord, Hotwire, Active\nJob, the Rails test stack. The moment code stops loading Rails — a plain script, a gem,\nan `Enumerable` refactor with no `ActiveRecord` in sight — it is no longer this skill.\nThat is `ruby` (see `..\u002Fruby\u002FSKILL.md`).\n\n## Target versions\n\n```text\nRails        8.1   (stable line, released 2025-10-22; 8.0 shipped 2024-11-07)\nRuby         3.4+  (floor for current Rails)\nJobs\u002Fqueue   Solid Queue   (default Active Job backend — database-backed, no Redis)\nCache        Solid Cache   (default cache store — database-backed)\nWebSockets   Solid Cable   (default Action Cable adapter — database-backed)\nAssets       Propshaft     (default; Sprockets is legacy)\nJS           Importmaps    (default; no Node build step required)\nDeploy       Kamal 2 + Thruster\nFront-end    Hotwire = Turbo 8 + Stimulus\nAuth         `rails generate authentication`  (built in; no Devise for basic auth)\n```\n\nA fresh Rails 8 app needs **no Redis and no Node**. Stop reaching for Sidekiq\u002FRedis or\na JS bundler by reflex — the Solid trifecta and Importmaps already cover the default\ncase. Rails 8.1 adds Active Job Continuations (resumable long jobs), Structured Event\nReporting, local CI via `config\u002Fci.rb`, and Markdown rendering.\n\n## When to use\n\n- Generating\u002Fediting anything under `app\u002F` (models, controllers, views, jobs, mailers,\n  channels), `config\u002Froutes.rb`, or `db\u002Fmigrate\u002F`.\n- ActiveRecord work: associations, scopes, validations, callbacks, `includes`\u002F`preload`\u002F\n  `eager_load`, query objects, migrations.\n- Hotwire UI: Turbo Frames\u002FStreams, morphing, Stimulus controllers, broadcasts.\n- Background work via Active Job \u002F Solid Queue; fragment caching via Solid Cache.\n- Rails testing: Minitest model\u002Fintegration\u002Fsystem tests, fixtures, RSpec + Capybara,\n  debugging flaky Turbo system tests.\n- Upgrading a Rails app or migrating off Redis\u002FSidekiq onto the Solid stack.\n\n## When NOT to use\n\n- Plain Ruby with no Rails loaded — scripts, gems, CLIs, Bundler packaging → `ruby`.\n- PHP\u002FLaravel → `laravel`. Python\u002FDjango → `django`. (Route by the language\u002Fframework\n  the file actually uses.)\n- Pure engine-level schema\u002Findex\u002Flocking depth not expressed as an AR migration →\n  `postgresdb` \u002F `mysql` \u002F `db-migrations`.\n- Host\u002Fcontainer\u002FCI provisioning (Kamal host setup, Docker, runners) → `deployment` \u002F\n  `docker` \u002F `github-actions`. This skill writes the Rails-side glue, then hands off.\n\n## The request cycle — where logic lives\n\nRoute → controller → model → view. Keep each layer doing one job.\n\n- **Controllers stay skinny.** A controller action finds\u002Fbuilds objects, calls one\n  domain method, and renders\u002Fredirects. Why: a controller fat with business rules is\n  untestable except through the full HTTP stack and impossible to reuse.\n- **Domain logic lives on the model.** Validations, scopes, state transitions, and\n  computed attributes belong on the AR class. Why: that is where the data and its\n  invariants already are.\n- **Extract a PORO\u002Fservice object only when** a method spans 2+ models or does external\n  IO (payment, email, third-party API). Don't pre-extract — a one-model method is just\n  a model method. Why: premature service objects scatter logic that AR would hold fine.\n\n```ruby\n# Good: skinny controller, domain logic on the model.\nclass PostsController \u003C ApplicationController\n  def create\n    @post = Current.user.posts.build(post_params)\n    if @post.publish   # model method owns the rule\n      redirect_to @post, notice: \"Published\"\n    else\n      render :new, status: :unprocessable_entity\n    end\n  end\n\n  private\n\n  def post_params\n    params.expect(post: [:title, :body])   # Rails 8 strong params\n  end\nend\n```\n\n## ActiveRecord\n\nAssociations, validations, and scopes are the vocabulary — use them before writing raw\nSQL or manual loops.\n\n```ruby\nclass Post \u003C ApplicationRecord\n  belongs_to :author, class_name: \"User\"\n  has_many :comments, dependent: :destroy\n\n  validates :title, presence: true, length: { maximum: 120 }\n  scope :published, -> { where.not(published_at: nil) }\n\n  def publish\n    update(published_at: Time.current)\n  end\nend\n```\n\n**Kill N+1 with eager loading.** The classic footgun is touching an association inside\na loop, firing one query per row.\n\n```ruby\n# Bad: 1 query for posts + 1 per post for its author (N+1).\nPost.published.each { |p| puts p.author.name }\n\n# Good: 2 queries total — posts, then all authors in one IN(...).\nPost.published.includes(:author).each { |p| puts p.author.name }\n```\n\nGate it: add the `bullet` gem in development, or mark a hot association\n`strict_loading` so an accidental lazy load raises instead of silently degrading.\n\n**Migrations must be reversible and safe on a live table.** A migration that locks a\nlarge table blocks every reader and writer for its duration.\n\n```ruby\n# Good: a Postgres index built without an exclusive table lock.\nclass AddIndexToPostsOnAuthor \u003C ActiveRecord::Migration[8.1]\n  disable_ddl_transaction!   # required — concurrent index can't run in a txn\n  def change\n    add_index :posts, :author_id, algorithm: :concurrently\n  end\nend\n```\n\nRules: never `add_column ..., default:` on a huge legacy table without checking your\nRails\u002FPostgres version handles it without a full rewrite; backfill data in batches with\n`find_each` or `update_all`, not one giant `UPDATE` in the migration; add the\n`strong_migrations` gem so unsafe operations fail in review, not in production.\n\nDeeper AR — query objects, `strict_loading`, counter caches, composite primary keys,\nadvisory locks, per-operation safe-migration recipes (add column, rename, backfill in\nbatches) — is in `references\u002Factiverecord.md`.\n\n## Hotwire\n\nHotwire is the default front-end: Turbo for navigation\u002Fupdates, Stimulus for behavior.\nReach for the lightest tool that does the job.\n\n| Need | Use | Why |\n|------|-----|-----|\n| Faster full-page navigation, no code | Turbo Drive (on by default) | Free; intercepts links\u002Fforms |\n| Replace one bounded region after an action | Turbo **Frame** | Scoped DOM swap, no JS |\n| Update several elements \u002F push from server | Turbo **Stream** | Targeted append\u002Freplace\u002Fremove + broadcasts |\n| Re-render a whole page and keep scroll\u002Ffocus | **Morphing** (Turbo 8) | Diffs the DOM; kills most custom Stream choreography |\n| Client behavior (toggle, copy, debounce) | Stimulus controller | Sprinkle, not a SPA |\n\nDefault to Turbo Drive and morphing; only hand-write a Turbo Stream when you need to\ntouch elements that morphing can't infer (e.g. prepend to a list from a broadcast).\n\n```javascript\n\u002F\u002F app\u002Fjavascript\u002Fcontrollers\u002Fclipboard_controller.js\nimport { Controller } from \"@hotwired\u002Fstimulus\"\n\nexport default class extends Controller {\n  static targets = [\"source\"]\n  static values = { successText: { type: String, default: \"Copied!\" } }\n\n  copy() {\n    navigator.clipboard.writeText(this.sourceTarget.value)\n  }\n}\n```\n\nWorked Frame\u002FStream\u002Fmorph examples, model broadcasting (`broadcasts_to`), Stimulus\nvalues\u002Ftargets\u002Foutlets, and how to system-test Turbo are in `references\u002Fhotwire.md`.\n\n## Background jobs & caching\n\nUse Active Job over **Solid Queue** (the Rails 8 default). Two non-negotiable rules:\n\n- **Jobs take serializable arguments — pass IDs, not records.** Why: a serialized AR\n  object goes stale between enqueue and run; an ID is re-fetched fresh.\n- **Jobs must be idempotent.** Why: retries and at-least-once delivery mean a job can\n  run twice; design so the second run is a no-op.\n\n```ruby\nclass CommentNotificationJob \u003C ApplicationJob\n  queue_as :default\n\n  def perform(comment_id)\n    comment = Comment.find_by(id: comment_id)\n    return unless comment   # idempotent: nothing to do if it's gone\n    CommentMailer.posted(comment).deliver_now\n  end\nend\n```\n\nFor genuinely long work (large backfills, bulk exports) use **Active Job Continuations**\n(Rails 8.1) so a job can checkpoint and resume instead of restarting from zero. Cache\nexpensive view fragments with the `cache` helper backed by Solid Cache:\n\n```erb\n\u003C% cache @post do %>\n  \u003C%= render @post.comments %>\n\u003C% end %>\n```\n\nDo **not** add Sidekiq\u002FRedis to a Rails 8 app unless a real, stated throughput or\nlatency requirement justifies the extra moving part. Solid Queue covers the default\ncase on the database you already run.\n\n## Testing\n\nMinitest + fixtures is the framework default; parallel execution is on by default.\nRSpec-rails (8.x) is the popular alternative. Pick one and exercise behavior through the\nrequest, never private methods.\n\n| Test type | Base class | Tests |\n|-----------|-----------|-------|\n| Model \u002F unit | `ActiveSupport::TestCase` | validations, scopes, domain methods |\n| Integration | `ActionDispatch::IntegrationTest` | a request → response, status, redirects |\n| System (browser) | `ApplicationSystemTestCase` | end-to-end UI incl. Turbo\u002FStimulus |\n| Job | `ActiveJob::TestCase` | enqueue + `perform` behavior |\n\nFixtures (default) are fast and load once; reach for factories (FactoryBot) only when\nper-test object variation gets unwieldy. **Flaky Turbo system test?** It's almost always\na timing race: never `sleep`. Use Capybara's auto-waiting matchers (`assert_selector`,\n`assert_text`, `assert_no_selector`) which retry until the DOM settles, and swap the\ndefault Selenium driver for **Cuprite or Playwright** to cut Turbo-timing flake.\n\nMinitest vs RSpec layout, fixtures gotchas, driver config, parallelization, and\nrequest-spec \u002F broadcast-testing patterns are in `references\u002Ftesting.md`.\n\n## Anti-patterns\n\n| Anti-pattern | Why it bites | Do instead |\n|--------------|--------------|------------|\n| Business logic in the controller | Untestable except through HTTP; not reusable | Push it onto the model; service object only for cross-model\u002FIO |\n| Callback soup (`after_save` chains for business rules) | Hidden order-dependent side effects, brutal to test | Explicit method called from the action; reserve callbacks for data hygiene |\n| Touching an association in a loop | N+1 — one query per row, silent in dev | `includes`\u002F`preload`\u002F`eager_load`; gate with `bullet`\u002F`strict_loading` |\n| Blocking DDL on a big live table | Locks readers + writers for the whole migration | `disable_ddl_transaction!` + `algorithm: :concurrently`; `strong_migrations` |\n| Passing AR records into jobs | Stale serialized state; fails on retry | Pass IDs, re-`find` inside `perform` |\n| Adding Sidekiq\u002FRedis to a Rails 8 app by reflex | A new daemon + dependency for nothing | Solid Queue is the default; add Sidekiq only for a stated need |\n| Queries or business logic in views | N+1 + logic you can't test | Prepare in controller\u002Fmodel; views only render |\n| Testing private methods | Locks tests to internals; refactors break green tests | Test observable behavior through the request |\n| Hand-rolled `fetch`\u002FJS for live updates | Reinvents what Turbo gives free | Turbo Stream or morphing |\n\n## Verify\n\nRun `scripts\u002Fverify.sh` inside a Rails app for a read-only static gate: it runs RuboCop\n(if rubocop-rails is configured) and `bin\u002Frails zeitwerk:check`, and greps for the\nstatically-detectable anti-patterns above (Sidekiq\u002FRedis in a default app, `.all.each`\nmass loads, a concurrent `add_index` missing `disable_ddl_transaction!`). It skips any\ncheck whose tooling is absent and exits non-zero only on a hard violation.\n",{"name":5,"tags":24,"origin":31,"profiles":32,"recommends":33,"description":7},[5,25,26,27,28,29,30],"activerecord","hotwire","turbo","stimulus","solid-queue","minitest","risco",[],[34,35,36,37,38],"ruby","postgresdb","testing-web","deployment","db-migrations","main","d69096e239f2a89aabc2cd078c47664a9d3b1e11","04-安全渗透\u002Frails",3,"https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts","https:\u002F\u002Fgithub.com\u002Flza6","个人vx：Tf00798\r\n个人✈：@TFGY999","2026-10-08 14:29:22",{"source":8,"skillName":5,"commands":48,"prompt":58,"zipAvailable":59},[49,52,55],{"tool":50,"command":51},"npx","npx skills add lza6\u002FArmor-piercing-system-prompts --skill rails",{"tool":53,"command":54},"bunx","bunx skills add lza6\u002FArmor-piercing-system-prompts --skill rails",{"tool":56,"command":57},"pnpm","pnpm dlx skills add lza6\u002FArmor-piercing-system-prompts --skill rails","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F04-安全渗透\u002Frails\u002FSKILL.md",true,[61,67,71,75,79],{"path":62,"resourceType":63,"resourceTypeDesc":64,"sizeBytes":65,"sourceHtmlUrl":66},"evals\u002Fcases.yaml","REFERENCE","参考文档",2866,"https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F04-安全渗透\u002Frails\u002Fevals\u002Fcases.yaml",{"path":68,"resourceType":63,"resourceTypeDesc":64,"sizeBytes":69,"sourceHtmlUrl":70},"evals\u002FREADME.md",811,"https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F04-安全渗透\u002Frails\u002Fevals\u002FREADME.md",{"path":72,"resourceType":63,"resourceTypeDesc":64,"sizeBytes":73,"sourceHtmlUrl":74},"references\u002Factiverecord.md",4277,"https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F04-安全渗透\u002Frails\u002Freferences\u002Factiverecord.md",{"path":76,"resourceType":63,"resourceTypeDesc":64,"sizeBytes":77,"sourceHtmlUrl":78},"references\u002Fhotwire.md",4045,"https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F04-安全渗透\u002Frails\u002Freferences\u002Fhotwire.md",{"path":80,"resourceType":63,"resourceTypeDesc":64,"sizeBytes":81,"sourceHtmlUrl":82},"references\u002Ftesting.md",3498,"https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F04-安全渗透\u002Frails\u002Freferences\u002Ftesting.md",[84,92,97,104,111,118],{"skillNo":85,"name":86,"nameZh":6,"description":87,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":88,"categories":89,"keywords":90,"publishedAt":91},"01M7FFG485KY83TD6HSC4YPCMC","obsidian-clipper-template-creator","Guide for creating templates for the Obsidian Web Clipper. Use when you want to create a new clipping template, understand available variables, or format clipped content.","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fobsidian-clipper-template-creator\u002FSKILL.md",[],[],"2026-11-16 10:05:34",{"skillNo":93,"name":86,"nameZh":6,"description":87,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":94,"categories":95,"keywords":96,"publishedAt":91},"01M7FFG0T6AZ0STEJPSB3CX84K","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fobsidian-clipper-template-creator-antigravity-awesome-skills-main\u002FSKILL.md",[],[],{"skillNo":98,"name":99,"nameZh":6,"description":100,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":101,"categories":102,"keywords":103,"publishedAt":91},"01M7FFFY0QEM14SKWPDYGMXM2P","python-api","Programmatic Object-Detection-Metrics API guidance for BoundingBox, BoundingBoxes, Evaluator, enums, coordinate conversion, AP\u002FmAP semantics, and source-style import diagnostics.","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fobject-detection-metrics\u002Fsub-skills\u002Fpython-api\u002FSKILL.md",[],[],{"skillNo":105,"name":106,"nameZh":6,"description":107,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":108,"categories":109,"keywords":110,"publishedAt":91},"01M7FFFVZQZ2GJ0C0TGP7JHD20","file-evaluation","Folder-based PASCAL VOC AP\u002FmAP evaluation from ground-truth and detection text files.","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fobject-detection-metrics\u002Fsub-skills\u002Ffile-evaluation\u002FSKILL.md",[],[],{"skillNo":112,"name":113,"nameZh":6,"description":114,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":115,"categories":116,"keywords":117,"publishedAt":91},"01M7FFFSFNYSE77SJ6PE1CK2DA","object-detection-metrics","Guides legacy Object-Detection-Metrics PASCAL VOC AP\u002FmAP evaluation from detection text folders and direct Python API classes.","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fobject-detection-metrics\u002FSKILL.md",[],[],{"skillNo":119,"name":120,"nameZh":6,"description":121,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":122,"categories":123,"keywords":124,"publishedAt":91},"01M7FFFP0GCK1RVXBCPQ8APBMT","nx-workspace-patterns","Configure and optimize Nx monorepo workspaces. Use when setting up Nx, configuring project boundaries, optimizing build caching, or implementing affected commands.","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fnx-workspace-patterns\u002FSKILL.md",[],[]]