@ryuenn3123/agentic-senior-core 2.5.22 → 3.0.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/.agent-context/prompts/init-project.md +5 -5
- package/.agent-context/prompts/refactor.md +2 -1
- package/.agent-context/prompts/review-code.md +3 -2
- package/.agent-context/review-checklists/pr-checklist.md +8 -1
- package/.agent-context/rules/architecture.md +11 -0
- package/.agent-context/rules/frontend-architecture.md +2 -2
- package/.agent-context/state/architecture-map.md +1 -1
- package/.agent-context/state/memory-continuity-benchmark.json +1 -1
- package/.agents/workflows/init-project.md +3 -3
- package/.agents/workflows/refactor.md +1 -1
- package/.agents/workflows/review-code.md +4 -5
- package/.cursorrules +27 -71
- package/.gemini/instructions.md +6 -7
- package/.github/copilot-instructions.md +5 -6
- package/.windsurfrules +27 -71
- package/AGENTS.md +7 -9
- package/CONTRIBUTING.md +18 -31
- package/README.md +21 -4
- package/bin/agentic-senior-core.js +0 -6
- package/lib/cli/commands/init.mjs +113 -650
- package/lib/cli/commands/launch.mjs +1 -23
- package/lib/cli/commands/rollback.mjs +1 -1
- package/lib/cli/commands/upgrade.mjs +1 -23
- package/lib/cli/compiler.mjs +77 -72
- package/lib/cli/constants.mjs +84 -26
- package/lib/cli/init-architecture-flow.mjs +231 -0
- package/lib/cli/init-detection-flow.mjs +123 -0
- package/lib/cli/init-options.mjs +344 -0
- package/lib/cli/init-selection.mjs +100 -0
- package/lib/cli/preflight.mjs +1 -1
- package/lib/cli/profile-packs.mjs +15 -1
- package/lib/cli/project-scaffolder.mjs +18 -154
- package/lib/cli/utils.mjs +16 -12
- package/mcp.json +19 -19
- package/package.json +5 -2
- package/scripts/context-triggered-audit.mjs +18 -18
- package/scripts/documentation-boundary-audit.mjs +92 -5
- package/scripts/forbidden-content-check.mjs +1 -1
- package/scripts/frontend-usability-audit.mjs +21 -28
- package/scripts/governance-weekly-report.mjs +29 -15
- package/scripts/llm-judge.mjs +2 -5
- package/scripts/mcp-server.mjs +389 -5
- package/scripts/release-gate.mjs +121 -145
- package/scripts/sync-thin-adapters.mjs +161 -0
- package/scripts/v3-purge-audit.mjs +231 -0
- package/scripts/validate-evidence-bundle.mjs +1 -1
- package/scripts/validate.mjs +224 -272
- package/.agent-context/blueprints/api-nextjs.md +0 -184
- package/.agent-context/blueprints/aspnet-api.md +0 -247
- package/.agent-context/blueprints/ci-github-actions.md +0 -226
- package/.agent-context/blueprints/ci-gitlab.md +0 -200
- package/.agent-context/blueprints/fastapi-service.md +0 -210
- package/.agent-context/blueprints/go-service.md +0 -217
- package/.agent-context/blueprints/graphql-grpc-api.md +0 -51
- package/.agent-context/blueprints/infrastructure-as-code.md +0 -62
- package/.agent-context/blueprints/kubernetes-manifests.md +0 -76
- package/.agent-context/blueprints/laravel-api.md +0 -233
- package/.agent-context/blueprints/mobile-app.md +0 -91
- package/.agent-context/blueprints/nestjs-logic.md +0 -247
- package/.agent-context/blueprints/observability.md +0 -227
- package/.agent-context/blueprints/spring-boot-api.md +0 -218
- package/.agent-context/profiles/platform.md +0 -13
- package/.agent-context/profiles/regulated.md +0 -13
- package/.agent-context/profiles/startup.md +0 -13
- package/.agent-context/review-checklists/frontend-excellence-rubric.md +0 -73
- package/.agent-context/review-checklists/frontend-skill-parity.md +0 -29
- package/.agent-context/review-checklists/frontend-usability.md +0 -35
- package/.agent-context/review-checklists/marketplace-acceptance.md +0 -60
- package/.agent-context/review-checklists/performance-audit.md +0 -71
- package/.agent-context/review-checklists/release-operations.md +0 -33
- package/.agent-context/review-checklists/security-audit.md +0 -119
- package/.agent-context/skills/README.md +0 -63
- package/.agent-context/skills/backend/README.md +0 -68
- package/.agent-context/skills/backend/architecture.md +0 -361
- package/.agent-context/skills/backend/compatibility-manifest.json +0 -8
- package/.agent-context/skills/backend/data-access.md +0 -231
- package/.agent-context/skills/backend/errors.md +0 -138
- package/.agent-context/skills/backend/validation.md +0 -117
- package/.agent-context/skills/backend.md +0 -29
- package/.agent-context/skills/cli/.evidence/compatibility-manifest.json +0 -5
- package/.agent-context/skills/cli/.evidence/sbom-excerpt.json +0 -10
- package/.agent-context/skills/cli/.evidence/test-report.json +0 -8
- package/.agent-context/skills/cli/CHANGELOG.md +0 -6
- package/.agent-context/skills/cli/README.md +0 -56
- package/.agent-context/skills/cli/compatibility-manifest.json +0 -8
- package/.agent-context/skills/cli/init.md +0 -38
- package/.agent-context/skills/cli/output.md +0 -36
- package/.agent-context/skills/cli/package.json +0 -5
- package/.agent-context/skills/cli/safety-telemetry.md +0 -39
- package/.agent-context/skills/cli/tests/.gitkeep +0 -1
- package/.agent-context/skills/cli/upgrade.md +0 -38
- package/.agent-context/skills/cli.md +0 -32
- package/.agent-context/skills/distribution/.evidence/compatibility-manifest.json +0 -9
- package/.agent-context/skills/distribution/.evidence/sbom-excerpt.json +0 -6
- package/.agent-context/skills/distribution/.evidence/test-report.json +0 -8
- package/.agent-context/skills/distribution/CHANGELOG.md +0 -7
- package/.agent-context/skills/distribution/README.md +0 -27
- package/.agent-context/skills/distribution/compatibility-manifest.json +0 -8
- package/.agent-context/skills/distribution/compatibility.md +0 -32
- package/.agent-context/skills/distribution/package.json +0 -5
- package/.agent-context/skills/distribution/provenance-attestation.md +0 -47
- package/.agent-context/skills/distribution/publish.md +0 -37
- package/.agent-context/skills/distribution/rollback.md +0 -32
- package/.agent-context/skills/distribution/tests/.gitkeep +0 -1
- package/.agent-context/skills/distribution.md +0 -32
- package/.agent-context/skills/frontend/.evidence/compatibility-manifest.json +0 -9
- package/.agent-context/skills/frontend/.evidence/sbom-excerpt.json +0 -6
- package/.agent-context/skills/frontend/.evidence/test-report.json +0 -8
- package/.agent-context/skills/frontend/CHANGELOG.md +0 -7
- package/.agent-context/skills/frontend/README.md +0 -50
- package/.agent-context/skills/frontend/accessibility.md +0 -107
- package/.agent-context/skills/frontend/compatibility-manifest.json +0 -8
- package/.agent-context/skills/frontend/conversion-clarity.md +0 -51
- package/.agent-context/skills/frontend/motion.md +0 -67
- package/.agent-context/skills/frontend/package.json +0 -5
- package/.agent-context/skills/frontend/performance.md +0 -63
- package/.agent-context/skills/frontend/responsive-delivery.md +0 -41
- package/.agent-context/skills/frontend/tests/.gitkeep +0 -1
- package/.agent-context/skills/frontend/ui-architecture.md +0 -128
- package/.agent-context/skills/frontend.md +0 -40
- package/.agent-context/skills/fullstack/.evidence/compatibility-manifest.json +0 -9
- package/.agent-context/skills/fullstack/.evidence/sbom-excerpt.json +0 -6
- package/.agent-context/skills/fullstack/.evidence/test-report.json +0 -8
- package/.agent-context/skills/fullstack/CHANGELOG.md +0 -7
- package/.agent-context/skills/fullstack/README.md +0 -27
- package/.agent-context/skills/fullstack/compatibility-manifest.json +0 -8
- package/.agent-context/skills/fullstack/contracts.md +0 -53
- package/.agent-context/skills/fullstack/end-to-end.md +0 -42
- package/.agent-context/skills/fullstack/feature-slicing.md +0 -65
- package/.agent-context/skills/fullstack/package.json +0 -5
- package/.agent-context/skills/fullstack/release-coordination.md +0 -51
- package/.agent-context/skills/fullstack/tests/.gitkeep +0 -1
- package/.agent-context/skills/fullstack.md +0 -30
- package/.agent-context/skills/index.json +0 -107
- package/.agent-context/skills/review-quality/.evidence/compatibility-manifest.json +0 -9
- package/.agent-context/skills/review-quality/.evidence/sbom-excerpt.json +0 -6
- package/.agent-context/skills/review-quality/.evidence/test-report.json +0 -8
- package/.agent-context/skills/review-quality/CHANGELOG.md +0 -7
- package/.agent-context/skills/review-quality/README.md +0 -27
- package/.agent-context/skills/review-quality/benchmark.md +0 -30
- package/.agent-context/skills/review-quality/compatibility-manifest.json +0 -8
- package/.agent-context/skills/review-quality/package.json +0 -5
- package/.agent-context/skills/review-quality/planning.md +0 -38
- package/.agent-context/skills/review-quality/release-decision.md +0 -49
- package/.agent-context/skills/review-quality/security.md +0 -34
- package/.agent-context/skills/review-quality/tests/.gitkeep +0 -1
- package/.agent-context/skills/review-quality.md +0 -34
- package/.agent-context/stacks/csharp.md +0 -149
- package/.agent-context/stacks/flutter.md +0 -16
- package/.agent-context/stacks/go.md +0 -181
- package/.agent-context/stacks/java.md +0 -135
- package/.agent-context/stacks/php.md +0 -192
- package/.agent-context/stacks/python.md +0 -153
- package/.agent-context/stacks/react-native.md +0 -16
- package/.agent-context/stacks/ruby.md +0 -80
- package/.agent-context/stacks/rust.md +0 -86
- package/.agent-context/stacks/typescript.md +0 -317
- package/.agent-context/state/skill-platform.json +0 -38
- package/lib/cli/skill-selector.mjs +0 -232
- package/lib/cli/templates/api-contract.md.id.tmpl +0 -143
- package/lib/cli/templates/api-contract.md.tmpl +0 -143
- package/lib/cli/templates/architecture-decision-record.md.id.tmpl +0 -106
- package/lib/cli/templates/architecture-decision-record.md.tmpl +0 -145
- package/lib/cli/templates/database-schema.md.id.tmpl +0 -74
- package/lib/cli/templates/database-schema.md.tmpl +0 -74
- package/lib/cli/templates/flow-overview.md.id.tmpl +0 -118
- package/lib/cli/templates/flow-overview.md.tmpl +0 -131
- package/lib/cli/templates/project-brief.md.id.tmpl +0 -55
- package/lib/cli/templates/project-brief.md.tmpl +0 -79
- package/scripts/init-project.ps1 +0 -105
- package/scripts/init-project.sh +0 -131
- package/scripts/skill-tier-policy.mjs +0 -76
- package/scripts/trust-scorer.mjs +0 -119
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
# PHP Stack Profile — Modern PHP, Not Legacy PHP
|
|
2
|
-
|
|
3
|
-
> PHP 8.x is a different language from PHP 5.
|
|
4
|
-
> If your AI writes PHP without type declarations, reject it immediately.
|
|
5
|
-
|
|
6
|
-
## Language Version: PHP 8.3+ (Laravel 13 Baseline, 8.5 Recommended)
|
|
7
|
-
|
|
8
|
-
Laravel 13 requires PHP 8.3+. Use PHP 8.5 when your runtime supports it, but avoid forcing 8.5-only syntax in shared packages unless project constraints explicitly require it.
|
|
9
|
-
|
|
10
|
-
### Strict Types Everywhere
|
|
11
|
-
```php
|
|
12
|
-
<?php
|
|
13
|
-
// REQUIRED: First line of EVERY PHP file
|
|
14
|
-
declare(strict_types=1);
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
### Typed Properties, Parameters, and Returns
|
|
18
|
-
```php
|
|
19
|
-
// BANNED: Untyped PHP
|
|
20
|
-
function getUser($id) {
|
|
21
|
-
$user = $this->db->find($id);
|
|
22
|
-
return $user;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// REQUIRED: Full type declarations
|
|
26
|
-
function getUser(int $id): ?User {
|
|
27
|
-
return $this->userRepository->find($id);
|
|
28
|
-
}
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
### Enums (PHP 8.1+)
|
|
32
|
-
```php
|
|
33
|
-
// BANNED: Magic strings
|
|
34
|
-
$status = 'pending';
|
|
35
|
-
|
|
36
|
-
// REQUIRED: Backed enums
|
|
37
|
-
enum OrderStatus: string {
|
|
38
|
-
case Pending = 'pending';
|
|
39
|
-
case Confirmed = 'confirmed';
|
|
40
|
-
case Shipped = 'shipped';
|
|
41
|
-
case Delivered = 'delivered';
|
|
42
|
-
}
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
### Readonly Properties and Classes (PHP 8.2+)
|
|
46
|
-
```php
|
|
47
|
-
// Readonly for DTOs and value objects
|
|
48
|
-
readonly class CreateUserDto {
|
|
49
|
-
public function __construct(
|
|
50
|
-
public string $name,
|
|
51
|
-
public string $email,
|
|
52
|
-
public int $age,
|
|
53
|
-
) {}
|
|
54
|
-
}
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
### Optional on PHP 8.5+: Pipe Operator
|
|
58
|
-
```php
|
|
59
|
-
// Use when your project runtime is locked to PHP 8.5+
|
|
60
|
-
$result = $input
|
|
61
|
-
|> 'trim'
|
|
62
|
-
|> 'strtolower'
|
|
63
|
-
|> fn($s) => str_replace(' ', '-', $s);
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
---
|
|
67
|
-
|
|
68
|
-
## Validation at Boundaries: Laravel Form Requests
|
|
69
|
-
|
|
70
|
-
```php
|
|
71
|
-
// BANNED: Validating in controller body
|
|
72
|
-
public function store(Request $request) {
|
|
73
|
-
$data = $request->all(); // Raw, unvalidated!
|
|
74
|
-
User::create($data); // Mass assignment vulnerability!
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
// REQUIRED: Form Request class
|
|
78
|
-
class StoreUserRequest extends FormRequest {
|
|
79
|
-
public function rules(): array {
|
|
80
|
-
return [
|
|
81
|
-
'name' => ['required', 'string', 'max:100'],
|
|
82
|
-
'email' => ['required', 'email', 'unique:users'],
|
|
83
|
-
'age' => ['required', 'integer', 'min:13', 'max:150'],
|
|
84
|
-
];
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
public function store(StoreUserRequest $request): JsonResponse {
|
|
89
|
-
$user = $this->userService->create($request->validated());
|
|
90
|
-
return response()->json($user, 201);
|
|
91
|
-
}
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
---
|
|
95
|
-
|
|
96
|
-
## Project Structure (Laravel)
|
|
97
|
-
|
|
98
|
-
```
|
|
99
|
-
project-name/
|
|
100
|
-
├── app/
|
|
101
|
-
│ ├── Modules/ # Feature-based grouping
|
|
102
|
-
│ │ ├── User/
|
|
103
|
-
│ │ │ ├── Controllers/
|
|
104
|
-
│ │ │ │ └── UserController.php # Transport
|
|
105
|
-
│ │ │ ├── Services/
|
|
106
|
-
│ │ │ │ └── UserService.php # Business logic
|
|
107
|
-
│ │ │ ├── Repositories/
|
|
108
|
-
│ │ │ │ └── UserRepository.php # Data access
|
|
109
|
-
│ │ │ ├── Requests/
|
|
110
|
-
│ │ │ │ └── StoreUserRequest.php
|
|
111
|
-
│ │ │ ├── Resources/
|
|
112
|
-
│ │ │ │ └── UserResource.php # API response transformer
|
|
113
|
-
│ │ │ ├── Models/
|
|
114
|
-
│ │ │ │ └── User.php # Eloquent model
|
|
115
|
-
│ │ │ └── Policies/
|
|
116
|
-
│ │ │ └── UserPolicy.php # Authorization
|
|
117
|
-
│ │ └── Order/
|
|
118
|
-
│ │ └── ...
|
|
119
|
-
│ │
|
|
120
|
-
│ ├── Shared/
|
|
121
|
-
│ │ ├── Exceptions/
|
|
122
|
-
│ │ │ └── Handler.php
|
|
123
|
-
│ │ └── Middleware/
|
|
124
|
-
│
|
|
125
|
-
├── database/migrations/
|
|
126
|
-
├── routes/api.php
|
|
127
|
-
├── tests/
|
|
128
|
-
│ ├── Feature/
|
|
129
|
-
│ └── Unit/
|
|
130
|
-
├── phpstan.neon # Static analysis config
|
|
131
|
-
└── composer.json
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
---
|
|
135
|
-
|
|
136
|
-
## Standards
|
|
137
|
-
|
|
138
|
-
### PSR Compliance
|
|
139
|
-
- **PSR-4:** Autoloading (Composer handles this)
|
|
140
|
-
- **PSR-12:** Coding style (use PHP-CS-Fixer or Pint)
|
|
141
|
-
|
|
142
|
-
### Static Analysis: PHPStan Level 8+
|
|
143
|
-
```neon
|
|
144
|
-
# phpstan.neon
|
|
145
|
-
parameters:
|
|
146
|
-
level: 8
|
|
147
|
-
paths:
|
|
148
|
-
- app
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
---
|
|
152
|
-
|
|
153
|
-
## Preferred Libraries
|
|
154
|
-
|
|
155
|
-
| Need | Library | Why |
|
|
156
|
-
|------|---------|-----|
|
|
157
|
-
| Framework | Laravel 13 | Most productive PHP framework with AI SDK, JSON:API resources, and stronger security defaults |
|
|
158
|
-
| Validation | Laravel Form Requests | Built-in, declarative |
|
|
159
|
-
| ORM | Eloquent | Convention over configuration |
|
|
160
|
-
| Testing | PHPUnit / Pest | Pest preferred for readability |
|
|
161
|
-
| Static analysis | PHPStan (level 8+) | Catch type errors at build time |
|
|
162
|
-
| Formatting | Laravel Pint | Zero-config PSR-12 formatter |
|
|
163
|
-
| API resources | Laravel API Resources | Clean response transformation |
|
|
164
|
-
| Auth | Laravel Sanctum / Passport | Token-based auth |
|
|
165
|
-
| Queue | Laravel Queues | Built-in, multiple drivers |
|
|
166
|
-
| API docs | Scribe or L5-Swagger | Auto-generated OpenAPI |
|
|
167
|
-
|
|
168
|
-
---
|
|
169
|
-
|
|
170
|
-
## Laravel 13 Guardrails
|
|
171
|
-
|
|
172
|
-
- Use `PreventRequestForgery` for explicit CSRF middleware references (old aliases still exist but are deprecated).
|
|
173
|
-
- Ensure `upsert(..., uniqueBy: ...)` always passes a non-empty `uniqueBy` value.
|
|
174
|
-
- Prefer first-party JSON:API resources when you need JSON:API-compliant responses.
|
|
175
|
-
- If caching objects, configure `cache.serializable_classes` allow-list explicitly.
|
|
176
|
-
- For AI-assisted Laravel projects, use `laravel/boost` `^2.0` and run `php artisan boost:install`.
|
|
177
|
-
- Laravel 12 projects are still supported: keep `VerifyCsrfToken` and avoid 13-only API assumptions until framework upgrade is complete.
|
|
178
|
-
|
|
179
|
-
---
|
|
180
|
-
|
|
181
|
-
## Banned Patterns
|
|
182
|
-
|
|
183
|
-
| Pattern | Why | Alternative |
|
|
184
|
-
|---------|-----|-------------|
|
|
185
|
-
| Missing `declare(strict_types=1)` | Loose type coercion | Always declare |
|
|
186
|
-
| `$request->all()` in `create()` | Mass assignment vulnerability | `$request->validated()` |
|
|
187
|
-
| Raw SQL with concatenation | SQL injection | Eloquent or query builder with bindings |
|
|
188
|
-
| `dd()` / `dump()` in production | Debug leak | Structured logging |
|
|
189
|
-
| God controllers (500+ lines) | Violates SRP | Thin controllers, fat services |
|
|
190
|
-
| Business logic in models | Model becomes unmaintainable | Service layer |
|
|
191
|
-
| `try { } catch (\Exception $e) { }` | Swallows everything | Specific exception types |
|
|
192
|
-
| Dynamic properties (deprecated 8.2) | Runtime errors | Declared typed properties |
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
# Python Stack Profile — Explicit is Better Than Implicit
|
|
2
|
-
|
|
3
|
-
> Python's readability is a gift. Don't waste it with sloppy typing and god functions.
|
|
4
|
-
|
|
5
|
-
## Type System (Enforced)
|
|
6
|
-
|
|
7
|
-
### Type Hints Everywhere (Python 3.12+)
|
|
8
|
-
```python
|
|
9
|
-
# BANNED: Untyped function signatures
|
|
10
|
-
def process_data(data, options):
|
|
11
|
-
...
|
|
12
|
-
|
|
13
|
-
# REQUIRED: Full type annotations
|
|
14
|
-
def process_order(order: Order, options: ProcessingOptions) -> OrderResult:
|
|
15
|
-
...
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
**Rule:** Every function MUST have type annotations for all parameters and return types. Use `mypy --strict` or `pyright` in strict mode.
|
|
19
|
-
|
|
20
|
-
### No `Any` (Same Rule as TypeScript)
|
|
21
|
-
```python
|
|
22
|
-
# BANNED
|
|
23
|
-
def handle(data: Any) -> Any: ...
|
|
24
|
-
result: dict[str, Any] = get_response()
|
|
25
|
-
|
|
26
|
-
# REQUIRED
|
|
27
|
-
def handle(data: OrderPayload) -> OrderResult: ...
|
|
28
|
-
result: OrderResponse = get_response()
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
---
|
|
32
|
-
|
|
33
|
-
## Validation at Boundaries: Pydantic
|
|
34
|
-
|
|
35
|
-
### Rule: ALL External Data MUST Pass Through Pydantic
|
|
36
|
-
|
|
37
|
-
```python
|
|
38
|
-
# BANNED: Trusting raw dicts
|
|
39
|
-
@app.post("/users")
|
|
40
|
-
async def create_user(request: Request):
|
|
41
|
-
data = await request.json() # Could be anything!
|
|
42
|
-
return await user_service.create(data)
|
|
43
|
-
|
|
44
|
-
# REQUIRED: Pydantic model at the boundary
|
|
45
|
-
from pydantic import BaseModel, EmailStr, Field
|
|
46
|
-
|
|
47
|
-
class CreateUserRequest(BaseModel):
|
|
48
|
-
name: str = Field(min_length=1, max_length=100)
|
|
49
|
-
email: EmailStr
|
|
50
|
-
age: int = Field(ge=13, le=150)
|
|
51
|
-
|
|
52
|
-
@app.post("/users")
|
|
53
|
-
async def create_user(payload: CreateUserRequest) -> UserResponse:
|
|
54
|
-
return await user_service.create(payload)
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
### Pydantic Best Practices
|
|
58
|
-
- Use `Field()` with constraints (`min_length`, `ge`, `le`, `pattern`)
|
|
59
|
-
- Use `model_config = ConfigDict(strict=True)` to prevent type coercion
|
|
60
|
-
- Derive response models from base models: `class UserResponse(UserBase):`
|
|
61
|
-
- Use `model_validator` for cross-field validation
|
|
62
|
-
|
|
63
|
-
---
|
|
64
|
-
|
|
65
|
-
## Project Structure
|
|
66
|
-
|
|
67
|
-
```
|
|
68
|
-
project-name/
|
|
69
|
-
├── src/
|
|
70
|
-
│ ├── __init__.py
|
|
71
|
-
│ ├── main.py # Application entry point
|
|
72
|
-
│ ├── config.py # Pydantic Settings (env validation)
|
|
73
|
-
│ │
|
|
74
|
-
│ ├── modules/ # Feature modules
|
|
75
|
-
│ │ ├── user/
|
|
76
|
-
│ │ │ ├── __init__.py
|
|
77
|
-
│ │ │ ├── router.py # Transport (API routes)
|
|
78
|
-
│ │ │ ├── service.py # Business logic
|
|
79
|
-
│ │ │ ├── repository.py # Data access
|
|
80
|
-
│ │ │ ├── schemas.py # Pydantic models (DTOs)
|
|
81
|
-
│ │ │ ├── models.py # SQLAlchemy/ORM models
|
|
82
|
-
│ │ │ └── exceptions.py # Domain-specific errors
|
|
83
|
-
│ │ └── order/
|
|
84
|
-
│ │ └── ...
|
|
85
|
-
│ │
|
|
86
|
-
│ └── shared/
|
|
87
|
-
│ ├── errors.py # Base error classes
|
|
88
|
-
│ ├── middleware.py # Auth, logging, error handling
|
|
89
|
-
│ ├── database.py # DB session management
|
|
90
|
-
│ └── logger.py # Structured logging (structlog)
|
|
91
|
-
│
|
|
92
|
-
├── tests/
|
|
93
|
-
│ ├── conftest.py # Fixtures
|
|
94
|
-
│ ├── factories.py # Test data factories
|
|
95
|
-
│ └── modules/
|
|
96
|
-
│ └── user/
|
|
97
|
-
│ └── test_user_service.py
|
|
98
|
-
│
|
|
99
|
-
├── pyproject.toml # Project config (single source)
|
|
100
|
-
├── .env.example
|
|
101
|
-
└── Dockerfile
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
---
|
|
105
|
-
|
|
106
|
-
## Async Patterns
|
|
107
|
-
|
|
108
|
-
```python
|
|
109
|
-
# BANNED: Sync I/O in async context
|
|
110
|
-
import requests # Blocks the event loop!
|
|
111
|
-
response = requests.get("https://api.example.com")
|
|
112
|
-
|
|
113
|
-
# REQUIRED: Use async HTTP client
|
|
114
|
-
import httpx
|
|
115
|
-
async with httpx.AsyncClient() as client:
|
|
116
|
-
response = await client.get("https://api.example.com")
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
**Rule:** In async applications (FastAPI, etc.), NEVER use synchronous I/O libraries (`requests`, `time.sleep`, `open()` for large files). Use `httpx`, `asyncio.sleep`, `aiofiles`.
|
|
120
|
-
|
|
121
|
-
---
|
|
122
|
-
|
|
123
|
-
## Preferred Libraries (2025)
|
|
124
|
-
|
|
125
|
-
| Need | Library | Why |
|
|
126
|
-
|------|---------|-----|
|
|
127
|
-
| Web framework | `fastapi` | Async, type-safe, auto OpenAPI docs |
|
|
128
|
-
| Validation | `pydantic` v2 | Fast, Rust-powered, zero compromise |
|
|
129
|
-
| ORM | `sqlalchemy` 2.0+ / `sqlmodel` | Mature, async support. SQLModel wraps SQLAlchemy + Pydantic |
|
|
130
|
-
| HTTP client | `httpx` | Async-native, requests-compatible API |
|
|
131
|
-
| Testing | `pytest` + `pytest-asyncio` | Standard, plugin-rich |
|
|
132
|
-
| Linting | `ruff` | 10-100x faster than flake8+isort+black combined |
|
|
133
|
-
| Formatting | `ruff format` (or `black`) | Consistent, zero-config |
|
|
134
|
-
| Type checking | `mypy --strict` or `pyright` | Catch type errors before runtime |
|
|
135
|
-
| Logging | `structlog` | Structured, JSON-ready, contextvars |
|
|
136
|
-
| Env config | `pydantic-settings` | Type-safe env with validation |
|
|
137
|
-
| Password | `passlib[bcrypt]` or `argon2-cffi` | Proven, secure |
|
|
138
|
-
| Migration | `alembic` | SQLAlchemy migration standard |
|
|
139
|
-
|
|
140
|
-
---
|
|
141
|
-
|
|
142
|
-
## Banned Patterns
|
|
143
|
-
|
|
144
|
-
| Pattern | Why | Alternative |
|
|
145
|
-
|---------|-----|-------------|
|
|
146
|
-
| `Any` type | Defeats type checking | Specific types or `Unknown` protocol |
|
|
147
|
-
| `requests` in async | Blocks event loop | `httpx` |
|
|
148
|
-
| `print()` for logging | No structure, no levels | `structlog` or `logging` |
|
|
149
|
-
| `except Exception: pass` | Swallows every error | Specific exceptions, always log |
|
|
150
|
-
| `from module import *` | Namespace pollution | Explicit imports |
|
|
151
|
-
| Mutable default args | Shared state bug | `def f(items: list | None = None):` |
|
|
152
|
-
| Global state | Untestable, concurrency bugs | Dependency injection |
|
|
153
|
-
| `os.environ["KEY"]` | Crashes with KeyError | `pydantic-settings` with defaults |
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
# React Native Stack
|
|
2
|
-
|
|
3
|
-
Use this stack for cross-platform mobile applications built with React Native.
|
|
4
|
-
|
|
5
|
-
## Core Guidance
|
|
6
|
-
|
|
7
|
-
- Keep the app shell thin and delegate data fetching to dedicated service modules.
|
|
8
|
-
- Treat navigation, device integration, and UI composition as separate concerns.
|
|
9
|
-
- Prefer typed API contracts and isolate platform-specific code behind adapters.
|
|
10
|
-
- Keep release gating strict because mobile packaging failures are expensive to recover from.
|
|
11
|
-
|
|
12
|
-
## Recommended Pairings
|
|
13
|
-
|
|
14
|
-
- `mobile-app` blueprint for the starter architecture.
|
|
15
|
-
- `frontend` skill domain for UI composition, accessibility, and motion guidance.
|
|
16
|
-
- `fullstack` skill domain when the app depends on backend contract orchestration.
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
# Ruby on Rails Engineering Standards
|
|
2
|
-
|
|
3
|
-
> Rails provides "Convention over Configuration," but convention does not mean "put all your business logic in ActiveRecord callbacks."
|
|
4
|
-
|
|
5
|
-
## Core Tenets
|
|
6
|
-
1. **Skinny Models, Skinny Controllers, Fat Services:** The default Rails MVC is insufficient for complex domains. Extract business logic into Service Objects (Interactors).
|
|
7
|
-
2. **Death to N+1 Queries:** The `bullet` gem is mandatory in development and test environments. Any N+1 query is a blocker.
|
|
8
|
-
3. **No Hidden Magic:** Avoid deeply nested or complex ActiveRecord callbacks (`before_save`, `after_commit`). They obscure the flow of data. If an action has side effects, orchestrate it in a Service Object.
|
|
9
|
-
4. **Strong Parameters Only:** Never trust user input. Always permit explicit parameters in the controller layer before passing data down.
|
|
10
|
-
|
|
11
|
-
## Architecture & Layering (The Service Object Pattern)
|
|
12
|
-
Default Rails couples the HTTP request cycle tightly to the Database via the Model. We break this.
|
|
13
|
-
|
|
14
|
-
### 1. Controllers (Transport Layer)
|
|
15
|
-
- **Role:** Handle HTTP requests, parse parameters (Strong Params), authenticate/authorize the user, call the Service Object, and return the HTTP response/JSON.
|
|
16
|
-
- **BANNED:** Calling `Model.create()`, `Model.update()`, or writing any business calculations in the controller.
|
|
17
|
-
- **ALLOWED:** `MyService.call(params)`
|
|
18
|
-
|
|
19
|
-
### 2. Service Objects (Application Layer)
|
|
20
|
-
- **Role:** The orchestrator. Located in `app/services/`.
|
|
21
|
-
- **Structure:** Usually plain Ruby objects (POROs) with a single public `call` method.
|
|
22
|
-
- **Responsibility:** Executes the business transaction, handling database operations, sending emails, or enqueuing background jobs.
|
|
23
|
-
|
|
24
|
-
### 3. Models (Domain & Persistence Layer)
|
|
25
|
-
- **Role:** ActiveRecord models should only contain associations (`belongs_to`, `has_many`), scopes, and simple data validations (e.g., `validates :email, presence: true`).
|
|
26
|
-
- **BANNED:** Complex business logic, sending emails, API calls to third parties.
|
|
27
|
-
|
|
28
|
-
## Ecosystem & Dependencies (March 2026)
|
|
29
|
-
- **API Mode:** Use `rails new my_api --api` for backend-only projects.
|
|
30
|
-
- **Background Jobs:** `sidekiq` is the standard. Default `ActiveJob` should map to a Sidekiq backend (powered by Redis).
|
|
31
|
-
- **Authentication/Authorization:** `devise` (if needed, though often overkill for raw APIs; consider `jwt` + custom auth) and `pundit` (mandatory for authorization). Avoid `cancancan`.
|
|
32
|
-
- **Testing:** `rspec-rails` and `factory_bot_rails`. Default `minitest` and `fixtures` are explicitly banned for Agentic-Senior-Core projects.
|
|
33
|
-
- **Linting:** `rubocop` is mandatory. The build must fail if RuboCop fails.
|
|
34
|
-
|
|
35
|
-
## Anti-Patterns (Zero Tolerance)
|
|
36
|
-
|
|
37
|
-
### 1. The Fat Model Callback Hell
|
|
38
|
-
```ruby
|
|
39
|
-
# ❌ BANNED: The model side-effect
|
|
40
|
-
class User < ApplicationRecord
|
|
41
|
-
after_create :send_welcome_email
|
|
42
|
-
|
|
43
|
-
def send_welcome_email
|
|
44
|
-
UserMailer.welcome(self).deliver_now
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
# ✅ REQUIRED: The Service Object Orchestrator
|
|
49
|
-
class Users::CreateService
|
|
50
|
-
def self.call(params)
|
|
51
|
-
user = User.new(params)
|
|
52
|
-
if user.save
|
|
53
|
-
UserMailer.welcome(user).deliver_later
|
|
54
|
-
end
|
|
55
|
-
user
|
|
56
|
-
end
|
|
57
|
-
end
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
### 2. N+1 Queries in Responses
|
|
61
|
-
```ruby
|
|
62
|
-
# ❌ BANNED: Will execute 101 queries for 100 posts
|
|
63
|
-
def index
|
|
64
|
-
@posts = Post.all
|
|
65
|
-
render json: @posts.map { |p| { title: p.title, author: p.author.name } }
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
# ✅ REQUIRED: Eager loading
|
|
69
|
-
def index
|
|
70
|
-
@posts = Post.includes(:author).all
|
|
71
|
-
# ...
|
|
72
|
-
end
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
### 3. Logic in Views/Serializers
|
|
76
|
-
If using ActiveModelSerializers, Jbuilder, or Blueprinter, never perform database queries or heavy calculations in the serialization phase.
|
|
77
|
-
|
|
78
|
-
## Background Jobs (Sidekiq)
|
|
79
|
-
- **Rule:** Any operation taking longer than 300ms (e.g., sending an email, generating a PDF, calling an external API) **MUST** be pushed to a background job (`.deliver_later` or `MyWorker.perform_async`).
|
|
80
|
-
- **Rule:** Background job parameters must be simple types (strings, integers, IDs). **NEVER** pass an ActiveRecord object directly to a Sidekiq worker (it might be stale when the job runs). Pass the `user_id` instead.
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
# Rust Engineering Standards
|
|
2
|
-
|
|
3
|
-
> Rust guarantees memory safety, but not logic safety. Write code that is as predictable as the compiler.
|
|
4
|
-
|
|
5
|
-
## Core Tenets
|
|
6
|
-
1. **Never Panic:** The use of `unwrap()`, `expect()`, or `panic!()` in production business logic is strictly banned.
|
|
7
|
-
2. **Make Invalid States Unrepresentable:** Use Rust's powerful type system (enums, newtypes) to enforce business rules at compile time.
|
|
8
|
-
3. **Explicit Errors:** Use `Result` for all fallible operations.
|
|
9
|
-
4. **Fearless Concurrency:** Leverage `Send` and `Sync`. Avoid shared mutable state; prefer message passing or structured concurrency.
|
|
10
|
-
|
|
11
|
-
## Ecosystem & Dependencies (March 2026)
|
|
12
|
-
Adhere to the `efficiency-vs-hype` rule. The Rust ecosystem is robust; use community standards:
|
|
13
|
-
|
|
14
|
-
### Backend / API
|
|
15
|
-
- **Web Framework:** `axum` (Standard for new projects, built on `tokio` and `tower`). Avoid `actix-web` and `rocket` for new microservices unless migrating legacy code.
|
|
16
|
-
- **Async Runtime:** `tokio` (Standard).
|
|
17
|
-
- **Serialization:** `serde` + `serde_json`.
|
|
18
|
-
|
|
19
|
-
### Data / Persistence
|
|
20
|
-
- **Database:** `sqlx` (preferred for compile-time checked SQL) or `sea-orm` (if an ORM is strictly required). Avoid `diesel` (unless explicitly requested).
|
|
21
|
-
- **Connection Pooling:** Built into `sqlx` (use `PgPool`, etc.).
|
|
22
|
-
|
|
23
|
-
### Validation / Error Handling / Observability
|
|
24
|
-
- **Error Handling:** `thiserror` (for libraries and domain boundaries) and `anyhow` (for application/binaries and controllers).
|
|
25
|
-
- **Validation:** `validator` crate.
|
|
26
|
-
- **Telemetry/Logging:** `tracing` + `tracing-subscriber`. `log` and `env_logger` are legacy.
|
|
27
|
-
|
|
28
|
-
## Architecture & Layering
|
|
29
|
-
Strict Clean Architecture / Hexagonal Architecture.
|
|
30
|
-
|
|
31
|
-
1. **Transport (`/api` or `/transport`)**
|
|
32
|
-
- Axum routers and handlers.
|
|
33
|
-
- Responsible for extracting JSON/Path data, verifying auth claims, and calling the Domain/Service layer.
|
|
34
|
-
- **MUST:** Return standard HTTP status codes mapping to domain errors.
|
|
35
|
-
|
|
36
|
-
2. **Application / Service (`/services` or `/app`)**
|
|
37
|
-
- Orchestrates business logic, database transactions, and external API calls.
|
|
38
|
-
- **NO** HTTP knowledge (Axum types do not cross this boundary).
|
|
39
|
-
|
|
40
|
-
3. **Domain (`/domain`)**
|
|
41
|
-
- Pure Rust logic. Structs, Enums, Traits.
|
|
42
|
-
- **Must not** know about the database (SQL) or HTTP. Use traits (interfaces) to define repository contracts.
|
|
43
|
-
|
|
44
|
-
4. **Infrastructure / Repository (`/repo` or `/infra`)**
|
|
45
|
-
- `sqlx` queries go here. Implements the traits defined in Domain.
|
|
46
|
-
|
|
47
|
-
## Anti-Patterns (Zero Tolerance)
|
|
48
|
-
|
|
49
|
-
### 1. The `unwrap()` Fallacy
|
|
50
|
-
```rust
|
|
51
|
-
// ❌ BANNED: Will crash the server if parsing fails
|
|
52
|
-
let user_id = id_string.parse::<i32>().unwrap();
|
|
53
|
-
|
|
54
|
-
// ✅ REQUIRED: Explicit error mapping
|
|
55
|
-
let user_id = id_string.parse::<i32>().map_err(AppError::InvalidId)?;
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
### 2. Stringly-Typed Domain
|
|
59
|
-
```rust
|
|
60
|
-
// ❌ BANNED: Passing raw strings everywhere
|
|
61
|
-
fn update_email(user_id: String, email: String) {}
|
|
62
|
-
|
|
63
|
-
// ✅ REQUIRED: Newtypes and validated types
|
|
64
|
-
struct UserId(uuid::Uuid);
|
|
65
|
-
struct Email(String); // Should be validated on creation
|
|
66
|
-
|
|
67
|
-
fn update_email(user_id: UserId, email: Email) {}
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
### 3. Cloning to Appease the Borrow Checker
|
|
71
|
-
```rust
|
|
72
|
-
// ❌ POOR PRACTICE: Cloning just to make it compile instead of designing lifetimes/ownership
|
|
73
|
-
let name = user.name.clone();
|
|
74
|
-
process_name(name);
|
|
75
|
-
|
|
76
|
-
// ✅ REQUIRED: Pass by reference (borrowing)
|
|
77
|
-
process_name(&user.name);
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
### 4. Catch-all `anyhow::Error` in Traits
|
|
81
|
-
Traits defining contracts between layers (like Repositories) should return explicit errors (`thiserror`), not `anyhow::Error`, so the caller can systematically handle specific failures (e.g., `NotFound`, `ConstraintViolation`).
|
|
82
|
-
|
|
83
|
-
## Testing Standards
|
|
84
|
-
- **Unit Tests:** Inside the same file as the code (`#[cfg(test)] mod tests { ... }`).
|
|
85
|
-
- **Integration Tests:** In the `tests/` directory at the root level.
|
|
86
|
-
- **Mocking:** Use `mockall` or manually implement traits for test doubles. Avoid testing against a real database in unit tests; use them in integration tests using `sqlx::test`.
|