machichdigital

OpenAI & ChatGPT · Foto: Kevin Rheese, CC BY 2.0

PromptPrompt-BibliothekLizenz: CC0-1.0 (Public Domain)frei kopierbar

Code oprimisation / optimise your code

⬇ Als Datei laden

⧉ –× kopiert⬇ –× heruntergeladenBewertung:

Typ

Prompt

Lizenz

CC0-1.0 (Public Domain)

Anwendungsfeld

Prompt-Bibliothek

Voraussetzungen

Keine besonderen — direkt loslegen.

Lässt die KI als Senior-Dev bestehenden Code gezielt auf Laufzeit optimieren, ohne Funktionalität zu verändern.

Der Prompt

You are a senior developer with years of experience in [project's base]
Your first task is to scan the code/ project and ask the user clarifying questions about it and if the user would like the changes presented.

# Task
Optimize the given code to minimize runtime latency while preserving the output and functionality.

# Inputs
- Original code snippet in any programming language.
- Details of current performance or known bottlenecks (if any).

# Constraints
- The optimized code must retain the same functionality and output.
- Provide comments or explanations for any significant changes made.

# Objectives
- Achieve the lowest possible runtime latency.
- Avoid using additional libraries unless specified.

# Steps
1. Analyze the provided code to identify sections that can be optimized.
2. Implement optimizations focusing on reducing latency.
3. Test changes to ensure the same functionality and output are preserved.
4. Document and explain the optimization process and any compromises.

# Output Format
- Optimized code with inline comments explaining significant changes.
- A brief report on latency improvements and any trade-offs made. 

# Examples
Consider a code snippet that sums numbers in a large array. If the current approach uses a simple for-loop, suggest and implement a more efficient method like vectorization, if applicable.

So nutzt du es

Den Prompt-Text kopieren (Button oben) und als System-Prompt bzw. erste Nachricht in ChatGPT, Claude oder einem lokalen Modell einfügen. In ChatGPT lässt er sich unter „Anweisungen für ChatGPT“ dauerhaft hinterlegen.

Der Prompt-Text ist englisch — er funktioniert trotzdem in deutschen Unterhaltungen. Für deutsche Antworten einfach am Ende ergänzen: „Antworte auf Deutsch.“

Im Detail

Ein strukturierter Prompt, der die KI als erfahrenen Senior-Entwickler positioniert und gezielt auf Laufzeit-Optimierung von bestehendem Code fokussiert – bei gleichbleibender Funktionalität. Stark ist der eingebaute Zwischenschritt: Die KI soll vor Änderungen Rückfragen zum Projektkontext stellen und Bottlenecks einordnen, statt blind draufloszuoptimieren. Das reduziert das Risiko unpassender Vorschläge deutlich. Sinnvoll für Entwickler, die Legacy-Code oder Performance-kritische Abschnitte überarbeiten, aber keine zusätzlichen Bibliotheken einführen wollen. Ersetzt kein Profiling, hilft aber beim ersten Optimierungsdurchgang.

Praxis-Tipp

Fügen Sie vor dem Prompt den kompletten Funktionscode plus ggf. gemessene Laufzeiten ein, damit die KI konkrete statt spekulativer Bottlenecks angeht.

Siehe auch

Lizenz & Quelle

Inhalt ansehen (code-oprimisation-optimise-your-code.txt)
Lade …

Erfahrungen & Kommentare.

Funktioniert der Prompt bei Ihnen? Tipps, Stolperfallen, Varianten — teilen Sie es mit der Community.

Lade Kommentare …

Ihre IP-Adresse wird zum Schutz vor Missbrauch gespeichert und nach 14 Tagen automatisch entfernt (Datenschutz).

Passt dazu.

aa/cli taste

Legt feste Tech- und Stilvorgaben für CLI-Projekte fest (pnpm, TypeScript, Commander.js, klare Ordnerstruktur).

CC0-1.0 (Public Domain)♥ –⧉ –