Versão breve
- A refatorização deve preservar o comportamento do código. Estes prompts exigem testes existentes, uma alteração delimitada e uma comparação que possa ser revista antes de aceitar a reorganização.
- Nunca cole credenciais, dados privados de clientes ou repositórios proprietários completos num assistente não autorizado. Execute os comandos e os testes sugeridos no seu ambiente. Uma alteração plausível não comprova que funciona.
A refatorização deve preservar o comportamento do código. Estes prompts exigem testes existentes, uma alteração delimitada e uma comparação que possa ser revista antes de aceitar a reorganização.
Nunca cole credenciais, dados privados de clientes ou repositórios proprietários completos num assistente não autorizado. Execute os comandos e os testes sugeridos no seu ambiente. Uma alteração plausível não comprova que funciona.
Como utilizar esta coleção
Escolha a tarefa mais próxima do seu trabalho. Copie o prompt, substitua a cena genérica ou o contexto de código pelos seus dados e mantenha as restrições que ajudam a avaliar o resultado. Altere uma variável de cada vez para identificar o que melhorou.
A abordagem segue o guia de engenharia de prompts do GitHub Copilot: forneça contexto concreto e examine o resultado sem assumir que um primeiro rascunho bem apresentado está correto.
Prompts de diagnóstico
Este conjunto centra-se em o diagnóstico. Forneça o seu código real e o comando de teste antes de aceitar a resposta.
1. Uma longa sequência de condições
Help with a long conditional chain 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.Verificação: Execute a reprodução proposta antes de aplicar uma correção.
2. Uma regra de validação duplicada
Help with a duplicated validation rule 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.Verificação: Execute a reprodução proposta antes de aplicar uma correção.
3. Uma função auxiliar de base de dados com efeitos secundários
Help with a database helper with side effects 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.Verificação: Execute a reprodução proposta antes de aplicar uma correção.
4. Um componente React grande
Help with a large React component 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.Verificação: Execute a reprodução proposta antes de aplicar uma correção.
5. Um controlador de API com lógica entrelaçada
Help with a tangled API controller 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.Verificação: Execute a reprodução proposta antes de aplicar uma correção.
6. Uma configuração com strings especiais
Help with a magic-string configuration 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.Verificação: Execute a reprodução proposta antes de aplicar uma correção.
7. Um utilitário com nomes pouco claros
Help with a utility with vague names 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.Verificação: Execute a reprodução proposta antes de aplicar uma correção.
8. Um ciclo lento
Help with a slow loop 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.Verificação: Execute a reprodução proposta antes de aplicar uma correção.
9. Uma sequência antiga de callbacks
Help with a legacy callback chain 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.Verificação: Execute a reprodução proposta antes de aplicar uma correção.

10. Uma verificação de permissões dispersa
Help with a scattered permission check 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.Verificação: Execute a reprodução proposta antes de aplicar uma correção.
Prompts de implementação
Este conjunto centra-se em a implementação. Forneça o seu código real e o comando de teste antes de aceitar a resposta.
11. Uma longa sequência de condições
Help with a long conditional chain 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.Verificação: Examine as diferenças para identificar alterações fora do âmbito e acesso não previsto a dados.
12. Uma regra de validação duplicada
Help with a duplicated validation rule 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.Verificação: Examine as diferenças para identificar alterações fora do âmbito e acesso não previsto a dados.
13. Uma função auxiliar de base de dados com efeitos secundários
Help with a database helper with side effects 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.Verificação: Examine as diferenças para identificar alterações fora do âmbito e acesso não previsto a dados.
14. Um componente React grande
Help with a large React component 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.Verificação: Examine as diferenças para identificar alterações fora do âmbito e acesso não previsto a dados.
15. Um controlador de API com lógica entrelaçada
Help with a tangled API controller 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.Verificação: Examine as diferenças para identificar alterações fora do âmbito e acesso não previsto a dados.
16. Uma configuração com strings especiais
Help with a magic-string configuration 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.Verificação: Examine as diferenças para identificar alterações fora do âmbito e acesso não previsto a dados.
17. Um utilitário com nomes pouco claros
Help with a utility with vague names 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.Verificação: Examine as diferenças para identificar alterações fora do âmbito e acesso não previsto a dados.

18. Um ciclo lento
Help with a slow loop 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.Verificação: Examine as diferenças para identificar alterações fora do âmbito e acesso não previsto a dados.
19. Uma sequência antiga de callbacks
Help with a legacy callback chain 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.Verificação: Examine as diferenças para identificar alterações fora do âmbito e acesso não previsto a dados.
20. Uma verificação de permissões dispersa
Help with a scattered permission check 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.Verificação: Examine as diferenças para identificar alterações fora do âmbito e acesso não previsto a dados.
Prompts para testar os limites
Este conjunto centra-se em os testes dos limites. Forneça o seu código real e o comando de teste antes de aceitar a resposta.
21. Uma longa sequência de condições
Help with a long conditional chain 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.Verificação: Execute os testes e, quando possível, confirme que falham antes da correção.
22. Uma regra de validação duplicada
Help with a duplicated validation rule 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.Verificação: Execute os testes e, quando possível, confirme que falham antes da correção.
23. Uma função auxiliar de base de dados com efeitos secundários
Help with a database helper with side effects 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.Verificação: Execute os testes e, quando possível, confirme que falham antes da correção.
24. Um componente React grande
Help with a large React component 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.Verificação: Execute os testes e, quando possível, confirme que falham antes da correção.
25. Um controlador de API com lógica entrelaçada
Help with a tangled API controller 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.Verificação: Execute os testes e, quando possível, confirme que falham antes da correção.
O que verificar antes de utilizar o resultado
Nunca cole credenciais, dados privados de clientes ou repositórios proprietários completos num assistente não autorizado. Execute os comandos e os testes sugeridos no seu ambiente. Uma alteração plausível não comprova que funciona.
Se o resultado não cumprir a tarefa, encurte o prompt e indique o facto ou a restrição em falta. Guarde a versão utilizada para que o recurso final ou a alteração de código possam ser reproduzidos.
Leituras adicionais
Continue com um guia relacionado
Ponha em prática
O seu próximo passo
Tem uma pergunta ou uma correção?
Contactar a Thrive


