@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.
Files changed (155) hide show
  1. package/.editorconfig +18 -0
  2. package/AGENTS.md +169 -0
  3. package/CLAUDE.md +122 -0
  4. package/CONTRIBUTING.md +90 -0
  5. package/LICENSE +21 -0
  6. package/README.md +195 -0
  7. package/config/commands.yaml +194 -0
  8. package/config/levels.yaml +135 -0
  9. package/config/models.yaml +192 -0
  10. package/config/settings.yaml +405 -0
  11. package/config/tools-extended.yaml +534 -0
  12. package/config/tools.yaml +437 -0
  13. package/docs/assets/logo.png +0 -0
  14. package/docs/commands.md +132 -0
  15. package/docs/customization-guide.md +445 -0
  16. package/docs/getting-started.md +154 -0
  17. package/docs/how-to-start.md +242 -0
  18. package/docs/navigation-index.md +227 -0
  19. package/docs/usage-guide.md +113 -0
  20. package/install.js +1044 -0
  21. package/package.json +35 -0
  22. package/pyproject.toml +182 -0
  23. package/rules/_bootstrap.md +138 -0
  24. package/rules/agents-ia.md +607 -0
  25. package/rules/api-design.md +337 -0
  26. package/rules/automations-n8n.md +646 -0
  27. package/rules/code-style.md +570 -0
  28. package/rules/documentation.md +98 -0
  29. package/rules/security.md +316 -0
  30. package/rules/stack.md +395 -0
  31. package/rules/testing.md +326 -0
  32. package/rules/workflow.md +353 -0
  33. package/scripts/create_skill.js +300 -0
  34. package/scripts/validate_skills.js +283 -0
  35. package/skills/ai-agent-engineer/SKILL.md +394 -0
  36. package/skills/ai-agent-engineer/references/agent-patterns.md +149 -0
  37. package/skills/api-designer/SKILL.md +429 -0
  38. package/skills/api-designer/references/api-standards.md +13 -0
  39. package/skills/architect/SKILL.md +285 -0
  40. package/skills/architect/references/c4-model.md +133 -0
  41. package/skills/automation-engineer/SKILL.md +352 -0
  42. package/skills/automation-engineer/references/n8n-patterns.md +127 -0
  43. package/skills/backend-engineer/SKILL.md +261 -0
  44. package/skills/backend-engineer/assets/fastapi-project-structure.yaml +74 -0
  45. package/skills/backend-engineer/references/debugging-guide.md +174 -0
  46. package/skills/backend-engineer/references/design-patterns.md +208 -0
  47. package/skills/backend-engineer/scripts/scaffold_backend.py +313 -0
  48. package/skills/bmad-methodology/SKILL.md +202 -0
  49. package/skills/bmad-methodology/references/scale-adaptive-levels.md +141 -0
  50. package/skills/browser-agent/SKILL.md +502 -0
  51. package/skills/browser-agent/scripts/playwright_setup.ts +16 -0
  52. package/skills/code-reviewer/SKILL.md +306 -0
  53. package/skills/code-reviewer/references/code-review-checklist.md +16 -0
  54. package/skills/data-engineer/SKILL.md +474 -0
  55. package/skills/data-engineer/assets/pg-monitoring-queries.sql +154 -0
  56. package/skills/data-engineer/references/index-strategy.md +128 -0
  57. package/skills/data-engineer/scripts/backup_postgres.py +221 -0
  58. package/skills/devops-engineer/SKILL.md +547 -0
  59. package/skills/devops-engineer/references/ci-cd-patterns.md +265 -0
  60. package/skills/devops-engineer/scripts/docker_healthcheck.py +125 -0
  61. package/skills/document-generator/SKILL.md +746 -0
  62. package/skills/document-generator/references/pdf-generation.md +22 -0
  63. package/skills/frontend-engineer/SKILL.md +532 -0
  64. package/skills/frontend-engineer/references/accessibility-guide.md +146 -0
  65. package/skills/frontend-engineer/scripts/audit_bundle.py +144 -0
  66. package/skills/git-workflow/SKILL.md +374 -0
  67. package/skills/git-workflow/references/git-flow.md +25 -0
  68. package/skills/mcp-builder/SKILL.md +471 -0
  69. package/skills/mcp-builder/references/mcp-server-guide.md +23 -0
  70. package/skills/mobile-engineer/SKILL.md +502 -0
  71. package/skills/mobile-engineer/references/platform-guidelines.md +160 -0
  72. package/skills/orchestrator/SKILL.md +246 -0
  73. package/skills/orchestrator/references/methodology-routing.md +117 -0
  74. package/skills/orchestrator/references/persona-mapping.md +85 -0
  75. package/skills/orchestrator/references/routing-logic.md +110 -0
  76. package/skills/performance-engineer/SKILL.md +549 -0
  77. package/skills/performance-engineer/references/caching-patterns.md +181 -0
  78. package/skills/performance-engineer/scripts/profile_endpoint.py +170 -0
  79. package/skills/product-manager/SKILL.md +488 -0
  80. package/skills/product-manager/references/prioritization-frameworks.md +126 -0
  81. package/skills/prompt-engineer/SKILL.md +433 -0
  82. package/skills/prompt-engineer/references/prompt-patterns.md +158 -0
  83. package/skills/qa-engineer/SKILL.md +441 -0
  84. package/skills/qa-engineer/references/testing-strategy.md +166 -0
  85. package/skills/qa-engineer/scripts/run_coverage.py +147 -0
  86. package/skills/scrum-master/SKILL.md +225 -0
  87. package/skills/scrum-master/references/sprint-ceremonies.md +159 -0
  88. package/skills/security-analyst/SKILL.md +390 -0
  89. package/skills/security-analyst/references/owasp-top10.md +188 -0
  90. package/skills/security-analyst/scripts/audit_security.py +242 -0
  91. package/skills/seo-auditor/SKILL.md +523 -0
  92. package/skills/seo-auditor/references/seo-checklist.md +17 -0
  93. package/skills/spec-driven-dev/SKILL.md +342 -0
  94. package/skills/spec-driven-dev/references/phase-gates.md +107 -0
  95. package/skills/supabase-expert/SKILL.md +602 -0
  96. package/skills/supabase-expert/references/supabase-patterns.md +19 -0
  97. package/skills/swe-agent/SKILL.md +311 -0
  98. package/skills/swe-agent/references/trajectory-format.md +134 -0
  99. package/skills/systematic-debugger/SKILL.md +512 -0
  100. package/skills/systematic-debugger/references/debugging-guide.md +12 -0
  101. package/skills/tech-lead/SKILL.md +409 -0
  102. package/skills/tech-lead/references/code-review-checklist.md +111 -0
  103. package/skills/technical-writer/SKILL.md +631 -0
  104. package/skills/technical-writer/references/doc-templates.md +218 -0
  105. package/skills/testing-strategist/SKILL.md +476 -0
  106. package/skills/testing-strategist/references/testing-pyramid.md +16 -0
  107. package/skills/ux-ui-designer/SKILL.md +419 -0
  108. package/skills/ux-ui-designer/references/design-system-foundation.md +168 -0
  109. package/skills_overview.txt +94 -0
  110. package/templates/PROJECT_KICKOFF.md +284 -0
  111. package/templates/SKILL_TEMPLATE.md +131 -0
  112. package/templates/USAGE.md +95 -0
  113. package/templates/agent-python/README.md +71 -0
  114. package/templates/agent-python/agent.py +272 -0
  115. package/templates/agent-python/config.yaml +76 -0
  116. package/templates/agent-python/prompts/system.md +109 -0
  117. package/templates/agent-python/requirements.txt +7 -0
  118. package/templates/automation-n8n/README.md +14 -0
  119. package/templates/automation-n8n/webhook-handler.json +57 -0
  120. package/templates/backend-node/Dockerfile +12 -0
  121. package/templates/backend-node/README.md +15 -0
  122. package/templates/backend-node/package.json +30 -0
  123. package/templates/backend-node/src/index.ts +19 -0
  124. package/templates/backend-node/src/routes.ts +7 -0
  125. package/templates/backend-node/tsconfig.json +22 -0
  126. package/templates/backend-python/Dockerfile +11 -0
  127. package/templates/backend-python/README.md +78 -0
  128. package/templates/backend-python/app/core/config.py +12 -0
  129. package/templates/backend-python/app/core/database.py +12 -0
  130. package/templates/backend-python/app/main.py +17 -0
  131. package/templates/backend-python/app/routers/__init__.py +1 -0
  132. package/templates/backend-python/app/routers/health.py +7 -0
  133. package/templates/backend-python/requirements-dev.txt +6 -0
  134. package/templates/backend-python/requirements.txt +4 -0
  135. package/templates/backend-python/tests/test_health.py +9 -0
  136. package/templates/checkpoint.yaml +117 -0
  137. package/templates/database/README.md +474 -0
  138. package/templates/frontend-react/README.md +446 -0
  139. package/templates/plan.yaml +320 -0
  140. package/templates/session.yaml +125 -0
  141. package/templates/spec.yaml +229 -0
  142. package/templates/tasks.yaml +330 -0
  143. package/workflows/bugfix-backend.md +380 -0
  144. package/workflows/documentation.md +232 -0
  145. package/workflows/generate-prd.md +320 -0
  146. package/workflows/ideation.md +396 -0
  147. package/workflows/new-agent-ia.md +497 -0
  148. package/workflows/new-automation.md +374 -0
  149. package/workflows/new-feature.md +290 -0
  150. package/workflows/optimize-performance.md +373 -0
  151. package/workflows/resolve-github-issue.md +524 -0
  152. package/workflows/security-review.md +291 -0
  153. package/workflows/spec-driven.md +476 -0
  154. package/workflows/testing-strategy.md +296 -0
  155. package/workflows/third-party-integration.md +277 -0
@@ -0,0 +1,373 @@
1
+ ---
2
+ description: Workflow para identificar y resolver cuellos de botella de performance
3
+ level: 2-3
4
+ personas: [backend-engineer, architect]
5
+ ---
6
+
7
+ # Optimize Performance Workflow
8
+
9
+ Este workflow guía la identificación y resolución de problemas de performance.
10
+
11
+ ## Pre-requisitos
12
+
13
+ 1. Leer [AGENTS.md](../AGENTS.md)
14
+ 2. Leer [rules/stack.md](../rules/stack.md)
15
+ 3. Definir métricas objetivo de performance
16
+
17
+ ## Información Requerida
18
+
19
+ 1. **Síntoma**: ¿Qué es lento? (endpoint, query, proceso)
20
+ 2. **Métricas actuales**: ¿Cuánto tarda actualmente?
21
+ 3. **Métricas objetivo**: ¿Cuánto debería tardar?
22
+ 4. **Carga**: ¿Cuántas requests/segundo?
23
+ 5. **Ambiente**: ¿Dev, staging, producción?
24
+ 6. **Tendencia**: ¿Siempre fue lento o empeoró?
25
+
26
+ ---
27
+
28
+ ## Paso 1: Medir Estado Actual
29
+
30
+ ### 1.1 Identificar Métricas Base
31
+
32
+ ```python
33
+ # Agregar timing a endpoints sospechosos
34
+ import time
35
+ import structlog
36
+
37
+ logger = structlog.get_logger()
38
+
39
+ @router.get("/slow-endpoint")
40
+ async def slow_endpoint():
41
+ start = time.perf_counter()
42
+
43
+ # ... lógica ...
44
+
45
+ elapsed = time.perf_counter() - start
46
+ logger.info("endpoint_timing", endpoint="/slow-endpoint", elapsed_ms=elapsed*1000)
47
+
48
+ return result
49
+ ```
50
+
51
+ ### 1.2 Analizar Logs de Timing
52
+
53
+ ```bash
54
+ # Buscar endpoints lentos
55
+ grep "endpoint_timing" logs/app.log | \
56
+ jq -r '[.endpoint, .elapsed_ms] | @tsv' | \
57
+ sort -t$'\t' -k2 -nr | head -20
58
+ ```
59
+
60
+ ### 1.3 Profiling (si es necesario)
61
+
62
+ ```python
63
+ # Para Python - usar cProfile
64
+ import cProfile
65
+ import pstats
66
+
67
+ profiler = cProfile.Profile()
68
+ profiler.enable()
69
+
70
+ # Ejecutar código lento
71
+ result = slow_function()
72
+
73
+ profiler.disable()
74
+ stats = pstats.Stats(profiler).sort_stats('cumulative')
75
+ stats.print_stats(20) # Top 20 funciones lentas
76
+ ```
77
+
78
+ ---
79
+
80
+ ## Paso 2: Identificar Cuellos de Botella
81
+
82
+ ### Checklist de Causas Comunes
83
+
84
+ ```
85
+ ┌─────────────────────────────────────────────────────────────┐
86
+ │ CAUSAS DE LENTITUD │
87
+ ├─────────────────────────────────────────────────────────────┤
88
+ │ DATABASE │
89
+ │ [ ] N+1 queries │
90
+ │ [ ] Queries sin índices │
91
+ │ [ ] Queries que retornan demasiados datos │
92
+ │ [ ] Locks de base de datos │
93
+ │ [ ] Conexiones agotadas │
94
+ ├─────────────────────────────────────────────────────────────┤
95
+ │ CODE │
96
+ │ [ ] Loops ineficientes │
97
+ │ [ ] Operaciones síncronas bloqueantes │
98
+ │ [ ] Serialización/deserialización costosa │
99
+ │ [ ] Regex complejos │
100
+ │ [ ] Cálculos repetidos (sin cache) │
101
+ ├─────────────────────────────────────────────────────────────┤
102
+ │ NETWORK │
103
+ │ [ ] APIs externas lentas │
104
+ │ [ ] Llamadas secuenciales (deberían ser paralelas) │
105
+ │ [ ] Payloads muy grandes │
106
+ │ [ ] DNS resolution lenta │
107
+ ├─────────────────────────────────────────────────────────────┤
108
+ │ MEMORY │
109
+ │ [ ] Memory leaks │
110
+ │ [ ] Objetos muy grandes en memoria │
111
+ │ [ ] Garbage collection frecuente │
112
+ ├─────────────────────────────────────────────────────────────┤
113
+ │ INFRASTRUCTURE │
114
+ │ [ ] CPU insuficiente │
115
+ │ [ ] RAM insuficiente │
116
+ │ [ ] Disco I/O lento │
117
+ │ [ ] Contenedor con límites muy bajos │
118
+ └─────────────────────────────────────────────────────────────┘
119
+ ```
120
+
121
+ ### Análisis de Queries SQL
122
+
123
+ ```python
124
+ # Agregar logging de queries
125
+ import logging
126
+ logging.getLogger('sqlalchemy.engine').setLevel(logging.INFO)
127
+
128
+ # En producción, usar query explain
129
+ EXPLAIN ANALYZE SELECT * FROM users WHERE email = 'test@example.com';
130
+ ```
131
+
132
+ ---
133
+
134
+ ## Paso 3: Priorizar Optimizaciones
135
+
136
+ ### Matriz de Priorización
137
+
138
+ | Optimización | Impacto | Esfuerzo | Riesgo | Prioridad |
139
+ |--------------|---------|----------|--------|-----------|
140
+ | [Opt 1] | Alto/Medio/Bajo | Alto/Medio/Bajo | Alto/Medio/Bajo | 1-5 |
141
+ | [Opt 2] | ... | ... | ... | ... |
142
+
143
+ **Regla**: Priorizar **Alto Impacto + Bajo Esfuerzo + Bajo Riesgo**
144
+
145
+ ---
146
+
147
+ ## Paso 4: Implementar Optimizaciones
148
+
149
+ ### 4.1 Optimizaciones de Database
150
+
151
+ #### Agregar Índices
152
+ ```sql
153
+ -- Identificar queries sin índices
154
+ EXPLAIN ANALYZE SELECT * FROM orders WHERE customer_id = 123;
155
+
156
+ -- Crear índice
157
+ CREATE INDEX idx_orders_customer_id ON orders(customer_id);
158
+
159
+ -- Verificar mejora
160
+ EXPLAIN ANALYZE SELECT * FROM orders WHERE customer_id = 123;
161
+ ```
162
+
163
+ #### Eliminar N+1 Queries
164
+ ```python
165
+ # Antes (N+1)
166
+ users = await db.query(User).all()
167
+ for user in users:
168
+ orders = await db.query(Order).filter(Order.user_id == user.id).all()
169
+
170
+ # Después (JOIN o eager loading)
171
+ users = await db.query(User).options(selectinload(User.orders)).all()
172
+ ```
173
+
174
+ #### Paginar Resultados
175
+ ```python
176
+ # Antes
177
+ all_orders = await repository.get_all() # Puede ser millones
178
+
179
+ # Después
180
+ orders = await repository.get_paginated(page=1, page_size=100)
181
+ ```
182
+
183
+ ### 4.2 Optimizaciones de Código
184
+
185
+ #### Agregar Cache
186
+ ```python
187
+ from functools import lru_cache
188
+ import redis
189
+
190
+ redis_client = redis.Redis.from_url(settings.REDIS_URL)
191
+
192
+ async def get_user_settings(user_id: int) -> dict:
193
+ """Obtiene settings con cache en Redis."""
194
+ cache_key = f"user_settings:{user_id}"
195
+
196
+ # Intentar cache primero
197
+ cached = await redis_client.get(cache_key)
198
+ if cached:
199
+ return json.loads(cached)
200
+
201
+ # Si no hay cache, obtener de DB
202
+ settings = await repository.get_settings(user_id)
203
+
204
+ # Guardar en cache (5 minutos)
205
+ await redis_client.setex(cache_key, 300, json.dumps(settings))
206
+
207
+ return settings
208
+ ```
209
+
210
+ #### Paralelizar Llamadas
211
+ ```python
212
+ import asyncio
213
+
214
+ # Antes (secuencial) - 3 segundos
215
+ user = await get_user(user_id)
216
+ orders = await get_orders(user_id)
217
+ preferences = await get_preferences(user_id)
218
+
219
+ # Después (paralelo) - 1 segundo
220
+ user, orders, preferences = await asyncio.gather(
221
+ get_user(user_id),
222
+ get_orders(user_id),
223
+ get_preferences(user_id)
224
+ )
225
+ ```
226
+
227
+ #### Código Async Correcto
228
+ ```python
229
+ # Antes (blocking)
230
+ import requests
231
+ response = requests.get(url) # Bloquea event loop!
232
+
233
+ # Después (async)
234
+ import httpx
235
+ async with httpx.AsyncClient() as client:
236
+ response = await client.get(url)
237
+ ```
238
+
239
+ ### 4.3 Optimizaciones de Infraestructura
240
+
241
+ #### Aumentar Pool de Conexiones
242
+ ```python
243
+ # config.py
244
+ DATABASE_URL = "postgresql+asyncpg://..."
245
+ DATABASE_POOL_SIZE = 20 # Aumentar si hay muchas conexiones
246
+ DATABASE_MAX_OVERFLOW = 10
247
+ ```
248
+
249
+ #### Agregar Redis para Cache de Sesión
250
+ ```yaml
251
+ # docker-compose.yml
252
+ services:
253
+ redis:
254
+ image: redis:7-alpine
255
+ command: redis-server --maxmemory 256mb --maxmemory-policy allkeys-lru
256
+ ```
257
+
258
+ ---
259
+
260
+ ## Paso 5: Medir Mejora
261
+
262
+ ### 5.1 Benchmark Antes/Después
263
+
264
+ ```python
265
+ # benchmark.py
266
+ import asyncio
267
+ import time
268
+ import httpx
269
+ import statistics
270
+
271
+ async def benchmark_endpoint(url: str, n: int = 100) -> dict:
272
+ """Ejecuta N requests y reporta métricas."""
273
+ times = []
274
+
275
+ async with httpx.AsyncClient() as client:
276
+ for _ in range(n):
277
+ start = time.perf_counter()
278
+ await client.get(url)
279
+ elapsed = time.perf_counter() - start
280
+ times.append(elapsed * 1000)
281
+
282
+ return {
283
+ "requests": n,
284
+ "min_ms": min(times),
285
+ "max_ms": max(times),
286
+ "avg_ms": statistics.mean(times),
287
+ "median_ms": statistics.median(times),
288
+ "p95_ms": sorted(times)[int(n * 0.95)],
289
+ "p99_ms": sorted(times)[int(n * 0.99)]
290
+ }
291
+
292
+ # Ejecutar
293
+ results = asyncio.run(benchmark_endpoint("http://localhost:8000/endpoint"))
294
+ print(results)
295
+ ```
296
+
297
+ ### 5.2 Comparar Resultados
298
+
299
+ | Métrica | Antes | Después | Mejora |
300
+ |---------|-------|---------|--------|
301
+ | Avg (ms) | 500 | 50 | 10x |
302
+ | P95 (ms) | 800 | 100 | 8x |
303
+ | P99 (ms) | 1200 | 150 | 8x |
304
+
305
+ ---
306
+
307
+ ## Paso 6: Documentar
308
+
309
+ ### 6.1 Documentar Optimizaciones
310
+
311
+ ```markdown
312
+ # Optimización: [Nombre]
313
+
314
+ ## Problema
315
+ - Endpoint: /api/v1/users
316
+ - Tiempo promedio: 500ms
317
+ - Causa: N+1 queries
318
+
319
+ ## Solución
320
+ - Agregar eager loading para orders
321
+ - Agregar índice en orders.user_id
322
+
323
+ ## Resultados
324
+ - Tiempo promedio: 50ms (10x mejora)
325
+ - CPU: -30%
326
+ - DB connections: -50%
327
+
328
+ ## Archivos Modificados
329
+ - `app/repositories/user_repository.py`
330
+ - `migrations/xxx_add_index.sql`
331
+ ```
332
+
333
+ ### 6.2 Agregar Monitoring Permanente
334
+
335
+ ```python
336
+ # Agregar métricas para monitoreo continuo
337
+ from prometheus_client import Histogram
338
+
339
+ REQUEST_LATENCY = Histogram(
340
+ 'request_latency_seconds',
341
+ 'Request latency in seconds',
342
+ ['endpoint']
343
+ )
344
+
345
+ @router.get("/endpoint")
346
+ async def endpoint():
347
+ with REQUEST_LATENCY.labels(endpoint="/endpoint").time():
348
+ return await process()
349
+ ```
350
+
351
+ ---
352
+
353
+ ## Checklist Final
354
+
355
+ ### Análisis
356
+ - [ ] Métricas base medidas
357
+ - [ ] Cuellos de botella identificados
358
+ - [ ] Causas raíz documentadas
359
+
360
+ ### Implementación
361
+ - [ ] Optimizaciones priorizadas
362
+ - [ ] Cambios implementados
363
+ - [ ] Tests no afectados
364
+
365
+ ### Validación
366
+ - [ ] Benchmarks ejecutados
367
+ - [ ] Mejora confirmada
368
+ - [ ] Sin regresiones
369
+
370
+ ### Documentación
371
+ - [ ] Optimizaciones documentadas
372
+ - [ ] Monitoring configurado
373
+ - [ ] Lecciones aprendidas registradas