AI CodingThrive Editorial

25 KI-Prompts zum Programmieren mit Python

Python-Assistenten schreiben schnell Entwürfe. Ein hilfreiches Ergebnis ist eine überschaubare Funktion mit klaren Typen, Beispielen und Tests. Diese Prompts klären Annahmen, bevor Quellcode entsteht.

13 Min. LesezeitAktualisiert
Python-Arbeitsplatz mit Laptop, Notizbuch und abstrakten Code-Formen.

Die Kurzfassung

  • Python-Assistenten schreiben schnell Entwürfe. Ein hilfreiches Ergebnis ist eine überschaubare Funktion mit klaren Typen, Beispielen und Tests. Diese Prompts klären Annahmen, bevor Quellcode entsteht.
  • 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.

Python-Assistenten schreiben schnell Entwürfe. Ein hilfreiches Ergebnis ist eine überschaubare Funktion mit klaren Typen, Beispielen und Tests. Diese Prompts klären Annahmen, bevor Quellcode entsteht.

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 CSV-Importer

Help with a CSV importer 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. Ein Hilfsprogramm zur Datumsnormalisierung

Help with a date normalization utility 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. Ein Log-Parser

Help with a log parser 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 HTTP-Client mit Wiederholungsversuchen

Help with a retrying HTTP client 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 Bericht für die Kommandozeile

Help with a command-line report 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 Erkennung von Duplikaten

Help with a duplicate detector 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 Programm zum Umbenennen von Dateien

Help with a file renamer 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. Eine Schicht zur Datenvalidierung

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

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

9. Eine Hintergrundaufgabe

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

CSV records passing through a Python validation workflow.

10. Ein Refactoring vom Notebook zum Modul

Help with a notebook-to-module 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.

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

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 CSV-Importer

Help with a CSV importer 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. Ein Hilfsprogramm zur Datumsnormalisierung

Help with a date normalization utility 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. Ein Log-Parser

Help with a log parser 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 HTTP-Client mit Wiederholungsversuchen

Help with a retrying HTTP client 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 Bericht für die Kommandozeile

Help with a command-line report 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 Erkennung von Duplikaten

Help with a duplicate detector 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 Programm zum Umbenennen von Dateien

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

18. Eine Schicht zur Datenvalidierung

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

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

19. Eine Hintergrundaufgabe

Help with a background task 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 Refactoring vom Notebook zum Modul

Help with a notebook-to-module 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.

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

Prompts für Grenzfalltests

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

21. Ein CSV-Importer

Help with a CSV importer 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. Ein Hilfsprogramm zur Datumsnormalisierung

Help with a date normalization utility 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. Ein Log-Parser

Help with a log parser 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 HTTP-Client mit Wiederholungsversuchen

Help with a retrying HTTP client 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 Bericht für die Kommandozeile

Help with a command-line report 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
25 KI-Prompts zum Programmieren mit Python | Thrive