testing-best-practices
Skill8 starsChanged 3 months agoMITView on GitHub
Laravel test design and review. Use when selecting coverage, naming or structuring tests, choosing assertions or test data, isolating dependencies, testing HTTP or security boundaries, improving suite performance, or reviewing test value. Use framework guidance or search-docs for Pest and PHPUnit syntax.
4 other projects use a version of this, 1 of them edited.
Adopted by
Most recently taken up by
- relaticle/relaticleedited, first seen Oct 4, 2026
- siberiacancode/agent-skillstheir own version, first seen Sep 19, 2026
- gazi04/code-forgeword for word, first seen Sep 18, 2026
- Spardutti/claude-skillstheir own version, first seen Aug 31, 2026
Other versions4 projects use a version of this.
Word for word · 1
- gazi04/code-forge★ 0100% same
Edited · 1
- relaticle/relaticle★ 1.8k96% same
Wrote their own version · 2
- siberiacancode/agent-skills★ 23same name
- Spardutti/claude-skills★ 3same 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.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- infer-conventionsSkill
- laravel-best-practicesSkill
- tailwindcss-developmentSkill
The file
We split this skill into the rules it gives an agent
11 rules. 0 are common, 9 are distinctive, and 2 are very specific to this project.
0
Common
Most of the 3 edited versions we read keep these.
9
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 16
Read nearby tests before you choose syntax and organization.
- Distinctive: line 24
Read this section before you write a test.
- Distinctive: line 26
Test observable behavior and application contracts.
- Distinctive: line 29
Leave framework behavior to framework tests.
- Distinctive: line 30
Keep every test that can detect a distinct defect.
- Distinctive: line 31
Write a feature test first.
- Very specific: line 32
Write a feature test for every behavior reachable through a request.
- Distinctive: line 34
Use the test tools that the project installs.
- Distinctive: line 38
Read the code under test. Read the tests in the same directory.
- Distinctive: line 41
Write the tests. Run the smallest set of tests that covers the change.
- Very specific: line 42
Check every applicable item in rules/review.md and every selected rule file.
“Common” is measured: kept by at least 6 in 10 of the 3 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
Testing Best Practices
This skill provides rules for designing Laravel tests. Each rule file explains what to do and why. Use search-docs for Laravel and Pest API syntax.
This project uses Pest. Follow the corresponding guidance in each rule.
Consistency First
Read nearby tests before you choose syntax and organization.
A pattern repeated throughout the project is a convention, and project conventions take precedence over this skill. Follow them and give new tests the same structure.
These rules govern the tests you write now. An existing test that follows a project convention is not defective merely because it conflicts with this skill. Do not delete or rewrite it. If the convention has drawbacks, explain them and let the user decide.
What to Test
Read this section before you write a test.
- Test observable behavior and application contracts. A test must pass after an implementation change if the behavior stays the same.
- Cover every changed decision and each applicable high-value failure mode. A decision is a branch, a validation, a calculation, or an authorization.
- Exercise declarations through behavior instead of repeating their text.
- Leave framework behavior to framework tests. Testing project configuration is not testing the framework. A constrained relationship, cast, scope, or validation rule belongs to this project.
- Keep every test that can detect a distinct defect. When two tests detect the same defect, trim the higher-layer test to one case and report the duplication. Do not delete an existing test.
- Write a feature test first. Write a unit test only for logic that does not use the framework.
- Write a feature test for every behavior reachable through a request. Real-browser tests require
pestphp/pest-plugin-browserand a browser download, neither of which this project installs. Mention the package only if the user asks for a real-browser test. - Judge an architecture test by the convention it protects, not by the rules above. An
arch()test declares a rule for an entire directory, such as the parent class of every model, the classes that may use an enum, or the methods every factory declares. It intentionally checks declarations and fails when a new file breaks the convention. - Use the test tools that the project installs. Add a new test dependency, plugin, or browser only after the user asks for it.
How to Apply
- Read the code under test. Read the tests in the same directory. Identify every decision in the code.
- Select every applicable branch in the rule index. Read every selected rule file.
- Report each defect in the code before you write a test. Examples are a method with no body, a policy that no action calls, and a write action with no validation. Test the actual behavior. Report the defect to the user.
- Write the tests. Run the smallest set of tests that covers the change. The tests must pass.
- Check every applicable item in
rules/review.mdand every selected rule file. Resolve every mismatch before completion.
Rule Index
Most changes need more than one rule file.
| Subject | Rule File |
| Test framework features that may already do the work | rules/finding-features.md |
| File layout, test names, and groups | rules/naming.md |
| Arrange-act-assert and choosing the correct assertion | rules/assertions.md |
| Endpoint coverage, authentication, authorization, tenant isolation, validation, and browser tests | rules/endpoint-tests.md |
| Factories, test data ownership, and repeated input values | rules/test-data.md |
| Fakes, mocks, outbound HTTP, time, randomness, and databases | rules/isolation.md |
| Escaping, injection, cross-tenant access, and privilege checks | rules/security.md |
| Environment and CI settings for a slow suite | rules/performance.md |
| Reviewing a test or suite | rules/review.md |
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.

