AI CodingThrive Editorial

25 prompts de IA para programadores de JavaScript

Los errores de JavaScript suelen aparecer en los límites: conversión de tipos, tiempos asíncronos y estado del navegador. Estos prompts se centran en un límite y exigen una prueba ejecutable.

14 min de lectura
Espacio de trabajo de JavaScript con recorridos que representan tareas asíncronas.

La versión breve

  • Los errores de JavaScript suelen aparecer en los límites: conversión de tipos, tiempos asíncronos y estado del navegador. Estos prompts se centran en un límite y exigen una prueba ejecutable.
  • 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.

Los errores de JavaScript suelen aparecer en los límites: conversión de tipos, tiempos asíncronos y estado del navegador. Estos prompts se centran en un límite y exigen una prueba ejecutable.

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. Una ruta de rechazo de promesas

Help with a promise rejection path 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. Un cierre obsoleto en un manejador de eventos

Help with a stale closure in an event handler 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. Un campo de búsqueda con espera antes de ejecutar

Help with a debounced search field 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. Un error de mutación de un array

Help with an array mutation bug 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. Una fecha analizada incorrectamente

Help with an incorrect date parse 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. Un tiempo de espera agotado en fetch

Help with a fetch timeout 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. Una migración del almacenamiento local

Help with a local-storage migration 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. Una fuga de escuchadores de eventos

Help with an event listener leak 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. Un manejador de teclado accesible

Help with an accessibility keyboard handler 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.

Asynchronous event paths and browser state timeline on a developer screen.

10. Un error de importación ESM

Help with an ESM import error 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.

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. Una ruta de rechazo de promesas

Help with a promise rejection path 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. Un cierre obsoleto en un manejador de eventos

Help with a stale closure in an event handler 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. Un campo de búsqueda con espera antes de ejecutar

Help with a debounced search field 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. Un error de mutación de un array

Help with an array mutation bug 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. Una fecha analizada incorrectamente

Help with an incorrect date parse 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. Un tiempo de espera agotado en fetch

Help with a fetch timeout 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. Una migración del almacenamiento local

Help with a local-storage migration 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.

18. Una fuga de escuchadores de eventos

Help with an event listener leak 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. Un manejador de teclado accesible

Help with an accessibility keyboard handler 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. Un error de importación ESM

Help with an ESM import error 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.

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. Una ruta de rechazo de promesas

Help with a promise rejection path 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. Un cierre obsoleto en un manejador de eventos

Help with a stale closure in an event handler 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. Un campo de búsqueda con espera antes de ejecutar

Help with a debounced search field 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. Un error de mutación de un array

Help with an array mutation bug 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. Una fecha analizada incorrectamente

Help with an incorrect date parse 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
25 prompts de IA para programadores de JavaScript