AI CodingThrive Editorial

30 KI-Prompts zum Debuggen von Quellcode

Debugging beginnt mit einem reproduzierbaren Fehler. Diese Prompts verlangen Hypothesen, einen gezielten Test und die kleinste Änderung, die den Fehler erklärt.

16 Min. LesezeitAktualisiert
Ein Entwickler prüft ein Softwareproblem am Laptop an einem ruhigen Arbeitsplatz.

Die Kurzfassung

  • Debugging beginnt mit einem reproduzierbaren Fehler. Diese Prompts verlangen Hypothesen, einen gezielten Test und die kleinste Änderung, die den Fehler erklärt.
  • Gib niemals Zugangsdaten, private Kundendaten oder vollständige proprietäre Repositorys an einen nicht freigegebenen Assistenten weiter. Führe vorgeschlagene Befehle und Tests in deiner eigenen Umgebung aus. Ein plausibler Patch belegt noch nicht, dass die Änderung funktioniert.

Debugging beginnt mit einem reproduzierbaren Fehler. Diese Prompts verlangen Hypothesen, einen gezielten Test und die kleinste Änderung, die den Fehler erklärt.

Gib niemals Zugangsdaten, private Kundendaten oder vollständige proprietäre Repositorys an einen nicht freigegebenen Assistenten weiter. Führe vorgeschlagene Befehle und Tests in deiner eigenen Umgebung aus. Ein plausibler Patch belegt noch nicht, dass die Änderung funktioniert.

So nutzt du diese Sammlung

Wähle die Aufgabe, die deiner Arbeit am nächsten kommt. Kopiere den Prompt und ersetze die allgemeine Szene oder den Code-Kontext durch deine eigenen Angaben. Behalte die Vorgaben bei, mit denen du das Ergebnis prüfen kannst. Ändere jeweils eine Variable, damit du erkennst, was besser geworden ist.

Der Ansatz folgt dem Leitfaden zum Prompt Engineering mit GitHub Copilot: Gib konkreten Kontext an und prüfe die Ausgabe, statt einen überzeugend formulierten ersten Entwurf ungeprüft zu übernehmen.

Prompts für die Fehlerdiagnose

Diese Gruppe behandelt die Fehlerdiagnose. Gib deinen tatsächlichen Quellcode und Testbefehl an, bevor du die Antwort übernimmst.

1. Ein Nullwert bringt eine Seite zum Absturz

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.

Prüfung: Führe die vorgeschlagene Fehlerreproduktion aus, bevor du einen Patch anwendest.

2. Eine Zeitzonenumrechnung liegt einen Tag daneben

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.

Prüfung: Führe die vorgeschlagene Fehlerreproduktion aus, bevor du einen Patch anwendest.

3. Eine gelegentliche 401-Antwort

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.

Prüfung: Führe die vorgeschlagene Fehlerreproduktion aus, bevor du einen Patch anwendest.

4. Ein Wettlauf zwischen zwei Speichervorgängen

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.

Prüfung: Führe die vorgeschlagene Fehlerreproduktion aus, bevor du einen Patch anwendest.

5. Ein Listeneintrag fehlt nach dem Filtern

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.

Prüfung: Führe die vorgeschlagene Fehlerreproduktion aus, bevor du einen Patch anwendest.

6. Eine Seite wird unter Last langsam

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.

Prüfung: Führe die vorgeschlagene Fehlerreproduktion aus, bevor du einen Patch anwendest.

7. Ein defekter Deep Link

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.

Prüfung: Führe die vorgeschlagene Fehlerreproduktion aus, bevor du einen Patch anwendest.

8. Ein Parser lehnt gültige Eingaben ab

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.

Prüfung: Führe die vorgeschlagene Fehlerreproduktion aus, bevor du einen Patch anwendest.

9. Eine veraltete Antwort aus dem Cache

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.

Prüfung: Führe die vorgeschlagene Fehlerreproduktion aus, bevor du einen Patch anwendest.

10. Ein Upload funktioniert nur lokal

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.

Prüfung: Führe die vorgeschlagene Fehlerreproduktion aus, bevor du einen Patch anwendest.

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

Prompts für die Implementierung

Diese Gruppe behandelt die Implementierung. Gib deinen tatsächlichen Quellcode und Testbefehl an, bevor du die Antwort übernimmst.

11. Ein Nullwert bringt eine Seite zum Absturz

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.

Prüfung: Prüfe den Diff auf Änderungen außerhalb des Auftrags und unbeabsichtigte Datenzugriffe.

12. Eine Zeitzonenumrechnung liegt einen Tag daneben

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.

Prüfung: Prüfe den Diff auf Änderungen außerhalb des Auftrags und unbeabsichtigte Datenzugriffe.

13. Eine gelegentliche 401-Antwort

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.

Prüfung: Prüfe den Diff auf Änderungen außerhalb des Auftrags und unbeabsichtigte Datenzugriffe.

14. Ein Wettlauf zwischen zwei Speichervorgängen

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.

Prüfung: Prüfe den Diff auf Änderungen außerhalb des Auftrags und unbeabsichtigte Datenzugriffe.

15. Ein Listeneintrag fehlt nach dem Filtern

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.

Prüfung: Prüfe den Diff auf Änderungen außerhalb des Auftrags und unbeabsichtigte Datenzugriffe.

16. Eine Seite wird unter Last langsam

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.

Prüfung: Prüfe den Diff auf Änderungen außerhalb des Auftrags und unbeabsichtigte Datenzugriffe.

17. Ein defekter Deep Link

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.

Prüfung: Prüfe den Diff auf Änderungen außerhalb des Auftrags und unbeabsichtigte Datenzugriffe.

18. Ein Parser lehnt gültige Eingaben ab

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.

Prüfung: Prüfe den Diff auf Änderungen außerhalb des Auftrags und unbeabsichtigte Datenzugriffe.

19. Eine veraltete Antwort aus dem Cache

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.

Prüfung: Prüfe den Diff auf Änderungen außerhalb des Auftrags und unbeabsichtigte Datenzugriffe.

20. Ein Upload funktioniert nur lokal

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.

Prüfung: Prüfe den Diff auf Änderungen außerhalb des Auftrags und unbeabsichtigte Datenzugriffe.

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

Prompts für Grenzfalltests

Diese Gruppe behandelt Grenzfalltests. Gib deinen tatsächlichen Quellcode und Testbefehl an, bevor du die Antwort übernimmst.

21. Ein Nullwert bringt eine Seite zum Absturz

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.

Prüfung: Führe die Tests aus und prüfe nach Möglichkeit, ob sie vor der Fehlerbehebung fehlschlagen.

22. Eine Zeitzonenumrechnung liegt einen Tag daneben

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.

Prüfung: Führe die Tests aus und prüfe nach Möglichkeit, ob sie vor der Fehlerbehebung fehlschlagen.

23. Eine gelegentliche 401-Antwort

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.

Prüfung: Führe die Tests aus und prüfe nach Möglichkeit, ob sie vor der Fehlerbehebung fehlschlagen.

24. Ein Wettlauf zwischen zwei Speichervorgängen

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.

Prüfung: Führe die Tests aus und prüfe nach Möglichkeit, ob sie vor der Fehlerbehebung fehlschlagen.

25. Ein Listeneintrag fehlt nach dem Filtern

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.

Prüfung: Führe die Tests aus und prüfe nach Möglichkeit, ob sie vor der Fehlerbehebung fehlschlagen.

26. Eine Seite wird unter Last langsam

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.

Prüfung: Führe die Tests aus und prüfe nach Möglichkeit, ob sie vor der Fehlerbehebung fehlschlagen.

27. Ein defekter Deep Link

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.

Prüfung: Führe die Tests aus und prüfe nach Möglichkeit, ob sie vor der Fehlerbehebung fehlschlagen.

28. Ein Parser lehnt gültige Eingaben ab

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.

Prüfung: Führe die Tests aus und prüfe nach Möglichkeit, ob sie vor der Fehlerbehebung fehlschlagen.

29. Eine veraltete Antwort aus dem Cache

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.

Prüfung: Führe die Tests aus und prüfe nach Möglichkeit, ob sie vor der Fehlerbehebung fehlschlagen.

30. Ein Upload funktioniert nur lokal

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.

Prüfung: Führe die Tests aus und prüfe nach Möglichkeit, ob sie vor der Fehlerbehebung fehlschlagen.

Was du vor der Verwendung des Ergebnisses prüfen solltest

Gib niemals Zugangsdaten, private Kundendaten oder vollständige proprietäre Repositorys an einen nicht freigegebenen Assistenten weiter. Führe vorgeschlagene Befehle und Tests in deiner eigenen Umgebung aus. Ein plausibler Patch belegt noch nicht, dass die Änderung funktioniert.

Wenn die Ausgabe die Aufgabe verfehlt, kürze den Prompt und ergänze die fehlende Angabe oder Vorgabe. Halte fest, welche Version du verwendet hast, damit sich das fertige Material oder die Code-Änderung reproduzieren lässt.

Weiterführende Informationen

Mit einem verwandten Leitfaden fortfahren

Setzen Sie es in die Praxis um

Dein nächster Schritt

Hast du eine Frage oder Korrektur?

Thrive kontaktieren

Weiterlesen

Mehr aus dem Journal

Alle Artikel