testing-best-practices
Skill184 starsChanged 2 months agoApache-2.0View 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.
We split this skill into the rules it gives an agent
12 rules. 9 are common, 1 is distinctive, and 2 are very specific to this project.
9
Common
Most of the 16 edited versions we read keep these.
1
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
- Common: line 16
Read nearby tests before you choose syntax and organization.
- Distinctive: line 22
Use the project convention for each item that follows:
- Common: line 31
Read this section before you write a test.
- Common: line 33
Test observable behavior and application contracts.
- Common: line 36
Leave framework behavior to framework tests.
- Common: line 37
Keep every test that can detect a distinct defect.
- Common: line 38
Write a feature test first.
- Very specific: line 39
Write a feature test for every behavior reachable through a request.
- Common: line 41
Use the test tools that the project installs.
- Common: line 45
Read the code under test. Read the tests in the same directory.
- Common: line 48
Write the tests. Run the smallest set of tests that covers the change.
- Very specific: line 49
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 16 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.
Use the project convention for each item that follows:
- the use of
it()ortest() - the construction of a factory
- the setup of the authentication
- the layout of the files
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 |
| A feature of the test framework that can already do the work | rules/finding-features.md |
| The layout of the files, the names of the tests, and the groups | rules/naming.md |
| Arrange-act-assert, and the correct assertion for each subject | rules/assertions.md |
| The coverage of an endpoint, the authentication, the authorization, the isolation of a tenant, the validation, and the tests in a browser | rules/endpoint-tests.md |
| The factories, the owner of the test data, and the repeated input values | rules/test-data.md |
| The fakes, the mocks, the outbound HTTP, the time, the randomness, and the database | rules/isolation.md |
| The escaping, the injection, the access across tenants, and the checks of privilege | rules/security.md |
| The settings of the environment and of the CI for a slow suite | rules/performance.md |
| The review of a test or of a suite | rules/review.md |
Other versions16 projects use a version of this.
Word for word · 0
None found.
Edited · 13
- coollabsio/coolify★ 65k82% same
- anonaddy/anonaddy★ 4.9k81% same
- yaojingang/GEOFlow★ 3.8k80% same
- relaticle/relaticle★ 1.8k82% same
- Relaticle/relaticle★ 1.8k82% same
- nasirkhan/laravel-starter★ 1.4k81% same
- WINBIGFOX/TimeScribe★ 91382% same
- trypostit/trypost★ 79282% same
- Dricle/eveil★ 1087% same
- BhargavDetroja/claude-tracker★ 887% same
3 more not listed
Wrote their own version · 3
- siberiacancode/agent-skills★ 23same name
- Spardutti/claude-skills★ 3same name
- davidanthonyn/claude-skills★ 0same 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.
Used alongsideProjects with it also use ai-sdk-development, fortify-development and 4 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.
m3ueSkillai-sdk-development
TRIGGER when working with ai-sdk which is Laravel official first-party AI SDK. Activate when building, editing AI agents, chatbots, text generation, image generation, audio/TTS, transcription/STT, embeddings, RAG, vector stores, reranking, structured output, streaming, conversation memory, tools, queueing, broadcasting, and provider failover across OpenAI, Anthropic, Gemini, Azure, Groq, xAI, DeepSeek, Mistral, Ollama, ElevenLabs, Cohere, Jina, and VoyageAI. Invoke when the user references ai-sdk, the `Laravel\Ai\` namespace, or this project's AI features — not for Prism PHP or other AI packages used directly.
Also in 5 projects that use this
gdarkoSkillfortify-development
ACTIVATE when the user works on authentication in Laravel. This includes login, registration, password reset, email verification, two-factor authentication (2FA/TOTP/QR codes/recovery codes), profile updates, password confirmation, or any auth-related routes and controllers. Activate when the user mentions Fortify, auth, authentication, login, register, signup, forgot password, verify email, 2FA, or references app/Actions/Fortify/, CreateNewUser, UpdateUserProfileInformation, FortifyServiceProvider, config/fortify.php, or auth guards. Fortify is the frontend-agnostic authentication backend for Laravel that registers all auth routes and controllers. Also activate when building SPA or headless authentication, customizing login redirects, overriding response contracts like LoginResponse, or configuring login throttling. Do NOT activate for Laravel Passport (OAuth2 API tokens), Socialite (OAuth social login), or non-auth Laravel features.
Also in 5 projects that use this
datashamanSkilllivewire-development
Use for any task or question involving Livewire. Activate if user mentions Livewire, wire: directives, or Livewire-specific concepts like wire:model, wire:click, wire:sort, or islands, invoke this skill. Covers building new components, debugging reactivity issues, real-time form validation, drag-and-drop, loading states, migrating from Livewire 3 to 4, converting component formats (SFC/MFC/class-based), and performance optimization. Do not use for non-Livewire reactive UI (React, Vue, Alpine-only, Inertia.js) or standard Laravel forms without Livewire.
Also in 4 projects that use this
whisper-moneySkillcashier-stripe-development
Handles Laravel Cashier Stripe integration including subscriptions, webhooks, Stripe Checkout, invoices, charges, refunds, trials, coupons, metered billing, and payment failure handling. Triggered when a user mentions Cashier, Billable, IncompletePayment, stripe_id, newSubscription, Stripe subscriptions, or billing. Also applies when setting up webhooks, handling SCA/3DS payment failures, testing with Stripe test cards, or troubleshooting incomplete subscriptions, CSRF webhook errors, or migration publish issues.
Also in 3 projects that use this
datashamanSkillpassport-development
Develops OAuth2 API authentication with Laravel Passport. Activates when installing or configuring Passport; setting up OAuth2 grants (authorization code, client credentials, personal access tokens, device authorization); managing OAuth clients; protecting API routes with token authentication; defining or checking token scopes; configuring SPA cookie authentication; handling token lifetimes and refresh tokens; or when the user mentions Passport, OAuth2, API tokens, bearer tokens, or API authentication. Make sure to use this skill whenever the user works with OAuth2, API tokens, or third-party API access, even if they don't explicitly mention Passport.
Also in 3 projects that use this
StacklokLabsSkillmcp-development
Guide for developing MCP servers with Python SDK. Use when implementing MCP tools, resources, or prompts.
Also in 4 projects that use this
In this repository33 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- .cursor/rules/laravel-boost.mdcCursor rule
- configure-nightwatchSkill
- configuring-horizonSkill
- inertia-vue-developmentSkill
- infer-conventionsSkill
- laravel-best-practicesSkill
- pulse-developmentSkill
- socialite-developmentSkill
- tailwindcss-developmentSkill
- testing-best-practicesSkill
- wayfinder-developmentSkill
- configure-nightwatchSkill
- configuring-horizonSkill
- inertia-vue-developmentSkill
- infer-conventionsSkill
- laravel-best-practicesSkill
- pulse-developmentSkill
- socialite-developmentSkill
- tailwindcss-developmentSkill
- wayfinder-developmentSkill
- configure-nightwatchSkill
- configuring-horizonSkill
- inertia-vue-developmentSkill
- infer-conventionsSkill
- laravel-best-practicesSkill
- pulse-developmentSkill
- socialite-developmentSkill
- tailwindcss-developmentSkill
- testing-best-practicesSkill
- wayfinder-developmentSkill
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.

