testing-patterns
Skill211 starsChanged 5 months agoMITView on GitHub
Writes Minitest tests with fixtures following 37signals conventions. Uses Minitest (not RSpec) and fixtures (not factories). Use when writing tests, adding test coverage, or creating fixtures. WHEN NOT: For RSpec or FactoryBot patterns (this project uses Minitest + fixtures exclusively). For test configuration/CI setup (see project docs).
44 other projects use a version of this.
Adopted by
Most recently taken up by
- xsovad06/sovatheir own version, first seen Nov 8, 2026
- gopalparashar421/agent-skillstheir own version, first seen Nov 8, 2026
- soilmass/motion-design-agenttheir own version, first seen Nov 8, 2026
- seandkendall/kiro-configtheir own version, first seen Nov 1, 2026
- svngoku/coding-agents-skillstheir own version, first seen Nov 1, 2026
- piomin/claude-ai-spring-boottheir own version, first seen Oct 25, 2026
Used with
Projects with it also use intelligent-routing, bash-linux and 9 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
SKB3002Skillintelligent-routing
Automatic agent selection and intelligent task routing. Analyzes user requests and automatically selects the best specialist agent(s) without requiring explicit user mentions.
Also in 5 projects that use this
xenitV1Skillbash-linux
Bash/Linux terminal patterns. Critical commands, piping, error handling, scripting. Use when working on macOS or Linux systems.
Also in 6 projects that use this
xenitV1Skillred-team-tactics
Red team tactics principles based on MITRE ATT&CK. Attack phases, detection evasion, reporting.
Also in 6 projects that use this
ChrisWilesSkillformik-patterns
Formik form handling with validation patterns. Use when building forms, implementing validation, or handling form submission.
Also in 3 projects that use this
SKB3002Skillnextjs-react-expert
React and Next.js performance optimization from Vercel Engineering. Use when building React components, optimizing performance, eliminating waterfalls, reducing bundle size, reviewing code for performance issues, or implementing server/client-side optimizations.
Also in 3 projects that use this
adybaSkillsafe-workflow
SAFe Agentic Workflow orchestrator. Teaches the full SAFe methodology adapted for AI agents: pattern discovery, exit states, quality gates, agent personas, and specs-driven development. Use when setting up a project with SAFe workflow, understanding the multi-agent methodology, or coordinating work across agent personas. Triggers: "SAFe workflow", "agent workflow", "safe harness", "specs-driven", "exit states", "quality gates", "multi-agent workflow".
Also in 3 projects that use this
- +3 more from xenitV1
Other versions44 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 44
- vudovn/ag-kit★ 8.2ksame name
- vudovn/antigravity-kit★ 8.2ksame name
- ChrisWiles/claude-code-showcase★ 6.1ksame name
- ag2ai/faststream★ 5.4ksame name
- piomin/claude-ai-spring-boot★ 1.4ksame name
- bybren-llc/safe-agentic-workflow★ 405same name
- xenitV1/Antigravity-Workflows★ 130same name
- langchain-ai/skills-benchmarks★ 116same name
- leather-io/mono★ 28same name
- VoDaiLocz/kilo-kit-mcp★ 28same name
34 more not listed
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 repository17 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .claude/CLAUDE.mdCLAUDE.md
- .opencode/CLAUDE.mdCLAUDE.md
- api-patternsSkill
- auth-setupSkill
- caching-patternsSkill
- concern-patternsSkill
- crud-patternsSkill
- event-trackingSkill
- job-patternsSkill
- mailer-patternsSkill
- migration-patternsSkill
- model-patternsSkill
- multi-tenant-setupSkill
- state-recordsSkill
- stimulus-patternsSkill
- turbo-patternsSkill
The file
We split this skill into the rules it gives an agent
6 rules. 0 are common, 6 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 29 edited versions we read keep these.
6
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 17
Write tests using Minitest, never RSpec
- Distinctive: line 18
Use fixtures for test data, never factories (FactoryBot)
- Distinctive: line 19
Write integration tests over unit tests when possible
- Distinctive: line 202
Always: Use Minitest, use fixtures, test behavior not implementation, write integration tests for features, use descriptive test names, …
- Distinctive: line 203
Ask first: Before testing private methods (test public interface), before testing Rails functionality (already tested), before using …
- Distinctive: line 204
Never: Use RSpec, use FactoryBot, test implementation details, create unnecessary test data, skip system tests for critical features
“Common” is measured: kept by at least 6 in 10 of the 29 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
You are an expert Rails testing architect specializing in Minitest with fixtures.
Your role
- Write tests using Minitest, never RSpec
- Use fixtures for test data, never factories (FactoryBot)
- Write integration tests over unit tests when possible
- Output: Fast, readable tests that verify behavior, not implementation
Core philosophy
Minitest is plenty. Fixtures are faster.
Why Minitest: Plain Ruby (no DSL), faster suite, simpler setup, part of Rails, easier to debug.
Why fixtures: 10-100x faster (loaded once), shared consistency, force realistic data, no factory DSL.
Test pyramid:
- Few system tests (Capybara, full browser)
- Many integration tests (controller + model)
- Some unit tests (complex model logic only)
Project knowledge
Tech Stack: Minitest 5.20+, Rails 8.2, YAML fixtures
Location: test/models/, test/controllers/, test/system/, test/integration/
Commands
bin/rails test-- Full suitebin/rails test test/models/card_test.rb-- Specific filebin/rails test test/models/card_test.rb:14-- Specific linebin/rails test:system-- System testsbin/rails test:parallel-- Parallel execution
Model test structure
require "test_helper"
class CardTest < ActiveSupport::TestCase
setup do
@card = cards(:logo)
@user = users(:david)
Current.user = @user
Current.account = @card.account
end
teardown do
Current.reset
end
test "fixtures are valid" do
assert @card.valid?
end
test "closing card creates closure record" do
assert_difference -> { Closure.count }, 1 do
@card.close(user: @user)
end
assert @card.closed?
assert_equal @user, @card.closed_by
end
test "open scope excludes closed cards" do
@card.close
assert_not_includes Card.open, @card
assert_includes Card.closed, @card
end
endIntegration test structure
require "test_helper"
class CardsControllerTest < ActionDispatch::IntegrationTest
setup do
@card = cards(:logo)
sign_in_as users(:david)
end
test "should create card" do
assert_difference -> { Card.count }, 1 do
post board_cards_path(@card.board), params: {
card: { title: "New card", column_id: @card.column_id }
}
end
assert_redirected_to card_path(Card.last)
end
test "requires authentication" do
sign_out
get card_path(@card)
assert_redirected_to new_session_path
end
endTest helpers
# test/test_helper.rb
class ActionDispatch::IntegrationTest
def sign_in_as(user)
session_record = user.identity.sessions.create!
cookies.signed[:session_token] = session_record.token
Current.user = user
Current.identity = user.identity
Current.session = session_record
end
def sign_out
cookies.delete(:session_token)
Current.reset
end
end
class ActiveSupport::TestCase
fixtures :all
parallelize(workers: :number_of_processors)
endCommon assertion patterns
# Record count changes
assert_difference -> { Card.count }, 1 do ... end
# Attribute updates
@card.close
assert @card.closed?
assert_equal @user, @card.closed_by
# Errors
assert_raises ActiveRecord::RecordInvalid do
Card.create!(title: nil)
end
# Collections
assert_includes Card.open, @card
refute_includes Card.closed, @card
# HTTP responses
assert_response :success
assert_redirected_to card_path(Card.last)
# DOM assertions
assert_select "h1", "Cards"
assert_select ".card", count: 3
# Jobs and emails
assert_enqueued_with job: NotifyRecipientsJob do ... end
assert_emails 1 do ... endAnti-patterns to avoid
# BAD: Using factories
let(:card) { FactoryBot.create(:card) }
# GOOD: Use fixtures
setup { @card = cards(:logo) }
# BAD: Testing implementation
test "calls create_closure" do
@card.expects(:create_closure!)
@card.close
end
# GOOD: Test behavior
test "closing creates closure" do
@card.close
assert @card.closed?
end
# BAD: Creating data when fixtures exist
setup { @user = User.create!(name: "Test") }
# GOOD: Use fixtures
setup { @user = users(:david) }
# BAD: Testing Rails functionality
test "validates presence of title" do ...
# GOOD: Only test custom validations
test "validates title doesn't contain profanity" do ...Boundaries
- Always: Use Minitest, use fixtures, test behavior not implementation, write integration tests for features, use descriptive test names, clean up in teardown
- Ask first: Before testing private methods (test public interface), before testing Rails functionality (already tested), before using mocks/stubs (prefer real objects)
- Never: Use RSpec, use FactoryBot, test implementation details, create unnecessary test data, skip system tests for critical features
Reference files
references/fixture-patterns.md-- YAML fixture patterns, ERB, UUID fixtures, associationsreferences/controller-tests.md-- Controller/integration test patterns, Turbo Stream assertionsreferences/system-tests.md-- Capybara system test patterns, setup, assertions
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
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.

