AI CodingThrive Editorial

30 prompts de IA para revisar código

Una buena revisión identifica un riesgo concreto y una forma de comprobarlo. Estos prompts distinguen la corrección, la seguridad y la facilidad de mantenimiento para evitar un veredicto genérico.

16 min de lectura
Dos programadores comentan un cambio de código resaltado en una pantalla.

La versión breve

  • Una buena revisión identifica un riesgo concreto y una forma de comprobarlo. Estos prompts distinguen la corrección, la seguridad y la facilidad de mantenimiento para evitar un veredicto genérico.
  • 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.

Una buena revisión identifica un riesgo concreto y una forma de comprobarlo. Estos prompts distinguen la corrección, la seguridad y la facilidad de mantenimiento para evitar un veredicto genérico.

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 cambio de autenticación

Help with an authentication change 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 migración del esquema

Help with a schema 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.

3. Una actualización de la paginación de una API

Help with an API pagination update 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 proceso de cola en segundo plano

Help with a background queue worker 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 ruta de subida de archivos

Help with a file upload route 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 cambio en la validación de un formulario

Help with a form validation change 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 capa de caché

Help with a caching layer 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 webhook de pago

Help with a payment webhook 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 actualización de dependencias

Help with a dependency upgrade 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 refactorización del estado del cliente

Help with a client-side state refactor 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.

Two reviewers checking a code change for correctness, security and tests.

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 cambio de autenticación

Help with an authentication change 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 migración del esquema

Help with a schema 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.

13. Una actualización de la paginación de una API

Help with an API pagination update 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 proceso de cola en segundo plano

Help with a background queue worker 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 ruta de subida de archivos

Help with a file upload route 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 cambio en la validación de un formulario

Help with a form validation change 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 capa de caché

Help with a caching layer 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 webhook de pago

Help with a payment webhook 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 actualización de dependencias

Help with a dependency upgrade 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 refactorización del estado del cliente

Help with a client-side state refactor 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 cambio de autenticación

Help with an authentication change 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 migración del esquema

Help with a schema migration 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 actualización de la paginación de una API

Help with an API pagination update 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 proceso de cola en segundo plano

Help with a background queue worker 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 ruta de subida de archivos

Help with a file upload route 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. Un cambio en la validación de un formulario

Help with a form validation change 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. Una capa de caché

Help with a caching layer 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 webhook de pago

Help with a payment webhook 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 actualización de dependencias

Help with a dependency upgrade 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 refactorización del estado del cliente

Help with a client-side state refactor 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