omgkit 2.1.1 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/plugin/skills/databases/mongodb/SKILL.md +81 -28
- package/plugin/skills/databases/prisma/SKILL.md +87 -32
- package/plugin/skills/databases/redis/SKILL.md +80 -27
- package/plugin/skills/devops/aws/SKILL.md +80 -26
- package/plugin/skills/devops/github-actions/SKILL.md +84 -32
- package/plugin/skills/devops/kubernetes/SKILL.md +94 -32
- package/plugin/skills/devops/performance-profiling/SKILL.md +59 -863
- package/plugin/skills/frameworks/django/SKILL.md +158 -24
- package/plugin/skills/frameworks/express/SKILL.md +153 -33
- package/plugin/skills/frameworks/fastapi/SKILL.md +153 -34
- package/plugin/skills/frameworks/laravel/SKILL.md +146 -33
- package/plugin/skills/frameworks/nestjs/SKILL.md +137 -25
- package/plugin/skills/frameworks/rails/SKILL.md +594 -28
- package/plugin/skills/frameworks/react/SKILL.md +94 -962
- package/plugin/skills/frameworks/spring/SKILL.md +528 -35
- package/plugin/skills/frameworks/vue/SKILL.md +147 -25
- package/plugin/skills/frontend/accessibility/SKILL.md +145 -36
- package/plugin/skills/frontend/frontend-design/SKILL.md +114 -29
- package/plugin/skills/frontend/responsive/SKILL.md +131 -28
- package/plugin/skills/frontend/shadcn-ui/SKILL.md +133 -43
- package/plugin/skills/frontend/tailwindcss/SKILL.md +105 -37
- package/plugin/skills/frontend/threejs/SKILL.md +110 -35
- package/plugin/skills/languages/javascript/SKILL.md +195 -34
- package/plugin/skills/methodology/brainstorming/SKILL.md +98 -30
- package/plugin/skills/methodology/defense-in-depth/SKILL.md +83 -37
- package/plugin/skills/methodology/dispatching-parallel-agents/SKILL.md +92 -31
- package/plugin/skills/methodology/executing-plans/SKILL.md +117 -28
- package/plugin/skills/methodology/finishing-development-branch/SKILL.md +111 -32
- package/plugin/skills/methodology/problem-solving/SKILL.md +65 -311
- package/plugin/skills/methodology/receiving-code-review/SKILL.md +76 -27
- package/plugin/skills/methodology/requesting-code-review/SKILL.md +93 -22
- package/plugin/skills/methodology/root-cause-tracing/SKILL.md +75 -40
- package/plugin/skills/methodology/sequential-thinking/SKILL.md +75 -224
- package/plugin/skills/methodology/systematic-debugging/SKILL.md +81 -35
- package/plugin/skills/methodology/test-driven-development/SKILL.md +120 -26
- package/plugin/skills/methodology/testing-anti-patterns/SKILL.md +88 -35
- package/plugin/skills/methodology/token-optimization/SKILL.md +73 -34
- package/plugin/skills/methodology/verification-before-completion/SKILL.md +128 -28
- package/plugin/skills/methodology/writing-plans/SKILL.md +105 -20
- package/plugin/skills/omega/omega-architecture/SKILL.md +178 -40
- package/plugin/skills/omega/omega-coding/SKILL.md +247 -41
- package/plugin/skills/omega/omega-sprint/SKILL.md +208 -46
- package/plugin/skills/omega/omega-testing/SKILL.md +253 -42
- package/plugin/skills/omega/omega-thinking/SKILL.md +263 -51
- package/plugin/skills/security/better-auth/SKILL.md +83 -34
- package/plugin/skills/security/oauth/SKILL.md +118 -35
- package/plugin/skills/security/owasp/SKILL.md +112 -35
- package/plugin/skills/testing/playwright/SKILL.md +141 -38
- package/plugin/skills/testing/pytest/SKILL.md +137 -38
- package/plugin/skills/testing/vitest/SKILL.md +124 -39
- package/plugin/skills/tools/document-processing/SKILL.md +111 -838
- package/plugin/skills/tools/image-processing/SKILL.md +126 -659
- package/plugin/skills/tools/mcp-development/SKILL.md +85 -758
- package/plugin/skills/tools/media-processing/SKILL.md +118 -735
- package/plugin/stdrules/SKILL_STANDARDS.md +490 -0
|
@@ -1,65 +1,178 @@
|
|
|
1
1
|
---
|
|
2
|
-
name: laravel
|
|
3
|
-
description: Laravel
|
|
2
|
+
name: building-laravel-apis
|
|
3
|
+
description: Builds enterprise Laravel applications with Eloquent, API Resources, Sanctum auth, and queue processing. Use when creating PHP backends, REST APIs, or full-stack Laravel applications.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# Laravel
|
|
6
|
+
# Laravel
|
|
7
7
|
|
|
8
|
-
##
|
|
8
|
+
## Quick Start
|
|
9
9
|
|
|
10
|
-
### Model
|
|
11
10
|
```php
|
|
12
|
-
|
|
11
|
+
// routes/api.php
|
|
12
|
+
Route::get('/health', fn () => ['status' => 'ok']);
|
|
13
|
+
|
|
14
|
+
Route::middleware('auth:sanctum')->group(function () {
|
|
15
|
+
Route::apiResource('users', UserController::class);
|
|
16
|
+
});
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Features
|
|
20
|
+
|
|
21
|
+
| Feature | Description | Guide |
|
|
22
|
+
|---------|-------------|-------|
|
|
23
|
+
| Models | Eloquent ORM, relationships, scopes | [MODELS.md](MODELS.md) |
|
|
24
|
+
| Controllers | Resource controllers, form requests | [CONTROLLERS.md](CONTROLLERS.md) |
|
|
25
|
+
| API Resources | Response transformation | [RESOURCES.md](RESOURCES.md) |
|
|
26
|
+
| Auth | Sanctum, policies, gates | [AUTH.md](AUTH.md) |
|
|
27
|
+
| Queues | Jobs, events, listeners | [QUEUES.md](QUEUES.md) |
|
|
28
|
+
| Testing | Feature, unit tests | [TESTING.md](TESTING.md) |
|
|
29
|
+
|
|
30
|
+
## Common Patterns
|
|
31
|
+
|
|
32
|
+
### Model with Relationships
|
|
33
|
+
|
|
34
|
+
```php
|
|
35
|
+
class User extends Authenticatable
|
|
13
36
|
{
|
|
14
|
-
|
|
15
|
-
|
|
37
|
+
use HasApiTokens, HasFactory, SoftDeletes;
|
|
38
|
+
|
|
39
|
+
protected $fillable = ['name', 'email', 'password', 'role'];
|
|
40
|
+
protected $hidden = ['password', 'remember_token'];
|
|
41
|
+
protected $casts = ['email_verified_at' => 'datetime', 'password' => 'hashed'];
|
|
42
|
+
|
|
43
|
+
public function organizations(): BelongsToMany
|
|
44
|
+
{
|
|
45
|
+
return $this->belongsToMany(Organization::class, 'memberships')
|
|
46
|
+
->withPivot('role')
|
|
47
|
+
->withTimestamps();
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
public function scopeActive($query)
|
|
51
|
+
{
|
|
52
|
+
return $query->where('is_active', true);
|
|
53
|
+
}
|
|
16
54
|
|
|
17
|
-
public function
|
|
55
|
+
public function scopeSearch($query, ?string $search)
|
|
18
56
|
{
|
|
19
|
-
return $
|
|
57
|
+
return $search
|
|
58
|
+
? $query->where('name', 'like', "%{$search}%")
|
|
59
|
+
->orWhere('email', 'like', "%{$search}%")
|
|
60
|
+
: $query;
|
|
20
61
|
}
|
|
21
62
|
}
|
|
22
63
|
```
|
|
23
64
|
|
|
24
|
-
### Controller
|
|
65
|
+
### Controller with Service
|
|
66
|
+
|
|
25
67
|
```php
|
|
26
68
|
class UserController extends Controller
|
|
27
69
|
{
|
|
28
|
-
public function
|
|
70
|
+
public function __construct(private UserService $userService) {}
|
|
71
|
+
|
|
72
|
+
public function index(Request $request): PaginatedCollection
|
|
29
73
|
{
|
|
30
|
-
|
|
74
|
+
$users = $this->userService->list(
|
|
75
|
+
search: $request->input('search'),
|
|
76
|
+
perPage: $request->input('per_page', 20)
|
|
77
|
+
);
|
|
78
|
+
return new PaginatedCollection($users, UserResource::class);
|
|
31
79
|
}
|
|
32
80
|
|
|
33
|
-
public function store(
|
|
81
|
+
public function store(CreateUserRequest $request): JsonResponse
|
|
34
82
|
{
|
|
35
|
-
$
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
83
|
+
$user = $this->userService->create($request->validated());
|
|
84
|
+
return (new UserResource($user))
|
|
85
|
+
->response()
|
|
86
|
+
->setStatusCode(201);
|
|
87
|
+
}
|
|
39
88
|
|
|
40
|
-
|
|
41
|
-
|
|
89
|
+
public function show(User $user): UserResource
|
|
90
|
+
{
|
|
91
|
+
return new UserResource($user->load('organizations'));
|
|
42
92
|
}
|
|
43
93
|
}
|
|
44
94
|
```
|
|
45
95
|
|
|
46
|
-
###
|
|
96
|
+
### Form Request Validation
|
|
97
|
+
|
|
47
98
|
```php
|
|
48
|
-
|
|
99
|
+
class CreateUserRequest extends FormRequest
|
|
100
|
+
{
|
|
101
|
+
public function authorize(): bool
|
|
102
|
+
{
|
|
103
|
+
return $this->user()->isAdmin();
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
public function rules(): array
|
|
107
|
+
{
|
|
108
|
+
return [
|
|
109
|
+
'name' => ['required', 'string', 'min:2', 'max:100'],
|
|
110
|
+
'email' => ['required', 'email', 'unique:users,email'],
|
|
111
|
+
'password' => ['required', 'confirmed', Password::min(8)->mixedCase()->numbers()],
|
|
112
|
+
'role' => ['sometimes', 'in:admin,user,guest'],
|
|
113
|
+
];
|
|
114
|
+
}
|
|
115
|
+
}
|
|
49
116
|
```
|
|
50
117
|
|
|
51
|
-
|
|
118
|
+
## Workflows
|
|
119
|
+
|
|
120
|
+
### API Development
|
|
121
|
+
|
|
122
|
+
1. Create model and migration
|
|
123
|
+
2. Create controller with `php artisan make:controller --api`
|
|
124
|
+
3. Add Form Request for validation
|
|
125
|
+
4. Create API Resource for responses
|
|
126
|
+
5. Write feature tests
|
|
127
|
+
|
|
128
|
+
### Resource Response
|
|
129
|
+
|
|
52
130
|
```php
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
$
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
131
|
+
class UserResource extends JsonResource
|
|
132
|
+
{
|
|
133
|
+
public function toArray(Request $request): array
|
|
134
|
+
{
|
|
135
|
+
return [
|
|
136
|
+
'id' => $this->id,
|
|
137
|
+
'name' => $this->name,
|
|
138
|
+
'email' => $this->email,
|
|
139
|
+
'organizations' => OrganizationResource::collection($this->whenLoaded('organizations')),
|
|
140
|
+
'created_at' => $this->created_at->toIso8601String(),
|
|
141
|
+
];
|
|
142
|
+
}
|
|
143
|
+
}
|
|
59
144
|
```
|
|
60
145
|
|
|
61
146
|
## Best Practices
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
147
|
+
|
|
148
|
+
| Do | Avoid |
|
|
149
|
+
|----|-------|
|
|
150
|
+
| Use Form Requests for validation | Validating in controllers |
|
|
151
|
+
| Use API Resources for responses | Returning models directly |
|
|
152
|
+
| Use service classes for logic | Fat controllers |
|
|
153
|
+
| Use eager loading | N+1 queries |
|
|
154
|
+
| Use soft deletes | Hard deletes for important data |
|
|
155
|
+
|
|
156
|
+
## Project Structure
|
|
157
|
+
|
|
158
|
+
```
|
|
159
|
+
app/
|
|
160
|
+
├── Http/
|
|
161
|
+
│ ├── Controllers/Api/
|
|
162
|
+
│ ├── Requests/
|
|
163
|
+
│ ├── Resources/
|
|
164
|
+
│ └── Middleware/
|
|
165
|
+
├── Models/
|
|
166
|
+
├── Services/
|
|
167
|
+
├── Policies/
|
|
168
|
+
├── Jobs/
|
|
169
|
+
└── Events/
|
|
170
|
+
routes/
|
|
171
|
+
├── api.php
|
|
172
|
+
└── web.php
|
|
173
|
+
tests/
|
|
174
|
+
├── Feature/
|
|
175
|
+
└── Unit/
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
For detailed examples and patterns, see reference files above.
|
|
@@ -1,32 +1,63 @@
|
|
|
1
1
|
---
|
|
2
|
-
name: nestjs
|
|
3
|
-
description: NestJS
|
|
2
|
+
name: building-nestjs-apis
|
|
3
|
+
description: Builds enterprise NestJS applications with TypeScript, dependency injection, TypeORM, and microservices patterns. Use when creating scalable Node.js backends, REST/GraphQL APIs, or microservices.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# NestJS
|
|
6
|
+
# NestJS
|
|
7
7
|
|
|
8
|
-
##
|
|
8
|
+
## Quick Start
|
|
9
9
|
|
|
10
|
-
### Module
|
|
11
10
|
```typescript
|
|
12
|
-
@
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
11
|
+
import { Controller, Get, Module, NestFactory } from '@nestjs/common';
|
|
12
|
+
|
|
13
|
+
@Controller('health')
|
|
14
|
+
class HealthController {
|
|
15
|
+
@Get()
|
|
16
|
+
check() {
|
|
17
|
+
return { status: 'ok' };
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@Module({ controllers: [HealthController] })
|
|
22
|
+
class AppModule {}
|
|
23
|
+
|
|
24
|
+
async function bootstrap() {
|
|
25
|
+
const app = await NestFactory.create(AppModule);
|
|
26
|
+
await app.listen(3000);
|
|
27
|
+
}
|
|
28
|
+
bootstrap();
|
|
19
29
|
```
|
|
20
30
|
|
|
21
|
-
|
|
31
|
+
## Features
|
|
32
|
+
|
|
33
|
+
| Feature | Description | Guide |
|
|
34
|
+
|---------|-------------|-------|
|
|
35
|
+
| Modules | Dependency injection, providers | [MODULES.md](MODULES.md) |
|
|
36
|
+
| Controllers | Routes, validation, guards | [CONTROLLERS.md](CONTROLLERS.md) |
|
|
37
|
+
| Services | Business logic, repositories | [SERVICES.md](SERVICES.md) |
|
|
38
|
+
| Database | TypeORM, Prisma integration | [DATABASE.md](DATABASE.md) |
|
|
39
|
+
| Auth | Passport, JWT, guards | [AUTH.md](AUTH.md) |
|
|
40
|
+
| Testing | Unit, e2e with Jest | [TESTING.md](TESTING.md) |
|
|
41
|
+
|
|
42
|
+
## Common Patterns
|
|
43
|
+
|
|
44
|
+
### Controller with Validation
|
|
45
|
+
|
|
22
46
|
```typescript
|
|
23
47
|
@Controller('users')
|
|
48
|
+
@UseGuards(JwtAuthGuard)
|
|
24
49
|
export class UsersController {
|
|
25
|
-
constructor(private usersService: UsersService) {}
|
|
50
|
+
constructor(private readonly usersService: UsersService) {}
|
|
26
51
|
|
|
27
52
|
@Get()
|
|
28
|
-
|
|
29
|
-
|
|
53
|
+
@Roles('admin')
|
|
54
|
+
findAll(@Query() query: PaginationDto) {
|
|
55
|
+
return this.usersService.findAll(query);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
@Get(':id')
|
|
59
|
+
findOne(@Param('id', ParseUUIDPipe) id: string) {
|
|
60
|
+
return this.usersService.findOne(id);
|
|
30
61
|
}
|
|
31
62
|
|
|
32
63
|
@Post()
|
|
@@ -36,32 +67,113 @@ export class UsersController {
|
|
|
36
67
|
}
|
|
37
68
|
```
|
|
38
69
|
|
|
39
|
-
### Service
|
|
70
|
+
### Service with Repository
|
|
71
|
+
|
|
40
72
|
```typescript
|
|
41
73
|
@Injectable()
|
|
42
74
|
export class UsersService {
|
|
43
|
-
constructor(private
|
|
75
|
+
constructor(private readonly usersRepo: UsersRepository) {}
|
|
76
|
+
|
|
77
|
+
async findAll(query: PaginationDto) {
|
|
78
|
+
const [users, total] = await this.usersRepo.findAllWithCount({
|
|
79
|
+
skip: query.skip,
|
|
80
|
+
take: query.limit,
|
|
81
|
+
});
|
|
82
|
+
return { data: users, total, page: query.page };
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
async findOne(id: string) {
|
|
86
|
+
const user = await this.usersRepo.findOne({ where: { id } });
|
|
87
|
+
if (!user) throw new NotFoundException('User not found');
|
|
88
|
+
return user;
|
|
89
|
+
}
|
|
44
90
|
|
|
45
|
-
async
|
|
46
|
-
|
|
91
|
+
async create(dto: CreateUserDto) {
|
|
92
|
+
const exists = await this.usersRepo.findByEmail(dto.email);
|
|
93
|
+
if (exists) throw new ConflictException('Email in use');
|
|
94
|
+
return this.usersRepo.save(this.usersRepo.create(dto));
|
|
47
95
|
}
|
|
48
96
|
}
|
|
49
97
|
```
|
|
50
98
|
|
|
51
|
-
### DTO
|
|
99
|
+
### DTO with Validation
|
|
100
|
+
|
|
52
101
|
```typescript
|
|
53
102
|
export class CreateUserDto {
|
|
54
103
|
@IsEmail()
|
|
55
104
|
email: string;
|
|
56
105
|
|
|
106
|
+
@IsString()
|
|
107
|
+
@MinLength(2)
|
|
108
|
+
name: string;
|
|
109
|
+
|
|
57
110
|
@IsString()
|
|
58
111
|
@MinLength(8)
|
|
112
|
+
@Matches(/^(?=.*[A-Z])(?=.*\d)/, {
|
|
113
|
+
message: 'Password must contain uppercase and number',
|
|
114
|
+
})
|
|
59
115
|
password: string;
|
|
116
|
+
|
|
117
|
+
@IsOptional()
|
|
118
|
+
@IsEnum(UserRole)
|
|
119
|
+
role?: UserRole;
|
|
60
120
|
}
|
|
61
121
|
```
|
|
62
122
|
|
|
123
|
+
## Workflows
|
|
124
|
+
|
|
125
|
+
### API Development
|
|
126
|
+
|
|
127
|
+
1. Create module with `nest g module [name]`
|
|
128
|
+
2. Create controller and service
|
|
129
|
+
3. Define DTOs with class-validator
|
|
130
|
+
4. Add guards for auth/roles
|
|
131
|
+
5. Write unit and e2e tests
|
|
132
|
+
|
|
133
|
+
### Module Structure
|
|
134
|
+
|
|
135
|
+
```typescript
|
|
136
|
+
@Module({
|
|
137
|
+
imports: [TypeOrmModule.forFeature([User])],
|
|
138
|
+
controllers: [UsersController],
|
|
139
|
+
providers: [UsersService, UsersRepository],
|
|
140
|
+
exports: [UsersService],
|
|
141
|
+
})
|
|
142
|
+
export class UsersModule {}
|
|
143
|
+
```
|
|
144
|
+
|
|
63
145
|
## Best Practices
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
146
|
+
|
|
147
|
+
| Do | Avoid |
|
|
148
|
+
|----|-------|
|
|
149
|
+
| Use dependency injection | Direct instantiation |
|
|
150
|
+
| Validate with DTOs | Trusting input |
|
|
151
|
+
| Use guards for auth | Auth logic in controllers |
|
|
152
|
+
| Use interceptors for cross-cutting | Duplicating logging/transform |
|
|
153
|
+
| Write unit + e2e tests | Skipping test coverage |
|
|
154
|
+
|
|
155
|
+
## Project Structure
|
|
156
|
+
|
|
157
|
+
```
|
|
158
|
+
src/
|
|
159
|
+
├── main.ts
|
|
160
|
+
├── app.module.ts
|
|
161
|
+
├── common/
|
|
162
|
+
│ ├── decorators/
|
|
163
|
+
│ ├── guards/
|
|
164
|
+
│ ├── interceptors/
|
|
165
|
+
│ └── pipes/
|
|
166
|
+
├── config/
|
|
167
|
+
├── users/
|
|
168
|
+
│ ├── users.module.ts
|
|
169
|
+
│ ├── users.controller.ts
|
|
170
|
+
│ ├── users.service.ts
|
|
171
|
+
│ ├── dto/
|
|
172
|
+
│ └── entities/
|
|
173
|
+
└── auth/
|
|
174
|
+
├── auth.module.ts
|
|
175
|
+
├── strategies/
|
|
176
|
+
└── guards/
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
For detailed examples and patterns, see reference files above.
|