Testing Best Practices Skill - #769
Open
nexxai wants to merge 13 commits into
Open
Conversation
|
I think it should be |
# Conflicts: # .ai/pest/3/skill/pest-testing/SKILL.blade.php # .ai/pest/4/skill/pest-testing/SKILL.blade.php
pushpak1300
marked this pull request as draft
August 24, 2026 15:28
Signed-off-by: Pushpak Chhajed <pushpak1300@gmail.com>
Signed-off-by: Pushpak Chhajed <pushpak1300@gmail.com>
pushpak1300
marked this pull request as ready for review
August 25, 2026 04:30
Signed-off-by: Pushpak Chhajed <pushpak1300@gmail.com>
Signed-off-by: Pushpak Chhajed <pushpak1300@gmail.com>
Signed-off-by: Pushpak Chhajed <pushpak1300@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description update by @pushpak1300
Currently, Boost has a few different testing guidance/skills:
pest-testingenforce-testingphpunit-guidelinesThey all overlap in different ways, which makes the current testing guidance a bit hit or miss.
We've also had feedback that agents sometimes go too far with tests. They may add tests for tiny or unnecessary changes, over-mock things, test framework behavior or config that doesn't really need testing, or generally write more tests than the change actually requires.
To improve this, we're consolidating the existing guidance into a new
test-best-practicesskill, similar tolaravel-best-practices.The goal is to give agents better guidance on what should be tested, how much testing is appropriate, and how to write effective tests for Laravel applications without over-testing.
The skill will also be composed based on the packages installed in the project. For example, it can include specific guidance for:
This should give us one consistent testing philosophy while still adapting the guidance to each application's actual testing stack.
I ended up running new skill on https://github.com/pinkary-project/pinkary.com and found this issue which imo are validate the issues.
Details
# Test Suite Audit661 tests, 137 files, ~12.7k lines, reviewed against
.claude/skills/testing-best-practices.A report — nothing was changed. Per
rules/review.mda duplicate shrinks at the higher layer to theone case that proves the wiring, it is not deleted; a pattern the project repeats is a convention,
named once rather than per file.
Fix first — a real defect ships green today
app/Models/User.php:97canAccessPanel()has no test at all. ItshasVerifiedEmail()branch and second admin (mrpunyapal@gmail.com) are uncovered, while 5 Citadel HTTP files repeat the same 2-case matrix by hard-coding an email. → matrix intoUserTest.php, one refused-role HTTP test per entry point.livewire/questions/show.blade.php:58{!! $question->content !!}rendersParsableContentoutput raw;Unit/Services/ContentTest.phpfeeds it zero hostile inputs.StripProviderParsableis the only guard and nothing asserts it. → add a case shaped likeBioTest.php:12.Unit/Models/QuestionTest.php:47-71root/parent/children/descendantsadd->where('is_ignored', false)->where('is_reported', false)(Question.php:231-266); the test only checks instance types, so deleting both clauses stays green. → assert an ignored/reported child is excluded.Then — same defect covered twice, shrink the higher layer
Http/Register/CreateTest.php:200-276,:333-351NotBlockedAccountTest. Split is inverted —UsernameTest.php:20-32lumps 6 inputs under one->throws()with no message assertion. → matrix + messages down to the rule tests, one case per rule stays up.Livewire/Links/IndexTest.php:247-267,PeopleToFollowTest.php:48-60Concerns/FollowableTest.phpalready owns.Http/About/IndexTest.php+Http/Verified/IndexTest.phpHttp/Bookmarks/IndexTest.php:29-45PeopleToFollowRecommendationsTestowns — likely the suite's most expensive test.Http/LoginTest.php:31-42:45-56— 6 bcrypt hashes — and never assertsassertGuest()on the 429.Then — suite-wide hygiene
tests/Pest.php: noHttp::preventStrayRequests()(0 suite-wide — a missing fake reaches the network), noSleep::fake(), noExceptions::fake();RefreshDatabaseoverLazilyRefreshDatabase; globalStorage::fake()inbeforeEach(); two dead stubs (something()at:50,toBeOne()at:37).assertStatus(200|302|403|404|429)across 20 files instead ofassertOk()/assertForbidden()/assertNotFound()/assertTooManyRequests(). PlusCitadel/Users/IndexTest.php:24usesassertDatabaseHaswhereassertModelExists()applies.'guest'/'auth', the rest bare nouns ('relations','link','mention'). 11 files mixit()andtest(); worst isLivewire/Questions/CreateTest.php(1 vs 50).beforeEach():Livewire/Questions/EditTest.php:12,CreateTest.php:20-21,Http/Profile/ShowTest.php:11.Http/Register/CreateTest.php:302-325: AAA comments instead of blank lines, a// or specific route if expectedleftover, a destination-lessassertRedirect(), andexpect($user)->not->toBeNull()afterassertDatabaseHasproved it.Your call — repeated conventions, not fixes
test('relations')in 6 model files assertingtoBeInstanceOfon unconstrained relationstoMatchSnapshot(), 4 of them the whole ofContentTest.phpexpect(true)->toBeTrue()across all 7Unit/Rules/*files$this->fail()in the closure; reads as if nothing is asserted.Checked and correct — no action
arch()tests (judged by the convention they protect, not behavioral value) · the 9test('to array')model tests (
rules/isolation.mdendorses asserting exacttoArray()keys; each usestoHaveCount()) ·BCRYPT_ROUNDS=4inphpunit.xml· bio XSS escaping atUnit/Services/BioTest.php:12.Note
Once merged we need to delete this skill