Explain unfamiliar code before I change it
Explains unfamiliar code in plain words, maps what calls what, and lists what could break if you change it, before any edit is made.
Task:
Explain the code below so that I understand what it does and what could break if I change it.
Context:
The code is [language and framework]. I need to change it to [the change you want to make]. My experience with this language is [beginner, some or experienced]. I do not know the rest of the project, so treat the pasted code as all I have.
Rules:
- Read all the code before explaining and do not run or change anything.
- Start with what the code does in two sentences, then walk through it in the order it runs, in plain words.
- Name every input, output and side effect, such as files written, network calls and shared state.
- Point to the lines where my change would go and list what else may depend on them. Say which dependencies you cannot see from this snippet.
- Explain any part that deletes, overwrites or force-resets data before anything else in the walkthrough.
- If you see a password, token or key in the code, say so and tell me to rotate it. Ask for no secrets in the chat.
Result:
Two sentences of summary, then a walkthrough of at most 10 numbered points, then a list of at most 5 risks of my change, each with the line it concerns.
Material:
[paste the code here]