AI CodingThrive Editorial

30 prompts de IA para depurar código

La depuración empieza por un síntoma que se pueda reproducir. Estos prompts piden hipótesis, una prueba acotada y el cambio más pequeño que explique el fallo.

16 min de lecturaActualizado el
Un programador examina un problema de software en un portátil en su espacio de trabajo.

La versión breve

  • La depuración empieza por un síntoma que se pueda reproducir. Estos prompts piden hipótesis, una prueba acotada y el cambio más pequeño que explique el fallo.
  • No pegues credenciales, datos privados de clientes ni repositorios propietarios completos en un asistente no autorizado. Ejecuta los comandos y las pruebas en tu propio entorno. Que un parche parezca correcto no demuestra que funcione.

La depuración empieza por un síntoma que se pueda reproducir. Estos prompts piden hipótesis, una prueba acotada y el cambio más pequeño que explique el fallo.

No pegues credenciales, datos privados de clientes ni repositorios propietarios completos en un asistente no autorizado. Ejecuta los comandos y las pruebas en tu propio entorno. Que un parche parezca correcto no demuestra que funcione.

Cómo usar esta colección

Elige la tarea más parecida a tu trabajo. Copia el prompt, sustituye la escena o el contexto de código genérico por tus datos y conserva las restricciones que te permitan evaluar el resultado. Cambia una variable cada vez para saber qué ha mejorado.

El método sigue la guía de ingeniería de prompts de GitHub Copilot: aporta contexto concreto y revisa el resultado, sin dar por correcta una primera respuesta bien presentada.

Prompts de diagnóstico

Este grupo se centra en el diagnóstico. Facilita tu código y el comando de pruebas antes de aceptar la respuesta.

1. Un valor nulo bloquea una página

Help with a null value crashing a page in my existing codebase. Ask for the relevant file, expected behavior, actual behavior and test command if I have not supplied them. Then state competing hypotheses, request a minimal reproduction and identify evidence that separates them. Preserve public interfaces unless evidence requires a change. Show assumptions, a focused diff and the exact command I should run. Do not invent files, test results or security guarantees.

Revisión: Ejecuta la reproducción propuesta antes de aplicar un parche.

2. Una conversión de zona horaria se desvía un día

Help with a timezone conversion off by one day in my existing codebase. Ask for the relevant file, expected behavior, actual behavior and test command if I have not supplied them. Then state competing hypotheses, request a minimal reproduction and identify evidence that separates them. Preserve public interfaces unless evidence requires a change. Show assumptions, a focused diff and the exact command I should run. Do not invent files, test results or security guarantees.

Revisión: Ejecuta la reproducción propuesta antes de aplicar un parche.

3. Una respuesta 401 intermitente

Help with an intermittent 401 response in my existing codebase. Ask for the relevant file, expected behavior, actual behavior and test command if I have not supplied them. Then state competing hypotheses, request a minimal reproduction and identify evidence that separates them. Preserve public interfaces unless evidence requires a change. Show assumptions, a focused diff and the exact command I should run. Do not invent files, test results or security guarantees.

Revisión: Ejecuta la reproducción propuesta antes de aplicar un parche.

4. Una condición de carrera entre dos guardados

Help with a race between two saves in my existing codebase. Ask for the relevant file, expected behavior, actual behavior and test command if I have not supplied them. Then state competing hypotheses, request a minimal reproduction and identify evidence that separates them. Preserve public interfaces unless evidence requires a change. Show assumptions, a focused diff and the exact command I should run. Do not invent files, test results or security guarantees.

Revisión: Ejecuta la reproducción propuesta antes de aplicar un parche.

5. Un elemento desaparece al filtrar una lista

Help with a missing list item after filtering in my existing codebase. Ask for the relevant file, expected behavior, actual behavior and test command if I have not supplied them. Then state competing hypotheses, request a minimal reproduction and identify evidence that separates them. Preserve public interfaces unless evidence requires a change. Show assumptions, a focused diff and the exact command I should run. Do not invent files, test results or security guarantees.

Revisión: Ejecuta la reproducción propuesta antes de aplicar un parche.

6. Una página lenta bajo carga

Help with a slow page under load in my existing codebase. Ask for the relevant file, expected behavior, actual behavior and test command if I have not supplied them. Then state competing hypotheses, request a minimal reproduction and identify evidence that separates them. Preserve public interfaces unless evidence requires a change. Show assumptions, a focused diff and the exact command I should run. Do not invent files, test results or security guarantees.

Revisión: Ejecuta la reproducción propuesta antes de aplicar un parche.

7. Un enlace directo que no funciona

Help with a broken deep link in my existing codebase. Ask for the relevant file, expected behavior, actual behavior and test command if I have not supplied them. Then state competing hypotheses, request a minimal reproduction and identify evidence that separates them. Preserve public interfaces unless evidence requires a change. Show assumptions, a focused diff and the exact command I should run. Do not invent files, test results or security guarantees.

Revisión: Ejecuta la reproducción propuesta antes de aplicar un parche.

8. Un analizador rechaza datos válidos

Help with a parser rejecting valid input in my existing codebase. Ask for the relevant file, expected behavior, actual behavior and test command if I have not supplied them. Then state competing hypotheses, request a minimal reproduction and identify evidence that separates them. Preserve public interfaces unless evidence requires a change. Show assumptions, a focused diff and the exact command I should run. Do not invent files, test results or security guarantees.

Revisión: Ejecuta la reproducción propuesta antes de aplicar un parche.

9. Una respuesta obsoleta en caché

Help with a stale cached response in my existing codebase. Ask for the relevant file, expected behavior, actual behavior and test command if I have not supplied them. Then state competing hypotheses, request a minimal reproduction and identify evidence that separates them. Preserve public interfaces unless evidence requires a change. Show assumptions, a focused diff and the exact command I should run. Do not invent files, test results or security guarantees.

Revisión: Ejecuta la reproducción propuesta antes de aplicar un parche.

10. Una subida que solo funciona en local

Help with an upload that works only locally in my existing codebase. Ask for the relevant file, expected behavior, actual behavior and test command if I have not supplied them. Then state competing hypotheses, request a minimal reproduction and identify evidence that separates them. Preserve public interfaces unless evidence requires a change. Show assumptions, a focused diff and the exact command I should run. Do not invent files, test results or security guarantees.

Revisión: Ejecuta la reproducción propuesta antes de aplicar un parche.

Developer investigating a timezone bug with two clocks and a date test.

Prompts de implementación

Este grupo se centra en la implementación. Facilita tu código y el comando de pruebas antes de aceptar la respuesta.

11. Un valor nulo bloquea una página

Help with a null value crashing a page in my existing codebase. Ask for the relevant file, expected behavior, actual behavior and test command if I have not supplied them. Then make the smallest change that satisfies the stated behavior and show a focused diff. Preserve public interfaces unless evidence requires a change. Show assumptions, a focused diff and the exact command I should run. Do not invent files, test results or security guarantees.

Revisión: Revisa el diff para detectar cambios ajenos a la tarea y accesos a datos no previstos.

12. Una conversión de zona horaria se desvía un día

Help with a timezone conversion off by one day in my existing codebase. Ask for the relevant file, expected behavior, actual behavior and test command if I have not supplied them. Then make the smallest change that satisfies the stated behavior and show a focused diff. Preserve public interfaces unless evidence requires a change. Show assumptions, a focused diff and the exact command I should run. Do not invent files, test results or security guarantees.

Revisión: Revisa el diff para detectar cambios ajenos a la tarea y accesos a datos no previstos.

13. Una respuesta 401 intermitente

Help with an intermittent 401 response in my existing codebase. Ask for the relevant file, expected behavior, actual behavior and test command if I have not supplied them. Then make the smallest change that satisfies the stated behavior and show a focused diff. Preserve public interfaces unless evidence requires a change. Show assumptions, a focused diff and the exact command I should run. Do not invent files, test results or security guarantees.

Revisión: Revisa el diff para detectar cambios ajenos a la tarea y accesos a datos no previstos.

14. Una condición de carrera entre dos guardados

Help with a race between two saves in my existing codebase. Ask for the relevant file, expected behavior, actual behavior and test command if I have not supplied them. Then make the smallest change that satisfies the stated behavior and show a focused diff. Preserve public interfaces unless evidence requires a change. Show assumptions, a focused diff and the exact command I should run. Do not invent files, test results or security guarantees.

Revisión: Revisa el diff para detectar cambios ajenos a la tarea y accesos a datos no previstos.

15. Un elemento desaparece al filtrar una lista

Help with a missing list item after filtering in my existing codebase. Ask for the relevant file, expected behavior, actual behavior and test command if I have not supplied them. Then make the smallest change that satisfies the stated behavior and show a focused diff. Preserve public interfaces unless evidence requires a change. Show assumptions, a focused diff and the exact command I should run. Do not invent files, test results or security guarantees.

Revisión: Revisa el diff para detectar cambios ajenos a la tarea y accesos a datos no previstos.

16. Una página lenta bajo carga

Help with a slow page under load in my existing codebase. Ask for the relevant file, expected behavior, actual behavior and test command if I have not supplied them. Then make the smallest change that satisfies the stated behavior and show a focused diff. Preserve public interfaces unless evidence requires a change. Show assumptions, a focused diff and the exact command I should run. Do not invent files, test results or security guarantees.

Revisión: Revisa el diff para detectar cambios ajenos a la tarea y accesos a datos no previstos.

17. Un enlace directo que no funciona

Help with a broken deep link in my existing codebase. Ask for the relevant file, expected behavior, actual behavior and test command if I have not supplied them. Then make the smallest change that satisfies the stated behavior and show a focused diff. Preserve public interfaces unless evidence requires a change. Show assumptions, a focused diff and the exact command I should run. Do not invent files, test results or security guarantees.

Revisión: Revisa el diff para detectar cambios ajenos a la tarea y accesos a datos no previstos.

18. Un analizador rechaza datos válidos

Help with a parser rejecting valid input in my existing codebase. Ask for the relevant file, expected behavior, actual behavior and test command if I have not supplied them. Then make the smallest change that satisfies the stated behavior and show a focused diff. Preserve public interfaces unless evidence requires a change. Show assumptions, a focused diff and the exact command I should run. Do not invent files, test results or security guarantees.

Revisión: Revisa el diff para detectar cambios ajenos a la tarea y accesos a datos no previstos.

19. Una respuesta obsoleta en caché

Help with a stale cached response in my existing codebase. Ask for the relevant file, expected behavior, actual behavior and test command if I have not supplied them. Then make the smallest change that satisfies the stated behavior and show a focused diff. Preserve public interfaces unless evidence requires a change. Show assumptions, a focused diff and the exact command I should run. Do not invent files, test results or security guarantees.

Revisión: Revisa el diff para detectar cambios ajenos a la tarea y accesos a datos no previstos.

20. Una subida que solo funciona en local

Help with an upload that works only locally in my existing codebase. Ask for the relevant file, expected behavior, actual behavior and test command if I have not supplied them. Then make the smallest change that satisfies the stated behavior and show a focused diff. Preserve public interfaces unless evidence requires a change. Show assumptions, a focused diff and the exact command I should run. Do not invent files, test results or security guarantees.

Revisión: Revisa el diff para detectar cambios ajenos a la tarea y accesos a datos no previstos.

Three-step code workflow: brief the work, inspect the result, edit and verify.

Prompts para probar casos límite

Este grupo se centra en probar los casos límite. Facilita tu código y el comando de pruebas antes de aceptar la respuesta.

21. Un valor nulo bloquea una página

Help with a null value crashing a page in my existing codebase. Ask for the relevant file, expected behavior, actual behavior and test command if I have not supplied them. Then add unit or integration cases for empty, invalid and concurrent inputs as appropriate. Preserve public interfaces unless evidence requires a change. Show assumptions, a focused diff and the exact command I should run. Do not invent files, test results or security guarantees.

Revisión: Ejecuta las pruebas y, cuando sea posible, comprueba que fallen antes de aplicar la corrección.

22. Una conversión de zona horaria se desvía un día

Help with a timezone conversion off by one day in my existing codebase. Ask for the relevant file, expected behavior, actual behavior and test command if I have not supplied them. Then add unit or integration cases for empty, invalid and concurrent inputs as appropriate. Preserve public interfaces unless evidence requires a change. Show assumptions, a focused diff and the exact command I should run. Do not invent files, test results or security guarantees.

Revisión: Ejecuta las pruebas y, cuando sea posible, comprueba que fallen antes de aplicar la corrección.

23. Una respuesta 401 intermitente

Help with an intermittent 401 response in my existing codebase. Ask for the relevant file, expected behavior, actual behavior and test command if I have not supplied them. Then add unit or integration cases for empty, invalid and concurrent inputs as appropriate. Preserve public interfaces unless evidence requires a change. Show assumptions, a focused diff and the exact command I should run. Do not invent files, test results or security guarantees.

Revisión: Ejecuta las pruebas y, cuando sea posible, comprueba que fallen antes de aplicar la corrección.

24. Una condición de carrera entre dos guardados

Help with a race between two saves in my existing codebase. Ask for the relevant file, expected behavior, actual behavior and test command if I have not supplied them. Then add unit or integration cases for empty, invalid and concurrent inputs as appropriate. Preserve public interfaces unless evidence requires a change. Show assumptions, a focused diff and the exact command I should run. Do not invent files, test results or security guarantees.

Revisión: Ejecuta las pruebas y, cuando sea posible, comprueba que fallen antes de aplicar la corrección.

25. Un elemento desaparece al filtrar una lista

Help with a missing list item after filtering in my existing codebase. Ask for the relevant file, expected behavior, actual behavior and test command if I have not supplied them. Then add unit or integration cases for empty, invalid and concurrent inputs as appropriate. Preserve public interfaces unless evidence requires a change. Show assumptions, a focused diff and the exact command I should run. Do not invent files, test results or security guarantees.

Revisión: Ejecuta las pruebas y, cuando sea posible, comprueba que fallen antes de aplicar la corrección.

26. Una página lenta bajo carga

Help with a slow page under load in my existing codebase. Ask for the relevant file, expected behavior, actual behavior and test command if I have not supplied them. Then add unit or integration cases for empty, invalid and concurrent inputs as appropriate. Preserve public interfaces unless evidence requires a change. Show assumptions, a focused diff and the exact command I should run. Do not invent files, test results or security guarantees.

Revisión: Ejecuta las pruebas y, cuando sea posible, comprueba que fallen antes de aplicar la corrección.

27. Un enlace directo que no funciona

Help with a broken deep link in my existing codebase. Ask for the relevant file, expected behavior, actual behavior and test command if I have not supplied them. Then add unit or integration cases for empty, invalid and concurrent inputs as appropriate. Preserve public interfaces unless evidence requires a change. Show assumptions, a focused diff and the exact command I should run. Do not invent files, test results or security guarantees.

Revisión: Ejecuta las pruebas y, cuando sea posible, comprueba que fallen antes de aplicar la corrección.

28. Un analizador rechaza datos válidos

Help with a parser rejecting valid input in my existing codebase. Ask for the relevant file, expected behavior, actual behavior and test command if I have not supplied them. Then add unit or integration cases for empty, invalid and concurrent inputs as appropriate. Preserve public interfaces unless evidence requires a change. Show assumptions, a focused diff and the exact command I should run. Do not invent files, test results or security guarantees.

Revisión: Ejecuta las pruebas y, cuando sea posible, comprueba que fallen antes de aplicar la corrección.

29. Una respuesta obsoleta en caché

Help with a stale cached response in my existing codebase. Ask for the relevant file, expected behavior, actual behavior and test command if I have not supplied them. Then add unit or integration cases for empty, invalid and concurrent inputs as appropriate. Preserve public interfaces unless evidence requires a change. Show assumptions, a focused diff and the exact command I should run. Do not invent files, test results or security guarantees.

Revisión: Ejecuta las pruebas y, cuando sea posible, comprueba que fallen antes de aplicar la corrección.

30. Una subida que solo funciona en local

Help with an upload that works only locally in my existing codebase. Ask for the relevant file, expected behavior, actual behavior and test command if I have not supplied them. Then add unit or integration cases for empty, invalid and concurrent inputs as appropriate. Preserve public interfaces unless evidence requires a change. Show assumptions, a focused diff and the exact command I should run. Do not invent files, test results or security guarantees.

Revisión: Ejecuta las pruebas y, cuando sea posible, comprueba que fallen antes de aplicar la corrección.

Qué comprobar antes de usar el resultado

No pegues credenciales, datos privados de clientes ni repositorios propietarios completos en un asistente no autorizado. Ejecuta los comandos y las pruebas en tu propio entorno. Que un parche parezca correcto no demuestra que funcione.

Si el resultado no resuelve la tarea, acorta el prompt y especifica el dato o la restricción que falta. Guarda la versión utilizada para poder reproducir el recurso final o el cambio de código.

Para seguir leyendo

Continúa con una guía relacionada

Llévalo a la práctica

Tu siguiente paso

¿Tienes una pregunta o una corrección?

Contactar con Thrive

Seguir leyendo

Más artículos del diario

Todos los artículos