Toposort doc only
Skill sangjinsu/skill-execution-bench/skills/toposort-doc-only
Local-first benchmark comparing four Skill packaging patterns — doc-only, inline-code, Python script, and Go binary — to find which is most reliable when an LLM coding agent executes a Skill.From the repository description
npx -y skills add sangjinsu/skill-execution-bench --skill toposort-doc-onlyAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
2.4 KB, 623 tokens by cl100k_base, as published. Nobody here has run it
Dependency Topological Sort (Doc Only)
When to use
Use this Skill when you need to order tasks so that every task comes after all of its dependencies, and only written instructions are available. There is no reusable code here — reason through the algorithm below and produce the order by hand.
Inputs
- A JSON array of records, each
{"id": "<integer>", "deps": ["<id>", ...]}. depslists the ids that must come before this task (empty if none).- Ids are unique integers; every dependency refers to an existing node (valid DAG, no cycles).
Expected output
A JSON array of ids in a valid topological order. Output compact JSON (no spaces),
e.g. ["5","4","3","2","1"].
Note: the topological order is usually not the same as sorting ids ascending. You must follow the dependencies.
Procedure (Kahn's algorithm)
- Compute indegree for every node = the number of its dependencies (length of
its
depslist). - Ready set = all nodes whose indegree is 0 (no remaining dependencies).
- Repeat until every node is placed:
a. Among the nodes currently in the ready set, pick the one with the
smallest numeric id (e.g.
2before10). b. Append that id to the output order and remove it from the ready set. c. For every node that listed the just-placed id in itsdeps, decrease its indegree by 1. If a node's indegree reaches 0, add it to the ready set. - The output is the sequence of ids in the order they were placed.
Track the indegrees and the ready set carefully as they change at each step — the choice of "smallest ready id" is re-evaluated every iteration, not once.
Worked example
Input:
[{"id":"3","deps":["1","2"]},{"id":"1","deps":[]},{"id":"2","deps":["1"]}]
- indegree: 1→0, 2→1, 3→2. Ready = {1}.
- Place 1. Now 2's indegree → 0. Ready = {2}.
- Place 2. Now 3's indegree → 0. Ready = {3}.
- Place 3.
Output: ["1","2","3"]
Validation
- The result is a JSON array containing every input id exactly once.
- For every record, all of its
depsappear before it in the output. - Whenever multiple nodes were ready at the same time, the smaller numeric id comes first.
- The order is not assumed to be ascending id order — it follows dependencies.
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.