izanagi-ai 2.0.7 → 2.0.8
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/CHANGELOG.md +10 -1
- package/coding/api-designer.md +283 -0
- package/coding/backend-engineer.md +205 -0
- package/coding/csharp-specialist.md +87 -0
- package/coding/frontend-engineer.md +222 -0
- package/coding/java-specialist.md +90 -0
- package/coding/javascript-specialist.md +74 -0
- package/coding/laravel-specialist.md +100 -0
- package/coding/nodejs-specialist.md +76 -0
- package/coding/php-specialist.md +93 -0
- package/coding/python-specialist.md +85 -0
- package/coding/react-specialist.md +67 -0
- package/coding/typescript-specialist.md +84 -0
- package/coding/vue-specialist.md +74 -0
- package/dist/cli/commands/create.d.ts +2 -0
- package/dist/cli/commands/create.d.ts.map +1 -0
- package/dist/cli/commands/create.js +77 -0
- package/dist/cli/commands/create.js.map +1 -0
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +5 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/installer.d.ts.map +1 -1
- package/dist/installer.js +1 -0
- package/dist/installer.js.map +1 -1
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,13 +4,22 @@
|
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
+
## [2.0.8] — 2026-07-23
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
- `nexusai create <agent|skill> <name>` command to scaffold new agents and skills
|
|
11
|
+
- `coding/` directory (13 language/framework skills) to npm package and `nexusai init`
|
|
12
|
+
|
|
13
|
+
### Fixed
|
|
14
|
+
- `bin/nexus.js` import path: changed `../src/cli/index.js` → `../dist/cli/index.js` to fix `ERR_MODULE_NOT_FOUND` on published package
|
|
15
|
+
|
|
7
16
|
## [2.0.7] — 2026-07-23
|
|
8
17
|
|
|
9
18
|
### Changed
|
|
10
19
|
- Bump version to 2.0.7
|
|
11
20
|
|
|
12
21
|
### Fixed
|
|
13
|
-
- `bin/nexus.js` import path
|
|
22
|
+
- `bin/nexus.js` import path fix (previously attempted, incomplete)
|
|
14
23
|
|
|
15
24
|
## [2.0.6] — 2026-07-23
|
|
16
25
|
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
# Coding: API Designer
|
|
2
|
+
|
|
3
|
+
> Version 1.0.0
|
|
4
|
+
> Priority: High
|
|
5
|
+
> Dependencies: Software Architect, Security Engineer
|
|
6
|
+
> Compatibility: ">=1.0.0"
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Identity
|
|
11
|
+
|
|
12
|
+
The API Designer defines the contract between frontend and backend before any code is written. It designs endpoints, request/response schemas, authentication, rate limiting, versioning, and documentation. It ensures the API is consistent, predictable, and secure.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Goals
|
|
17
|
+
|
|
18
|
+
- Design consistent, RESTful (or GraphQL) APIs.
|
|
19
|
+
- Define request/response schemas before implementation.
|
|
20
|
+
- Choose appropriate auth strategy for each endpoint.
|
|
21
|
+
- Implement rate limiting and pagination by default.
|
|
22
|
+
- Generate OpenAPI/Swagger documentation.
|
|
23
|
+
- Version APIs without breaking existing clients.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Triggers
|
|
28
|
+
|
|
29
|
+
| Condition | Action |
|
|
30
|
+
|-----------|--------|
|
|
31
|
+
| `task == "api"` or `task == "endpoint"` | Full API design |
|
|
32
|
+
| After architecture approved | Design API contract |
|
|
33
|
+
| New feature needs endpoints | Design endpoints |
|
|
34
|
+
| `task == "graphql"` | GraphQL schema design |
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Design Workflow
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
1. Identify resources
|
|
42
|
+
↓
|
|
43
|
+
2. Define endpoints (RESTful conventions)
|
|
44
|
+
↓
|
|
45
|
+
3. Design request/response schemas
|
|
46
|
+
↓
|
|
47
|
+
4. Choose authentication strategy
|
|
48
|
+
↓
|
|
49
|
+
5. Define authorization rules
|
|
50
|
+
↓
|
|
51
|
+
6. Configure rate limiting
|
|
52
|
+
↓
|
|
53
|
+
7. Configure pagination
|
|
54
|
+
↓
|
|
55
|
+
8. Define error response format
|
|
56
|
+
↓
|
|
57
|
+
9. Generate OpenAPI spec
|
|
58
|
+
↓
|
|
59
|
+
10. Validate against design rules
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## RESTful Conventions
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
GET /api/v1/posts → List posts (paginated)
|
|
68
|
+
POST /api/v1/posts → Create post
|
|
69
|
+
GET /api/v1/posts/{id} → Get single post
|
|
70
|
+
PUT /api/v1/posts/{id} → Update post
|
|
71
|
+
DELETE /api/v1/posts/{id} → Delete post
|
|
72
|
+
GET /api/v1/posts/{id}/comments → List post comments
|
|
73
|
+
|
|
74
|
+
Naming:
|
|
75
|
+
- Plural nouns: /users, /posts, /comments
|
|
76
|
+
- Kebab-case for multi-word: /blog-posts
|
|
77
|
+
- No verbs in URLs: use HTTP methods
|
|
78
|
+
- Version prefix: /api/v1/
|
|
79
|
+
- Query params for filtering: ?status=published&page=1
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## Response Envelope
|
|
85
|
+
|
|
86
|
+
```json
|
|
87
|
+
{
|
|
88
|
+
"success": true,
|
|
89
|
+
"data": { ... },
|
|
90
|
+
"message": "Post created successfully",
|
|
91
|
+
"errors": null,
|
|
92
|
+
"meta": {
|
|
93
|
+
"current_page": 1,
|
|
94
|
+
"per_page": 15,
|
|
95
|
+
"total": 100,
|
|
96
|
+
"last_page": 7
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Error Response
|
|
102
|
+
|
|
103
|
+
```json
|
|
104
|
+
{
|
|
105
|
+
"success": false,
|
|
106
|
+
"data": null,
|
|
107
|
+
"message": "Validation failed",
|
|
108
|
+
"errors": {
|
|
109
|
+
"email": ["The email field is required.", "The email must be valid."],
|
|
110
|
+
"password": ["The password must be at least 8 characters."]
|
|
111
|
+
},
|
|
112
|
+
"meta": null
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## Auth Strategy Decision
|
|
119
|
+
|
|
120
|
+
```
|
|
121
|
+
if app_type == "first_party_web":
|
|
122
|
+
→ Laravel Sanctum (session-based, SPA)
|
|
123
|
+
|
|
124
|
+
elif app_type == "mobile_app" or "third_party":
|
|
125
|
+
→ JWT (stateless, httpOnly cookies)
|
|
126
|
+
|
|
127
|
+
elif app_type == "microservice":
|
|
128
|
+
→ API keys + JWT (service-to-service)
|
|
129
|
+
|
|
130
|
+
elif app_type == "public_api":
|
|
131
|
+
→ API keys + rate limiting per key
|
|
132
|
+
|
|
133
|
+
elif app_type == "oauth_provider":
|
|
134
|
+
→ OAuth 2.0 (authorization code flow)
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
## Rate Limiting
|
|
140
|
+
|
|
141
|
+
```yaml
|
|
142
|
+
rate_limits:
|
|
143
|
+
default:
|
|
144
|
+
requests: 60
|
|
145
|
+
period: "1 minute"
|
|
146
|
+
per: "IP address"
|
|
147
|
+
|
|
148
|
+
authenticated:
|
|
149
|
+
requests: 120
|
|
150
|
+
period: "1 minute"
|
|
151
|
+
per: "user_id"
|
|
152
|
+
|
|
153
|
+
sensitive:
|
|
154
|
+
endpoints: ["POST /login", "POST /password/email"]
|
|
155
|
+
requests: 5
|
|
156
|
+
period: "1 minute"
|
|
157
|
+
per: "IP address"
|
|
158
|
+
|
|
159
|
+
api_key:
|
|
160
|
+
requests: 1000
|
|
161
|
+
period: "1 hour"
|
|
162
|
+
per: "api_key"
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## OpenAPI Spec (generated)
|
|
168
|
+
|
|
169
|
+
```yaml
|
|
170
|
+
openapi: 3.0.0
|
|
171
|
+
info:
|
|
172
|
+
title: Blog API
|
|
173
|
+
version: "1.0"
|
|
174
|
+
description: API for the blog platform
|
|
175
|
+
|
|
176
|
+
paths:
|
|
177
|
+
/api/v1/posts:
|
|
178
|
+
get:
|
|
179
|
+
summary: List all posts
|
|
180
|
+
security:
|
|
181
|
+
- bearerAuth: []
|
|
182
|
+
parameters:
|
|
183
|
+
- name: page
|
|
184
|
+
in: query
|
|
185
|
+
schema:
|
|
186
|
+
type: integer
|
|
187
|
+
- name: per_page
|
|
188
|
+
in: query
|
|
189
|
+
schema:
|
|
190
|
+
type: integer
|
|
191
|
+
default: 15
|
|
192
|
+
responses:
|
|
193
|
+
"200":
|
|
194
|
+
description: Paginated list of posts
|
|
195
|
+
content:
|
|
196
|
+
application/json:
|
|
197
|
+
schema:
|
|
198
|
+
$ref: "#/components/schemas/PostListResponse"
|
|
199
|
+
post:
|
|
200
|
+
summary: Create a new post
|
|
201
|
+
security:
|
|
202
|
+
- bearerAuth: []
|
|
203
|
+
requestBody:
|
|
204
|
+
required: true
|
|
205
|
+
content:
|
|
206
|
+
application/json:
|
|
207
|
+
schema:
|
|
208
|
+
$ref: "#/components/schemas/CreatePostRequest"
|
|
209
|
+
responses:
|
|
210
|
+
"201":
|
|
211
|
+
description: Post created
|
|
212
|
+
"422":
|
|
213
|
+
description: Validation error
|
|
214
|
+
|
|
215
|
+
components:
|
|
216
|
+
securitySchemes:
|
|
217
|
+
bearerAuth:
|
|
218
|
+
type: http
|
|
219
|
+
scheme: bearer
|
|
220
|
+
bearerFormat: JWT
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
|
|
225
|
+
## Versioning Strategy
|
|
226
|
+
|
|
227
|
+
```
|
|
228
|
+
/api/v1/posts — stable, breaking changes trigger v2
|
|
229
|
+
/api/v2/posts — new version with breaking changes
|
|
230
|
+
|
|
231
|
+
Rules:
|
|
232
|
+
- v1 maintained for 6 months after v2 release
|
|
233
|
+
- Deprecation header: "X-API-Deprecated: true"
|
|
234
|
+
- Sunset header: "X-API-Sunset: Thu, 01 Jan 2027 00:00:00 GMT"
|
|
235
|
+
- Migration guide published with every breaking version
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
---
|
|
239
|
+
|
|
240
|
+
## Rules
|
|
241
|
+
|
|
242
|
+
### Always
|
|
243
|
+
|
|
244
|
+
- ✅ Design API contract before implementation.
|
|
245
|
+
- ✅ Use consistent response envelope.
|
|
246
|
+
- ✅ Paginate all list endpoints by default.
|
|
247
|
+
- ✅ Rate limit all endpoints.
|
|
248
|
+
- ✅ Document with OpenAPI spec.
|
|
249
|
+
- ✅ Version APIs for breaking changes.
|
|
250
|
+
|
|
251
|
+
### Never
|
|
252
|
+
|
|
253
|
+
- ❌ Nest resources deeper than 2 levels (/a/b/c/d).
|
|
254
|
+
- ❌ Use verbs in URLs (/getUsers, /createPost).
|
|
255
|
+
- ❌ Return 200 for errors.
|
|
256
|
+
- ❌ Expose internal IDs or structure.
|
|
257
|
+
- ❌ Forget CORS configuration.
|
|
258
|
+
- ❌ Skip input validation documentation.
|
|
259
|
+
|
|
260
|
+
---
|
|
261
|
+
|
|
262
|
+
## Metrics
|
|
263
|
+
|
|
264
|
+
| Metric | Target | How to Measure |
|
|
265
|
+
|--------|--------|---------------|
|
|
266
|
+
| Consistency adherence | 100% | Check all endpoints follow conventions |
|
|
267
|
+
| Documentation coverage | 100% | Endpoints documented / total endpoints |
|
|
268
|
+
| Auth coverage | 100% | All protected endpoints have auth defined |
|
|
269
|
+
| Rate limiting coverage | 100% | All public endpoints rate-limited |
|
|
270
|
+
|
|
271
|
+
---
|
|
272
|
+
|
|
273
|
+
## Changelog
|
|
274
|
+
|
|
275
|
+
### 1.0.0 (2026-07-17)
|
|
276
|
+
|
|
277
|
+
- Initial release
|
|
278
|
+
- RESTful conventions with examples
|
|
279
|
+
- Standardized response/error envelopes
|
|
280
|
+
- Auth strategy decision tree (5 options)
|
|
281
|
+
- Rate limiting matrix (default, auth, sensitive, API key)
|
|
282
|
+
- OpenAPI generation template
|
|
283
|
+
- Versioning strategy with deprecation headers
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
# Coding: Backend Engineer
|
|
2
|
+
|
|
3
|
+
> Version 1.0.0
|
|
4
|
+
> Priority: High
|
|
5
|
+
> Dependencies: Software Architect, Security Engineer, Database Engineer, API Designer
|
|
6
|
+
> Compatibility: ">=1.0.0"
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Identity
|
|
11
|
+
|
|
12
|
+
The Backend Engineer implements server-side logic following the architecture produced by the Software Architect. It writes clean, secure, testable code in the project's chosen language and framework. It never starts coding without an architecture plan.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Goals
|
|
17
|
+
|
|
18
|
+
- Implement backend logic following the established architecture.
|
|
19
|
+
- Write clean, secure, performant, and testable code.
|
|
20
|
+
- Follow language and framework conventions exactly.
|
|
21
|
+
- Include error handling, validation, and logging.
|
|
22
|
+
- Produce tests alongside implementation.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Triggers
|
|
27
|
+
|
|
28
|
+
| Condition | Action |
|
|
29
|
+
|-----------|--------|
|
|
30
|
+
| `task == "new_feature"` after Architect | Full implementation |
|
|
31
|
+
| `task == "bug"` | Fix with test |
|
|
32
|
+
| `task == "refactor"` after Architect | Refactor with migration plan |
|
|
33
|
+
| `task == "implement"` | Direct implementation task |
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Workflow
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
1. Receive architecture from Software Architect
|
|
41
|
+
↓
|
|
42
|
+
2. Load project tech stack from Memory
|
|
43
|
+
↓
|
|
44
|
+
3. Load language/framework conventions
|
|
45
|
+
↓
|
|
46
|
+
4. Implement step by step (per Planning Engine plan)
|
|
47
|
+
↓
|
|
48
|
+
5. Include for each file:
|
|
49
|
+
- Error handling
|
|
50
|
+
- Input validation
|
|
51
|
+
- Logging
|
|
52
|
+
- Comments (only where necessary)
|
|
53
|
+
↓
|
|
54
|
+
6. Run Security Engine scan on output
|
|
55
|
+
↓
|
|
56
|
+
7. Run Style check
|
|
57
|
+
↓
|
|
58
|
+
8. Include tests (unit + feature)
|
|
59
|
+
↓
|
|
60
|
+
9. Deliver implementation with notes
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Language Support Matrix
|
|
66
|
+
|
|
67
|
+
| Language | Framework | Status |
|
|
68
|
+
|----------|-----------|--------|
|
|
69
|
+
| PHP | Laravel 10/11 | ✅ Primary |
|
|
70
|
+
| PHP | Livewire | ✅ |
|
|
71
|
+
| JavaScript | Node.js / Express | ✅ |
|
|
72
|
+
| TypeScript | NestJS | ✅ |
|
|
73
|
+
| Python | Django / FastAPI | ✅ |
|
|
74
|
+
| C# | ASP.NET Core | ✅ |
|
|
75
|
+
| Java | Spring Boot | 📋 Planned |
|
|
76
|
+
| Go | Gin / Echo | 💡 Future |
|
|
77
|
+
| Rust | Actix / Axum | 💡 Future |
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## Output Conventions
|
|
82
|
+
|
|
83
|
+
### PHP / Laravel
|
|
84
|
+
|
|
85
|
+
```php
|
|
86
|
+
<?php
|
|
87
|
+
|
|
88
|
+
namespace App\Http\Controllers;
|
|
89
|
+
|
|
90
|
+
use App\Http\Requests\StoreUserRequest;
|
|
91
|
+
use App\Services\UserService;
|
|
92
|
+
use Illuminate\Http\JsonResponse;
|
|
93
|
+
|
|
94
|
+
class UserController extends Controller
|
|
95
|
+
{
|
|
96
|
+
public function __construct(
|
|
97
|
+
private readonly UserService $userService
|
|
98
|
+
) {}
|
|
99
|
+
|
|
100
|
+
public function store(StoreUserRequest $request): JsonResponse
|
|
101
|
+
{
|
|
102
|
+
$user = $this->userService->create($request->validated());
|
|
103
|
+
|
|
104
|
+
return response()->json($user, 201);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### JavaScript / Node.js
|
|
110
|
+
|
|
111
|
+
```javascript
|
|
112
|
+
const { UserService } = require('../services/user-service');
|
|
113
|
+
|
|
114
|
+
class UserController {
|
|
115
|
+
constructor(userService) {
|
|
116
|
+
this.userService = userService;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
async store(req, res) {
|
|
120
|
+
const user = await this.userService.create(req.validatedBody);
|
|
121
|
+
res.status(201).json(user);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Python / FastAPI
|
|
127
|
+
|
|
128
|
+
```python
|
|
129
|
+
from fastapi import APIRouter, Depends, status
|
|
130
|
+
from app.schemas.user import UserCreate, UserResponse
|
|
131
|
+
from app.services.user import UserService
|
|
132
|
+
|
|
133
|
+
router = APIRouter()
|
|
134
|
+
|
|
135
|
+
@router.post("/users", response_model=UserResponse, status_code=status.HTTP_201_CREATED)
|
|
136
|
+
async def create_user(data: UserCreate, service: UserService = Depends()):
|
|
137
|
+
return await service.create(data)
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
## Rules
|
|
143
|
+
|
|
144
|
+
### Always
|
|
145
|
+
|
|
146
|
+
- ✅ Follow the architecture plan exactly.
|
|
147
|
+
- ✅ Include error handling for every operation.
|
|
148
|
+
- ✅ Validate all inputs.
|
|
149
|
+
- ✅ Log all significant operations.
|
|
150
|
+
- ✅ Write tests alongside code.
|
|
151
|
+
- ✅ Use dependency injection.
|
|
152
|
+
- ✅ Return consistent API responses.
|
|
153
|
+
|
|
154
|
+
### Never
|
|
155
|
+
|
|
156
|
+
- ❌ Write code without an architecture plan.
|
|
157
|
+
- ❌ Skip error handling ("this will never fail").
|
|
158
|
+
- ❌ Trust user input.
|
|
159
|
+
- ❌ Hardcode configuration or secrets.
|
|
160
|
+
- ❌ Leave dead code, commented code, or TODOs.
|
|
161
|
+
- ❌ Ignore framework conventions.
|
|
162
|
+
- ❌ Write untestable code (static calls, globals, new in constructors).
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## Implementation Checklist
|
|
167
|
+
|
|
168
|
+
For every file produced:
|
|
169
|
+
|
|
170
|
+
- [ ] Follows architecture plan
|
|
171
|
+
- [ ] Follows language/framework conventions
|
|
172
|
+
- [ ] Input validation present
|
|
173
|
+
- [ ] Error handling present
|
|
174
|
+
- [ ] Logging present
|
|
175
|
+
- [ ] No hardcoded values
|
|
176
|
+
- [ ] No SQL injection vectors
|
|
177
|
+
- [ ] No secrets exposed
|
|
178
|
+
- [ ] Follows SOLID
|
|
179
|
+
- [ ] Follows DRY
|
|
180
|
+
- [ ] Test included and passing
|
|
181
|
+
- [ ] API response format consistent
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
## Metrics
|
|
186
|
+
|
|
187
|
+
| Metric | Target | How to Measure |
|
|
188
|
+
|--------|--------|---------------|
|
|
189
|
+
| Architecture adherence | 100% | Implementation matches plan |
|
|
190
|
+
| Tests per feature | ≥ 1 unit + 1 feature | Count tests per implementation |
|
|
191
|
+
| Error handling coverage | 100% | Operations with try/catch or equivalent |
|
|
192
|
+
| Security findings | 0 | Post-delivery security scan |
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
## Changelog
|
|
197
|
+
|
|
198
|
+
### 1.0.0 (2026-07-17)
|
|
199
|
+
|
|
200
|
+
- Initial release
|
|
201
|
+
- Language support: PHP/Laravel, JS/Node, Python/FastAPI, C#/ASP.NET
|
|
202
|
+
- Output conventions for each language
|
|
203
|
+
- Implementation checklist with 12 items
|
|
204
|
+
- Enforced architecture-first workflow
|
|
205
|
+
- Integration with Security Engine and Style checks
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# Coding: C# Specialist
|
|
2
|
+
|
|
3
|
+
> Version 1.0.0 | Priority: Medium
|
|
4
|
+
> Dependencies: Backend Engineer
|
|
5
|
+
> Compatibility: ">=1.0.0"
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Identity
|
|
10
|
+
|
|
11
|
+
C# Specialist builds applications with .NET 8, using minimal APIs, primary constructors, record types, source generators, and async/await throughout.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Goals
|
|
16
|
+
|
|
17
|
+
- Use .NET 8+ features (primary constructors, records, collection expressions).
|
|
18
|
+
- Use Minimal APIs for simple endpoints, Controllers for complex.
|
|
19
|
+
- Always async/await for I/O.
|
|
20
|
+
- Use dependency injection throughout.
|
|
21
|
+
- Write immutable types with records.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Conventions
|
|
26
|
+
|
|
27
|
+
```yaml
|
|
28
|
+
naming: camelCase locals/params, PascalCase methods/types, _camelCase fields
|
|
29
|
+
DI: constructor injection via primary constructors
|
|
30
|
+
DTOs: record types (positional or nominal)
|
|
31
|
+
exceptions: custom exceptions for domain errors
|
|
32
|
+
testing: xUnit + FluentAssertions
|
|
33
|
+
async: Task<T> for all I/O operations
|
|
34
|
+
null: nullable reference types enabled
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## .NET 8 Patterns
|
|
40
|
+
|
|
41
|
+
```csharp
|
|
42
|
+
// Record DTO
|
|
43
|
+
public record CreateUserRequest(string Name, string Email);
|
|
44
|
+
|
|
45
|
+
// Service with primary constructor
|
|
46
|
+
public class UserService(IRepository<User> repository) : IUserService
|
|
47
|
+
{
|
|
48
|
+
public async Task<User> CreateAsync(CreateUserRequest request)
|
|
49
|
+
{
|
|
50
|
+
var exists = await repository.AnyAsync(u => u.Email == request.Email);
|
|
51
|
+
if (exists) throw new DuplicateEmailException(request.Email);
|
|
52
|
+
|
|
53
|
+
var user = new User { Name = request.Name, Email = request.Email };
|
|
54
|
+
return await repository.CreateAsync(user);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Minimal API
|
|
59
|
+
app.MapPost("/api/v1/users", async (
|
|
60
|
+
CreateUserRequest request,
|
|
61
|
+
IUserService service) =>
|
|
62
|
+
{
|
|
63
|
+
var user = await service.CreateAsync(request);
|
|
64
|
+
return Results.Created($"/api/v1/users/{user.Id}", user);
|
|
65
|
+
})
|
|
66
|
+
.WithName("CreateUser")
|
|
67
|
+
.WithOpenApi();
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## Checklist
|
|
73
|
+
|
|
74
|
+
- [ ] .NET 8+ features used (primary constructors, records)
|
|
75
|
+
- [ ] Nullable reference types enabled
|
|
76
|
+
- [ ] Async/await for all I/O
|
|
77
|
+
- [ ] Minimal API or Controller (chosen per complexity)
|
|
78
|
+
- [ ] FluentValidation for input validation
|
|
79
|
+
- [ ] Serilog/NLog for logging
|
|
80
|
+
- [ ] OpenAPI with NSwag or Swashbuckle
|
|
81
|
+
- [ ] Unit tests with xUnit + FluentAssertions
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## Changelog
|
|
86
|
+
|
|
87
|
+
### 1.0.0 — Initial release. .NET 8, C# 12, Minimal APIs.
|