@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,330 @@
|
|
|
1
|
+
# Tasks Template (SPEC DRIVEN Development)
|
|
2
|
+
# LMAgent Framework v3.0 - SPEC+LM Methodology
|
|
3
|
+
#
|
|
4
|
+
# This template breaks down a plan.yaml into executable tasks.
|
|
5
|
+
# Each task is assigned to a persona and can be executed in parallel.
|
|
6
|
+
# Use with `/dev` persona.
|
|
7
|
+
#
|
|
8
|
+
# Usage:
|
|
9
|
+
# 1. Requires: specs/[feature-name]/plan.yaml (approved)
|
|
10
|
+
# 2. Copy to: specs/[feature-name]/tasks.yaml
|
|
11
|
+
# 3. Execute tasks in dependency order
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
metadata:
|
|
15
|
+
title: "Tasks: [Feature Name]"
|
|
16
|
+
spec_reference: "specs/[feature-name]/spec.yaml"
|
|
17
|
+
plan_reference: "specs/[feature-name]/plan.yaml"
|
|
18
|
+
version: "1.0"
|
|
19
|
+
author: "[Dev Name or Agent ID]"
|
|
20
|
+
created: "[YYYY-MM-DD]"
|
|
21
|
+
status: in_progress # pending | in_progress | completed
|
|
22
|
+
|
|
23
|
+
# ============================================
|
|
24
|
+
# TASK SUMMARY
|
|
25
|
+
# ============================================
|
|
26
|
+
|
|
27
|
+
summary:
|
|
28
|
+
total_tasks: 0
|
|
29
|
+
completed_tasks: 0
|
|
30
|
+
in_progress_tasks: 0
|
|
31
|
+
blocked_tasks: 0
|
|
32
|
+
estimated_hours: 0
|
|
33
|
+
actual_hours: 0
|
|
34
|
+
|
|
35
|
+
# ============================================
|
|
36
|
+
# PHASE 1: [Foundation & Setup]
|
|
37
|
+
# ============================================
|
|
38
|
+
|
|
39
|
+
phase_1:
|
|
40
|
+
name: "Foundation & Setup"
|
|
41
|
+
status: pending # pending | in_progress | completed
|
|
42
|
+
started_at: null
|
|
43
|
+
completed_at: null
|
|
44
|
+
|
|
45
|
+
tasks:
|
|
46
|
+
- id: "T001"
|
|
47
|
+
title: "[Create project structure]"
|
|
48
|
+
description: |
|
|
49
|
+
[Detailed description of what needs to be done.
|
|
50
|
+
Include specific files to create, patterns to follow,
|
|
51
|
+
and expected outcomes.]
|
|
52
|
+
persona: "/dev"
|
|
53
|
+
priority: 1
|
|
54
|
+
estimated_hours: 0.5
|
|
55
|
+
actual_hours: null
|
|
56
|
+
status: pending # pending | in_progress | completed | blocked
|
|
57
|
+
|
|
58
|
+
# Files this task will create/modify
|
|
59
|
+
file_operations:
|
|
60
|
+
create:
|
|
61
|
+
- "path/to/new/file.py"
|
|
62
|
+
- "path/to/another/file.py"
|
|
63
|
+
modify:
|
|
64
|
+
- "path/to/existing/file.py"
|
|
65
|
+
delete: []
|
|
66
|
+
|
|
67
|
+
# Dependencies
|
|
68
|
+
dependencies: []
|
|
69
|
+
blocks: ["T002", "T003"]
|
|
70
|
+
|
|
71
|
+
# Acceptance criteria (from spec)
|
|
72
|
+
acceptance_criteria:
|
|
73
|
+
- "[ ] [Criterion 1]"
|
|
74
|
+
- "[ ] [Criterion 2]"
|
|
75
|
+
|
|
76
|
+
# Commands to run
|
|
77
|
+
commands:
|
|
78
|
+
setup: []
|
|
79
|
+
validate:
|
|
80
|
+
- "pytest tests/test_structure.py -v"
|
|
81
|
+
|
|
82
|
+
# Notes for the implementing agent
|
|
83
|
+
implementation_notes: |
|
|
84
|
+
- Use the standard project template
|
|
85
|
+
- Follow code-style.md guidelines
|
|
86
|
+
- Reference: rules/stack.md
|
|
87
|
+
|
|
88
|
+
# Completion tracking
|
|
89
|
+
started_at: null
|
|
90
|
+
completed_at: null
|
|
91
|
+
completed_by: null
|
|
92
|
+
|
|
93
|
+
- id: "T002"
|
|
94
|
+
title: "[Set up database]"
|
|
95
|
+
description: "[Create migrations, seed data]"
|
|
96
|
+
persona: "/dev"
|
|
97
|
+
priority: 1
|
|
98
|
+
estimated_hours: 1.0
|
|
99
|
+
status: pending
|
|
100
|
+
dependencies: ["T001"]
|
|
101
|
+
blocks: ["T004"]
|
|
102
|
+
file_operations:
|
|
103
|
+
create:
|
|
104
|
+
- "migrations/001_initial.sql"
|
|
105
|
+
modify: []
|
|
106
|
+
delete: []
|
|
107
|
+
acceptance_criteria:
|
|
108
|
+
- "[ ] Migrations run without errors"
|
|
109
|
+
- "[ ] Schema matches design"
|
|
110
|
+
commands:
|
|
111
|
+
validate:
|
|
112
|
+
- "alembic upgrade head"
|
|
113
|
+
- "alembic check"
|
|
114
|
+
|
|
115
|
+
# ============================================
|
|
116
|
+
# PHASE 2: [Core Logic]
|
|
117
|
+
# ============================================
|
|
118
|
+
|
|
119
|
+
phase_2:
|
|
120
|
+
name: "Core Logic"
|
|
121
|
+
status: pending
|
|
122
|
+
depends_on_phases: [1]
|
|
123
|
+
|
|
124
|
+
tasks:
|
|
125
|
+
- id: "T003"
|
|
126
|
+
title: "[Implement service layer]"
|
|
127
|
+
description: "[Business logic implementation]"
|
|
128
|
+
persona: "/dev"
|
|
129
|
+
priority: 1
|
|
130
|
+
estimated_hours: 3.0
|
|
131
|
+
status: pending
|
|
132
|
+
dependencies: ["T001"]
|
|
133
|
+
blocks: ["T005"]
|
|
134
|
+
|
|
135
|
+
# TDD approach
|
|
136
|
+
tdd:
|
|
137
|
+
test_first: true
|
|
138
|
+
test_file: "tests/unit/test_service.py"
|
|
139
|
+
test_cases:
|
|
140
|
+
- "test_create_entity"
|
|
141
|
+
- "test_read_entity"
|
|
142
|
+
- "test_update_entity"
|
|
143
|
+
- "test_delete_entity"
|
|
144
|
+
- "test_validation_errors"
|
|
145
|
+
|
|
146
|
+
file_operations:
|
|
147
|
+
create:
|
|
148
|
+
- "src/services/entity_service.py"
|
|
149
|
+
- "tests/unit/test_service.py"
|
|
150
|
+
modify: []
|
|
151
|
+
|
|
152
|
+
acceptance_criteria:
|
|
153
|
+
- "[ ] All CRUD operations work"
|
|
154
|
+
- "[ ] Validation errors handled"
|
|
155
|
+
- "[ ] Unit tests passing"
|
|
156
|
+
- "[ ] Coverage >80%"
|
|
157
|
+
|
|
158
|
+
commands:
|
|
159
|
+
validate:
|
|
160
|
+
- "pytest tests/unit/ -v --cov=src/services"
|
|
161
|
+
- "ruff check src/services/"
|
|
162
|
+
|
|
163
|
+
# ============================================
|
|
164
|
+
# PHASE 3: [API Layer]
|
|
165
|
+
# ============================================
|
|
166
|
+
|
|
167
|
+
phase_3:
|
|
168
|
+
name: "API Layer"
|
|
169
|
+
status: pending
|
|
170
|
+
depends_on_phases: [2]
|
|
171
|
+
|
|
172
|
+
# Parallel execution group
|
|
173
|
+
parallel_execution:
|
|
174
|
+
enabled: true
|
|
175
|
+
groups:
|
|
176
|
+
- name: "Endpoints"
|
|
177
|
+
tasks: ["T004", "T005"]
|
|
178
|
+
rationale: "Independent endpoints"
|
|
179
|
+
- name: "Supporting"
|
|
180
|
+
tasks: ["T006"]
|
|
181
|
+
can_run_with: ["Endpoints"]
|
|
182
|
+
|
|
183
|
+
tasks:
|
|
184
|
+
- id: "T004"
|
|
185
|
+
title: "[Create REST endpoints]"
|
|
186
|
+
description: "[FastAPI/NestJS endpoints]"
|
|
187
|
+
persona: "/dev"
|
|
188
|
+
priority: 1
|
|
189
|
+
estimated_hours: 2.0
|
|
190
|
+
status: pending
|
|
191
|
+
dependencies: ["T002", "T003"]
|
|
192
|
+
|
|
193
|
+
file_operations:
|
|
194
|
+
create:
|
|
195
|
+
- "src/routers/entity.py"
|
|
196
|
+
- "tests/integration/test_api.py"
|
|
197
|
+
|
|
198
|
+
acceptance_criteria:
|
|
199
|
+
- "[ ] GET /entities works"
|
|
200
|
+
- "[ ] POST /entities works"
|
|
201
|
+
- "[ ] PUT /entities/{id} works"
|
|
202
|
+
- "[ ] DELETE /entities/{id} works"
|
|
203
|
+
- "[ ] OpenAPI schema generated"
|
|
204
|
+
|
|
205
|
+
commands:
|
|
206
|
+
validate:
|
|
207
|
+
- "pytest tests/integration/ -v"
|
|
208
|
+
- "curl http://localhost:8000/docs"
|
|
209
|
+
|
|
210
|
+
- id: "T005"
|
|
211
|
+
title: "[Add authentication]"
|
|
212
|
+
description: "[JWT/OAuth middleware]"
|
|
213
|
+
persona: "/dev"
|
|
214
|
+
priority: 2
|
|
215
|
+
estimated_hours: 1.5
|
|
216
|
+
status: pending
|
|
217
|
+
dependencies: ["T003"]
|
|
218
|
+
|
|
219
|
+
security_considerations:
|
|
220
|
+
- "Use bcrypt for password hashing"
|
|
221
|
+
- "JWT expiry: 15 minutes"
|
|
222
|
+
- "Refresh token rotation"
|
|
223
|
+
|
|
224
|
+
acceptance_criteria:
|
|
225
|
+
- "[ ] Login endpoint works"
|
|
226
|
+
- "[ ] Protected routes require auth"
|
|
227
|
+
- "[ ] Tokens expire correctly"
|
|
228
|
+
|
|
229
|
+
- id: "T006"
|
|
230
|
+
title: "[Generate API documentation]"
|
|
231
|
+
description: "[Swagger/OpenAPI docs]"
|
|
232
|
+
persona: "/dev"
|
|
233
|
+
priority: 3
|
|
234
|
+
estimated_hours: 0.5
|
|
235
|
+
status: pending
|
|
236
|
+
dependencies: ["T004"]
|
|
237
|
+
|
|
238
|
+
acceptance_criteria:
|
|
239
|
+
- "[ ] /docs endpoint available"
|
|
240
|
+
- "[ ] All endpoints documented"
|
|
241
|
+
- "[ ] Examples provided"
|
|
242
|
+
|
|
243
|
+
# ============================================
|
|
244
|
+
# PHASE 4: [Testing & Polish]
|
|
245
|
+
# ============================================
|
|
246
|
+
|
|
247
|
+
phase_4:
|
|
248
|
+
name: "Testing & Polish"
|
|
249
|
+
status: pending
|
|
250
|
+
depends_on_phases: [2, 3]
|
|
251
|
+
|
|
252
|
+
tasks:
|
|
253
|
+
- id: "T007"
|
|
254
|
+
title: "[E2E tests]"
|
|
255
|
+
description: "[Full flow testing]"
|
|
256
|
+
persona: "/qa"
|
|
257
|
+
priority: 1
|
|
258
|
+
estimated_hours: 2.0
|
|
259
|
+
status: pending
|
|
260
|
+
dependencies: ["T004", "T005"]
|
|
261
|
+
|
|
262
|
+
test_scenarios:
|
|
263
|
+
- scenario: "Happy path"
|
|
264
|
+
steps:
|
|
265
|
+
- "Create user"
|
|
266
|
+
- "Login"
|
|
267
|
+
- "Create entity"
|
|
268
|
+
- "Read entity"
|
|
269
|
+
- "Delete entity"
|
|
270
|
+
- "Logout"
|
|
271
|
+
expected: "All operations succeed"
|
|
272
|
+
|
|
273
|
+
- scenario: "Error path"
|
|
274
|
+
steps:
|
|
275
|
+
- "Try invalid login"
|
|
276
|
+
- "Try unauthorized access"
|
|
277
|
+
- "Try invalid data"
|
|
278
|
+
expected: "Appropriate errors returned"
|
|
279
|
+
|
|
280
|
+
acceptance_criteria:
|
|
281
|
+
- "[ ] Happy path passes"
|
|
282
|
+
- "[ ] Error paths handled"
|
|
283
|
+
- "[ ] Performance acceptable"
|
|
284
|
+
|
|
285
|
+
- id: "T008"
|
|
286
|
+
title: "[Code review & refactor]"
|
|
287
|
+
description: "[Final polish]"
|
|
288
|
+
persona: "/lead"
|
|
289
|
+
priority: 2
|
|
290
|
+
estimated_hours: 1.0
|
|
291
|
+
status: pending
|
|
292
|
+
dependencies: ["T007"]
|
|
293
|
+
|
|
294
|
+
review_checklist:
|
|
295
|
+
- "[ ] No TODO comments left"
|
|
296
|
+
- "[ ] No hardcoded values"
|
|
297
|
+
- "[ ] Consistent naming"
|
|
298
|
+
- "[ ] Proper error handling"
|
|
299
|
+
- "[ ] Security best practices"
|
|
300
|
+
|
|
301
|
+
acceptance_criteria:
|
|
302
|
+
- "[ ] Linting passes"
|
|
303
|
+
- "[ ] Type checking passes"
|
|
304
|
+
- "[ ] Security scan passes"
|
|
305
|
+
|
|
306
|
+
# ============================================
|
|
307
|
+
# EXECUTION LOGS
|
|
308
|
+
# ============================================
|
|
309
|
+
|
|
310
|
+
execution_log:
|
|
311
|
+
- timestamp: null
|
|
312
|
+
task_id: null
|
|
313
|
+
action: null
|
|
314
|
+
agent: null
|
|
315
|
+
result: null
|
|
316
|
+
notes: null
|
|
317
|
+
|
|
318
|
+
# ============================================
|
|
319
|
+
# BLOCKERS & ISSUES
|
|
320
|
+
# ============================================
|
|
321
|
+
|
|
322
|
+
blockers:
|
|
323
|
+
- id: "B001"
|
|
324
|
+
task_id: null
|
|
325
|
+
description: null
|
|
326
|
+
severity: null # critical | major | minor
|
|
327
|
+
status: null # open | resolved | wontfix
|
|
328
|
+
resolution: null
|
|
329
|
+
created_at: null
|
|
330
|
+
resolved_at: null
|
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Workflow para analizar y arreglar bugs en servicios backend Python/Node
|
|
3
|
+
level: 1-2
|
|
4
|
+
personas: [backend-engineer, qa-engineer]
|
|
5
|
+
version: 2.1
|
|
6
|
+
type: workflow
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Bugfix Backend Workflow
|
|
10
|
+
|
|
11
|
+
> **Tiempo estimado**: 30 min - 2 horas | **Level**: 1-2
|
|
12
|
+
|
|
13
|
+
Este workflow guía el proceso de análisis y corrección de bugs en backends.
|
|
14
|
+
|
|
15
|
+
## Pre-requisitos
|
|
16
|
+
|
|
17
|
+
1. Leer [AGENTS.md](../AGENTS.md)
|
|
18
|
+
2. Leer [rules/workflow.md](../rules/workflow.md)
|
|
19
|
+
3. Leer [personas/backend-engineer.md](../personas/backend-engineer.md)
|
|
20
|
+
|
|
21
|
+
## Información Requerida
|
|
22
|
+
|
|
23
|
+
Proporciona la siguiente información sobre el bug:
|
|
24
|
+
|
|
25
|
+
1. **Descripción del bug**: ¿Qué está pasando?
|
|
26
|
+
2. **Comportamiento esperado**: ¿Qué debería pasar?
|
|
27
|
+
3. **Pasos para reproducir**: ¿Cómo se reproduce?
|
|
28
|
+
4. **Ambiente**: ¿Dev, staging, producción?
|
|
29
|
+
5. **Logs/Errores**: ¿Hay mensajes de error?
|
|
30
|
+
6. **Frecuencia**: ¿Siempre ocurre o es intermitente?
|
|
31
|
+
7. **Impacto**: ¿Crítico, alto, medio, bajo?
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## Paso 1: Reproducir el Bug
|
|
36
|
+
|
|
37
|
+
### 1.1 Crear Script de Reproducción
|
|
38
|
+
|
|
39
|
+
```python
|
|
40
|
+
# reproduce_bug.py
|
|
41
|
+
|
|
42
|
+
"""
|
|
43
|
+
Script para reproducir el bug descrito en [issue/ticket].
|
|
44
|
+
|
|
45
|
+
Bug: [Descripción breve]
|
|
46
|
+
Comportamiento esperado: [...]
|
|
47
|
+
Comportamiento actual: [...]
|
|
48
|
+
"""
|
|
49
|
+
|
|
50
|
+
import asyncio
|
|
51
|
+
import httpx
|
|
52
|
+
|
|
53
|
+
async def reproduce():
|
|
54
|
+
"""Intenta reproducir el bug."""
|
|
55
|
+
async with httpx.AsyncClient(base_url="http://localhost:8000") as client:
|
|
56
|
+
# Configurar estado inicial si es necesario
|
|
57
|
+
|
|
58
|
+
# Ejecutar acción que causa el bug
|
|
59
|
+
response = await client.post("/endpoint", json={
|
|
60
|
+
# Datos que causan el bug
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
print(f"Status: {response.status_code}")
|
|
64
|
+
print(f"Response: {response.json()}")
|
|
65
|
+
|
|
66
|
+
# Verificar si el bug ocurrió
|
|
67
|
+
# assert ...
|
|
68
|
+
|
|
69
|
+
if __name__ == "__main__":
|
|
70
|
+
asyncio.run(reproduce())
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### 1.2 Ejecutar y Confirmar
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
# Ejecutar script de reproducción
|
|
77
|
+
python reproduce_bug.py
|
|
78
|
+
|
|
79
|
+
# Si el bug no se reproduce, revisar:
|
|
80
|
+
# - ¿Datos correctos?
|
|
81
|
+
# - ¿Ambiente correcto?
|
|
82
|
+
# - ¿Estado previo necesario?
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Paso 2: Localizar el Problema
|
|
88
|
+
|
|
89
|
+
### 2.1 Analizar Logs
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
# Buscar errores relacionados
|
|
93
|
+
grep -r "ERROR" logs/ | grep -i "[keyword del bug]"
|
|
94
|
+
|
|
95
|
+
# Ver logs recientes
|
|
96
|
+
tail -f logs/app.log | grep -i "[keyword]"
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### 2.2 Trazar el Código
|
|
100
|
+
|
|
101
|
+
```
|
|
102
|
+
1. Identificar endpoint afectado
|
|
103
|
+
2. Seguir flujo: Router → Service → Repository
|
|
104
|
+
3. Identificar punto exacto de fallo
|
|
105
|
+
4. Verificar inputs/outputs en cada paso
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### 2.3 Buscar Código Relacionado
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
# Buscar funciones/clases relacionadas
|
|
112
|
+
grep -rn "function_name" app/
|
|
113
|
+
|
|
114
|
+
# Buscar usos de la entidad afectada
|
|
115
|
+
grep -rn "EntityName" app/
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## Paso 3: Analizar Causa Raíz
|
|
121
|
+
|
|
122
|
+
### Checklist de Causas Comunes
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
[ ] Validación de input faltante
|
|
126
|
+
[ ] Manejo de null/None incorrecto
|
|
127
|
+
[ ] Error en lógica condicional
|
|
128
|
+
[ ] Race condition
|
|
129
|
+
[ ] Timeout no manejado
|
|
130
|
+
[ ] Excepción no capturada
|
|
131
|
+
[ ] Error de tipo/casting
|
|
132
|
+
[ ] Query SQL incorrecta
|
|
133
|
+
[ ] Estado inconsistente
|
|
134
|
+
[ ] Configuración incorrecta
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Documentar Análisis
|
|
138
|
+
|
|
139
|
+
```markdown
|
|
140
|
+
## Análisis del Bug
|
|
141
|
+
|
|
142
|
+
### Síntoma
|
|
143
|
+
[Qué se observa]
|
|
144
|
+
|
|
145
|
+
### Localización
|
|
146
|
+
- Archivo: `app/services/xyz.py`
|
|
147
|
+
- Función: `process_data()`
|
|
148
|
+
- Línea: 42
|
|
149
|
+
|
|
150
|
+
### Causa Raíz
|
|
151
|
+
[Por qué ocurre]
|
|
152
|
+
|
|
153
|
+
### Impacto
|
|
154
|
+
[Qué afecta]
|
|
155
|
+
|
|
156
|
+
### Solución Propuesta
|
|
157
|
+
[Cómo arreglar]
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## Paso 4: Escribir Test que Falla
|
|
163
|
+
|
|
164
|
+
Antes de arreglar, escribir test que demuestra el bug:
|
|
165
|
+
|
|
166
|
+
```python
|
|
167
|
+
# tests/test_bug_{issue_number}.py
|
|
168
|
+
|
|
169
|
+
import pytest
|
|
170
|
+
|
|
171
|
+
class TestBug{IssueNumber}:
|
|
172
|
+
"""
|
|
173
|
+
Test para bug #{issue_number}.
|
|
174
|
+
|
|
175
|
+
Bug: [Descripción]
|
|
176
|
+
Causa: [Causa raíz]
|
|
177
|
+
"""
|
|
178
|
+
|
|
179
|
+
@pytest.mark.asyncio
|
|
180
|
+
async def test_bug_scenario(self, client):
|
|
181
|
+
"""El escenario que causa el bug."""
|
|
182
|
+
# Arrange - Configurar estado
|
|
183
|
+
|
|
184
|
+
# Act - Ejecutar acción que causa bug
|
|
185
|
+
response = await client.post("/endpoint", json={
|
|
186
|
+
# Datos que causan el bug
|
|
187
|
+
})
|
|
188
|
+
|
|
189
|
+
# Assert - Verificar comportamiento CORRECTO
|
|
190
|
+
# Este test FALLA antes del fix
|
|
191
|
+
assert response.status_code == 200 # o el esperado
|
|
192
|
+
assert response.json()["field"] == "expected_value"
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## Paso 5: Implementar Fix
|
|
198
|
+
|
|
199
|
+
### 5.1 Aplicar Corrección
|
|
200
|
+
|
|
201
|
+
```python
|
|
202
|
+
# Antes (código con bug)
|
|
203
|
+
def process_data(data):
|
|
204
|
+
result = data["field"] # Falla si field no existe
|
|
205
|
+
return result
|
|
206
|
+
|
|
207
|
+
# Después (código corregido)
|
|
208
|
+
def process_data(data):
|
|
209
|
+
result = data.get("field")
|
|
210
|
+
if result is None:
|
|
211
|
+
raise ValidationError("field is required")
|
|
212
|
+
return result
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### 5.2 Verificar que Test Pasa
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
# Ejecutar test específico
|
|
219
|
+
pytest tests/test_bug_{issue_number}.py -v
|
|
220
|
+
|
|
221
|
+
# Debería pasar ahora
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
### 5.3 Verificar que Otros Tests No Fallan
|
|
225
|
+
|
|
226
|
+
```bash
|
|
227
|
+
# Ejecutar todos los tests
|
|
228
|
+
pytest --cov=app --cov-fail-under=80
|
|
229
|
+
|
|
230
|
+
# Verificar que no hay regresiones
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
## Paso 6: Verificar Fix
|
|
236
|
+
|
|
237
|
+
### 6.1 Re-ejecutar Script de Reproducción
|
|
238
|
+
|
|
239
|
+
```bash
|
|
240
|
+
python reproduce_bug.py
|
|
241
|
+
|
|
242
|
+
# Debería mostrar comportamiento correcto ahora
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
### 6.2 Test Manual (si aplica)
|
|
246
|
+
|
|
247
|
+
1. Probar escenario del bug
|
|
248
|
+
2. Probar casos edge relacionados
|
|
249
|
+
3. Verificar que funcionalidad general sigue bien
|
|
250
|
+
|
|
251
|
+
---
|
|
252
|
+
|
|
253
|
+
## Paso 7: Documentar y Commit
|
|
254
|
+
|
|
255
|
+
### 7.1 Commit Message
|
|
256
|
+
|
|
257
|
+
```
|
|
258
|
+
fix(module): descripción corta del fix
|
|
259
|
+
|
|
260
|
+
Fixes #{issue_number}
|
|
261
|
+
|
|
262
|
+
- [Cambio 1]
|
|
263
|
+
- [Cambio 2]
|
|
264
|
+
|
|
265
|
+
Root cause: [Explicación breve de la causa]
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
### 7.2 Actualizar Documentación (si aplica)
|
|
269
|
+
|
|
270
|
+
- [ ] README si hay cambios de comportamiento
|
|
271
|
+
- [ ] Docstrings si hay nuevos parámetros
|
|
272
|
+
- [ ] Changelog si es fix significativo
|
|
273
|
+
|
|
274
|
+
---
|
|
275
|
+
|
|
276
|
+
## Paso 8: Code Review
|
|
277
|
+
|
|
278
|
+
### Checklist para Reviewer
|
|
279
|
+
|
|
280
|
+
- [ ] Test reproduce el bug original
|
|
281
|
+
- [ ] Fix es minimal y enfocado
|
|
282
|
+
- [ ] No hay regresiones
|
|
283
|
+
- [ ] Código sigue estándares
|
|
284
|
+
- [ ] Documentación actualizada
|
|
285
|
+
|
|
286
|
+
---
|
|
287
|
+
|
|
288
|
+
## Templates
|
|
289
|
+
|
|
290
|
+
### Bug Report Template
|
|
291
|
+
|
|
292
|
+
```markdown
|
|
293
|
+
## Bug Report
|
|
294
|
+
|
|
295
|
+
### Descripción
|
|
296
|
+
[Qué está pasando]
|
|
297
|
+
|
|
298
|
+
### Pasos para Reproducir
|
|
299
|
+
1. [Paso 1]
|
|
300
|
+
2. [Paso 2]
|
|
301
|
+
3. [Paso 3]
|
|
302
|
+
|
|
303
|
+
### Comportamiento Esperado
|
|
304
|
+
[Qué debería pasar]
|
|
305
|
+
|
|
306
|
+
### Comportamiento Actual
|
|
307
|
+
[Qué pasa actualmente]
|
|
308
|
+
|
|
309
|
+
### Ambiente
|
|
310
|
+
- OS: [...]
|
|
311
|
+
- Python/Node: [versión]
|
|
312
|
+
- Branch: [...]
|
|
313
|
+
|
|
314
|
+
### Logs/Screenshots
|
|
315
|
+
```
|
|
316
|
+
[Logs de error]
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
### Impacto
|
|
320
|
+
- [ ] Crítico - Sistema caído
|
|
321
|
+
- [ ] Alto - Feature principal afectado
|
|
322
|
+
- [ ] Medio - Feature secundario afectado
|
|
323
|
+
- [ ] Bajo - Edge case, workaround existe
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
### Fix PR Template
|
|
327
|
+
|
|
328
|
+
```markdown
|
|
329
|
+
## Fix: [Título del Bug]
|
|
330
|
+
|
|
331
|
+
Fixes #{issue_number}
|
|
332
|
+
|
|
333
|
+
### Causa Raíz
|
|
334
|
+
[Explicación de por qué ocurría el bug]
|
|
335
|
+
|
|
336
|
+
### Solución
|
|
337
|
+
[Qué se cambió y por qué]
|
|
338
|
+
|
|
339
|
+
### Testing
|
|
340
|
+
- [x] Test que reproduce el bug
|
|
341
|
+
- [x] Test pasa después del fix
|
|
342
|
+
- [x] Sin regresiones en otros tests
|
|
343
|
+
|
|
344
|
+
### Checklist
|
|
345
|
+
- [ ] Código sigue estándares
|
|
346
|
+
- [ ] Tests completos
|
|
347
|
+
- [ ] Documentación actualizada
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
---
|
|
351
|
+
|
|
352
|
+
## Checklist Final
|
|
353
|
+
|
|
354
|
+
- [ ] Bug reproducido localmente
|
|
355
|
+
- [ ] Causa raíz identificada
|
|
356
|
+
- [ ] Test escrito que falla antes del fix
|
|
357
|
+
- [ ] Fix implementado
|
|
358
|
+
- [ ] Test pasa después del fix
|
|
359
|
+
- [ ] Sin regresiones
|
|
360
|
+
- [ ] Commit con mensaje descriptivo
|
|
361
|
+
- [ ] PR creado para review
|
|
362
|
+
|
|
363
|
+
---
|
|
364
|
+
|
|
365
|
+
## 🛠️ Herramientas Sugeridas
|
|
366
|
+
|
|
367
|
+
| Fase | Herramienta |
|
|
368
|
+
|------|-------------|
|
|
369
|
+
| Reproducción | `run_command` (scripts), `grep_search` |
|
|
370
|
+
| Análisis | `view_file`, `grep_search`, logs |
|
|
371
|
+
| Fix | `replace_file_content`, `write_to_file` |
|
|
372
|
+
| Validación | `run_command` (pytest) |
|
|
373
|
+
|
|
374
|
+
## ⚠️ Errores Comunes
|
|
375
|
+
|
|
376
|
+
| Error | Solución |
|
|
377
|
+
|-------|----------|
|
|
378
|
+
| Arreglar sin reproducir primero | SIEMPRE reproducir antes de tocar código |
|
|
379
|
+
| No escribir test de regresión | El test debe fallar ANTES del fix |
|
|
380
|
+
| Fix muy amplio | Cambiar solo lo necesario, mínima intervención |
|