EN
My account

Your privacy, your call. No advertising cookies. May we count your visit in aggregate (Cloudflare, no cookies) and remember where you came from? If you reject, we won’t measure your visit. · Cookies · Privacy

Privacy settings

Choose what we measure and what we keep in this browser. We never sell or share your data.

Essential

Remember your theme, language, saved items and this choice. Without them the site cannot work the way you ask.

Always on

Keeps the source of your first and latest visit for 90 days (utm parameters and referring site). It only leaves your browser if you subscribe to the newsletter.

Cloudflare Web Analytics counts visits in aggregate: page, referring site, country, browser and load times. No cookies, no identifiers and no profiling; nothing is stored in your browser. It only loads if you accept it. If you reject it or switch it off, it does not load (or stops loading from the next page) and we do not count your Telegram clicks either.

Cookies · Privacy

Work · Professional prompt

Explain legacy code

Professional structure: role, context, objective, details, steps, format, criteria and self-check. Designed for better results, not guaranteed ones: always review the answer.

Never use real personal data. If you need to, run it through the data cleaner.

Fill in the blanks
## Role
Act as a software architect who documents legacy systems.

## Context
I have to change code I did not write and that has no documentation.

## Objective
Understand what it does, how it flows and what may break when I change it.

## Details (fill in what is in square brackets)
- [code]
- [language]
- [change I want to make]

## Step-by-step instructions
1. Summarise the purpose of the code in three sentences.
2. Describe the main flow step by step.
3. List dependencies, side effects and global variables.
4. Flag the risks of the change I want to make.

## Output format
Summary, numbered flow, dependency table and list of risks with suggested tests to write first.

## Quality criteria
- It separates what is certain from what is assumed.
- It uses the real names in the code.
- It does not rewrite the code unless asked.

## Self-check
Before answering, check every quality criterion. If information is missing, ask me instead of making it up, and at the end state what you have assumed.

The link opens the empty template: what you type is not included.

Objective

Understand what it does, how it flows and what may break when I change it.

When to use it

This prompt is invaluable when you have inherited a 'black box' system and need to make updates without breaking existing functionality. It is perfect for those daunting moments where you are staring at thousands of lines of undocumented, tangled logic. However, it is not a substitute for a full code audit or a replacement for proper unit testing. If the codebase relies heavily on binary blobs or highly obfuscated machine code, the AI may struggle to provide an accurate dependency analysis.

Worked example: input (fictional data)

[code]: function calc_tax_rate($amt) { global $tax_rate_multiplier; $base = 1500; if ($amt > $base) return $amt * $tax_rate_multiplier; else return $amt * 0.05; } [language]: PHP 5.6 [change I want to make]: I need to update the base amount from 1500 to 2000 and change the default rate from 0.05 to 0.08 to match our new London compliance guidelines for the 2024 fiscal year.

Worked example: full response

Summary: This function calculates the applicable tax rate for a given transaction amount. It applies a higher rate multiplier if the amount exceeds a defined base threshold of 1500. If the amount is below that threshold, it applies a flat 5 percent tax rate. Flow: 1. The function accepts a transaction amount as an input. 2. It accesses a global variable named tax_rate_multiplier. 3. It compares the input amount against the hardcoded base of 1500. 4. If higher, it returns the amount multiplied by the global variable. 5. If lower or equal, it returns the amount multiplied by 0.05. Dependencies and Risks: - Global variable: tax_rate_multiplier. This is a critical dependency. Modifying this global could affect other modules like the reporting or payroll systems that might rely on this same variable. - Hardcoded base: The value 1500 is hardcoded, creating a maintenance burden if future tax thresholds change again. - Risk: Changing the base from 1500 to 2000 will alter tax calculations for all transactions between 1500 and 2000, potentially causing discrepancies in your accounting records. - Risk: Increasing the default rate to 0.08 will immediately impact all smaller transactions. Suggested Tests: - Create a unit test for inputs at exactly 1500 and 2000 to verify the boundary logic. - Write a test case for a transaction of 1000 to ensure the new 0.08 rate is applied correctly. - Run a search across the entire project for other usages of tax_rate_multiplier to ensure no downstream conflicts.

Variants

Quick Impact Summary

Instead of a full breakdown, focus strictly on the immediate impact. Summarise the purpose in one sentence, then list only the critical side effects and potential breaking changes resulting from my proposed edit. Keep the output concise and bulleted for rapid reading before I commit these specific changes to the production environment.

Junior Developer Guide

Explain this code as if I am a junior developer who is new to the team. Use simple, non-technical analogies to describe the logic flow. Highlight why the code is written in this specific way and explain the risks in plain English, avoiding complex architectural jargon where possible to ensure full understanding.

Security-First Analysis

Prioritise a security-first review of the code. Identify any potential vulnerabilities, unsafe practices, or insecure data handling patterns. Before explaining the flow, list any security risks associated with the existing code structure and highlight how my proposed change might introduce new vulnerabilities or expose sensitive data to potential exploitation.

Common mistakes

Related guide

General and assistant-specific tips

Tips by assistant

  • Claude: it handles long documents; paste the full text instead of loose fragments.
  • Claude: separate your data with tags such as <document>…</document>; Anthropic recommends this so it can tell instructions from content.

Getting the most out of it

  • Paste the prompt as is and only replace what is in [brackets].
  • If the answer does not fit, do not start over: ask for “shorter”, “more formal” or “as a table”.
  • Always review the result before using it: AI can get facts, dates or names wrong.

Before you paste it: quick checklist

  • Remove client names, amounts and internal data before pasting.
  • Say who the text is for and which tone you want.
  • Ask for a specific length: “120 words max” or “three bullet points”.
  • Read the result aloud and fix anything you wouldn’t say yourself.

How to adapt it to your assistant

The template works the same in ChatGPT, Gemini, Copilot or Claude because it only uses plain language. If your assistant supports fixed instructions (custom instructions, Gems or projects), you can store your preferred tone and format there and paste only the variable part. On a free plan, split long requests into two or three shorter messages.

See all Work prompts

More professional prompts

← All prompts

Found this prompt useful? A new one every Tuesday

Every Tuesday, 5 minutes: AI news with sources, a tool with its prompt and a guide. Free, with one-click unsubscribe. What is inside and a sample issue