@qubiit/lmagent 2.5.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/.editorconfig +18 -0
- package/AGENTS.md +169 -0
- package/CLAUDE.md +122 -0
- package/CONTRIBUTING.md +90 -0
- package/LICENSE +21 -0
- package/README.md +195 -0
- package/config/commands.yaml +194 -0
- package/config/levels.yaml +135 -0
- package/config/models.yaml +192 -0
- package/config/settings.yaml +405 -0
- package/config/tools-extended.yaml +534 -0
- package/config/tools.yaml +437 -0
- package/docs/assets/logo.png +0 -0
- package/docs/commands.md +132 -0
- package/docs/customization-guide.md +445 -0
- package/docs/getting-started.md +154 -0
- package/docs/how-to-start.md +242 -0
- package/docs/navigation-index.md +227 -0
- package/docs/usage-guide.md +113 -0
- package/install.js +1044 -0
- package/package.json +35 -0
- package/pyproject.toml +182 -0
- package/rules/_bootstrap.md +138 -0
- package/rules/agents-ia.md +607 -0
- package/rules/api-design.md +337 -0
- package/rules/automations-n8n.md +646 -0
- package/rules/code-style.md +570 -0
- package/rules/documentation.md +98 -0
- package/rules/security.md +316 -0
- package/rules/stack.md +395 -0
- package/rules/testing.md +326 -0
- package/rules/workflow.md +353 -0
- package/scripts/create_skill.js +300 -0
- package/scripts/validate_skills.js +283 -0
- package/skills/ai-agent-engineer/SKILL.md +394 -0
- package/skills/ai-agent-engineer/references/agent-patterns.md +149 -0
- package/skills/api-designer/SKILL.md +429 -0
- package/skills/api-designer/references/api-standards.md +13 -0
- package/skills/architect/SKILL.md +285 -0
- package/skills/architect/references/c4-model.md +133 -0
- package/skills/automation-engineer/SKILL.md +352 -0
- package/skills/automation-engineer/references/n8n-patterns.md +127 -0
- package/skills/backend-engineer/SKILL.md +261 -0
- package/skills/backend-engineer/assets/fastapi-project-structure.yaml +74 -0
- package/skills/backend-engineer/references/debugging-guide.md +174 -0
- package/skills/backend-engineer/references/design-patterns.md +208 -0
- package/skills/backend-engineer/scripts/scaffold_backend.py +313 -0
- package/skills/bmad-methodology/SKILL.md +202 -0
- package/skills/bmad-methodology/references/scale-adaptive-levels.md +141 -0
- package/skills/browser-agent/SKILL.md +502 -0
- package/skills/browser-agent/scripts/playwright_setup.ts +16 -0
- package/skills/code-reviewer/SKILL.md +306 -0
- package/skills/code-reviewer/references/code-review-checklist.md +16 -0
- package/skills/data-engineer/SKILL.md +474 -0
- package/skills/data-engineer/assets/pg-monitoring-queries.sql +154 -0
- package/skills/data-engineer/references/index-strategy.md +128 -0
- package/skills/data-engineer/scripts/backup_postgres.py +221 -0
- package/skills/devops-engineer/SKILL.md +547 -0
- package/skills/devops-engineer/references/ci-cd-patterns.md +265 -0
- package/skills/devops-engineer/scripts/docker_healthcheck.py +125 -0
- package/skills/document-generator/SKILL.md +746 -0
- package/skills/document-generator/references/pdf-generation.md +22 -0
- package/skills/frontend-engineer/SKILL.md +532 -0
- package/skills/frontend-engineer/references/accessibility-guide.md +146 -0
- package/skills/frontend-engineer/scripts/audit_bundle.py +144 -0
- package/skills/git-workflow/SKILL.md +374 -0
- package/skills/git-workflow/references/git-flow.md +25 -0
- package/skills/mcp-builder/SKILL.md +471 -0
- package/skills/mcp-builder/references/mcp-server-guide.md +23 -0
- package/skills/mobile-engineer/SKILL.md +502 -0
- package/skills/mobile-engineer/references/platform-guidelines.md +160 -0
- package/skills/orchestrator/SKILL.md +246 -0
- package/skills/orchestrator/references/methodology-routing.md +117 -0
- package/skills/orchestrator/references/persona-mapping.md +85 -0
- package/skills/orchestrator/references/routing-logic.md +110 -0
- package/skills/performance-engineer/SKILL.md +549 -0
- package/skills/performance-engineer/references/caching-patterns.md +181 -0
- package/skills/performance-engineer/scripts/profile_endpoint.py +170 -0
- package/skills/product-manager/SKILL.md +488 -0
- package/skills/product-manager/references/prioritization-frameworks.md +126 -0
- package/skills/prompt-engineer/SKILL.md +433 -0
- package/skills/prompt-engineer/references/prompt-patterns.md +158 -0
- package/skills/qa-engineer/SKILL.md +441 -0
- package/skills/qa-engineer/references/testing-strategy.md +166 -0
- package/skills/qa-engineer/scripts/run_coverage.py +147 -0
- package/skills/scrum-master/SKILL.md +225 -0
- package/skills/scrum-master/references/sprint-ceremonies.md +159 -0
- package/skills/security-analyst/SKILL.md +390 -0
- package/skills/security-analyst/references/owasp-top10.md +188 -0
- package/skills/security-analyst/scripts/audit_security.py +242 -0
- package/skills/seo-auditor/SKILL.md +523 -0
- package/skills/seo-auditor/references/seo-checklist.md +17 -0
- package/skills/spec-driven-dev/SKILL.md +342 -0
- package/skills/spec-driven-dev/references/phase-gates.md +107 -0
- package/skills/supabase-expert/SKILL.md +602 -0
- package/skills/supabase-expert/references/supabase-patterns.md +19 -0
- package/skills/swe-agent/SKILL.md +311 -0
- package/skills/swe-agent/references/trajectory-format.md +134 -0
- package/skills/systematic-debugger/SKILL.md +512 -0
- package/skills/systematic-debugger/references/debugging-guide.md +12 -0
- package/skills/tech-lead/SKILL.md +409 -0
- package/skills/tech-lead/references/code-review-checklist.md +111 -0
- package/skills/technical-writer/SKILL.md +631 -0
- package/skills/technical-writer/references/doc-templates.md +218 -0
- package/skills/testing-strategist/SKILL.md +476 -0
- package/skills/testing-strategist/references/testing-pyramid.md +16 -0
- package/skills/ux-ui-designer/SKILL.md +419 -0
- package/skills/ux-ui-designer/references/design-system-foundation.md +168 -0
- package/skills_overview.txt +94 -0
- package/templates/PROJECT_KICKOFF.md +284 -0
- package/templates/SKILL_TEMPLATE.md +131 -0
- package/templates/USAGE.md +95 -0
- package/templates/agent-python/README.md +71 -0
- package/templates/agent-python/agent.py +272 -0
- package/templates/agent-python/config.yaml +76 -0
- package/templates/agent-python/prompts/system.md +109 -0
- package/templates/agent-python/requirements.txt +7 -0
- package/templates/automation-n8n/README.md +14 -0
- package/templates/automation-n8n/webhook-handler.json +57 -0
- package/templates/backend-node/Dockerfile +12 -0
- package/templates/backend-node/README.md +15 -0
- package/templates/backend-node/package.json +30 -0
- package/templates/backend-node/src/index.ts +19 -0
- package/templates/backend-node/src/routes.ts +7 -0
- package/templates/backend-node/tsconfig.json +22 -0
- package/templates/backend-python/Dockerfile +11 -0
- package/templates/backend-python/README.md +78 -0
- package/templates/backend-python/app/core/config.py +12 -0
- package/templates/backend-python/app/core/database.py +12 -0
- package/templates/backend-python/app/main.py +17 -0
- package/templates/backend-python/app/routers/__init__.py +1 -0
- package/templates/backend-python/app/routers/health.py +7 -0
- package/templates/backend-python/requirements-dev.txt +6 -0
- package/templates/backend-python/requirements.txt +4 -0
- package/templates/backend-python/tests/test_health.py +9 -0
- package/templates/checkpoint.yaml +117 -0
- package/templates/database/README.md +474 -0
- package/templates/frontend-react/README.md +446 -0
- package/templates/plan.yaml +320 -0
- package/templates/session.yaml +125 -0
- package/templates/spec.yaml +229 -0
- package/templates/tasks.yaml +330 -0
- package/workflows/bugfix-backend.md +380 -0
- package/workflows/documentation.md +232 -0
- package/workflows/generate-prd.md +320 -0
- package/workflows/ideation.md +396 -0
- package/workflows/new-agent-ia.md +497 -0
- package/workflows/new-automation.md +374 -0
- package/workflows/new-feature.md +290 -0
- package/workflows/optimize-performance.md +373 -0
- package/workflows/resolve-github-issue.md +524 -0
- package/workflows/security-review.md +291 -0
- package/workflows/spec-driven.md +476 -0
- package/workflows/testing-strategy.md +296 -0
- package/workflows/third-party-integration.md +277 -0
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Workflow para crear una nueva automatización que involucra backend + n8n + opcionalmente agentes IA
|
|
3
|
+
level: 2-3
|
|
4
|
+
personas: [automation-engineer, backend-engineer, ai-agent-engineer]
|
|
5
|
+
version: 2.1
|
|
6
|
+
type: workflow
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# New Automation Workflow
|
|
10
|
+
|
|
11
|
+
> **Tiempo estimado**: 2-6 horas | **Level**: 2-3
|
|
12
|
+
|
|
13
|
+
Este workflow guía la creación de una nueva automatización end-to-end.
|
|
14
|
+
|
|
15
|
+
## Pre-requisitos
|
|
16
|
+
|
|
17
|
+
1. Leer [AGENTS.md](../AGENTS.md)
|
|
18
|
+
2. Leer [rules/automations-n8n.md](../rules/automations-n8n.md)
|
|
19
|
+
3. Leer [rules/stack.md](../rules/stack.md)
|
|
20
|
+
|
|
21
|
+
## Información Requerida
|
|
22
|
+
|
|
23
|
+
Antes de comenzar, necesito entender:
|
|
24
|
+
|
|
25
|
+
1. **Descripción de negocio**: ¿Qué proceso se quiere automatizar?
|
|
26
|
+
2. **Trigger**: ¿Qué inicia la automatización? (webhook, schedule, evento)
|
|
27
|
+
3. **Sistemas involucrados**: ¿Qué APIs/servicios se conectan?
|
|
28
|
+
4. **Output esperado**: ¿Cuál es el resultado final?
|
|
29
|
+
5. **Requisitos de fiabilidad**: ¿Crítico? ¿Tolerancia a fallos?
|
|
30
|
+
6. **Latencia aceptable**: ¿Tiempo máximo de ejecución?
|
|
31
|
+
7. **¿Involucra agentes IA?**: ¿Necesita procesamiento con LLM?
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## Paso 1: Analizar y Clasificar
|
|
36
|
+
|
|
37
|
+
### Determinar Nivel
|
|
38
|
+
- **Level 2**: Automatización simple (1-2 sistemas, sin IA)
|
|
39
|
+
- **Level 3**: Automatización compleja (3+ sistemas, con IA, crítica)
|
|
40
|
+
|
|
41
|
+
### Activar Personas
|
|
42
|
+
```
|
|
43
|
+
Automatización simple → Automation Engineer
|
|
44
|
+
Con backend custom → + Backend Engineer
|
|
45
|
+
Con agentes IA → + AI Agent Engineer
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Paso 2: Diseñar Arquitectura
|
|
51
|
+
|
|
52
|
+
### 2.1 Diagrama de Flujo
|
|
53
|
+
|
|
54
|
+
```mermaid
|
|
55
|
+
sequenceDiagram
|
|
56
|
+
participant T as Trigger
|
|
57
|
+
participant N as n8n
|
|
58
|
+
participant B as Backend API
|
|
59
|
+
participant A as Agent (opcional)
|
|
60
|
+
participant E as External API
|
|
61
|
+
participant D as Database
|
|
62
|
+
|
|
63
|
+
T->>N: Inicia workflow
|
|
64
|
+
N->>B: POST /webhooks/process
|
|
65
|
+
B->>D: Consultar datos
|
|
66
|
+
D-->>B: Datos
|
|
67
|
+
|
|
68
|
+
alt Requiere IA
|
|
69
|
+
B->>A: Procesar con agente
|
|
70
|
+
A-->>B: Resultado
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
B->>E: Llamar API externa
|
|
74
|
+
E-->>B: Respuesta
|
|
75
|
+
B->>D: Guardar resultado
|
|
76
|
+
B-->>N: Respuesta
|
|
77
|
+
N->>T: Notificar/Callback
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### 2.2 Definir Componentes
|
|
81
|
+
|
|
82
|
+
| Componente | Tipo | Descripción |
|
|
83
|
+
|------------|------|-------------|
|
|
84
|
+
| Trigger | [Webhook/Schedule/Event] | [Descripción] |
|
|
85
|
+
| n8n Workflow | [Nombre] | [Pasos principales] |
|
|
86
|
+
| Backend Endpoint | [POST /webhooks/xxx] | [Procesamiento] |
|
|
87
|
+
| Agente IA | [Nombre o N/A] | [Tarea del agente] |
|
|
88
|
+
| Sistemas externos | [Lista] | [APIs/servicios] |
|
|
89
|
+
| Storage | [DB/Redis/Files] | [Qué se guarda] |
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## Paso 3: Crear Plan de Implementación
|
|
94
|
+
|
|
95
|
+
### Archivos a Crear/Modificar
|
|
96
|
+
|
|
97
|
+
```markdown
|
|
98
|
+
## Backend
|
|
99
|
+
|
|
100
|
+
### Nuevos archivos
|
|
101
|
+
- [ ] `app/routers/webhooks/{automation_name}.py` - Endpoint del webhook
|
|
102
|
+
- [ ] `app/services/{automation_name}_service.py` - Lógica de negocio
|
|
103
|
+
- [ ] `app/schemas/{automation_name}.py` - Schemas de request/response
|
|
104
|
+
|
|
105
|
+
### Modificaciones
|
|
106
|
+
- [ ] `app/routers/__init__.py` - Registrar nuevo router
|
|
107
|
+
- [ ] `tests/test_{automation_name}.py` - Tests
|
|
108
|
+
|
|
109
|
+
## n8n
|
|
110
|
+
|
|
111
|
+
### Nuevo workflow
|
|
112
|
+
- [ ] `automations/n8n/workflows/{automation_name}.json` - Export del workflow
|
|
113
|
+
|
|
114
|
+
### Documentación
|
|
115
|
+
- [ ] `automations/docs/{automation_name}.md` - Documentación completa
|
|
116
|
+
|
|
117
|
+
## Agente (si aplica)
|
|
118
|
+
|
|
119
|
+
- [ ] `agents/config/agents.yaml` - Registrar nuevo agente
|
|
120
|
+
- [ ] `agents/python/prompts/{agent_name}.md` - Prompt del agente
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Orden de Implementación
|
|
124
|
+
|
|
125
|
+
1. **Schemas** - Definir estructuras de datos
|
|
126
|
+
2. **Service** - Implementar lógica de negocio
|
|
127
|
+
3. **Endpoint** - Crear webhook
|
|
128
|
+
4. **Tests** - Escribir tests
|
|
129
|
+
5. **n8n Workflow** - Crear flujo en n8n
|
|
130
|
+
6. **Documentación** - Documentar para el equipo
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## Paso 4: Implementar
|
|
135
|
+
|
|
136
|
+
### 4.1 Crear Endpoint (FastAPI)
|
|
137
|
+
|
|
138
|
+
```python
|
|
139
|
+
# app/routers/webhooks/{automation_name}.py
|
|
140
|
+
|
|
141
|
+
from fastapi import APIRouter, BackgroundTasks
|
|
142
|
+
from pydantic import BaseModel
|
|
143
|
+
from datetime import datetime
|
|
144
|
+
from uuid import uuid4
|
|
145
|
+
|
|
146
|
+
router = APIRouter(tags=["webhooks"])
|
|
147
|
+
|
|
148
|
+
class {AutomationName}Request(BaseModel):
|
|
149
|
+
"""Request para {automation_name}."""
|
|
150
|
+
# Definir campos según requerimientos
|
|
151
|
+
pass
|
|
152
|
+
|
|
153
|
+
class {AutomationName}Response(BaseModel):
|
|
154
|
+
"""Response para {automation_name}."""
|
|
155
|
+
success: bool
|
|
156
|
+
request_id: str
|
|
157
|
+
message: str
|
|
158
|
+
processed_at: datetime
|
|
159
|
+
|
|
160
|
+
@router.post("/{automation-name}")
|
|
161
|
+
async def handle_{automation_name}(
|
|
162
|
+
request: {AutomationName}Request,
|
|
163
|
+
background_tasks: BackgroundTasks
|
|
164
|
+
) -> {AutomationName}Response:
|
|
165
|
+
"""
|
|
166
|
+
Webhook para {descripción}.
|
|
167
|
+
|
|
168
|
+
## Uso en n8n
|
|
169
|
+
[Documentar aquí cómo usar desde n8n]
|
|
170
|
+
"""
|
|
171
|
+
request_id = str(uuid4())
|
|
172
|
+
|
|
173
|
+
background_tasks.add_task(
|
|
174
|
+
process_{automation_name},
|
|
175
|
+
request_id=request_id,
|
|
176
|
+
data=request
|
|
177
|
+
)
|
|
178
|
+
|
|
179
|
+
return {AutomationName}Response(
|
|
180
|
+
success=True,
|
|
181
|
+
request_id=request_id,
|
|
182
|
+
message="Queued for processing",
|
|
183
|
+
processed_at=datetime.utcnow()
|
|
184
|
+
)
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### 4.2 Crear Service
|
|
188
|
+
|
|
189
|
+
```python
|
|
190
|
+
# app/services/{automation_name}_service.py
|
|
191
|
+
|
|
192
|
+
from app.schemas.{automation_name} import {AutomationName}Request
|
|
193
|
+
import structlog
|
|
194
|
+
|
|
195
|
+
logger = structlog.get_logger()
|
|
196
|
+
|
|
197
|
+
async def process_{automation_name}(
|
|
198
|
+
request_id: str,
|
|
199
|
+
data: {AutomationName}Request
|
|
200
|
+
) -> dict:
|
|
201
|
+
"""
|
|
202
|
+
Procesa la automatización {automation_name}.
|
|
203
|
+
"""
|
|
204
|
+
logger.info(
|
|
205
|
+
"{automation_name}_start",
|
|
206
|
+
request_id=request_id
|
|
207
|
+
)
|
|
208
|
+
|
|
209
|
+
try:
|
|
210
|
+
# 1. Validar datos
|
|
211
|
+
# 2. Procesar lógica de negocio
|
|
212
|
+
# 3. Llamar APIs externas si necesario
|
|
213
|
+
# 4. Guardar resultados
|
|
214
|
+
|
|
215
|
+
result = {}
|
|
216
|
+
|
|
217
|
+
logger.info(
|
|
218
|
+
"{automation_name}_complete",
|
|
219
|
+
request_id=request_id
|
|
220
|
+
)
|
|
221
|
+
|
|
222
|
+
return result
|
|
223
|
+
|
|
224
|
+
except Exception as e:
|
|
225
|
+
logger.error(
|
|
226
|
+
"{automation_name}_error",
|
|
227
|
+
request_id=request_id,
|
|
228
|
+
error=str(e)
|
|
229
|
+
)
|
|
230
|
+
raise
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
### 4.3 Crear Workflow n8n
|
|
234
|
+
|
|
235
|
+
1. Abrir n8n
|
|
236
|
+
2. Crear nuevo workflow
|
|
237
|
+
3. Agregar nodos según el diseño
|
|
238
|
+
4. Configurar credenciales
|
|
239
|
+
5. Probar con datos de ejemplo
|
|
240
|
+
6. Exportar JSON a `automations/n8n/workflows/`
|
|
241
|
+
|
|
242
|
+
---
|
|
243
|
+
|
|
244
|
+
## Paso 5: Testing
|
|
245
|
+
|
|
246
|
+
### Tests Unitarios
|
|
247
|
+
```python
|
|
248
|
+
# tests/test_{automation_name}.py
|
|
249
|
+
|
|
250
|
+
import pytest
|
|
251
|
+
from httpx import AsyncClient
|
|
252
|
+
|
|
253
|
+
@pytest.mark.asyncio
|
|
254
|
+
async def test_{automation_name}_success(client: AsyncClient):
|
|
255
|
+
"""Test caso exitoso."""
|
|
256
|
+
response = await client.post(
|
|
257
|
+
"/webhooks/{automation-name}",
|
|
258
|
+
json={
|
|
259
|
+
# Datos de prueba
|
|
260
|
+
}
|
|
261
|
+
)
|
|
262
|
+
|
|
263
|
+
assert response.status_code == 200
|
|
264
|
+
data = response.json()
|
|
265
|
+
assert data["success"] is True
|
|
266
|
+
assert "request_id" in data
|
|
267
|
+
|
|
268
|
+
@pytest.mark.asyncio
|
|
269
|
+
async def test_{automation_name}_invalid_payload(client: AsyncClient):
|
|
270
|
+
"""Test payload inválido."""
|
|
271
|
+
response = await client.post(
|
|
272
|
+
"/webhooks/{automation-name}",
|
|
273
|
+
json={} # Payload vacío
|
|
274
|
+
)
|
|
275
|
+
|
|
276
|
+
assert response.status_code == 422 # Validation error
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
### Test E2E con n8n
|
|
280
|
+
1. Ejecutar workflow de prueba en n8n
|
|
281
|
+
2. Verificar que el webhook recibe correctamente
|
|
282
|
+
3. Verificar procesamiento completo
|
|
283
|
+
4. Verificar resultado final
|
|
284
|
+
|
|
285
|
+
---
|
|
286
|
+
|
|
287
|
+
## Paso 6: Documentación
|
|
288
|
+
|
|
289
|
+
### Crear documentación en `automations/docs/{automation_name}.md`
|
|
290
|
+
|
|
291
|
+
```markdown
|
|
292
|
+
# {Automation Name}
|
|
293
|
+
|
|
294
|
+
## Descripción
|
|
295
|
+
[Qué hace esta automatización]
|
|
296
|
+
|
|
297
|
+
## Trigger
|
|
298
|
+
- **Tipo**: [Webhook | Schedule | Event]
|
|
299
|
+
- **Endpoint**: POST /webhooks/{automation-name}
|
|
300
|
+
- **Schedule**: [Cron expression si aplica]
|
|
301
|
+
|
|
302
|
+
## Flujo
|
|
303
|
+
1. [Paso 1]
|
|
304
|
+
2. [Paso 2]
|
|
305
|
+
3. [Paso 3]
|
|
306
|
+
|
|
307
|
+
## Sistemas Involucrados
|
|
308
|
+
- **Backend**: [Endpoint y función]
|
|
309
|
+
- **n8n**: [Nombre del workflow]
|
|
310
|
+
- **APIs externas**: [Lista]
|
|
311
|
+
- **Base de datos**: [Tablas afectadas]
|
|
312
|
+
|
|
313
|
+
## Request/Response
|
|
314
|
+
|
|
315
|
+
### Request
|
|
316
|
+
```json
|
|
317
|
+
{
|
|
318
|
+
"field1": "value",
|
|
319
|
+
"field2": 123
|
|
320
|
+
}
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
### Response
|
|
324
|
+
```json
|
|
325
|
+
{
|
|
326
|
+
"success": true,
|
|
327
|
+
"request_id": "uuid",
|
|
328
|
+
"message": "processed"
|
|
329
|
+
}
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
## Manejo de Errores
|
|
333
|
+
| Error | Causa | Solución |
|
|
334
|
+
|-------|-------|----------|
|
|
335
|
+
| [Error 1] | [Causa] | [Solución] |
|
|
336
|
+
|
|
337
|
+
## Monitoreo
|
|
338
|
+
- **Logs**: Buscar por request_id
|
|
339
|
+
- **Métricas**: [Métricas a monitorear]
|
|
340
|
+
- **Alertas**: [Condiciones de alerta]
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
---
|
|
344
|
+
|
|
345
|
+
## Checklist Final
|
|
346
|
+
|
|
347
|
+
- [ ] Endpoint implementado y desplegado
|
|
348
|
+
- [ ] Service con lógica completa
|
|
349
|
+
- [ ] Tests unitarios pasando (>80% coverage)
|
|
350
|
+
- [ ] Workflow n8n creado y probado
|
|
351
|
+
- [ ] Documentación completa
|
|
352
|
+
- [ ] Credenciales configuradas
|
|
353
|
+
- [ ] Monitoreo/alertas configuradas
|
|
354
|
+
- [ ] Review de código completado
|
|
355
|
+
|
|
356
|
+
---
|
|
357
|
+
|
|
358
|
+
## 🛠️ Herramientas Sugeridas
|
|
359
|
+
|
|
360
|
+
| Fase | Herramienta |
|
|
361
|
+
|------|-------------|
|
|
362
|
+
| Diseño | `write_to_file` (schemas, docs) |
|
|
363
|
+
| Backend | `run_command` (pytest), `grep_search` |
|
|
364
|
+
| n8n | `browser_subagent` (probar workflows) |
|
|
365
|
+
| Validación | `run_command` (curl, pytest) |
|
|
366
|
+
|
|
367
|
+
## ⚠️ Errores Comunes
|
|
368
|
+
|
|
369
|
+
| Error | Solución |
|
|
370
|
+
|-------|----------|
|
|
371
|
+
| Webhook sin idempotencia | Diseñar para re-ejecución segura |
|
|
372
|
+
| Sin manejo de errores en n8n | Agregar Error Workflow o nodo IF |
|
|
373
|
+
| Credenciales hardcodeadas | Usar credentials store de n8n |
|
|
374
|
+
| Respuesta > 60s sin async | Usar background task + polling/callback |
|
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Workflow para implementar una nueva feature completa
|
|
3
|
+
level: 2-3
|
|
4
|
+
personas: [backend-engineer, frontend-engineer, qa-engineer]
|
|
5
|
+
version: 2.1
|
|
6
|
+
type: workflow
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# New Feature Implementation Workflow
|
|
10
|
+
|
|
11
|
+
> **Tiempo estimado**: 2-8 horas | **Level**: 2-3
|
|
12
|
+
|
|
13
|
+
Este workflow guía la implementación de una feature completa de principio a fin.
|
|
14
|
+
|
|
15
|
+
## Pre-requisitos
|
|
16
|
+
|
|
17
|
+
1. Feature definida y aprobada (PRD o issue)
|
|
18
|
+
2. Diseño UI aprobado (si aplica)
|
|
19
|
+
3. Arquitectura validada (si es compleja)
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Fase 1: Planificación
|
|
24
|
+
|
|
25
|
+
### 1.1 Entender el Alcance
|
|
26
|
+
|
|
27
|
+
- [ ] Leer PRD/issue completo
|
|
28
|
+
- [ ] Identificar componentes afectados
|
|
29
|
+
- [ ] Listar dependencias
|
|
30
|
+
|
|
31
|
+
### 1.2 Breakdown de Tareas
|
|
32
|
+
|
|
33
|
+
```markdown
|
|
34
|
+
## Feature: {nombre}
|
|
35
|
+
|
|
36
|
+
### Backend
|
|
37
|
+
- [ ] Modelo de datos
|
|
38
|
+
- [ ] Migraciones
|
|
39
|
+
- [ ] Endpoints API
|
|
40
|
+
- [ ] Tests
|
|
41
|
+
|
|
42
|
+
### Frontend
|
|
43
|
+
- [ ] Componentes UI
|
|
44
|
+
- [ ] Integración API
|
|
45
|
+
- [ ] Estados (loading/error)
|
|
46
|
+
- [ ] Tests
|
|
47
|
+
|
|
48
|
+
### Otros
|
|
49
|
+
- [ ] Documentación
|
|
50
|
+
- [ ] Feature flags (si aplica)
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### 1.3 Crear Rama
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
git checkout develop
|
|
57
|
+
git pull origin develop
|
|
58
|
+
git checkout -b feature/{nombre-feature}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Fase 2: Backend
|
|
64
|
+
|
|
65
|
+
### 2.1 Modelo de Datos
|
|
66
|
+
|
|
67
|
+
```python
|
|
68
|
+
# models/{feature}.py
|
|
69
|
+
class Feature(Base):
|
|
70
|
+
__tablename__ = "features"
|
|
71
|
+
|
|
72
|
+
id: Mapped[uuid.UUID] = mapped_column(primary_key=True)
|
|
73
|
+
name: Mapped[str]
|
|
74
|
+
# ...
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### 2.2 Migración
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
alembic revision -m "add_feature_table"
|
|
81
|
+
alembic upgrade head
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### 2.3 Schemas
|
|
85
|
+
|
|
86
|
+
```python
|
|
87
|
+
# schemas/{feature}.py
|
|
88
|
+
class FeatureCreate(BaseModel):
|
|
89
|
+
name: str
|
|
90
|
+
|
|
91
|
+
class FeatureResponse(BaseModel):
|
|
92
|
+
id: str
|
|
93
|
+
name: str
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### 2.4 Servicio
|
|
97
|
+
|
|
98
|
+
```python
|
|
99
|
+
# services/{feature}_service.py
|
|
100
|
+
class FeatureService:
|
|
101
|
+
async def create(self, data: FeatureCreate) -> Feature:
|
|
102
|
+
...
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### 2.5 Endpoints
|
|
106
|
+
|
|
107
|
+
```python
|
|
108
|
+
# routes/{feature}.py
|
|
109
|
+
@router.post("/", response_model=FeatureResponse, status_code=201)
|
|
110
|
+
async def create_feature(data: FeatureCreate):
|
|
111
|
+
return await service.create(data)
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### 2.6 Tests Backend
|
|
115
|
+
|
|
116
|
+
```python
|
|
117
|
+
# tests/test_{feature}.py
|
|
118
|
+
async def test_create_feature(client):
|
|
119
|
+
response = await client.post("/api/v1/features", json={...})
|
|
120
|
+
assert response.status_code == 201
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## Fase 3: Frontend
|
|
126
|
+
|
|
127
|
+
### 3.1 Tipos
|
|
128
|
+
|
|
129
|
+
```typescript
|
|
130
|
+
// types/{feature}.ts
|
|
131
|
+
interface Feature {
|
|
132
|
+
id: string;
|
|
133
|
+
name: string;
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### 3.2 API Client
|
|
138
|
+
|
|
139
|
+
```typescript
|
|
140
|
+
// lib/api/{feature}.ts
|
|
141
|
+
export const featuresApi = {
|
|
142
|
+
getAll: () => api.get<Feature[]>('/features'),
|
|
143
|
+
create: (data: CreateFeatureDto) => api.post<Feature>('/features', data),
|
|
144
|
+
};
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### 3.3 Custom Hook
|
|
148
|
+
|
|
149
|
+
```typescript
|
|
150
|
+
// hooks/use-{feature}.ts
|
|
151
|
+
export function useFeatures() {
|
|
152
|
+
return useQuery({ queryKey: ['features'], queryFn: featuresApi.getAll });
|
|
153
|
+
}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### 3.4 Componentes
|
|
157
|
+
|
|
158
|
+
```typescript
|
|
159
|
+
// components/features/{feature}/
|
|
160
|
+
├── feature-list.tsx
|
|
161
|
+
├── feature-card.tsx
|
|
162
|
+
├── feature-form.tsx
|
|
163
|
+
└── index.ts
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### 3.5 Página
|
|
167
|
+
|
|
168
|
+
```typescript
|
|
169
|
+
// app/(dashboard)/features/page.tsx
|
|
170
|
+
export default function FeaturesPage() {
|
|
171
|
+
const { data: features } = useFeatures();
|
|
172
|
+
return <FeatureList features={features} />;
|
|
173
|
+
}
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### 3.6 Tests Frontend
|
|
177
|
+
|
|
178
|
+
```typescript
|
|
179
|
+
// __tests__/feature-card.test.tsx
|
|
180
|
+
it('renders feature name', () => {
|
|
181
|
+
render(<FeatureCard feature={mockFeature} />);
|
|
182
|
+
expect(screen.getByText(mockFeature.name)).toBeInTheDocument();
|
|
183
|
+
});
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
## Fase 4: Integración
|
|
189
|
+
|
|
190
|
+
### 4.1 E2E Tests
|
|
191
|
+
|
|
192
|
+
```typescript
|
|
193
|
+
// e2e/features.spec.ts
|
|
194
|
+
test('user can create feature', async ({ page }) => {
|
|
195
|
+
await page.goto('/features');
|
|
196
|
+
await page.click('button:has-text("New")');
|
|
197
|
+
await page.fill('input[name="name"]', 'Test Feature');
|
|
198
|
+
await page.click('button:has-text("Create")');
|
|
199
|
+
await expect(page.locator('text=Test Feature')).toBeVisible();
|
|
200
|
+
});
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### 4.2 Manual Testing
|
|
204
|
+
|
|
205
|
+
- [ ] Happy path funciona
|
|
206
|
+
- [ ] Edge cases manejados
|
|
207
|
+
- [ ] Error states funcionan
|
|
208
|
+
- [ ] Mobile responsive
|
|
209
|
+
|
|
210
|
+
---
|
|
211
|
+
|
|
212
|
+
## Fase 5: Finalización
|
|
213
|
+
|
|
214
|
+
### 5.1 Cleanup
|
|
215
|
+
|
|
216
|
+
- [ ] Remover console.logs
|
|
217
|
+
- [ ] Remover código comentado
|
|
218
|
+
- [ ] Verificar imports no usados
|
|
219
|
+
|
|
220
|
+
### 5.2 Documentación
|
|
221
|
+
|
|
222
|
+
- [ ] README actualizado (si aplica)
|
|
223
|
+
- [ ] API docs actualizados
|
|
224
|
+
- [ ] Changelog entry
|
|
225
|
+
|
|
226
|
+
### 5.3 Code Review
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
git push origin feature/{nombre}
|
|
230
|
+
# Crear PR
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
### 5.4 Merge
|
|
234
|
+
|
|
235
|
+
- [ ] PR aprobado
|
|
236
|
+
- [ ] CI pasando
|
|
237
|
+
- [ ] Sin conflictos
|
|
238
|
+
- [ ] Squash & merge
|
|
239
|
+
|
|
240
|
+
---
|
|
241
|
+
|
|
242
|
+
## Checklist Final
|
|
243
|
+
|
|
244
|
+
```markdown
|
|
245
|
+
## Feature: {nombre}
|
|
246
|
+
|
|
247
|
+
### Backend
|
|
248
|
+
- [ ] Modelo creado
|
|
249
|
+
- [ ] Migración aplicada
|
|
250
|
+
- [ ] Endpoints funcionando
|
|
251
|
+
- [ ] Tests pasando (>80% cov)
|
|
252
|
+
|
|
253
|
+
### Frontend
|
|
254
|
+
- [ ] Componentes creados
|
|
255
|
+
- [ ] Integración API
|
|
256
|
+
- [ ] Estados handling
|
|
257
|
+
- [ ] Tests pasando
|
|
258
|
+
|
|
259
|
+
### Quality
|
|
260
|
+
- [ ] Linter pasando
|
|
261
|
+
- [ ] E2E tests
|
|
262
|
+
- [ ] Manual testing
|
|
263
|
+
- [ ] Documentación
|
|
264
|
+
|
|
265
|
+
### Deploy
|
|
266
|
+
- [ ] PR aprobado
|
|
267
|
+
- [ ] Merged a develop
|
|
268
|
+
- [ ] Tested en staging
|
|
269
|
+
- [ ] Ready for production
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
---
|
|
273
|
+
|
|
274
|
+
## 🛠️ Herramientas Sugeridas
|
|
275
|
+
|
|
276
|
+
| Fase | Herramienta |
|
|
277
|
+
|------|-------------|
|
|
278
|
+
| Planificación | `write_to_file` (crear plan), `view_file` (revisar existente) |
|
|
279
|
+
| Backend | `run_command` (alembic, pytest), `grep_search` |
|
|
280
|
+
| Frontend | `run_command` (npm test), `browser_subagent` |
|
|
281
|
+
| Validación | `run_command` (pytest, ruff, eslint) |
|
|
282
|
+
|
|
283
|
+
## ⚠️ Errores Comunes
|
|
284
|
+
|
|
285
|
+
| Error | Solución |
|
|
286
|
+
|-------|----------|
|
|
287
|
+
| Empezar sin PRD aprobado | Validar requerimientos primero |
|
|
288
|
+
| Backend y Frontend en paralelo sin contrato | Definir API contract primero |
|
|
289
|
+
| Olvidar estados (loading/error/empty) | Usar checklist de estados |
|
|
290
|
+
| Tests solo happy path | Agregar tests de errores y edge cases |
|