Skip to content

Commit b0933ea

Browse files
wip
1 parent 23683d1 commit b0933ea

File tree

322 files changed

+14787
-9078
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

322 files changed

+14787
-9078
lines changed
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
---
2+
name: pest-testing
3+
description: >-
4+
Tests applications using the Pest 3 PHP framework. Activates when writing tests, creating unit or feature
5+
tests, adding assertions, testing Livewire components, architecture testing, debugging test failures,
6+
working with datasets or mocking; or when the user mentions test, spec, TDD, expects, assertion,
7+
coverage, or needs to verify functionality works.
8+
---
9+
10+
# Pest Testing 3
11+
12+
## When to Apply
13+
14+
Activate this skill when:
15+
- Creating new tests (unit or feature)
16+
- Modifying existing tests
17+
- Debugging test failures
18+
- Working with datasets, mocking, or test organization
19+
- Writing architecture tests
20+
21+
## Documentation
22+
23+
Use `search-docs` for detailed Pest 3 patterns and documentation.
24+
25+
## Basic Usage
26+
27+
### Creating Tests
28+
29+
All tests must be written using Pest. Use `php artisan make:test --pest {name}`.
30+
31+
### Test Organization
32+
33+
- Tests live in the `tests/Feature` and `tests/Unit` directories.
34+
- Do NOT remove tests without approval - these are core application code.
35+
- Test happy paths, failure paths, and edge cases.
36+
37+
### Basic Test Structure
38+
39+
<code-snippet name="Basic Pest Test Example" lang="php">
40+
41+
it('is true', function () {
42+
expect(true)->toBeTrue();
43+
});
44+
45+
</code-snippet>
46+
47+
### Running Tests
48+
49+
- Run minimal tests with filter before finalizing: `php artisan test --compact --filter=testName`.
50+
- Run all tests: `php artisan test --compact`.
51+
- Run file: `php artisan test --compact tests/Feature/ExampleTest.php`.
52+
53+
## Assertions
54+
55+
Use specific assertions (`assertSuccessful()`, `assertNotFound()`) instead of `assertStatus()`:
56+
57+
<code-snippet name="Pest Response Assertion" lang="php">
58+
59+
it('returns all', function () {
60+
$this->postJson('/api/docs', [])->assertSuccessful();
61+
});
62+
63+
</code-snippet>
64+
65+
| Use | Instead of |
66+
|-----|------------|
67+
| `assertSuccessful()` | `assertStatus(200)` |
68+
| `assertNotFound()` | `assertStatus(404)` |
69+
| `assertForbidden()` | `assertStatus(403)` |
70+
71+
## Mocking
72+
73+
Import mock function before use: `use function Pest\Laravel\mock;`
74+
75+
## Datasets
76+
77+
Use datasets for repetitive tests (validation rules, etc.):
78+
79+
<code-snippet name="Pest Dataset Example" lang="php">
80+
81+
it('has emails', function (string $email) {
82+
expect($email)->not->toBeEmpty();
83+
})->with([
84+
'james' => 'james@laravel.com',
85+
'taylor' => 'taylor@laravel.com',
86+
]);
87+
88+
</code-snippet>
89+
90+
## Pest 3 Features
91+
92+
### Architecture Testing
93+
94+
Pest 3 includes architecture testing to enforce code conventions:
95+
96+
<code-snippet name="Architecture Test Example" lang="php">
97+
98+
arch('controllers')
99+
->expect('App\Http\Controllers')
100+
->toExtendNothing()
101+
->toHaveSuffix('Controller');
102+
103+
arch('models')
104+
->expect('App\Models')
105+
->toExtend('Illuminate\Database\Eloquent\Model');
106+
107+
arch('no debugging')
108+
->expect(['dd', 'dump', 'ray'])
109+
->not->toBeUsed();
110+
111+
</code-snippet>
112+
113+
### Type Coverage
114+
115+
Pest 3 provides improved type coverage analysis. Run with `--type-coverage` flag.
116+
117+
## Common Pitfalls
118+
119+
- Not importing `use function Pest\Laravel\mock;` before using mock
120+
- Using `assertStatus(200)` instead of `assertSuccessful()`
121+
- Forgetting datasets for repetitive validation tests
122+
- Deleting tests without approval
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
---
2+
name: tailwindcss-development
3+
description: >-
4+
Styles applications using Tailwind CSS v4 utilities. Activates when adding styles, restyling components,
5+
working with gradients, spacing, layout, flex, grid, responsive design, dark mode, colors,
6+
typography, or borders; or when the user mentions CSS, styling, classes, Tailwind, restyle,
7+
hero section, cards, buttons, or any visual/UI changes.
8+
---
9+
10+
# Tailwind CSS Development
11+
12+
## When to Apply
13+
14+
Activate this skill when:
15+
16+
- Adding styles to components or pages
17+
- Working with responsive design
18+
- Implementing dark mode
19+
- Extracting repeated patterns into components
20+
- Debugging spacing or layout issues
21+
22+
## Documentation
23+
24+
Use `search-docs` for detailed Tailwind CSS v4 patterns and documentation.
25+
26+
## Basic Usage
27+
28+
- Use Tailwind CSS classes to style HTML. Check and follow existing Tailwind conventions in the project before introducing new patterns.
29+
- Offer to extract repeated patterns into components that match the project's conventions (e.g., Blade, JSX, Vue).
30+
- Consider class placement, order, priority, and defaults. Remove redundant classes, add classes to parent or child elements carefully to reduce repetition, and group elements logically.
31+
32+
## Tailwind CSS v4 Specifics
33+
34+
- Always use Tailwind CSS v4 and avoid deprecated utilities.
35+
- `corePlugins` is not supported in Tailwind v4.
36+
37+
### CSS-First Configuration
38+
39+
In Tailwind v4, configuration is CSS-first using the `@theme` directive — no separate `tailwind.config.js` file is needed:
40+
41+
<code-snippet name="CSS-First Config" lang="css">
42+
@theme {
43+
--color-brand: oklch(0.72 0.11 178);
44+
}
45+
</code-snippet>
46+
47+
### Import Syntax
48+
49+
In Tailwind v4, import Tailwind with a regular CSS `@import` statement instead of the `@tailwind` directives used in v3:
50+
51+
<code-snippet name="v4 Import Syntax" lang="diff">
52+
- @tailwind base;
53+
- @tailwind components;
54+
- @tailwind utilities;
55+
+ @import "tailwindcss";
56+
</code-snippet>
57+
58+
### Replaced Utilities
59+
60+
Tailwind v4 removed deprecated utilities. Use the replacements shown below. Opacity values remain numeric.
61+
62+
| Deprecated | Replacement |
63+
|------------|-------------|
64+
| bg-opacity-* | bg-black/* |
65+
| text-opacity-* | text-black/* |
66+
| border-opacity-* | border-black/* |
67+
| divide-opacity-* | divide-black/* |
68+
| ring-opacity-* | ring-black/* |
69+
| placeholder-opacity-* | placeholder-black/* |
70+
| flex-shrink-* | shrink-* |
71+
| flex-grow-* | grow-* |
72+
| overflow-ellipsis | text-ellipsis |
73+
| decoration-slice | box-decoration-slice |
74+
| decoration-clone | box-decoration-clone |
75+
76+
## Spacing
77+
78+
Use `gap` utilities instead of margins for spacing between siblings:
79+
80+
<code-snippet name="Gap Utilities" lang="html">
81+
<div class="flex gap-8">
82+
<div>Item 1</div>
83+
<div>Item 2</div>
84+
</div>
85+
</code-snippet>
86+
87+
## Dark Mode
88+
89+
If existing pages and components support dark mode, new pages and components must support it the same way, typically using the `dark:` variant:
90+
91+
<code-snippet name="Dark Mode" lang="html">
92+
<div class="bg-white dark:bg-gray-900 text-gray-900 dark:text-white">
93+
Content adapts to color scheme
94+
</div>
95+
</code-snippet>
96+
97+
## Common Patterns
98+
99+
### Flexbox Layout
100+
101+
<code-snippet name="Flexbox Layout" lang="html">
102+
<div class="flex items-center justify-between gap-4">
103+
<div>Left content</div>
104+
<div>Right content</div>
105+
</div>
106+
</code-snippet>
107+
108+
### Grid Layout
109+
110+
<code-snippet name="Grid Layout" lang="html">
111+
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
112+
<div>Card 1</div>
113+
<div>Card 2</div>
114+
<div>Card 3</div>
115+
</div>
116+
</code-snippet>
117+
118+
## Common Pitfalls
119+
120+
- Using deprecated v3 utilities (bg-opacity-*, flex-shrink-*, etc.)
121+
- Using `@tailwind` directives instead of `@import "tailwindcss"`
122+
- Trying to use `tailwind.config.js` instead of CSS `@theme` directive
123+
- Using margins for spacing between siblings instead of gap utilities
124+
- Forgetting to add dark mode variants when the project uses dark mode
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
---
2+
name: pest-testing
3+
description: >-
4+
Tests applications using the Pest 3 PHP framework. Activates when writing tests, creating unit or feature
5+
tests, adding assertions, testing Livewire components, architecture testing, debugging test failures,
6+
working with datasets or mocking; or when the user mentions test, spec, TDD, expects, assertion,
7+
coverage, or needs to verify functionality works.
8+
---
9+
10+
# Pest Testing 3
11+
12+
## When to Apply
13+
14+
Activate this skill when:
15+
- Creating new tests (unit or feature)
16+
- Modifying existing tests
17+
- Debugging test failures
18+
- Working with datasets, mocking, or test organization
19+
- Writing architecture tests
20+
21+
## Documentation
22+
23+
Use `search-docs` for detailed Pest 3 patterns and documentation.
24+
25+
## Basic Usage
26+
27+
### Creating Tests
28+
29+
All tests must be written using Pest. Use `php artisan make:test --pest {name}`.
30+
31+
### Test Organization
32+
33+
- Tests live in the `tests/Feature` and `tests/Unit` directories.
34+
- Do NOT remove tests without approval - these are core application code.
35+
- Test happy paths, failure paths, and edge cases.
36+
37+
### Basic Test Structure
38+
39+
<code-snippet name="Basic Pest Test Example" lang="php">
40+
41+
it('is true', function () {
42+
expect(true)->toBeTrue();
43+
});
44+
45+
</code-snippet>
46+
47+
### Running Tests
48+
49+
- Run minimal tests with filter before finalizing: `php artisan test --compact --filter=testName`.
50+
- Run all tests: `php artisan test --compact`.
51+
- Run file: `php artisan test --compact tests/Feature/ExampleTest.php`.
52+
53+
## Assertions
54+
55+
Use specific assertions (`assertSuccessful()`, `assertNotFound()`) instead of `assertStatus()`:
56+
57+
<code-snippet name="Pest Response Assertion" lang="php">
58+
59+
it('returns all', function () {
60+
$this->postJson('/api/docs', [])->assertSuccessful();
61+
});
62+
63+
</code-snippet>
64+
65+
| Use | Instead of |
66+
|-----|------------|
67+
| `assertSuccessful()` | `assertStatus(200)` |
68+
| `assertNotFound()` | `assertStatus(404)` |
69+
| `assertForbidden()` | `assertStatus(403)` |
70+
71+
## Mocking
72+
73+
Import mock function before use: `use function Pest\Laravel\mock;`
74+
75+
## Datasets
76+
77+
Use datasets for repetitive tests (validation rules, etc.):
78+
79+
<code-snippet name="Pest Dataset Example" lang="php">
80+
81+
it('has emails', function (string $email) {
82+
expect($email)->not->toBeEmpty();
83+
})->with([
84+
'james' => 'james@laravel.com',
85+
'taylor' => 'taylor@laravel.com',
86+
]);
87+
88+
</code-snippet>
89+
90+
## Pest 3 Features
91+
92+
### Architecture Testing
93+
94+
Pest 3 includes architecture testing to enforce code conventions:
95+
96+
<code-snippet name="Architecture Test Example" lang="php">
97+
98+
arch('controllers')
99+
->expect('App\Http\Controllers')
100+
->toExtendNothing()
101+
->toHaveSuffix('Controller');
102+
103+
arch('models')
104+
->expect('App\Models')
105+
->toExtend('Illuminate\Database\Eloquent\Model');
106+
107+
arch('no debugging')
108+
->expect(['dd', 'dump', 'ray'])
109+
->not->toBeUsed();
110+
111+
</code-snippet>
112+
113+
### Type Coverage
114+
115+
Pest 3 provides improved type coverage analysis. Run with `--type-coverage` flag.
116+
117+
## Common Pitfalls
118+
119+
- Not importing `use function Pest\Laravel\mock;` before using mock
120+
- Using `assertStatus(200)` instead of `assertSuccessful()`
121+
- Forgetting datasets for repetitive validation tests
122+
- Deleting tests without approval

0 commit comments

Comments
 (0)