agentleFS
etewiahetewiah/property_web_builder/.claude/skills/rails-testing/SKILL.md

rails-testing

Skill644 starsChanged 10 months agoMITView on GitHub

Help with Rails testing including unit tests, integration tests, fixtures, and debugging test failures. Use when working on tests or debugging test issues.

We split this skill into the rules it gives an agent

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

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈13

    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:

    When helping with Rails testing:

    line 10
  2. Very specific:

    Check existing tests in test/ directory to understand project conventions

    line 13
  3. Distinctive:

    Look for test patterns in similar files (models, controllers, etc.)

    line 14
  4. Very specific:

    Run all tests: bin/rails test

    line 18
  5. Very specific:

    Run specific file: bin/rails test test/models/user_test.rb

    line 19
  6. Very specific:

    Run specific test: bin/rails test test/models/user_test.rb:5 (line number)

    line 20
  7. Very specific:

    Run with verbose output: bin/rails test -v

    line 21
  8. Very specific:

    Use --fail-fast to stop on first failure: bin/rails test --fail-fast

    line 22
  9. Distinctive:

    Models: Test business logic, validations, associations

    line 25
  10. Distinctive:

    Controllers: Test request/response, status codes, redirects, instance variables

    line 26
  11. Distinctive:

    Integration Tests: Test full workflows across multiple components

    line 27
  12. Distinctive:

    Fixtures: Use for test data setup

    line 28
  13. Very specific:

    Use descriptive test names: test_should_create_valid_user

    line 31
  14. Distinctive:

    Test both success and failure cases

    line 32
  15. Distinctive:

    Keep tests focused and isolated

    line 33
  16. Distinctive:

    Use fixtures for shared test data

    line 34
  17. Distinctive:

    Read error messages carefully - they usually point to the issue

    line 38
  18. Distinctive:

    Check if test data is set up correctly (fixtures, setup methods)

    line 39
  19. Distinctive:

    Verify assertions match the actual behavior

    line 40
  20. Very specific:

    Use puts or p to inspect values

    line 41
  21. Distinctive:

    Check test isolation - tests shouldn't depend on each other

    line 42
  22. Very specific:

    Check test/fixtures/ for test data

    line 47

≈ “Common” is an estimate: at least 1 in 5 of the 308,232 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

Rails Testing

Instructions

When helping with Rails testing:

  1. Understand the test structure
    • Check existing tests in test/ directory to understand project conventions
    • Look for test patterns in similar files (models, controllers, etc.)
    • Respect the project's test organization and naming conventions
  2. Running tests
    • Run all tests: bin/rails test
    • Run specific file: bin/rails test test/models/user_test.rb
    • Run specific test: bin/rails test test/models/user_test.rb:5 (line number)
    • Run with verbose output: bin/rails test -v
    • Use --fail-fast to stop on first failure: bin/rails test --fail-fast
  3. Test types in Rails
    • Models: Test business logic, validations, associations
    • Controllers: Test request/response, status codes, redirects, instance variables
    • Integration Tests: Test full workflows across multiple components
    • Fixtures: Use for test data setup
  4. Writing effective tests
    • Use descriptive test names: test_should_create_valid_user
    • Test both success and failure cases
    • Keep tests focused and isolated
    • Use fixtures for shared test data
    • Clean up side effects after tests
  5. Debugging test failures
    • Read error messages carefully - they usually point to the issue
    • Check if test data is set up correctly (fixtures, setup methods)
    • Verify assertions match the actual behavior
    • Use puts or p to inspect values
    • Check test isolation - tests shouldn't depend on each other
  6. Test database
    • Rails uses a separate test database
    • Run migrations: bin/rails db:test:prepare
    • Check test/fixtures/ for test data

Examples

When user asks: "How do I test this model?" → Create a model test in test/models/ following existing patterns, test validations and associations

When user asks: "Why is this test failing?" → Analyze the error, check test data setup, verify assertions, suggest fixes

When user asks: "Add tests for this controller" → Create controller tests in test/controllers/, test CRUD actions and edge cases

When user asks: "How do I set up test data?" → Suggest fixtures in test/fixtures/ or setup methods in the test file

Download now (ZIP)

  • Other versions2 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 2

    1. marckohlbrugge/unofficial-37signals-coding-style-guide★ 724same name
    2. mickzijdel/rails-toolkit★ 1same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository5 other files it gives its agents.

Does it work?

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

Reviews can't be read right now.

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.