Software engineering

Explain code prompt

A copy-and-paste prompt for ChatGPT, Claude or Gemini that gets a professional explain code on the first try, plus the cheapest model that does it well.

What most people type

what does this bash line do? find . -name '*.log' -mtime +7 -exec rm {} \;

The better prompt

Explain what this bash command does, piece by piece, in plain language:

find . -name '*.log' -mtime +7 -exec rm {} \;

Briefly break down each part (find ., -name, -mtime +7, -exec ... {} \;). Then, in one or two lines, note any risks, such as it deleting files permanently, and a safer way to preview what it would delete first.

What a professional explain code prompt covers

  • Asks for a plain explanation of each part
  • Mentions the risk of deleting files

Watch out for

  • Altered command

Best AI model for this prompt

This is a everyday task. You don't need the most expensive model. The cheapest model at each company that handles it well:

CompanyModelPer usePer 1,000 uses
AnthropicClaude Sonnet 5.5$0.0042$4.17
OpenAIGPT-6.1 Terra$0.0021$2.09
GoogleGemini 3.8 Flashcheapest$0.0016$1.57

Pay-per-use list prices for this prompt and its expected answer (about 400 tokens). On a monthly chat plan, the same choice shows up as more messages before you hit your limit. See today's AI prices.

Explain code prompt for ChatGPT, Claude and Gemini (Software engineering) · PromptSaver