$npx -y skills add MaxiDonkey/DelphiGenAI --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 | ## OpenAI Responses container note |
| 8 | |
| 9 | This OpenAI-adapted bundle is intended to be registered through the OpenAI |
| 10 | Skills API and attached to a Responses shell/container tool as a |
| 11 | `skill_reference`. The analysis logic is vendor-neutral; the OpenAI-specific |
| 12 | requirement is that the container can run Python and can read the uploaded |
| 13 | Delphi project files. |
| 14 | |
| 15 | ## When to use this skill |
| 16 | |
| 17 | - The user uploads an archive (`.zip`, `.tar`, `.tar.gz`) containing a Delphi |
| 18 | project, or a folder of `.pas` / `.dpr` / `.dpk` sources, and asks for an |
| 19 | architecture map or a dependency graph. |
| 20 | - The user asks "which unit depends on what?", "are there cycles?", |
| 21 | "what's the fan-in / fan-out?" against a Delphi codebase. |
| 22 | - The user wants a visual artifact (Mermaid, SVG, DOT) summarizing unit-level |
| 23 | coupling. |
| 24 | |
| 25 | Do not use this skill for non-Pascal codebases. |
| 26 | |
| 27 | ## Inputs |
| 28 | |
| 29 | The skill expects exactly one of: |
| 30 | |
| 31 | 1. A `.zip` / `.tar` / `.tar.gz` archive of a Delphi project. |
| 32 | 2. A directory already containing `.pas`, `.dpr`, or `.dpk` files. |
| 33 | |
| 34 | If the user pastes raw Pascal source instead, persist it to one or more |
| 35 | temporary `.pas` files first, then point `--input` at their parent directory. |
| 36 | |
| 37 | ## Workflow |
| 38 | |
| 39 | 1. Locate the input archive or directory in the working area. |
| 40 | 2. Run `scripts/tool.py` with `--input` pointing at it and `--output` pointing |
| 41 | at a fresh output folder. |
| 42 | 3. Read the generated `report.md` and summarize parsed units, fan-in/fan-out, |
| 43 | cycles, and orphan units. |
| 44 | 4. Attach or surface the generated artifacts: Mermaid, DOT, SVG when present, |
| 45 | JSON, and report. Embed `uses-graph.mmd` inline when the conversation |
| 46 | surface supports Mermaid rendering. |
| 47 | |
| 48 | ## Quick start |
| 49 | |
| 50 | ```bash |
| 51 | python scripts/tool.py \ |
| 52 | --input /path/to/project.zip \ |
| 53 | --output /path/to/out |
| 54 | ``` |
| 55 | |
| 56 | If the container exposes `python3` instead of `python`, use `python3` with the |
| 57 | same arguments. |
| 58 | |
| 59 | Useful flags, with full details in `reference.md`: |
| 60 | |
| 61 | - `--scope {all,interface,implementation}` - which `uses` sections to |
| 62 | consider. Default `all`. |
| 63 | - `--ignore-prefix LIST` - drop edges whose target starts with one of these |
| 64 | comma-separated prefixes, case-insensitive. Default: |
| 65 | `System,Winapi,Vcl,FMX,Data,Web,REST,IdGlobal`. Pass `""` to keep RTL/VCL. |
| 66 | - `--max-label N` - truncate node labels in the Mermaid output. Default `40`. |
| 67 | - `--include-orphans` - keep units that have no inbound and no outbound edges |
| 68 | in the graph. |
| 69 | |
| 70 | ## Outputs |
| 71 | |
| 72 | Files written in `--output`: |
| 73 | |
| 74 | | File | Purpose | |
| 75 | | --- | --- | |
| 76 | | `dependencies.json` | Raw graph: `{ unit: { defined_in, interface_uses, implementation_uses } }` | |
| 77 | | `uses-graph.mmd` | Mermaid `graph LR` ready to embed in markdown | |
| 78 | | `uses-graph.dot` | Graphviz DOT source | |
| 79 | | `uses-graph.svg` | SVG rendering, only when the `dot` binary is available on `PATH` | |
| 80 | | `report.md` | Human-readable summary: counts, hotspots, cycles, orphans | |
| 81 | |
| 82 | ## Notes |
| 83 | |
| 84 | - RTL / VCL / FMX targets are filtered by default to keep the diagram readable. |
| 85 | The user's own units are never filtered. |
| 86 | - Cycle detection uses Tarjan's strongly connected components on the directed |
| 87 | graph. Edge `A -> B` means `A uses B`. Self-loops are reported separately. |
| 88 | - Pascal `uses` syntax has several edge cases: dotted names, `in '<path>'` |
| 89 | aliases, conditional defines, and three comment styles. Read `reference.md` |
| 90 | before changing the parser. |