$npx -y skills add MaxiDonkey/DelphiAnthropic --skill delphi-uses-graphAnalyzes a Delphi / Object Pascal codebase to extract unit-level uses dependencies. Use when the user uploads a zip / archive of a Delphi project (or a folder of .pas / .dpr / .dpk files) and asks for a dependency graph, architecture map, cycle detection, fan-in / fan-out coupl
| 1 | # Delphi uses-graph skill |
| 2 | |
| 3 | This skill builds a directed graph of `uses` dependencies between Delphi / |
| 4 | Object Pascal units, computes coupling metrics, and detects circular |
| 5 | dependencies. |
| 6 | |
| 7 | ## When to use this skill |
| 8 | |
| 9 | - The user uploads an archive (`.zip`, `.tar`, `.tar.gz`) containing a Delphi |
| 10 | project, or a folder of `.pas` / `.dpr` / `.dpk` sources, and asks for an |
| 11 | architecture map or a dependency graph. |
| 12 | - The user asks "which unit depends on what?", "are there cycles?", |
| 13 | "what's the fan-in / fan-out?" against a Delphi codebase. |
| 14 | - The user wants a visual artifact (Mermaid embed, SVG, DOT) summarizing |
| 15 | unit-level coupling. |
| 16 | |
| 17 | Do **not** use this skill for non-Pascal codebases. |
| 18 | |
| 19 | ## Inputs |
| 20 | |
| 21 | The skill expects exactly one of: |
| 22 | |
| 23 | 1. A `.zip` / `.tar` / `.tar.gz` archive of a Delphi project (preferred). |
| 24 | 2. A directory already containing `.pas`, `.dpr`, `.dpk` files. |
| 25 | |
| 26 | If the user pastes raw Pascal source instead, persist it to one or more |
| 27 | temporary `.pas` files first, then point `--input` at their parent directory. |
| 28 | |
| 29 | ## Workflow |
| 30 | |
| 31 | 1. Locate the input archive or directory in the working area. |
| 32 | 2. Run `scripts/tool.py` with `--input` pointing at it and `--output` |
| 33 | pointing at a fresh subfolder of the working area. |
| 34 | 3. Read the generated `report.md` and summarize findings to the user: |
| 35 | number of parsed units, top fan-in / fan-out, cycles, orphan units. |
| 36 | 4. Attach the produced artifacts (Mermaid, DOT, SVG when present, JSON, |
| 37 | report) to the response. Embed `uses-graph.mmd` inline in the answer so |
| 38 | the user sees the diagram rendered. |
| 39 | |
| 40 | ## Quick start |
| 41 | |
| 42 | ```bash |
| 43 | python scripts/tool.py \ |
| 44 | --input /path/to/project.zip \ |
| 45 | --output /path/to/out |
| 46 | ``` |
| 47 | |
| 48 | Useful flags (full list in `reference.md`): |
| 49 | |
| 50 | - `--scope {all,interface,implementation}` — which `uses` sections to |
| 51 | consider. Default `all`. |
| 52 | - `--ignore-prefix LIST` — drop edges whose target starts with one of these |
| 53 | comma-separated prefixes, case-insensitive. Default |
| 54 | `System,Winapi,Vcl,FMX,Data,Web,REST,IdGlobal`. Pass `""` to keep RTL/VCL. |
| 55 | - `--max-label N` — truncate node labels in the Mermaid output (default 40). |
| 56 | - `--include-orphans` — keep units that have no inbound and no outbound |
| 57 | edges in the graph. |
| 58 | |
| 59 | ## Outputs (in `--output`) |
| 60 | |
| 61 | | File | Purpose | |
| 62 | | ------------------- | ---------------------------------------------------------------------------------------- | |
| 63 | | `dependencies.json` | Raw graph: `{ unit: { defined_in, interface_uses, implementation_uses } }` | |
| 64 | | `uses-graph.mmd` | Mermaid `graph LR` ready to embed in a markdown answer | |
| 65 | | `uses-graph.dot` | Graphviz DOT source | |
| 66 | | `uses-graph.svg` | SVG rendering — only when the `dot` binary is available on `PATH` | |
| 67 | | `report.md` | Human-readable summary: counts, top hotspots, cycles, orphans | |
| 68 | |
| 69 | ## Notes |
| 70 | |
| 71 | - RTL / VCL / FMX targets are filtered by default to keep the diagram |
| 72 | readable. The user's own units are never filtered. |
| 73 | - Cycle detection uses Tarjan's strongly connected components on the |
| 74 | directed graph (edge `A -> B` means *A uses B*). Self-loops are reported |
| 75 | separately. |
| 76 | - Pascal `uses` syntax has several edge cases (dotted names, `in '<path>'` |
| 77 | aliases, conditional defines, three comment styles). Read `reference.md` |
| 78 | before changing the parser. |