Mejores prompts para GitHub Copilot: 52 prompts para programar con IA
Biblioteca práctica con 52 prompts para GitHub Copilot diseñados para programar, analizar repositorios, implementar funcionalidades, encontrar bugs, crear tests, revisar seguridad, trabajar con Git, APIs, bases de datos, frontend, Agent Mode, Copilot CLI, Cloud Agent, MCP, Code Review, WordPress y WooCommerce.
¿Cómo escribir un buen prompt para GitHub Copilot?
Un buen prompt para GitHub Copilot debería indicar qué quieres conseguir, qué contexto debe revisar, qué restricciones debe respetar, cómo debería trabajar, cómo debe verificar el resultado y qué información debe entregar al terminar. Para tareas complejas, es mejor describir el objetivo claramente y permitir que el agente investigue el repositorio antes de modificarlo.
La estructura que mejora los prompts de programación
No necesitas escribir prompts enormes para cada tarea, pero sí eliminar ambigüedades importantes.
Di qué comportamiento debería existir cuando la tarea esté terminada.
Compatibilidad, seguridad, archivos que no deben tocarse o APIs que deben conservarse.
Tests, lint, build, diff o reproducción real antes de aceptar el resultado.
Prompt débil vs prompt útil
“Arregla este código”
No define problema, alcance, restricciones ni criterios de verificación.
“Encuentra la causa raíz antes de editar”
Indica cómo investigar, qué preservar y cómo demostrar que el bug quedó solucionado.
Goal → Context → Constraints → Work → Verify
Objetivo
Qué debe quedar funcionando.
Contexto
Qué archivos debe investigar.
Restricciones
Qué debe preservar.
Evidencia
Cómo demostrar que funciona.
52 prompts para GitHub Copilot
Puedes copiar cualquier prompt, adaptarlo a tu proyecto o utilizar el buscador y los filtros.
Fundamentos y comprensión de código
Explicar código antes de modificarlo
Explain this code before making any changes. Describe: - its purpose - inputs and outputs - main execution flow - external dependencies - side effects - error handling - security-sensitive behavior - assumptions it relies on Then identify the functions or modules that interact with it. Do not modify code yet.
Seguir el flujo de datos
Trace the complete data flow for [FEATURE / VALUE]. Start at the external input and follow it through: 1. request or event 2. validation 3. business logic 4. persistence 5. downstream calls 6. response or UI output For each step identify: - file - function - data transformation - trust boundary - possible failure point Do not change anything.
Analizar una función antes de tocarla
Analyze the function [FUNCTION NAME]. Find: - every caller - important downstream calls - public behavior - implicit assumptions - error paths - tests covering it - data it mutates - compatibility constraints Then explain what could break if its behavior changes. Do not edit the function.
Entender código legacy
Analyze this legacy code without refactoring it. Reconstruct: - what problem it solves - current observable behavior - important invariants - hidden coupling - global state - side effects - external integrations - backwards compatibility requirements Separate: 1. verified facts from the code 2. reasonable hypotheses 3. unknowns that require testing Do not modernize anything yet.
Repositorios y arquitectura
Analizar un repositorio completo
Analyze this repository before making changes. Identify: - application purpose - important directories - entry points - architectural layers - data stores - external services - authentication - authorization - build commands - test commands - lint / typecheck commands - deployment-related files - project-specific conventions Then produce a concise architecture map. Do not modify files.
Detectar deuda arquitectónica
Review this repository for architectural debt. Look for: - circular dependencies - duplicated abstractions - unclear module boundaries - business logic in transport layers - persistence leaking into UI - excessive global state - tightly coupled services - abstractions used only once - inconsistent architectural patterns Rank findings by: 1. maintenance cost 2. defect risk 3. difficulty to improve Do not recommend a rewrite.
Encontrar todos los archivos de una feature
Find every important file involved in [FEATURE]. Include: - entry points - routes - controllers / handlers - domain logic - database access - frontend components - tests - configuration - documentation Explain the role of each file and how they connect. Do not edit anything.
Crear un onboarding técnico
Create a technical onboarding guide for a developer joining this repository. Cover: - what the system does - architecture - important directories - local setup - required environment variables - database setup - how to run tests - how to run lint / build - important conventions - common development workflows - risky areas of the codebase Only include information supported by the repository. Mark unknowns explicitly.
Implementación y refactoring
Implementar una feature correctamente
Implement [FEATURE]. Before coding: 1. inspect the existing architecture 2. find similar functionality 3. identify affected public interfaces 4. identify tests 5. propose the smallest safe plan Requirements: [REQUIREMENTS] Constraints: [CONSTRAINTS] After implementation: - run relevant tests - run lint / typecheck / build when available - inspect the complete diff - verify backwards compatibility - report anything not verified.
Hacer el cambio mínimo seguro
Make the smallest safe change that solves [PROBLEM]. Do not: - rename unrelated symbols - reformat unrelated files - introduce a new abstraction unless necessary - change public APIs - change behavior outside scope Reuse existing project patterns. After the change, show why each modified file was necessary. Run the narrowest relevant tests.
Refactorizar sin cambiar comportamiento
Refactor [TARGET] without changing observable behavior. First identify: - current public behavior - existing tests - callers - side effects - compatibility constraints Then refactor incrementally. Do not mix behavioral changes with structural cleanup. Run the relevant tests before and after. Report any behavior that could not be verified.
Eliminar duplicación sin sobrearquitectura
Review the duplicated code in [FILES / FEATURE]. Determine whether the duplication represents: - the same concept - coincidentally similar code - different behavior that may diverge later Only extract an abstraction if it represents a stable shared concept. Prefer clarity over reducing line count. Preserve all existing behavior and run relevant tests.
Debugging y resolución de errores
Encontrar la causa raíz de un bug
Investigate this bug before editing code. Problem: [DESCRIBE BUG] First: 1. reproduce the failure 2. collect the exact error 3. inspect relevant logs 4. trace the execution path 5. identify the first incorrect state 6. form a root-cause hypothesis 7. find evidence supporting it Then explain: - root cause - affected code - why it fails - smallest safe fix - regression test required Only implement after the cause is supported by evidence.
Diagnosticar un test que falla
Investigate the failing test. Do not modify the test or implementation yet. Determine: - what behavior the test expects - whether that expectation matches the intended contract - the exact failing assertion - the code path producing the unexpected result - whether the failure is implementation, test, fixture, environment, or timing related Do not weaken assertions just to make the suite pass.
Encontrar qué cambio introdujo una regresión
Investigate this regression. Known good behavior: [DESCRIPTION] Current broken behavior: [DESCRIPTION] Use git history and relevant tests to identify the smallest change that introduced the regression. Compare: - behavior before - behavior after - assumptions that changed Do not revert unrelated work. Propose the smallest fix that restores the intended behavior.
Investigar un error intermitente
Investigate this intermittent failure. Do not assume the first plausible explanation is correct. Look for: - race conditions - shared mutable state - retries - caching - ordering assumptions - time dependencies - async operations - network dependencies - test pollution - database isolation problems Design a way to increase reproduction frequency. Only propose a fix after identifying evidence for the failure mechanism.
Testing y verificación
Generar tests útiles, no tests decorativos
Create focused tests for [TARGET]. Test observable behavior, not private implementation details. Cover: - normal path - invalid input - boundary values - error path - regression scenario - important security condition Reuse existing test helpers and project conventions. Avoid tests that simply duplicate the implementation logic.
Crear un test antes de arreglar el bug
Before fixing this bug, write the smallest regression test that reproduces it. Requirements: - fail for the current bug - test observable behavior - avoid private implementation details - isolate the failing condition Run it and confirm it fails for the expected reason. Then implement the fix and prove the same test passes.
Encontrar huecos de cobertura importantes
Review the tests for [FEATURE]. Do not optimize for coverage percentage. Find high-risk behavior that is not tested. Prioritize: - authorization failures - destructive operations - edge cases - error handling - backwards compatibility - concurrency - external API failures - previous bug-prone paths Recommend the smallest set of tests that most improves confidence.
Verificar una tarea antes de terminar
Verify the implementation before declaring the task complete. Run the checks available in this repository: - targeted tests - broader related tests - lint - typecheck - build - syntax checks Then inspect git diff. Confirm: - requirements are satisfied - no unrelated files changed - no debug code remains - public behavior is preserved List anything you could not verify.
Seguridad
Auditoría de seguridad general
Perform a security review of [TARGET]. First map: - trust boundaries - attacker-controlled input - authentication - authorization - secrets - persistence - external calls - output surfaces Then look for: - injection - authorization bypass - privilege escalation - IDOR - XSS - CSRF - SSRF - insecure deserialization - secret exposure - path traversal - unsafe file handling Only report findings with a concrete failure path.
Buscar fallos de autorización
Audit authorization for [FEATURE / API]. For every state-changing operation identify: - authenticated actor - target resource - required permission - ownership relationship - authorization check - location of enforcement Look for: - missing authorization - authentication-only checks - IDOR - tenant isolation failures - privilege escalation For each issue, describe a realistic unauthorized request.
Buscar secretos y credenciales expuestas
Review the repository for accidental secret exposure. Look for: - API keys - access tokens - private keys - database credentials - passwords - webhook secrets - credentials in tests - secrets in example files - sensitive logging Do not print secret values in your response. Report: - file - secret type - exposure risk - remediation - whether rotation is required.
Revisar riesgo de dependencias
Review the dependency changes in this diff. Identify: - newly added dependencies - major version changes - transitive impact - runtime vs development usage - duplicated functionality - unnecessary permissions - lockfile changes Determine whether each new dependency is actually needed. Do not remove anything until compatibility and usage are verified.
Git, commits y Pull Requests
Revisar el diff antes del commit
Review the current git diff before I commit. Check for: - accidental changes - unrelated refactors - debug statements - commented-out code - missing error handling - security regressions - backwards compatibility - missing tests - generated files that should not be committed Do not change anything. Return a prioritized checklist.
Generar un buen mensaje de commit
Inspect the staged changes and write a concise commit message. The message should explain: - what changed - why it changed Do not list every modified file. Do not claim tests were run unless they actually were. Use the repository's existing commit style if one is clearly established.
Crear una descripción de Pull Request
Create a pull request description from this branch's diff. Use this structure: ## Problem What was wrong or missing? ## Solution What approach was implemented? ## Important decisions What tradeoffs matter? ## Verification What tests or checks were actually run? ## Risk What could still go wrong? ## Review focus Which areas deserve extra reviewer attention? Only state verified facts.
Resolver un conflicto de merge con contexto
Analyze this merge conflict before resolving it. Determine: - intent of our branch - intent of the incoming branch - whether both behaviors are still required - tests covering each side - public contracts involved Resolve the conflict by preserving the intended behavior of both changes when compatible. Do not simply choose one side based on recency. Run relevant tests afterward.
APIs, backend y bases de datos
Crear un endpoint correctamente
Implement an endpoint for: [GOAL] Before coding, find existing endpoint patterns. Define: - HTTP method - route - request schema - authentication - authorization - validation - response schema - error responses - idempotency requirements Preserve existing API conventions. Add tests for: - success - invalid input - unauthenticated access - unauthorized access - missing resource.
Revisar compatibilidad de una API
Review this API change for backwards compatibility. Compare the previous and new contract. Check: - required parameters - optional parameters - response fields - field types - status codes - error format - pagination - sorting - authentication - authorization Identify clients that may break. Prefer additive changes when possible.
Revisar una consulta SQL
Review this database query. Analyze: - correctness - parameterization - injection risk - indexes likely used - full table scans - joins - sorting - pagination - result-set size - locking - concurrency - N+1 behavior Separate: 1. correctness issues 2. security issues 3. performance concerns Do not optimize without evidence that behavior remains equivalent.
Diseñar una migración de base de datos
Design a database migration plan. Do not execute it. Document: - current schema - target schema - expected data volume - compatibility during rollout - backfill strategy - batching - idempotency - locking risk - timeout risk - rollback strategy - application deployment order Identify the most dangerous step and how to reduce its risk.
Frontend, UX y rendimiento
Depurar un problema visual o JavaScript
Investigate this frontend bug. Before editing: - reproduce the behavior - inspect browser console - inspect network requests - inspect relevant DOM state - identify event handlers - identify data entering the component - check duplicate initialization - check race conditions Explain the root cause before modifying code. After fixing, verify the user flow in the browser.
Corregir responsive sin romper desktop
Fix this responsive layout issue. First identify the CSS rule that creates the failure. Test the layout at: - small mobile - large mobile - tablet - laptop - wide desktop Preserve existing desktop behavior. Avoid: - arbitrary pixel overrides - unnecessary !important - duplicating entire style blocks Make the smallest responsive change that fixes the underlying constraint.
Revisar accesibilidad de una interfaz
Review this UI for accessibility. Check: - semantic HTML - keyboard navigation - focus order - visible focus - form labels - error announcements - modal focus management - button vs link semantics - aria-expanded - aria-controls - dynamic status messages Prefer native HTML semantics. Do not add ARIA when a native element already solves the problem.
Auditar rendimiento frontend
Review this frontend for measurable performance risks. Look for: - unnecessary JavaScript - duplicate network requests - render-blocking resources - large bundles - unnecessary rerenders - unbounded DOM work - expensive event handlers - oversized images - layout shifts - work executed before needed For each finding explain which user-visible metric or behavior it can affect. Do not optimize purely theoretical issues.
Agent Mode y Copilot CLI
Prompt maestro para Agent Mode
Complete this task: [GOAL] Work autonomously, but keep the scope focused. Process: 1. inspect the relevant code 2. understand existing patterns 3. create a short implementation plan 4. implement incrementally 5. run the narrowest relevant tests 6. fix failures caused by your change 7. run broader verification 8. inspect git diff Do not: - hide failing tests - change unrelated behavior - claim verification that was not performed Finish with: - files changed - tests run - result - remaining uncertainty.
Investigar desde Copilot CLI
Investigate [PROBLEM] from the command line. You may use read-only inspection commands without changing files first. Inspect: - repository status - relevant source - configuration - test output - logs - dependency state Explain your diagnosis before applying changes. Ask for approval before any destructive command.
Controlar uso de herramientas
Use available tools to complete this task. You may freely perform: - code search - file reads - test execution - lint - build - git diff/status Ask before: - deleting files - resetting git state - modifying remote systems - deploying - publishing - rotating credentials - destructive database operations Prefer the least privileged tool that can complete each step.
Planificar una tarea antes de implementarla
Create an implementation plan for [GOAL]. Do not modify code. Investigate enough to make the plan repository-specific. Include: - affected files - existing patterns to reuse - data-flow changes - public API impact - database impact - security considerations - tests required - rollout concerns Prefer the smallest design that satisfies the requirements. Call out assumptions explicitly.
Copilot Cloud Agent
Delegar un Issue completo
Implement this issue: [ISSUE] Acceptance criteria: [CRITERIA] Before coding: - inspect existing architecture - find related implementation - identify tests Constraints: [CONSTRAINTS] After implementation: - run relevant tests - run lint / build - inspect diff - ensure no unrelated changes Open a pull request with: - problem - solution - verification - remaining risk.
Delegar un bug al Cloud Agent
Fix this bug: [BUG] Expected behavior: [EXPECTED] Current behavior: [CURRENT] First reproduce and identify the root cause. Add a regression test that fails before the fix. Implement the smallest safe fix. Run relevant tests. Do not change unrelated behavior. Open a pull request explaining: - root cause - fix - regression test - verification.
Delegar un refactor seguro
Refactor [TARGET] without changing behavior. Before editing: - identify public contracts - identify callers - run relevant tests - document current behavior Refactor incrementally. Do not mix new functionality with the cleanup. Run the same tests afterward. Open a pull request focused only on this refactor.
Actualizar documentación desde el código real
Update the documentation for [FEATURE]. Use the current implementation as the source of truth. Verify: - setup steps - configuration - API examples - command names - defaults - limitations - error cases Do not invent behavior that is not supported by the code. Keep the change limited to documentation.
Code Review y MCP
Review de alta señal
Review this change as if it were going to production. Prioritize: 1. functional bugs 2. security vulnerabilities 3. authorization failures 4. data loss 5. race conditions 6. API contract breaks 7. backwards incompatibility 8. missing regression tests For every finding include: - severity - affected code - concrete failure scenario - impact - smallest safe fix Ignore cosmetic preferences without behavioral impact.
Investigar un Issue usando MCP
Use GitHub MCP to investigate issue #[NUMBER]. Read: - issue description - comments - labels - linked pull requests - relevant repository history Then inspect the codebase and determine: - likely affected area - root cause hypothesis - files involved - tests needed - implementation risk Do not modify code yet.
Verificar una feature en navegador
Use the browser tools to verify [FEATURE]. Test the real user flow: 1. open the application 2. perform the normal path 3. test one invalid-input path 4. inspect console errors 5. inspect failed network requests 6. verify visible success state 7. verify error state Do not infer success only from the implementation. Report the behavior you actually observed.
Revisar código contra documentación externa
Review this implementation against the documentation available through [MCP SERVER]. First retrieve only the relevant requirements. Then compare them with the changed code. Separate findings into: - definite violations - potential incompatibilities - documentation ambiguities Cite the requirement that supports each finding. Do not invent requirements not present in the source.
WordPress y WooCommerce
Analizar un plugin WordPress
Analyze this WordPress plugin before changing anything. Identify: - plugin entry point - classes - actions - filters - AJAX handlers - REST routes - shortcodes - custom tables - $wpdb usage - cron jobs - WooCommerce integration - admin assets - frontend assets - security-sensitive code - tests Explain the architecture and data flow. Do not modify files.
Auditar seguridad WordPress
Perform a WordPress security audit. Inspect: - wp_ajax_* - wp_ajax_nopriv_* - register_rest_route() - admin_post_* - forms - shortcodes - file operations - $wpdb queries Check: - authentication - capabilities - ownership - nonce usage - permission_callback - validation - sanitization - output escaping - SQL injection - XSS - CSRF - privilege escalation Remember: nonce is not authorization.
Revisar compatibilidad HPOS
Audit this WooCommerce extension for HPOS compatibility. Find all order reads and writes. Flag: - direct wp_posts access - direct wp_postmeta access for orders - get_post_meta() on orders - update_post_meta() on orders - WP_Query used for orders - SQL tied to legacy storage - internal WooCommerce APIs Prefer: - wc_get_order() - wc_get_orders() - WC_Order getters/setters - supported WooCommerce CRUD APIs Explain each required change.
Debugging completo de WordPress
Investigate this WordPress bug. Do not edit code immediately. First inspect: - failing user flow - browser console - network request - HTTP response - PHP errors - debug.log - AJAX or REST handler - nonce - authentication - capabilities - input data - database operation - response generation Identify the first incorrect state. Then: 1. explain the root cause 2. write a regression test when practical 3. implement the smallest fix 4. run relevant checks 5. verify the user flow again.
¿Conviene guardar estos prompts como .prompt.md?
Actualmente: úsalo con criterio
GitHub todavía documenta
los archivos
.prompt.md
como prompts reutilizables
en determinados IDE,
pero VS Code
ya los considera
un mecanismo
en transición
para las sesiones
del nuevo Agent Host.
Para un workflow realmente importante y reutilizable, especialmente si tiene varios pasos, hoy conviene considerar convertirlo en una Agent Skill.
Ejemplo de un prompt reutilizable en VS Code
Cuando tu versión y modo de VS Code aún utilicen Prompt Files, su ubicación tradicional es:
.github/
└── prompts/
└── debug.prompt.md
---
name: debug
description: Find the root cause of a software bug before editing code.
agent: agent
argument-hint: "[describe the bug]"
---
Investigate:
${input:problem:Describe the problem}
Do not edit code immediately.
First:
1. reproduce
2. collect evidence
3. trace the execution path
4. identify the first incorrect state
5. explain the root cause
Then implement
the smallest safe fix
and verify it with tests.
Cuándo convertir un prompt en Agent Skill
7 reglas para obtener mejores respuestas de Copilot
Empieza por el objetivo
Explica qué resultado quieres, no solo qué archivo tocar.
Elimina ambigüedad
Nombra funciones, archivos, errores o comportamientos concretos.
Entrega contexto relevante
Referencia código y documentación útil, no todo el repositorio indiscriminadamente.
Divide tareas complejas
Explorar, planificar, implementar y verificar suele funcionar mejor que una orden vaga.
Define restricciones
Compatibilidad, seguridad y alcance reducen cambios innecesarios.
Pide evidencia
Tests y observación real son mejores que “parece correcto”.
Itera
Corrige supuestos y añade contexto cuando la primera respuesta sea insuficiente.
Guías relacionadas
Documentación para mejorar tus prompts
Prompt Engineering
Estrategias oficiales para escribir mejores prompts.
Ver documentación →Prompt Files
Ejemplos de prompts reutilizables.
Ver Prompt Files →Prompt Files
Estado actual, variables y migración hacia Skills.
Ver VS Code →AI Best Practices
Contexto, herramientas y verificación.
Ver prácticas →FAQ sobre prompts para GitHub Copilot
Define claramente el objetivo, entrega contexto relevante, elimina ambigüedades, establece restricciones y explica cómo debe verificarse el resultado. Para tareas complejas, divide el trabajo en investigación, implementación y verificación.
No necesariamente. Un prompt debe incluir la información que cambia las decisiones del agente. Agregar instrucciones irrelevantes puede aumentar ruido sin mejorar el resultado.
Un buen prompt de debugging debería pedir reproducir el problema, recopilar evidencia, seguir el flujo de ejecución, identificar el primer estado incorrecto y explicar la causa raíz antes de modificar código.
Para Agent Mode conviene definir un objetivo y restricciones claras, permitir que explore el repositorio, pedir implementación incremental y exigir tests, build y revisión del diff antes de terminar.
Indica explícitamente que debe realizar el cambio mínimo, reutilizar patrones existentes, evitar refactors no relacionados y explicar por qué cada archivo modificado era necesario.
Sí, los modos de agente pueden utilizar herramientas y terminal cuando están disponibles. Es recomendable pedir primero el test más específico y después una verificación más amplia.
Sí. Copilot Code Review puede revisar Pull Requests y cambios locales, y puedes personalizarlo mediante Instructions, Agent Skills y MCP.
Sí. Puedes crear prompts específicos para plugins, PHP, AJAX, REST API, seguridad, $wpdb, WooCommerce, HPOS y debugging.
Son archivos Markdown con extensión .prompt.md que permiten guardar prompts reutilizables en determinados IDE. VS Code los está desplazando en los nuevos workflows de Agent Host a favor de Agent Skills.
Un Prompt File es principalmente una plantilla reutilizable que se invoca manualmente. Una Agent Skill puede contener instrucciones, scripts y recursos, y el agente puede descubrirla y cargarla cuando una tarea resulta relevante.
Sí. En los IDE compatibles puedes indicar archivos, carpetas, selecciones y otros elementos de contexto, además de herramientas que permiten al agente buscar información por sí mismo.
Depende. Usa un prompt para una tarea concreta. Utiliza copilot-instructions.md para reglas que deberían aplicarse de forma persistente al proyecto.
GitHub Copilot vs Codex: cuál es mejor para programar con IA
Ya conocemos las principales capacidades de GitHub Copilot. El siguiente paso es compararlo directamente con OpenAI Codex en IDE, terminal, autonomía, agentes cloud, repositorios, Code Review, personalización, precio y workflows reales.
Comparar GitHub Copilot vs Codex →