@uocnv1998/agent-kit 1.0.6 โ 1.0.7
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/templates/.agent/dev/backend/ARCHITECTURE.md +1 -0
- package/templates/.agent/dev/backend/agents/backend-specialist.md +1 -1
- package/templates/.agent/dev/backend/rules/GEMINI.md +8 -5
- package/templates/.agent/dev/backend/skills/python-patterns/SKILL.md +441 -0
- package/templates/.agent/dev/frontend/rules/GEMINI.md +8 -5
package/package.json
CHANGED
|
@@ -37,6 +37,7 @@ Modular knowledge domains loaded by the `backend-specialist`.
|
|
|
37
37
|
| `mysql` | MySQL optimization and schema management |
|
|
38
38
|
| `clichouse-expert` | ClickHouse database expertise |
|
|
39
39
|
| `docker` | Containerization and deployment patterns |
|
|
40
|
+
| `python-patterns` | Python standards, FastAPI |
|
|
40
41
|
|
|
41
42
|
---
|
|
42
43
|
|
|
@@ -3,7 +3,7 @@ name: backend-specialist
|
|
|
3
3
|
description: Expert Backend Development Architect. Focuses on system design, security, scalability, and maintainability. Applies universal architectural principles (SOLID, TDD) regardless of the specific tech stack. Triggers on backend, server, api, database, auth.
|
|
4
4
|
tools: Read, Grep, Glob, Bash, Edit, Write
|
|
5
5
|
model: inherit
|
|
6
|
-
skills: database-design, api-patterns, security-principles, tdd-workflow
|
|
6
|
+
skills: database-design, api-patterns, security-principles, tdd-workflow, python-patterns
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
# Backend Development Architect
|
|
@@ -79,11 +79,14 @@ When applying the agent, inform the user:
|
|
|
79
79
|
|
|
80
80
|
### ๐ Core Development Principles (MANDATORY)
|
|
81
81
|
|
|
82
|
-
- **
|
|
83
|
-
- **
|
|
84
|
-
- **
|
|
85
|
-
|
|
86
|
-
|
|
82
|
+
- **Strict Adherence to Project Rules**: For all coding conventions, architecture patterns (e.g., SOLID), code formatting, and security policies, you MUST strictly follow the `AGENTS.md` file located in the project root.
|
|
83
|
+
- **Workflow Initialization**: Whenever starting any flow or executing OpenSpec workflows (e.g., `/opsx:propose`, `/opsx:apply`), you MUST read `AGENTS.md` (using `view_file`) first and actively use the **Context7 MCP Server** to look up relevant library documentation.
|
|
84
|
+
- **TDD (Test-Driven Development)**: Always write tests BEFORE writing the implementation. You must write both unit tests and feature tests. When generating tasks (e.g., during `/opsx:propose`), the `tasks.md` MUST explicitly break down features into exactly these steps:
|
|
85
|
+
1. `Write failing test (RED)`
|
|
86
|
+
2. `PIC APPROVAL CHECKPOINT (Wait for PIC review & approval of failing test)`
|
|
87
|
+
3. `Implement (GREEN)`
|
|
88
|
+
4. `Refactor`
|
|
89
|
+
- **TDD Enforcement**: During implementation (`/opsx:apply`), after completing step 1, you MUST pause and ask the PIC to review your failing tests. You are FORBIDDEN from writing actual implementation code (Step 3) until the PIC explicitly says "approved" or permits you to proceed.
|
|
87
90
|
|
|
88
91
|
### ๐ Documents (Workspace files)
|
|
89
92
|
|
|
@@ -0,0 +1,441 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: python-patterns
|
|
3
|
+
description: Python development principles and decision-making. Framework selection, async patterns, type hints, project structure. Teaches thinking, not copying.
|
|
4
|
+
allowed-tools: Read, Write, Edit, Glob, Grep
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Python Patterns
|
|
8
|
+
|
|
9
|
+
> Python development principles and decision-making for 2025.
|
|
10
|
+
> **Learn to THINK, not memorize patterns.**
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## โ ๏ธ How to Use This Skill
|
|
15
|
+
|
|
16
|
+
This skill teaches **decision-making principles**, not fixed code to copy.
|
|
17
|
+
|
|
18
|
+
- ASK user for framework preference when unclear
|
|
19
|
+
- Choose async vs sync based on CONTEXT
|
|
20
|
+
- Don't default to same framework every time
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## 1. Framework Selection (2025)
|
|
25
|
+
|
|
26
|
+
### Decision Tree
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
What are you building?
|
|
30
|
+
โ
|
|
31
|
+
โโโ API-first / Microservices
|
|
32
|
+
โ โโโ FastAPI (async, modern, fast)
|
|
33
|
+
โ
|
|
34
|
+
โโโ Full-stack web / CMS / Admin
|
|
35
|
+
โ โโโ Django (batteries-included)
|
|
36
|
+
โ
|
|
37
|
+
โโโ Simple / Script / Learning
|
|
38
|
+
โ โโโ Flask (minimal, flexible)
|
|
39
|
+
โ
|
|
40
|
+
โโโ AI/ML API serving
|
|
41
|
+
โ โโโ FastAPI (Pydantic, async, uvicorn)
|
|
42
|
+
โ
|
|
43
|
+
โโโ Background workers
|
|
44
|
+
โโโ Celery + any framework
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Comparison Principles
|
|
48
|
+
|
|
49
|
+
| Factor | FastAPI | Django | Flask |
|
|
50
|
+
|--------|---------|--------|-------|
|
|
51
|
+
| **Best for** | APIs, microservices | Full-stack, CMS | Simple, learning |
|
|
52
|
+
| **Async** | Native | Django 5.0+ | Via extensions |
|
|
53
|
+
| **Admin** | Manual | Built-in | Via extensions |
|
|
54
|
+
| **ORM** | Choose your own | Django ORM | Choose your own |
|
|
55
|
+
| **Learning curve** | Low | Medium | Low |
|
|
56
|
+
|
|
57
|
+
### Selection Questions to Ask:
|
|
58
|
+
1. Is this API-only or full-stack?
|
|
59
|
+
2. Need admin interface?
|
|
60
|
+
3. Team familiar with async?
|
|
61
|
+
4. Existing infrastructure?
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## 2. Async vs Sync Decision
|
|
66
|
+
|
|
67
|
+
### When to Use Async
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
async def is better when:
|
|
71
|
+
โโโ I/O-bound operations (database, HTTP, file)
|
|
72
|
+
โโโ Many concurrent connections
|
|
73
|
+
โโโ Real-time features
|
|
74
|
+
โโโ Microservices communication
|
|
75
|
+
โโโ FastAPI/Starlette/Django ASGI
|
|
76
|
+
|
|
77
|
+
def (sync) is better when:
|
|
78
|
+
โโโ CPU-bound operations
|
|
79
|
+
โโโ Simple scripts
|
|
80
|
+
โโโ Legacy codebase
|
|
81
|
+
โโโ Team unfamiliar with async
|
|
82
|
+
โโโ Blocking libraries (no async version)
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### The Golden Rule
|
|
86
|
+
|
|
87
|
+
```
|
|
88
|
+
I/O-bound โ async (waiting for external)
|
|
89
|
+
CPU-bound โ sync + multiprocessing (computing)
|
|
90
|
+
|
|
91
|
+
Don't:
|
|
92
|
+
โโโ Mix sync and async carelessly
|
|
93
|
+
โโโ Use sync libraries in async code
|
|
94
|
+
โโโ Force async for CPU work
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Async Library Selection
|
|
98
|
+
|
|
99
|
+
| Need | Async Library |
|
|
100
|
+
|------|---------------|
|
|
101
|
+
| HTTP client | httpx |
|
|
102
|
+
| PostgreSQL | asyncpg |
|
|
103
|
+
| Redis | aioredis / redis-py async |
|
|
104
|
+
| File I/O | aiofiles |
|
|
105
|
+
| Database ORM | SQLAlchemy 2.0 async, Tortoise |
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## 3. Type Hints Strategy
|
|
110
|
+
|
|
111
|
+
### When to Type
|
|
112
|
+
|
|
113
|
+
```
|
|
114
|
+
Always type:
|
|
115
|
+
โโโ Function parameters
|
|
116
|
+
โโโ Return types
|
|
117
|
+
โโโ Class attributes
|
|
118
|
+
โโโ Public APIs
|
|
119
|
+
|
|
120
|
+
Can skip:
|
|
121
|
+
โโโ Local variables (let inference work)
|
|
122
|
+
โโโ One-off scripts
|
|
123
|
+
โโโ Tests (usually)
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Common Type Patterns
|
|
127
|
+
|
|
128
|
+
```python
|
|
129
|
+
# These are patterns, understand them:
|
|
130
|
+
|
|
131
|
+
# Optional โ might be None
|
|
132
|
+
from typing import Optional
|
|
133
|
+
def find_user(id: int) -> Optional[User]: ...
|
|
134
|
+
|
|
135
|
+
# Union โ one of multiple types
|
|
136
|
+
def process(data: str | dict) -> None: ...
|
|
137
|
+
|
|
138
|
+
# Generic collections
|
|
139
|
+
def get_items() -> list[Item]: ...
|
|
140
|
+
def get_mapping() -> dict[str, int]: ...
|
|
141
|
+
|
|
142
|
+
# Callable
|
|
143
|
+
from typing import Callable
|
|
144
|
+
def apply(fn: Callable[[int], str]) -> str: ...
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Pydantic for Validation
|
|
148
|
+
|
|
149
|
+
```
|
|
150
|
+
When to use Pydantic:
|
|
151
|
+
โโโ API request/response models
|
|
152
|
+
โโโ Configuration/settings
|
|
153
|
+
โโโ Data validation
|
|
154
|
+
โโโ Serialization
|
|
155
|
+
|
|
156
|
+
Benefits:
|
|
157
|
+
โโโ Runtime validation
|
|
158
|
+
โโโ Auto-generated JSON schema
|
|
159
|
+
โโโ Works with FastAPI natively
|
|
160
|
+
โโโ Clear error messages
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## 4. Project Structure Principles
|
|
166
|
+
|
|
167
|
+
### Structure Selection
|
|
168
|
+
|
|
169
|
+
```
|
|
170
|
+
Small project / Script:
|
|
171
|
+
โโโ main.py
|
|
172
|
+
โโโ utils.py
|
|
173
|
+
โโโ requirements.txt
|
|
174
|
+
|
|
175
|
+
Medium API:
|
|
176
|
+
โโโ app/
|
|
177
|
+
โ โโโ __init__.py
|
|
178
|
+
โ โโโ main.py
|
|
179
|
+
โ โโโ models/
|
|
180
|
+
โ โโโ routes/
|
|
181
|
+
โ โโโ services/
|
|
182
|
+
โ โโโ schemas/
|
|
183
|
+
โโโ tests/
|
|
184
|
+
โโโ pyproject.toml
|
|
185
|
+
|
|
186
|
+
Large application:
|
|
187
|
+
โโโ src/
|
|
188
|
+
โ โโโ myapp/
|
|
189
|
+
โ โโโ core/
|
|
190
|
+
โ โโโ api/
|
|
191
|
+
โ โโโ services/
|
|
192
|
+
โ โโโ models/
|
|
193
|
+
โ โโโ ...
|
|
194
|
+
โโโ tests/
|
|
195
|
+
โโโ pyproject.toml
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### FastAPI Structure Principles
|
|
199
|
+
|
|
200
|
+
```
|
|
201
|
+
Organize by feature or layer:
|
|
202
|
+
|
|
203
|
+
By layer:
|
|
204
|
+
โโโ routes/ (API endpoints)
|
|
205
|
+
โโโ services/ (business logic)
|
|
206
|
+
โโโ models/ (database models)
|
|
207
|
+
โโโ schemas/ (Pydantic models)
|
|
208
|
+
โโโ dependencies/ (shared deps)
|
|
209
|
+
|
|
210
|
+
By feature:
|
|
211
|
+
โโโ users/
|
|
212
|
+
โ โโโ routes.py
|
|
213
|
+
โ โโโ service.py
|
|
214
|
+
โ โโโ schemas.py
|
|
215
|
+
โโโ products/
|
|
216
|
+
โโโ ...
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
## 5. Django Principles (2025)
|
|
222
|
+
|
|
223
|
+
### Django Async (Django 5.0+)
|
|
224
|
+
|
|
225
|
+
```
|
|
226
|
+
Django supports async:
|
|
227
|
+
โโโ Async views
|
|
228
|
+
โโโ Async middleware
|
|
229
|
+
โโโ Async ORM (limited)
|
|
230
|
+
โโโ ASGI deployment
|
|
231
|
+
|
|
232
|
+
When to use async in Django:
|
|
233
|
+
โโโ External API calls
|
|
234
|
+
โโโ WebSocket (Channels)
|
|
235
|
+
โโโ High-concurrency views
|
|
236
|
+
โโโ Background task triggering
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
### Django Best Practices
|
|
240
|
+
|
|
241
|
+
```
|
|
242
|
+
Model design:
|
|
243
|
+
โโโ Fat models, thin views
|
|
244
|
+
โโโ Use managers for common queries
|
|
245
|
+
โโโ Abstract base classes for shared fields
|
|
246
|
+
|
|
247
|
+
Views:
|
|
248
|
+
โโโ Class-based for complex CRUD
|
|
249
|
+
โโโ Function-based for simple endpoints
|
|
250
|
+
โโโ Use viewsets with DRF
|
|
251
|
+
|
|
252
|
+
Queries:
|
|
253
|
+
โโโ select_related() for FKs
|
|
254
|
+
โโโ prefetch_related() for M2M
|
|
255
|
+
โโโ Avoid N+1 queries
|
|
256
|
+
โโโ Use .only() for specific fields
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
---
|
|
260
|
+
|
|
261
|
+
## 6. FastAPI Principles
|
|
262
|
+
|
|
263
|
+
### async def vs def in FastAPI
|
|
264
|
+
|
|
265
|
+
```
|
|
266
|
+
Use async def when:
|
|
267
|
+
โโโ Using async database drivers
|
|
268
|
+
โโโ Making async HTTP calls
|
|
269
|
+
โโโ I/O-bound operations
|
|
270
|
+
โโโ Want to handle concurrency
|
|
271
|
+
|
|
272
|
+
Use def when:
|
|
273
|
+
โโโ Blocking operations
|
|
274
|
+
โโโ Sync database drivers
|
|
275
|
+
โโโ CPU-bound work
|
|
276
|
+
โโโ FastAPI runs in threadpool automatically
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
### Dependency Injection
|
|
280
|
+
|
|
281
|
+
```
|
|
282
|
+
Use dependencies for:
|
|
283
|
+
โโโ Database sessions
|
|
284
|
+
โโโ Current user / Auth
|
|
285
|
+
โโโ Configuration
|
|
286
|
+
โโโ Shared resources
|
|
287
|
+
|
|
288
|
+
Benefits:
|
|
289
|
+
โโโ Testability (mock dependencies)
|
|
290
|
+
โโโ Clean separation
|
|
291
|
+
โโโ Automatic cleanup (yield)
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
### Pydantic v2 Integration
|
|
295
|
+
|
|
296
|
+
```python
|
|
297
|
+
# FastAPI + Pydantic are tightly integrated:
|
|
298
|
+
|
|
299
|
+
# Request validation
|
|
300
|
+
@app.post("/users")
|
|
301
|
+
async def create(user: UserCreate) -> UserResponse:
|
|
302
|
+
# user is already validated
|
|
303
|
+
...
|
|
304
|
+
|
|
305
|
+
# Response serialization
|
|
306
|
+
# Return type becomes response schema
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
---
|
|
310
|
+
|
|
311
|
+
## 7. Background Tasks
|
|
312
|
+
|
|
313
|
+
### Selection Guide
|
|
314
|
+
|
|
315
|
+
| Solution | Best For |
|
|
316
|
+
|----------|----------|
|
|
317
|
+
| **BackgroundTasks** | Simple, in-process tasks |
|
|
318
|
+
| **Celery** | Distributed, complex workflows |
|
|
319
|
+
| **ARQ** | Async, Redis-based |
|
|
320
|
+
| **RQ** | Simple Redis queue |
|
|
321
|
+
| **Dramatiq** | Actor-based, simpler than Celery |
|
|
322
|
+
|
|
323
|
+
### When to Use Each
|
|
324
|
+
|
|
325
|
+
```
|
|
326
|
+
FastAPI BackgroundTasks:
|
|
327
|
+
โโโ Quick operations
|
|
328
|
+
โโโ No persistence needed
|
|
329
|
+
โโโ Fire-and-forget
|
|
330
|
+
โโโ Same process
|
|
331
|
+
|
|
332
|
+
Celery/ARQ:
|
|
333
|
+
โโโ Long-running tasks
|
|
334
|
+
โโโ Need retry logic
|
|
335
|
+
โโโ Distributed workers
|
|
336
|
+
โโโ Persistent queue
|
|
337
|
+
โโโ Complex workflows
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
---
|
|
341
|
+
|
|
342
|
+
## 8. Error Handling Principles
|
|
343
|
+
|
|
344
|
+
### Exception Strategy
|
|
345
|
+
|
|
346
|
+
```
|
|
347
|
+
In FastAPI:
|
|
348
|
+
โโโ Create custom exception classes
|
|
349
|
+
โโโ Register exception handlers
|
|
350
|
+
โโโ Return consistent error format
|
|
351
|
+
โโโ Log without exposing internals
|
|
352
|
+
|
|
353
|
+
Pattern:
|
|
354
|
+
โโโ Raise domain exceptions in services
|
|
355
|
+
โโโ Catch and transform in handlers
|
|
356
|
+
โโโ Client gets clean error response
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
### Error Response Philosophy
|
|
360
|
+
|
|
361
|
+
```
|
|
362
|
+
Include:
|
|
363
|
+
โโโ Error code (programmatic)
|
|
364
|
+
โโโ Message (human readable)
|
|
365
|
+
โโโ Details (field-level when applicable)
|
|
366
|
+
โโโ NOT stack traces (security)
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
---
|
|
370
|
+
|
|
371
|
+
## 9. Testing Principles
|
|
372
|
+
|
|
373
|
+
### Testing Strategy
|
|
374
|
+
|
|
375
|
+
| Type | Purpose | Tools |
|
|
376
|
+
|------|---------|-------|
|
|
377
|
+
| **Unit** | Business logic | pytest |
|
|
378
|
+
| **Integration** | API endpoints | pytest + httpx/TestClient |
|
|
379
|
+
| **E2E** | Full workflows | pytest + DB |
|
|
380
|
+
|
|
381
|
+
### Async Testing
|
|
382
|
+
|
|
383
|
+
```python
|
|
384
|
+
# Use pytest-asyncio for async tests
|
|
385
|
+
|
|
386
|
+
import pytest
|
|
387
|
+
from httpx import AsyncClient
|
|
388
|
+
|
|
389
|
+
@pytest.mark.asyncio
|
|
390
|
+
async def test_endpoint():
|
|
391
|
+
async with AsyncClient(app=app, base_url="http://test") as client:
|
|
392
|
+
response = await client.get("/users")
|
|
393
|
+
assert response.status_code == 200
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
### Fixtures Strategy
|
|
397
|
+
|
|
398
|
+
```
|
|
399
|
+
Common fixtures:
|
|
400
|
+
โโโ db_session โ Database connection
|
|
401
|
+
โโโ client โ Test client
|
|
402
|
+
โโโ authenticated_user โ User with token
|
|
403
|
+
โโโ sample_data โ Test data setup
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
---
|
|
407
|
+
|
|
408
|
+
## 10. Decision Checklist
|
|
409
|
+
|
|
410
|
+
Before implementing:
|
|
411
|
+
|
|
412
|
+
- [ ] **Asked user about framework preference?**
|
|
413
|
+
- [ ] **Chosen framework for THIS context?** (not just default)
|
|
414
|
+
- [ ] **Decided async vs sync?**
|
|
415
|
+
- [ ] **Planned type hint strategy?**
|
|
416
|
+
- [ ] **Defined project structure?**
|
|
417
|
+
- [ ] **Planned error handling?**
|
|
418
|
+
- [ ] **Considered background tasks?**
|
|
419
|
+
|
|
420
|
+
---
|
|
421
|
+
|
|
422
|
+
## 11. Anti-Patterns to Avoid
|
|
423
|
+
|
|
424
|
+
### โ DON'T:
|
|
425
|
+
- Default to Django for simple APIs (FastAPI may be better)
|
|
426
|
+
- Use sync libraries in async code
|
|
427
|
+
- Skip type hints for public APIs
|
|
428
|
+
- Put business logic in routes/views
|
|
429
|
+
- Ignore N+1 queries
|
|
430
|
+
- Mix async and sync carelessly
|
|
431
|
+
|
|
432
|
+
### โ
DO:
|
|
433
|
+
- Choose framework based on context
|
|
434
|
+
- Ask about async requirements
|
|
435
|
+
- Use Pydantic for validation
|
|
436
|
+
- Separate concerns (routes โ services โ repos)
|
|
437
|
+
- Test critical paths
|
|
438
|
+
|
|
439
|
+
---
|
|
440
|
+
|
|
441
|
+
> **Remember**: Python patterns are about decision-making for YOUR specific context. Don't copy codeโthink about what serves your application best.
|
|
@@ -81,11 +81,14 @@ When applying the agent, inform the user:
|
|
|
81
81
|
|
|
82
82
|
- **Pre-flight Documentation Check**: Before starting any task, you BแบฎT BUแปC PHแบขI (MUST) read all related documentation. This includes Business Analyst (BA) requirements (from Jira/Confluence), Designer specifications/mockups (from the specialized **subtask** created by the Designer), and API documentation (from the Backend developer's **comments or subtasks** on Jira/Confluence). Do not write any code until you fully understand the requirements from all sources.
|
|
83
83
|
- **Strict UI Adherence**: The user interface MUST strictly follow the Designer's specifications. You are FORBIDDEN from inventing or assuming UI layouts/components not defined in the design specs. If the documentation or design is missing for a specific part, you MUST notify the PIC (Person in Charge) immediately and ASK for their direction. You may propose generating a mockup, but you MUST ONLY create and provide the mockup if the PIC explicitly agrees to it. Do not proceed with implementation without the PIC's approval.
|
|
84
|
-
- **
|
|
85
|
-
- **
|
|
86
|
-
- **
|
|
87
|
-
|
|
88
|
-
|
|
84
|
+
- **Strict Adherence to Project Rules**: For all coding conventions, component architectures, code formatting, a11y, and performance guidelines, you MUST strictly follow the `AGENTS.md` file located in the project root.
|
|
85
|
+
- **Workflow Initialization**: Whenever starting any flow or executing OpenSpec workflows (e.g., `/opsx:propose`, `/opsx:apply`), you MUST read `AGENTS.md` (using `view_file`) first and actively use the **Context7 MCP Server** to look up relevant library documentation.
|
|
86
|
+
- **TDD (Test-Driven Development)**: Always write tests BEFORE writing the implementation. You must write both unit tests and feature tests. When generating tasks (e.g., during `/opsx:propose`), the `tasks.md` MUST explicitly break down features into exactly these steps:
|
|
87
|
+
1. `Write failing test (RED)`
|
|
88
|
+
2. `PIC APPROVAL CHECKPOINT (Wait for PIC review & approval of failing test)`
|
|
89
|
+
3. `Implement (GREEN)`
|
|
90
|
+
4. `Refactor`
|
|
91
|
+
- **TDD Enforcement**: During implementation (`/opsx:apply`), after completing step 1, you MUST pause and ask the PIC to review your failing tests. You are FORBIDDEN from writing actual implementation code (Step 3) until the PIC explicitly says "approved" or permits you to proceed.
|
|
89
92
|
|
|
90
93
|
### ๐ Documents (Workspace files)
|
|
91
94
|
|