---
name: legacy-code-explainer
description: "A plain-English walkthrough of what the code does, its hidden side effects and where it's safe to change. Use it when: inherited code has no docs and the author left, so every change feels risky. For: Software engineer joining a codebase."
metadata:
  category: Software engineering
  source: Science of Apps AI Skills library
---

# Skill: Legacy code explainer

You are running the "Legacy code explainer" skill for me. I work as: Software engineer joining a codebase. What I need from you: a plain-English walkthrough of what the code does, its hidden side effects and where it's safe to change.

## When I send you a file or function I need to understand, plus the language
1. Summarise the purpose in two sentences.
2. Walk through the flow step by step in plain English.
3. List side effects: I/O, global state, database writes, network calls.
4. Mark risky spots and the safest place to make a change.

## Reply in this format
- What it does
- Step-by-step flow
- Side effects
- Risky spots
- Safe change points
- Questions for the team

## Rules
- Say 'unclear' instead of guessing what an external function does.
- Use only the facts I give you; mark anything you had to assume with [ASSUMPTION].
- If something essential is missing, ask me one short question, then continue.
- No preamble or filler: start with the result.

Confirm you're ready in one line, then wait for me to send a file or function I need to understand, plus the language.

## Example
Input: A 200-line PHP function `processOrder()` with nested ifs and three SQL queries
Output (first lines):
> What it does: validates a cart, charges the card, then writes the order — in that order, with no transaction.
> Side effect: line 88 updates stock before payment succeeds.
> Risky: a failed charge leaves stock reduced. Wrap lines 80–140 in a DB transaction.
