@el-j/magic-helix-core 4.0.0-beta.1 → 4.0.0-beta.3
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/dist/index-B88j4AyE.js +13 -0
- package/dist/index-B88j4AyE.js.map +1 -0
- package/dist/index-CY-pQbuu.cjs +2 -0
- package/dist/index-CY-pQbuu.cjs.map +1 -0
- package/dist/index.cjs +75 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.mjs +2234 -51
- package/dist/index.mjs.map +1 -1
- package/dist/pattern-combiner.d.ts +1 -1
- package/dist/plugin-loader.d.ts +7 -1
- package/package.json +4 -4
- package/dist/BasePlugin-6wv0hYJ9.js +0 -98
- package/dist/BasePlugin-6wv0hYJ9.js.map +0 -1
- package/dist/BasePlugin-odQJAKA-.cjs +0 -2
- package/dist/BasePlugin-odQJAKA-.cjs.map +0 -1
- package/dist/builtin-plugins/base/BasePlugin.d.ts +0 -69
- package/dist/builtin-plugins/csharp/index.d.ts +0 -20
- package/dist/builtin-plugins/go/index.d.ts +0 -23
- package/dist/builtin-plugins/index.d.ts +0 -15
- package/dist/builtin-plugins/java/index.d.ts +0 -22
- package/dist/builtin-plugins/nodejs/index.d.ts +0 -44
- package/dist/builtin-plugins/php/index.d.ts +0 -20
- package/dist/builtin-plugins/python/index.d.ts +0 -27
- package/dist/builtin-plugins/ruby/index.d.ts +0 -20
- package/dist/builtin-plugins/rust/index.d.ts +0 -53
- package/dist/builtin-plugins/swift/index.d.ts +0 -22
- package/dist/default_templates/angular/angular-core.md +0 -19
- package/dist/default_templates/architecture/codeowners.md +0 -123
- package/dist/default_templates/architecture/monorepo.md +0 -146
- package/dist/default_templates/architecture/nx.md +0 -122
- package/dist/default_templates/architecture/turborepo.md +0 -114
- package/dist/default_templates/ci/github-actions.md +0 -268
- package/dist/default_templates/ci/gitlab-ci.md +0 -330
- package/dist/default_templates/containers/docker-multistage.md +0 -120
- package/dist/default_templates/containers/kubernetes-deploy.md +0 -210
- package/dist/default_templates/devops/docker-compose.md +0 -111
- package/dist/default_templates/devops/docker-dockerfile.md +0 -94
- package/dist/default_templates/devops/github-actions.md +0 -160
- package/dist/default_templates/devops/gitlab-ci.md +0 -210
- package/dist/default_templates/dotnet/framework-aspnetcore.md +0 -205
- package/dist/default_templates/dotnet/framework-blazor.md +0 -271
- package/dist/default_templates/dotnet/lang-csharp.md +0 -162
- package/dist/default_templates/generic/lang-typescript.md +0 -11
- package/dist/default_templates/generic/state-redux.md +0 -21
- package/dist/default_templates/generic/state-rxjs.md +0 -6
- package/dist/default_templates/generic/style-mui.md +0 -23
- package/dist/default_templates/generic/style-tailwind.md +0 -6
- package/dist/default_templates/generic/test-cypress.md +0 -21
- package/dist/default_templates/generic/test-jest.md +0 -20
- package/dist/default_templates/generic/test-playwright.md +0 -21
- package/dist/default_templates/generic/test-vitest.md +0 -6
- package/dist/default_templates/go/lang-go.md +0 -571
- package/dist/default_templates/java/build-gradle.md +0 -102
- package/dist/default_templates/java/build-maven.md +0 -86
- package/dist/default_templates/java/framework-spring-boot.md +0 -179
- package/dist/default_templates/java/lang-java.md +0 -78
- package/dist/default_templates/java/lang-kotlin.md +0 -88
- package/dist/default_templates/meta/magic-helix-meta.md +0 -213
- package/dist/default_templates/meta/meta-debug.md +0 -459
- package/dist/default_templates/meta/meta-implement.md +0 -450
- package/dist/default_templates/meta/meta-roadmap.md +0 -265
- package/dist/default_templates/nestjs/nestjs-core.md +0 -7
- package/dist/default_templates/patterns/architecture/clean-architecture.md +0 -469
- package/dist/default_templates/patterns/architecture/dependency-injection.md +0 -517
- package/dist/default_templates/patterns/architecture/domain-driven-design.md +0 -621
- package/dist/default_templates/patterns/architecture/layered-architecture.md +0 -382
- package/dist/default_templates/patterns/architecture/repository-pattern.md +0 -408
- package/dist/default_templates/patterns/domain-expertise/nextjs-rules.md +0 -115
- package/dist/default_templates/patterns/domain-expertise/react-patterns.md +0 -181
- package/dist/default_templates/patterns/domain-expertise/server-components.md +0 -212
- package/dist/default_templates/patterns/domain-expertise/shadcn-ui.md +0 -52
- package/dist/default_templates/patterns/domain-expertise/tailwind-patterns.md +0 -52
- package/dist/default_templates/patterns/environment/container-awareness.md +0 -17
- package/dist/default_templates/patterns/environment/ide-features.md +0 -17
- package/dist/default_templates/patterns/environment/os-commands.md +0 -17
- package/dist/default_templates/patterns/organization/heading-hierarchy.md +0 -103
- package/dist/default_templates/patterns/organization/sequential-workflows.md +0 -102
- package/dist/default_templates/patterns/organization/xml-rule-groups.md +0 -64
- package/dist/default_templates/patterns/reasoning/agent-loop.md +0 -151
- package/dist/default_templates/patterns/reasoning/confirmation-gates.md +0 -141
- package/dist/default_templates/patterns/reasoning/dependency-analysis.md +0 -132
- package/dist/default_templates/patterns/reasoning/one-tool-per-iteration.md +0 -152
- package/dist/default_templates/patterns/reasoning/preview-before-action.md +0 -194
- package/dist/default_templates/patterns/reasoning/reflection-checkpoints.md +0 -166
- package/dist/default_templates/patterns/reasoning/result-verification.md +0 -157
- package/dist/default_templates/patterns/reasoning/subtask-breakdown.md +0 -131
- package/dist/default_templates/patterns/reasoning/thinking-tags.md +0 -100
- package/dist/default_templates/patterns/role-definition/capability-declarations.md +0 -72
- package/dist/default_templates/patterns/role-definition/expert-identity.md +0 -45
- package/dist/default_templates/patterns/role-definition/scope-boundaries.md +0 -61
- package/dist/default_templates/patterns/safety/code-safety-rules.md +0 -17
- package/dist/default_templates/patterns/safety/credential-handling.md +0 -17
- package/dist/default_templates/patterns/safety/destructive-warnings.md +0 -17
- package/dist/default_templates/patterns/safety/refusal-messages.md +0 -17
- package/dist/default_templates/patterns/tone/adaptive-tone.md +0 -17
- package/dist/default_templates/patterns/tone/concise-communication.md +0 -17
- package/dist/default_templates/patterns/tone/forbidden-phrases.md +0 -17
- package/dist/default_templates/patterns/tool-guidelines/function-schemas.md +0 -143
- package/dist/default_templates/patterns/tool-guidelines/parameter-examples.md +0 -137
- package/dist/default_templates/patterns/tool-guidelines/usage-policies.md +0 -105
- package/dist/default_templates/php/framework-laravel.md +0 -112
- package/dist/default_templates/php/lang-php.md +0 -94
- package/dist/default_templates/python/lang-python.md +0 -508
- package/dist/default_templates/react/react-core.md +0 -677
- package/dist/default_templates/react/react-zustand.md +0 -7
- package/dist/default_templates/ruby/framework-rails.md +0 -309
- package/dist/default_templates/ruby/framework-sinatra.md +0 -227
- package/dist/default_templates/ruby/lang-ruby.md +0 -216
- package/dist/default_templates/rust/lang-rust.md +0 -89
- package/dist/default_templates/swift/framework-vapor.md +0 -352
- package/dist/default_templates/swift/lang-swift.md +0 -291
- package/dist/default_templates/vue/style-primevue.md +0 -6
- package/dist/default_templates/vue/style-quasar.md +0 -22
- package/dist/default_templates/vue/vue-core.md +0 -28
- package/dist/default_templates/vue/vue-pinia.md +0 -5
- package/dist/index-AkVwRl-r.js +0 -92
- package/dist/index-AkVwRl-r.js.map +0 -1
- package/dist/index-B6BeG1yT.cjs +0 -68
- package/dist/index-B6BeG1yT.cjs.map +0 -1
- package/dist/index-B8pyjKdF.js +0 -94
- package/dist/index-B8pyjKdF.js.map +0 -1
- package/dist/index-B_6W_RnJ.cjs +0 -76
- package/dist/index-B_6W_RnJ.cjs.map +0 -1
- package/dist/index-Bg8DD8ku.js +0 -216
- package/dist/index-Bg8DD8ku.js.map +0 -1
- package/dist/index-BkJhe5Af.js +0 -1748
- package/dist/index-BkJhe5Af.js.map +0 -1
- package/dist/index-Bv4Q1Pr7.cjs +0 -33
- package/dist/index-Bv4Q1Pr7.cjs.map +0 -1
- package/dist/index-CN8J45Nc.cjs +0 -24
- package/dist/index-CN8J45Nc.cjs.map +0 -1
- package/dist/index-CPbv2Od1.js +0 -62
- package/dist/index-CPbv2Od1.js.map +0 -1
- package/dist/index-Cf-MC6Al.js +0 -63
- package/dist/index-Cf-MC6Al.js.map +0 -1
- package/dist/index-DDPXXXDy.cjs +0 -19
- package/dist/index-DDPXXXDy.cjs.map +0 -1
- package/dist/index-DO30AzDe.cjs +0 -19
- package/dist/index-DO30AzDe.cjs.map +0 -1
- package/dist/index-Dm37u5ut.js +0 -2128
- package/dist/index-Dm37u5ut.js.map +0 -1
- package/dist/index-DqHvgoXJ.cjs +0 -19
- package/dist/index-DqHvgoXJ.cjs.map +0 -1
- package/dist/index-J1qAfsnO.cjs +0 -2
- package/dist/index-J1qAfsnO.cjs.map +0 -1
- package/dist/index-Jz0HYZ7B.js +0 -13
- package/dist/index-Jz0HYZ7B.js.map +0 -1
- package/dist/index-K39pdw94.cjs +0 -31
- package/dist/index-K39pdw94.cjs.map +0 -1
- package/dist/index-L3IVvhd1.cjs +0 -89
- package/dist/index-L3IVvhd1.cjs.map +0 -1
- package/dist/index-OT2XAJkc.js +0 -117
- package/dist/index-OT2XAJkc.js.map +0 -1
- package/dist/index-TPAX4XKg.cjs +0 -30
- package/dist/index-TPAX4XKg.cjs.map +0 -1
- package/dist/index-WmVSB57y.js +0 -107
- package/dist/index-WmVSB57y.js.map +0 -1
- package/dist/index-mYXvc3Fs.js +0 -68
- package/dist/index-mYXvc3Fs.js.map +0 -1
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
# Usage Policies Pattern
|
|
2
|
-
|
|
3
|
-
## Purpose
|
|
4
|
-
Define when and how to use tools, including restrictions. From **Cline** and **ChatGPT** patterns.
|
|
5
|
-
|
|
6
|
-
## Template
|
|
7
|
-
|
|
8
|
-
```markdown
|
|
9
|
-
## {TOOL_NAME} Usage Policy
|
|
10
|
-
|
|
11
|
-
### When to Use
|
|
12
|
-
- {USE_CASE_1}
|
|
13
|
-
- {USE_CASE_2}
|
|
14
|
-
- {USE_CASE_3}
|
|
15
|
-
|
|
16
|
-
### When NOT to Use
|
|
17
|
-
- {ANTI_PATTERN_1}
|
|
18
|
-
- {ANTI_PATTERN_2}
|
|
19
|
-
- {ANTI_PATTERN_3}
|
|
20
|
-
|
|
21
|
-
### Restrictions
|
|
22
|
-
- {RESTRICTION_1}
|
|
23
|
-
- {RESTRICTION_2}
|
|
24
|
-
- {RESTRICTION_3}
|
|
25
|
-
|
|
26
|
-
### Preferred Alternatives
|
|
27
|
-
If {CONDITION}, use {ALTERNATIVE_TOOL} instead because {REASON}.
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
## Examples
|
|
31
|
-
|
|
32
|
-
### Cline (Terminal Commands)
|
|
33
|
-
```markdown
|
|
34
|
-
## run_in_terminal Usage Policy
|
|
35
|
-
|
|
36
|
-
### When to Use
|
|
37
|
-
- Installing packages (npm, pip, brew)
|
|
38
|
-
- Running build commands (npm run build)
|
|
39
|
-
- Git operations (commit, push, pull)
|
|
40
|
-
- Executing test suites
|
|
41
|
-
|
|
42
|
-
### When NOT to Use
|
|
43
|
-
- Running Python code snippets (use pylance_runCodeSnippet instead)
|
|
44
|
-
- Reading file contents (use read_file instead)
|
|
45
|
-
- Making file edits (use replace_string_in_file instead)
|
|
46
|
-
- Parallel execution (terminal doesn't support concurrent commands)
|
|
47
|
-
|
|
48
|
-
### Restrictions
|
|
49
|
-
- Run one command at a time (wait for output before next)
|
|
50
|
-
- Use absolute paths to avoid navigation issues
|
|
51
|
-
- Disable paging (--no-pager, | cat) to prevent truncation
|
|
52
|
-
- Filter output with grep/awk for large results (>1000 lines)
|
|
53
|
-
|
|
54
|
-
### Preferred Alternatives
|
|
55
|
-
If running Python code, use `pylance_runCodeSnippet` instead because it:
|
|
56
|
-
- Uses correct workspace interpreter automatically
|
|
57
|
-
- Avoids shell escaping/quoting problems
|
|
58
|
-
- Provides clean, formatted output
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
### ChatGPT (Image Generation)
|
|
62
|
-
```markdown
|
|
63
|
-
## generate_image Usage Policy
|
|
64
|
-
|
|
65
|
-
### When to Use
|
|
66
|
-
- User explicitly requests an image
|
|
67
|
-
- Visual aid would enhance understanding
|
|
68
|
-
- Demonstrating design concepts
|
|
69
|
-
- Creating illustrations for explanations
|
|
70
|
-
|
|
71
|
-
### When NOT to Use
|
|
72
|
-
- User asked for text description only
|
|
73
|
-
- Depicting real people (use generic descriptions)
|
|
74
|
-
- Generating logos/brands (copyright concerns)
|
|
75
|
-
- Creating images of copyrighted characters
|
|
76
|
-
|
|
77
|
-
### Restrictions
|
|
78
|
-
- NEVER generate images of named real people (living or deceased)
|
|
79
|
-
- NEVER create content that is harmful, hateful, or violent
|
|
80
|
-
- NEVER generate trademarked characters or logos
|
|
81
|
-
- NEVER include recognizable brand names or products
|
|
82
|
-
|
|
83
|
-
### Preferred Alternatives
|
|
84
|
-
If user wants a person, describe generic attributes instead:
|
|
85
|
-
❌ "Generate an image of Taylor Swift"
|
|
86
|
-
✅ "Generate an image of a young woman with curly blonde hair performing on stage"
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
## Variables
|
|
90
|
-
- `{TOOL_NAME}`: Tool/function name
|
|
91
|
-
- `{USE_CASE_X}`: Appropriate scenarios
|
|
92
|
-
- `{ANTI_PATTERN_X}`: Inappropriate scenarios
|
|
93
|
-
- `{RESTRICTION_X}`: Hard constraints
|
|
94
|
-
- `{CONDITION}`: Circumstance triggering alternative
|
|
95
|
-
- `{ALTERNATIVE_TOOL}`: Better tool for scenario
|
|
96
|
-
- `{REASON}`: Why alternative is better
|
|
97
|
-
|
|
98
|
-
## Best Practices
|
|
99
|
-
1. Start with positive use cases (what to do)
|
|
100
|
-
2. Follow with anti-patterns (what not to do)
|
|
101
|
-
3. Use concrete examples (✅/❌ pairs)
|
|
102
|
-
4. Explain reasoning behind restrictions
|
|
103
|
-
5. Suggest alternatives when rejecting patterns
|
|
104
|
-
6. Include edge cases and gotchas
|
|
105
|
-
7. Benefits: Prevents misuse, improves efficiency, reduces errors
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
# Laravel Framework Guidelines
|
|
2
|
-
|
|
3
|
-
## Overview
|
|
4
|
-
This project uses Laravel framework. Follow Laravel conventions and best practices.
|
|
5
|
-
|
|
6
|
-
## Artisan Commands
|
|
7
|
-
- Serve application: `php artisan serve`
|
|
8
|
-
- Run migrations: `php artisan migrate`
|
|
9
|
-
- Create migration: `php artisan make:migration <name>`
|
|
10
|
-
- Create model: `php artisan make:model <name>`
|
|
11
|
-
- Create controller: `php artisan make:controller <name>`
|
|
12
|
-
- Clear cache: `php artisan cache:clear`
|
|
13
|
-
- List routes: `php artisan route:list`
|
|
14
|
-
|
|
15
|
-
## Directory Structure
|
|
16
|
-
- `app/` - Application core code
|
|
17
|
-
- `app/Http/Controllers/` - Controllers
|
|
18
|
-
- `app/Models/` - Eloquent models
|
|
19
|
-
- `app/Services/` - Business logic services
|
|
20
|
-
- `routes/` - Route definitions
|
|
21
|
-
- `database/migrations/` - Database migrations
|
|
22
|
-
- `resources/views/` - Blade templates
|
|
23
|
-
- `config/` - Configuration files
|
|
24
|
-
|
|
25
|
-
## Eloquent ORM
|
|
26
|
-
- Use Eloquent models for database interactions
|
|
27
|
-
- Define relationships in models
|
|
28
|
-
- Use query scopes for reusable queries
|
|
29
|
-
- Use accessors and mutators for attribute transformation
|
|
30
|
-
- Eager load relationships to avoid N+1 queries
|
|
31
|
-
|
|
32
|
-
## Routing
|
|
33
|
-
- Define routes in `routes/web.php` or `routes/api.php`
|
|
34
|
-
- Use resource controllers: `Route::resource('posts', PostController::class)`
|
|
35
|
-
- Use route model binding for automatic model injection
|
|
36
|
-
- Group related routes with middleware
|
|
37
|
-
- Name your routes for easier URL generation
|
|
38
|
-
|
|
39
|
-
## Controllers
|
|
40
|
-
- Keep controllers thin - delegate to services
|
|
41
|
-
- Use single action controllers for simple endpoints
|
|
42
|
-
- Return views or JSON responses appropriately
|
|
43
|
-
- Use form requests for validation
|
|
44
|
-
- Use resource controllers for CRUD operations
|
|
45
|
-
|
|
46
|
-
## Blade Templates
|
|
47
|
-
- Use Blade templating engine
|
|
48
|
-
- Extend layouts: `@extends('layouts.app')`
|
|
49
|
-
- Define sections: `@section('content') ... @endsection`
|
|
50
|
-
- Include partials: `@include('partials.header')`
|
|
51
|
-
- Use components for reusable UI elements
|
|
52
|
-
- Escape output: `{{ $variable }}` (automatic)
|
|
53
|
-
- Raw output (use cautiously): `{!! $html !!}`
|
|
54
|
-
|
|
55
|
-
## Validation
|
|
56
|
-
- Use Form Requests for complex validation
|
|
57
|
-
- Define rules in controller or Form Request
|
|
58
|
-
- Use built-in validation rules
|
|
59
|
-
- Create custom validation rules when needed
|
|
60
|
-
- Return validation errors automatically
|
|
61
|
-
|
|
62
|
-
## Database
|
|
63
|
-
- Use migrations for schema changes
|
|
64
|
-
- Use seeders for test data
|
|
65
|
-
- Use factories for model generation
|
|
66
|
-
- Write raw queries only when necessary
|
|
67
|
-
- Use database transactions for multiple operations
|
|
68
|
-
|
|
69
|
-
## Authentication
|
|
70
|
-
- Use Laravel Breeze or Jetstream for scaffolding
|
|
71
|
-
- Use middleware for route protection: `auth`, `guest`
|
|
72
|
-
- Use gates and policies for authorization
|
|
73
|
-
- Hash passwords with `Hash::make()`
|
|
74
|
-
- Use sanctum for API authentication
|
|
75
|
-
|
|
76
|
-
## Testing
|
|
77
|
-
- Write Feature tests in `tests/Feature/`
|
|
78
|
-
- Write Unit tests in `tests/Unit/`
|
|
79
|
-
- Use `php artisan test` to run tests
|
|
80
|
-
- Use factories for test data generation
|
|
81
|
-
- Use `RefreshDatabase` trait for database tests
|
|
82
|
-
|
|
83
|
-
## Queues & Jobs
|
|
84
|
-
- Use queues for slow operations
|
|
85
|
-
- Create jobs: `php artisan make:job <name>`
|
|
86
|
-
- Dispatch jobs: `dispatch(new JobName())`
|
|
87
|
-
- Run queue worker: `php artisan queue:work`
|
|
88
|
-
- Use different queues for priority
|
|
89
|
-
|
|
90
|
-
## Events & Listeners
|
|
91
|
-
- Use events for decoupled communication
|
|
92
|
-
- Create events: `php artisan make:event <name>`
|
|
93
|
-
- Create listeners: `php artisan make:listener <name>`
|
|
94
|
-
- Register in `EventServiceProvider`
|
|
95
|
-
- Dispatch events: `event(new EventName())`
|
|
96
|
-
|
|
97
|
-
## API Development
|
|
98
|
-
- Use API resources for JSON responses
|
|
99
|
-
- Version your API routes
|
|
100
|
-
- Use rate limiting middleware
|
|
101
|
-
- Return proper HTTP status codes
|
|
102
|
-
- Use Sanctum or Passport for authentication
|
|
103
|
-
|
|
104
|
-
## Best Practices
|
|
105
|
-
- Use dependency injection in constructors
|
|
106
|
-
- Keep business logic in service classes
|
|
107
|
-
- Use repository pattern for complex data access
|
|
108
|
-
- Follow single responsibility principle
|
|
109
|
-
- Write tests for all features
|
|
110
|
-
- Use environment variables for configuration
|
|
111
|
-
- Never commit `.env` file
|
|
112
|
-
- Use Laravel's built-in features before third-party packages
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
# PHP Development Guidelines
|
|
2
|
-
|
|
3
|
-
## Overview
|
|
4
|
-
This project uses PHP. Follow modern PHP standards (PSR-12) and best practices.
|
|
5
|
-
|
|
6
|
-
## Code Style
|
|
7
|
-
- Follow PSR-12 coding standards
|
|
8
|
-
- Use 4 spaces for indentation
|
|
9
|
-
- Use `declare(strict_types=1);` at the top of files
|
|
10
|
-
- Use type declarations for all parameters and return types
|
|
11
|
-
- Use `final` for classes that shouldn't be extended
|
|
12
|
-
|
|
13
|
-
## PHP Standards Recommendations (PSR)
|
|
14
|
-
- PSR-1: Basic Coding Standard
|
|
15
|
-
- PSR-4: Autoloading Standard
|
|
16
|
-
- PSR-7: HTTP Message Interface
|
|
17
|
-
- PSR-12: Extended Coding Style Guide
|
|
18
|
-
- PSR-15: HTTP Handlers
|
|
19
|
-
|
|
20
|
-
## Composer Commands
|
|
21
|
-
- Install dependencies: `composer install`
|
|
22
|
-
- Update dependencies: `composer update`
|
|
23
|
-
- Autoload optimization: `composer dump-autoload -o`
|
|
24
|
-
- Run scripts: `composer run-script <script-name>`
|
|
25
|
-
- Validate composer.json: `composer validate`
|
|
26
|
-
|
|
27
|
-
## Type Safety
|
|
28
|
-
- Use strict types: `declare(strict_types=1);`
|
|
29
|
-
- Add type hints to all parameters
|
|
30
|
-
- Add return type declarations
|
|
31
|
-
- Use union types in PHP 8+: `string|int`
|
|
32
|
-
- Use nullable types: `?string`
|
|
33
|
-
|
|
34
|
-
## Error Handling
|
|
35
|
-
- Use exceptions for error handling
|
|
36
|
-
- Create custom exception classes
|
|
37
|
-
- Catch specific exceptions, not generic `\Exception`
|
|
38
|
-
- Use `finally` blocks for cleanup
|
|
39
|
-
- Log errors appropriately
|
|
40
|
-
|
|
41
|
-
## Object-Oriented Programming
|
|
42
|
-
- Follow SOLID principles
|
|
43
|
-
- Use dependency injection
|
|
44
|
-
- Favor composition over inheritance
|
|
45
|
-
- Use interfaces for contracts
|
|
46
|
-
- Use abstract classes for shared behavior
|
|
47
|
-
|
|
48
|
-
## Modern PHP Features (8.x)
|
|
49
|
-
- Named arguments: `function(param: $value)`
|
|
50
|
-
- Constructor property promotion
|
|
51
|
-
- Match expressions instead of switch
|
|
52
|
-
- Nullsafe operator: `$obj?->method()`
|
|
53
|
-
- Attributes instead of annotations
|
|
54
|
-
|
|
55
|
-
## Security
|
|
56
|
-
- Always validate and sanitize user input
|
|
57
|
-
- Use prepared statements for database queries
|
|
58
|
-
- Escape output to prevent XSS
|
|
59
|
-
- Use CSRF tokens for forms
|
|
60
|
-
- Keep dependencies updated
|
|
61
|
-
- Use environment variables for sensitive data
|
|
62
|
-
|
|
63
|
-
## Testing
|
|
64
|
-
- Write PHPUnit tests for all classes
|
|
65
|
-
- Aim for high code coverage
|
|
66
|
-
- Use data providers for multiple test cases
|
|
67
|
-
- Mock external dependencies
|
|
68
|
-
- Run tests: `vendor/bin/phpunit`
|
|
69
|
-
|
|
70
|
-
## Code Quality Tools
|
|
71
|
-
- PHPStan: Static analysis - `vendor/bin/phpstan analyse`
|
|
72
|
-
- Psalm: Static analysis - `vendor/bin/psalm`
|
|
73
|
-
- PHP_CodeSniffer: Code style - `vendor/bin/phpcs`
|
|
74
|
-
- PHP-CS-Fixer: Auto-fix style - `vendor/bin/php-cs-fixer fix`
|
|
75
|
-
|
|
76
|
-
## Documentation
|
|
77
|
-
- Use PHPDoc blocks for all classes, methods, and properties
|
|
78
|
-
- Include `@param`, `@return`, and `@throws` tags
|
|
79
|
-
- Document complex logic with inline comments
|
|
80
|
-
- Keep documentation up-to-date
|
|
81
|
-
|
|
82
|
-
## Performance
|
|
83
|
-
- Use opcode caching (OPcache)
|
|
84
|
-
- Profile with Xdebug or Blackfire
|
|
85
|
-
- Optimize database queries
|
|
86
|
-
- Use caching (Redis, Memcached)
|
|
87
|
-
- Consider asynchronous processing for heavy tasks
|
|
88
|
-
|
|
89
|
-
## Common Patterns
|
|
90
|
-
- Repository pattern for data access
|
|
91
|
-
- Service layer for business logic
|
|
92
|
-
- Factory pattern for object creation
|
|
93
|
-
- Observer pattern for events
|
|
94
|
-
- Dependency injection containers
|