pywayne-data-structure

pywayne-data-structure is a skill for Claude Code, Codex from wangyendt/wayne-skills. It costs 46 tokens per session (932 once invoked), scanned A, original, MIT.

A Python toolkit for condition trees, union-find sets, and reading or writing XML files. A union-find set keeps track of which items belong to the same connected group.

In plain words
What is it for?
Building and searching nested condition trees, joining and finding related item groups, and loading or saving XML data.
Why use it?
It collects common data-structure and XML tasks behind a small set of Python classes instead of requiring separate implementations.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/wangyendt/wayne-skills/data-structure
Any agent
npx skills add wangyendt/wayne-skills --skill data-structure
Clone the repo
git clone --depth 1 https://github.com/wangyendt/wayne-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for pywayne-data-structure

README.md
[![agentmods](https://agentmods.dev/badge/skills/wangyendt/wayne-skills/data-structure.svg)](https://agentmods.dev/skills/wangyendt/wayne-skills/data-structure)
Your own site
<a href="https://agentmods.dev/skills/wangyendt/wayne-skills/data-structure"><img src="https://agentmods.dev/badge/skills/wangyendt/wayne-skills/data-structure.svg" alt="Measured on agentmods" height="20"></a>
Per session 46 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 932 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00046 $0.00932
Opus 5 $0.00023 $0.00466
Sonnet 5 $0.00009 $0.00186
Haiku 4.5 $0.00005 $0.00093

Measured 3d ago against content hash ee8fdb89ad62, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

pywayne-data-structure scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

pywayne/data-structure/SKILL.md · 162 lines

How it starts

The opening of the file, as written. The whole thing — 162 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Pywayne Data Structure

数据结构工具集,提供逻辑条件树、并查集和 XML 文件读写功能。

Quick Start

from pywayne.data_structure import ConditionTree, UnionFind, XmlIO

# 逻辑条件树
tree = ConditionTree("root")
tree.append_by_path([{'tag': 'if', 'attrib': {}, 'text': '条件1'}])
tree.append_by_path([{'tag': 'else', 'attrib': {}, 'text': '条件2'}])

# 并查集操作
uf = UnionFind(10)
rep = uf.find(3)  # 返回集合标识
uf.union(1, 2)  # 合并两个集合

# XML 读写
xml_io = XmlIO("config.xml", "output.xml")
tree = xml_io.read()
xml_io.write("root", tree)

ConditionTree - 逻辑条件树

用于存储和管理条件表达式的树形结构。

初始化

from pywayne.data_structure import ConditionTree

tree = ConditionTree("root")

添加节点

通过路径列表添加节点。

# 根节点
tree.append_by_path([{'tag': 'if', 'attrib': {}, 'text': '条件1'}])

# 子节点
path = [{'tag': 'if', 'attrib': {}, 'text': '条件1-1'}]
tree.append_by_path(path)

节点字典格式{'tag': 标签名, 'attrib': 属性字典, 'text': 文本内容}

查找节点

按标签名查找find(nick_name) - 查找指定标签名的节点

tree.find("if")  # 返回 if 节点

按路径查找find_by_path(path) - 沿给定路径查找节点

node = tree.find_by_path(["root", "if", "条件1-1"])

打印树路径

打印从根到所有叶子的完整路径。

tree.print_path()

UnionFind - 并查集

并查集数据结构,支持按秩合并与路径压缩。

初始化

from pywayne.data_structure import UnionFind

uf = UnionFind(10)  # N 个元素

查找集合标识

rep = uf.find(3)  # 返回元素 3 所在集合的标识(整数)

合并集合

uf.union(1, 2)  # 合并集合 1 和 2

检查连接性

uf.connected(1, 2)  # 检查元素 1 和 2 是否在同一集合

元素计数

count = uf.count()  # 返回集合中元素数量

XmlIO - XML 读写

用于 XML 文件的读取和写入,支持与 ConditionTree 互转。

初始化

from pywayne.data_structure import XmlIO

xml_io = XmlIO("input.xml", "output.xml")

参数说明

参数 类型 说明
file_read str 待读取的 XML 文件路径
file_write str 待输出的 XML 文件路径

读取 XML

tree = xml_io.read()

返回:解析得到的 ConditionTree 对象

写入 XML

xml_io.write("root", tree)

参数说明

Read the full file on GitHub · 162 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 162 lines · 46 tokens per session scan A ee8fdb89ad62

Subscribe to this mod's changes

pywayne-data-structure is a skill published in the GitHub repository wangyendt/wayne-skills (8 stars, last pushed 7d ago), licensed MIT. It adds 46 tokens to every session and 932 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

bump-dependency

Bumps a Python package dependency across Home Assistant Core integrations, regenerates core requirement files, runs verification tests and prek lint, and prepares a pull request with proper release/compare links.

home-assistant/core · 42 tokens

mem0-vercel-ai-sdk

Mem0 provider for Vercel AI SDK (@mem0/vercel-ai-provider). TRIGGER when: user mentions "vercel ai sdk", "@mem0/vercel-ai-provider", "createMem0", "retrieveMemories", "addMemories", "getMemories", "searchMemories", "mem0 vercel", "AI SDK provider", "AI SDK memory", or is using generateText/streamText with mem0. Also…

mem0ai/mem0 · 146 tokens

schema-exploration

Lists tables, describes columns and data types, identifies foreign key relationships, and maps entity relationships in a database. Use when the user asks about database schema, table structure, column types, what tables exist, ERD, foreign keys, or how entities relate.

langchain-ai/deepagents · 57 tokens

deepagents-thread-inspector

Inspect and explain conversations in the local Deep Agents Code SQLite session store. Use as a fallback when LangSmith trace tooling is unavailable, for offline or untraced sessions, or when asked to identify or summarize a local dcode thread, inspect checkpoint metadata, list recent local threads, or parse…

langchain-ai/deepagents · 82 tokens

agent-framework-azure-ai-py

Build persistent agents on Azure AI Foundry using the Microsoft Agent Framework Python SDK.

sickn33/agentic-awesome-skills · 24 tokens

pause

Pause Mem0 memory capture on this machine. Use when the user wants to stop memories being recorded, for example for private work or experiments.

mem0ai/mem0 · 30 tokens