libredwg

libredwg is a skill for Claude Code, Codex from znlgis/opengis-skills. It costs 50 tokens per session (2,544 once invoked), scanned B, original, MIT.

A free, open-source C library for reading and writing DWG files, the binary drawing format used by AutoCAD. It also provides command-line tools and bindings for languages such as Python, Perl and Common Lisp.

In plain words
What is it for?
Use it to inspect drawing entities, convert DWG to DXF, create or rewrite supported DWG files, and extract drawing data in automated programs or command-line workflows. Newer DWG versions may have limited writing support.
Why use it?
It lets software work with DWG files without relying on a commercial CAD library. It can also convert DWG and DXF files and export drawing data to formats such as JSON, XML and SVG.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to inspect drawing entities, convert DWG to DXF, create or rewrite supported DWG files, and extract drawing data in automated programs or command-line workflows. Newer DWG versions may have limited writing support.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/znlgis/opengis-skills/libredwg
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.

Any agent
npx skills add znlgis/opengis-skills --skill libredwg
Clone the repo
git clone --depth 1 https://github.com/znlgis/opengis-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 libredwg

README.md
[![agentmods](https://agentmods.dev/badge/skills/znlgis/opengis-skills/libredwg/github.svg)](https://agentmods.dev/skills/znlgis/opengis-skills/libredwg)
Your own site
<a href="https://agentmods.dev/skills/znlgis/opengis-skills/libredwg"><img src="https://agentmods.dev/badge/skills/znlgis/opengis-skills/libredwg/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for libredwg

Your own site · 80×15
<a href="https://agentmods.dev/skills/znlgis/opengis-skills/libredwg"><img src="https://agentmods.dev/badge/skills/znlgis/opengis-skills/libredwg.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 50 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,544 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 2 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 7 findings, up to high

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • high Tool Misuse · line 50
    Tool calls are chained to bypass individual safety checks or escalate capabilities beyond what any single tool call would allow.
    Fix: Limit tool chaining depth and validate the output of each tool before passing it to the next. Require explicit user approval for multi-step chains.
  • high Tool Misuse · line 183
    Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).
    Fix: Validate all tool parameters against an allowlist. Reject dangerous parameter values (shell=True, --force, -rf /) and use safe defaults.
  • high Tool Misuse · line 205
    Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).
    Fix: Validate all tool parameters against an allowlist. Reject dangerous parameter values (shell=True, --force, -rf /) and use safe defaults.
  • medium Privilege Escalation · line 39
    Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
    Fix: Avoid sudo/root unless strictly required. Prefer least-privilege patterns. If elevation is needed, document the justification and scope.
  • medium Privilege Escalation · line 40
    Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
    Fix: Avoid sudo/root unless strictly required. Prefer least-privilege patterns. If elevation is needed, document the justification and scope.
  • medium Privilege Escalation · line 50
    Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
    Fix: Avoid sudo/root unless strictly required. Prefer least-privilege patterns. If elevation is needed, document the justification and scope.
  • medium Privilege Escalation · line 43
    Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
    Fix: Avoid sudo/root unless strictly required. Prefer least-privilege patterns. If elevation is needed, document the justification and scope.
How audits are shown
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.1 $0.00050 $0.02544
Opus 5 $0.00025 $0.01272
Sonnet 5 $0.00010 $0.00509
Haiku 4.5 $0.00005 $0.00254

Measured yesterday against content hash f695d7e63bad, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade B, and why

libredwg scanned grade B with 2 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 yesterday.

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.

Asks for rootmediumPrivilege escalation

A mod that escalates privileges can change anything on the machine, not only the project.

sudo apt install libredwg-dev libredwg0 # 库 + 头文件

Runs shell commandslowCapability

Expected in a hook, worth knowing in a rule or an instructions file.

out = subprocess.check_output(["dwgread", "-O", "JSON", "input.dwg"])
cad/libredwg/SKILL.md · 246 lines

How it starts

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

项目地址: https://github.com/LibreDWG/libredwg

官网: https://www.gnu.org/software/libredwg/

手册: https://www.gnu.org/software/libredwg/manual/libredwg.html

许可证: GPL-3.0+

概述

LibreDWG 解决 DWG 二进制格式的开源读写:

  • 读取版本:DWG R1.4 – R2018+(R13、R14、R2000、R2004、R2007、R2010、R2013、R2018)
  • 写入版本:稳定支持 R1.4 – R2004(R2007+ 写入仍试验性)
  • 读写:DWG ↔ DXF(ASCII/Binary),并能转 JSON/XML/SVG
  • 命令行工具dwgreaddwgwritedwg2dxfdxf2dwgdwg2SVGdwgrewrite
  • 绑定:C API、Python(libredwg.python)、Common Lisp、Perl

与 ODA / Teigha 的差异:LibreDWG 完全开源(GPL),但版本兼容范围比商业库窄、高版本写入支持仍在完善。最新版本请参见 GitHub Releases


安装

# Debian/Ubuntu
sudo apt install libredwg-dev libredwg0      # 库 + 头文件
sudo apt install libredwg-tools              # CLI

# Fedora
sudo dnf install libredwg-tools libredwg-devel

# macOS
brew install libredwg

# 源码
git clone https://github.com/LibreDWG/libredwg
./autogen.sh && ./configure --enable-write && make && sudo make install

命令行工具

# DWG → DXF(ASCII)
dwg2dxf -y input.dwg                       # → input.dxf
dwg2dxf -y -m -b input.dwg                 # binary DXF

# DXF → DWG
dxf2dwg -y input.dxf

# DWG → JSON / SVG / GeoJSON / YAML
dwgread -O JSON  -o out.json input.dwg
dwgread -O GeoJSON -o out.geojson input.dwg
dwg2SVG          input.dwg > out.svg

# 列出实体统计
dwgread input.dwg | head -50

# 重写(修复/版本转换)
dwgrewrite -v 2018 input.dwg out.dwg       # 转换为 R2018

常用 -y 强制覆盖,-O 选输出格式,-v 指定 DWG 版本。


C API 入门

#include <dwg.h>
#include <dwg_api.h>

int main(void) {
    Dwg_Data dwg = { 0 };
    if (dwg_read_file("input.dwg", &dwg) != 0) return 1;

    // 遍历模型空间实体
    BITCODE_BL n; Dwg_Object_Ref **mspace_refs = NULL;
    Dwg_Object *mspace = dwg_get_first_object(&dwg, DWG_TYPE_BLOCK_HEADER);
    Dwg_Object_BLOCK_HEADER *blk = mspace ? mspace->tio.object->tio.BLOCK_HEADER : NULL;

    if (blk) {
        Dwg_Object_Ref **ents = dwg_block_header_get_entities(blk, &error, &n);
        for (BITCODE_BL i = 0; i < n; ++i) {
            Dwg_Object *o = dwg_ref_object(&dwg, ents[i]);
            if (!o) continue;
            switch (o->fixedtype) {
              case DWG_TYPE_LINE: {
                Dwg_Entity_LINE *l = o->tio.entity->tio.LINE;
                printf("LINE (%g,%g)-(%g,%g)\n",
                       l->start.x, l->start.y, l->end.x, l->end.y);
                break;
              }
              case DWG_TYPE_CIRCLE: {
                Dwg_Entity_CIRCLE *c = o->tio.entity->tio.CIRCLE;
                printf("CIRCLE (%g,%g) r=%g\n", c->center.x, c->center.y, c->radius);
                break;
              }
            }
        }
    }
    dwg_free(&dwg);
}

Read the full file on GitHub · 246 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. 8d ago Changed c19f5497085f
  2. 11d ago First seen · 246 lines · 50 tokens per session scan B f695d7e63bad

Subscribe to this mod's changes

libredwg is a skill published in the GitHub repository znlgis/opengis-skills (60 stars, last pushed 2d ago), licensed MIT. It adds 50 tokens to every session and 2,544 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it B with 2 findings (asks for root, runs shell commands). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

pennylane

Hardware-agnostic quantum ML framework with automatic differentiation. Use when training quantum circuits via gradients, building hybrid quantum-classical models, or needing device portability across IBM/Google/Rigetti/IonQ. Best for variational algorithms (VQE, QAOA), quantum neural networks, and integration with…

K-Dense-AI/scientific-agent-skills · 98 tokens

dd-code-generation

Use pup CLI for immediate Datadog operations or generate code for integration into applications.

DataDog/pup · 16 tokens

rocm-kernels

Provides guidance for writing and benchmarking optimized Triton kernels for AMD GPUs (MI355X, R9700) on ROCm, targeting HuggingFace diffusers (LTX-Video, SD3, FLUX) and transformers. Core kernels: RMSNorm, RoPE 3D, GEGLU, AdaLN. Includes XCD swizzle, autotune, diffusers integration patterns, and LTX-Video pipeline…

huggingface/kernels · 93 tokens

holoscan-install-wheel

Install Holoscan SDK Python wheel via pip into a venv. Use for Python installs; not for native C++/apt or Conda installs.

NVIDIA/skills · 37 tokens

typing-exclusion-worker

Python typing exclusion worker: remove assigned mypy exclusion modules in small scoped batches, fix typing issues, run validation, and produce a structured completion summary. Use when running parallel typing-debt workers or when asked to remove modules from pyproject mypy exclusion overrides.

getsentry/skills · 57 tokens

python

Python development with ruff, mypy, pytest - TDD and type safety.

alinaqi/maggy · 18 tokens