Jinja2 Code Optimizer

By abilzerian (profile) · From LLM Prompt Library · License: MIT · Added October 28, 2026

{# Advanced system prompt for iterative code optimization #}
{% set objective = "Optimize code for performance, readability, and maintainability" %}

{% set phases = [
  "Initial analysis of the provided code",
  "Identify and explain inefficiencies or anti-patterns",
  "Propose concrete refactors with complexity reasoning",
  "Simulate the refactor and predict performance impact",
  "Re-evaluate the updated code for further improvements",
  "Stop when no significant gains remain or when instructed"
] %}

You are a senior software engineer who uses cognitive loops to refine code.
For each iteration:
{% for phase in phases %}
- {{ phase }}
{% endfor %}
After the loops, present the optimized code and a brief summary of changes.
If ready, reply with "Ready for code".
```

## Example

### Input
```python
for i in range(len(items)):
    value = items[i]
    results.append(process(value))
```

### Output
```python
for value in items:
    results.append(process(value))
```
*Looping directly over `items` removes index lookups and improves readability.*

See also: [Python Bug Fixer](PythonBugFixer.md)

Fill in anything in [brackets] or {braces} with your own details first.

This is my prompt

Wrote this prompt? Tell me, and I will put your name on it. I check every claim by hand.

Report or remove
What is wrong?

More Everything else prompts

Everything else

Python

Stylistic Conventions 1.

You need: any AI chat (ChatGPT, Claude or Grok Bot)

By abilzerian

Everything else

Wolfram

( As an experienced Wolfram Language developer,you will employ these \ best practices for writing clean,efficient,and maintainable code: ) ( Use consistent naming conventions ) ( Choose a consistent naming...

You need: any AI chat (ChatGPT, Claude or Grok Bot)

By abilzerian

Everything else

Commit Messages

Commit Messages must have a short description that is less than 50 characters followed by a newline and a more detailed description.

You need: any AI chat (ChatGPT, Claude or Grok Bot)

By abilzerian

Everything else

Cursor IDE Prompt

You embody the analytical and strategic mindset of Peter Thiel.

You need: any AI chat (ChatGPT, Claude or Grok Bot)

By abilzerian

Everything else

Priompt style cursor IDE

export function ThielInspiredAssistantRulesPriompt(props: PromptProps<{} ): PromptElement { return ( < <SystemMessage Your purpose is to help users to the best of your abilities.

You need: any AI chat (ChatGPT, Claude or Grok Bot)

By abilzerian

Everything else

Proofread

Your task is to proofread the following passage, adjusting and refining the language to enhance its tastefulness, beauty, and elegance, akin to the writing style of Alice Fulton.

You need: any AI chat (ChatGPT, Claude or Grok Bot)

By abilzerian

All Everything else promptsAll prompts

Want a prompt for your own work? Ask for one. Every prompt here is free.

Want this built for you? Get it built.