Token导航 LogoToken导航TokenDH.com
研究检索只读github未标认证来源可访问许可证需确认审计通过

detect-diagram-crossings检测图表交叉点

Agent Skill

detect-diagram-crossings 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

376

周安装

16

GitHub Stars

163

下载量

132
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:detect-diagram-crossings(检测图表交叉点)
来源仓库:https://github.com/oocx/tfplan2md
仓库路径:skills/detect-diagram-crossings
安装命令:
npx skills add https://github.com/oocx/tfplan2md --skill detect-diagram-crossings
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/oocx/tfplan2md --skill detect-diagram-crossings

简介

detect-diagram-crossings 采用几何与视觉双重方法检测 SVG 流程图交叉。

  • 适用于工作流图、架构图的布局质量验证与调试。
  • 组合数学分析与人工检查,确保无重叠连线。
  • 需输入 SVG 文件路径,输出交叉点坐标与修正建议。
  • 适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

SKILL.md

Detect Diagram Crossings

Purpose

Provide a rigorous, multi-method approach to detecting edge crossings and overlaps in SVG flowchart diagrams. This skill combines mathematical geometric analysis with visual inspection to ensure diagrams have clean, crossing-free layouts.

When to Use

  • Validating Diagram Layouts: After creating or modifying workflow diagrams
  • Quality Assurance: Before committing diagram changes to ensure no crossings
  • Debugging Visual Issues: When users report crossing/overlap problems
  • Comparative Analysis: Testing multiple layout versions to find the best one

Detection Methods

Method 1: Parametric Line Intersection (Mathematical)

The primary detection method uses parametric line equations to mathematically determine if two line segments intersect.

Algorithm:

  1. Parse SVG paths into line segments (sequences of points connected by lines)
  2. For each pair of line segments from different paths:

- Calculate intersection using parametric equations: - Line 1: P = P1 + t(P2 - P1) - Line 2: P = P3 + u(P4 - P3) - Solve for parameters t and u - Intersection occurs if 0.01 < t < 0.99 AND 0.01 < u < 0.99

  1. Exclude endpoint connections (valid node-to-node connections)
  2. Report all internal segment intersections as crossings

Why This Works:

  • Mathematically precise: detects exact intersection points
  • Coordinate-based: doesn't rely on visual rendering
  • Tolerance-aware: excludes near-endpoint intersections (within 1% of segment length)

Limitations:

  • May not detect visual overlaps that aren't true mathematical intersections
  • Doesn't account for stroke width or arrow markers
  • Requires well-formed SVG path data

Method 2: Node-Path Proximity Analysis

Detects when paths pass through or very close to node bodies (not at connection points).

Algorithm:

  1. Extract all node bounding boxes from <rect> elements: (x, y, width, height)
  2. Parse each path's d attribute into individual line segments
  3. For EACH segment of EACH path (not just waypoints):

- Vertical segments (same x, different y): Check if x is within any node's x-range AND the y-range of the segment overlaps with the node's y-range - Horizontal segments (same y, different x): Check if y is within any node's y-range AND the x-range of the segment overlaps with the node's x-range - Diagonal segments: Check if the line passes through the node's bounding box

  1. For each detected intersection:

- Exclude segments that START or END at a node edge (valid connection points) - Report all segments that PASS THROUGH a node's interior

Critical: Segment-by-Segment Analysis A multi-segment path like M 890 1180 L 550 1180 L 550 820 L 890 820 has THREE segments:

  1. Horizontal: (890,1180) → (550,1180) at y=1180
  2. Vertical: (550,1180) → (550,820) at x=550
  3. Horizontal: (550,820) → (890,820) at y=820

Each segment must be checked independently against ALL nodes. A single path can cross MULTIPLE nodes.

Why This Works:

  • Catches paths that visually obscure nodes
  • Identifies routing issues where paths don't avoid nodes
  • Complements line intersection by checking path-node relationships
  • Detects all nodes crossed by multi-segment paths, not just the first one

Method 3: Path Overlap and Shared Point Analysis

Detects paths that share segments or start/end points, causing visual confusion.

Algorithm:

  1. Extract all path endpoints (start and end coordinates)
  2. Extract all path segments with their coordinates
  3. Check for:

- Shared endpoints: Multiple paths starting or ending at exact same point - Overlapping segments: Two paths sharing the same line segment (same x or y and overlapping range) - Convergence points: Multiple paths arriving at the same node edge within close proximity

Why This Works:

  • Identifies visual clutter where paths merge
  • Catches paths that are hard to distinguish
  • Highlights areas needing offset routing for clarity

Method 4: Routing Quality Analysis

Detects suboptimal path routing that could be improved for visual clarity.

Algorithm:

  1. Shared Start Points: Check if multiple paths originate from the exact same coordinate

- Example violation: UAT Tester → UAT PR and UAT Tester → Developer both starting at (890, 1180) - Fix: Offset one path to start from a different point on the same node edge

  1. Off-Center Connections: For nodes with only one incoming/outgoing path on an edge, verify the connection is centered

- Example violation: Path connecting to lower-left of a node instead of center-left - Fix: Adjust path endpoint to center of the edge

  1. Unnecessary Segments: Check if paths use more segments than necessary

- Example violation: 4-segment path when a 2-segment orthogonal path would work without crossings - Fix: Simplify the path to use the minimum number of segments

  1. Suboptimal Routes: Check if shorter intersection-free routes exist

- Example violation: Retro Report → Workflow Engineer going left-down-right instead of right-up-left - Fix: Reroute using the shorter valid alternative

Why This Works:

  • Ensures visual consistency and professionalism
  • Reduces clutter by minimizing unnecessary path complexity
  • Improves readability by using the most direct valid routes

Method 5: Visual Screenshot Analysis

Uses actual rendered output to catch visual issues that math might miss.

Algorithm:

  1. Capture high-resolution screenshot of rendered diagram
  2. Visually inspect for:

- Lines crossing over each other - Paths obscuring node labels - Arrow markers colliding with nodes/paths - Color overlaps making paths indistinguishable

  1. Document specific coordinates of visual crossings

Why This Works:

  • Catches rendering artifacts (antialiasing, stroke width effects)
  • Validates user-perceived quality
  • Identifies issues in arrow markers and decorations
  • Accounts for font rendering and text overlaps

Systematic Detection Checklist

When detecting issues manually (without scripts), follow this checklist:

Step 1: Build Node Inventory

Create a table of ALL nodes with their bounding boxes:

| Node Name | x-min | x-max | y-min | y-max |
|-----------|-------|-------|-------|-------|
| Developer | 780   | 1000  | 780   | 820   |
| Tech Writer | 490 | 710   | 960   | 1000  |
...

Step 2: Parse Each Path into Segments

For each path, break down the d attribute into individual segments:

Path: "M 890 1180 L 550 1180 L 550 820 L 890 820"
Segments:
  1. Horizontal at y=1180: x from 890 to 550
  2. Vertical at x=550: y from 1180 to 820
  3. Horizontal at y=820: x from 550 to 890

Step 3: Check EVERY Segment Against EVERY Node

For each segment, systematically check against all nodes:

  • Vertical segment at x=X, y from Y1 to Y2:

- Does X fall within [node.x-min, node.x-max]? - Does [Y1, Y2] overlap with [node.y-min, node.y-max]? - If BOTH yes → CROSSING DETECTED

  • Horizontal segment at y=Y, x from X1 to X2:

- Does Y fall within [node.y-min, node.y-max]? - Does [X1, X2] overlap with [node.x-min, node.x-max]? - If BOTH yes → CROSSING DETECTED

Step 4: Check Path Start/End Points

For each path, check if its start or end point is shared with other paths:

  • Same exact coordinates = SHARED ENDPOINT
  • Different paths arriving at same node edge within 5px = CONVERGENCE

Step 5: Check Path-Path Intersections

For each pair of paths, check if their segments intersect:

  • Two horizontal segments at same y with overlapping x-range = OVERLAP
  • Two vertical segments at same x with overlapping y-range = OVERLAP
  • Horizontal and vertical segments that cross = CROSSING

Hard Rules

Must

  • Build a complete node inventory FIRST before analyzing any paths
  • Parse each path into individual line segments - never analyze paths as single entities
  • Check EVERY segment against EVERY node - a single path can cross multiple nodes
  • Run all detection methods for thorough validation
  • Report exact coordinates of intersection points
  • Identify which paths AND which specific segments are involved in each crossing
  • Calculate parametric intersection parameters (t, u values) for path-path crossings
  • Test with actual SVG data from the diagram file
  • Create visual annotations showing crossing locations
  • Report shared endpoints and overlapping path segments as separate issues

Must Not

  • Rely on only one detection method
  • Report endpoint connections as crossings
  • Skip proximity analysis
  • Ignore visual rendering validation
  • Treat a multi-segment path as a single line - always decompose into segments
  • Stop after finding one crossing on a path - continue checking remaining segments
  • Assume segment routing based on comments - verify actual coordinates

Testing Approach

Test 1: Node Inventory Verification

Build the complete node inventory table and verify all nodes are captured.

Test 2: Path Segment Decomposition

Decompose ALL paths into segments and verify segment count matches expected.

Test 3: Systematic Segment-Node Checking

For each segment, check against ALL nodes (not just visually nearby ones).

Test 4: Mathematical Verification

Run parametric line intersection detection on all path-path segment pairs.

Test 5: Shared Point Detection

Check for paths sharing start/end points or overlapping segments.

Test 6: Visual Inspection

Analyze rendered screenshot for visual crossing artifacts.

Actions

1. Run Full Detection Suite

Execute the comprehensive Python detection script:

python3 .github/skills/detect-diagram-crossings/detect_crossings.py website/ai-workflow.html

This will:

  • Parse SVG and extract all paths and nodes
  • Decompose paths into individual line segments
  • Run segment-by-segment node crossing detection
  • Check path-path intersections
  • Detect shared endpoints and overlapping segments
  • Generate a detailed report with node inventory, path inventory, and issues

2. Run Extended Validation (Recommended)

Execute the JavaScript detection script for additional quality checks:

node .github/skills/detect-diagram-crossings/detect_all.js website/ai-workflow.html

This performs additional validation including:

  • Shared start points: Multiple paths must not start at the same point of a node
  • Off-center connections: If a path is the only connection to a node edge, it must connect at the center
  • Unnecessary segments: Flags paths with more than 2 segments when a simpler 2-segment orthogonal path would work
  • Suboptimal routes: Identifies paths that take longer routes when a shorter intersection-free alternative exists

Note: The JavaScript script requires Node.js and jsdom. Install dependencies with:

cd .github/skills/detect-diagram-crossings && npm install jsdom

3. Validate Fix

After modifying the diagram, re-run both detection scripts to confirm improvements:

python3 .github/skills/detect-diagram-crossings/detect_crossings.py website/ai-workflow.html
node .github/skills/detect-diagram-crossings/detect_all.js website/ai-workflow.html

Both scripts exit with:

  • Exit code 0: No errors (warnings are OK for Python script)
  • Exit code 1: Errors detected

Detection Metrics

Success Criteria

  • Zero mathematical crossings: All parametric tests pass
  • Zero proximity issues: No path segments through node bodies
  • Zero shared start points: Each path starts from a unique point on a node
  • Zero segment overlaps: No path segments overlap with other path segments
  • Centered single connections: Paths connecting to nodes with no other connections use center of edge
  • Minimal segment paths: No paths use more segments than necessary
  • Optimal routes: No significantly shorter intersection-free alternatives exist
  • Clean visual rendering: Screenshot confirms no visual crossings
  • All paths routed: Every connection has a clear, non-crossing path

Quality Thresholds

  • Excellent: 0 crossings by all methods
  • Good: 0 mathematical crossings, minor visual artifacts only
  • Fair: 1-2 mathematical crossings in complex areas
  • Poor: 3+ crossings or major visual overlaps
  • Unacceptable: Multiple obvious crossings visible in screenshot

Common Mistakes to Avoid

Mistake 1: Incomplete Path Decomposition

Wrong: Checking only path endpoints or waypoints Right: Parse d attribute into ALL individual line segments

Mistake 2: Stopping Early

Wrong: Finding one crossing on a path and moving to next path Right: Check ALL segments of the path against ALL nodes

Mistake 3: Visual Proximity Assumption

Wrong: Assuming a path doesn't cross a node because they look far apart Right: Mathematically verify segment coordinates against node bounds

Mistake 4: Ignoring Multi-Node Crossings

Wrong: Reporting "path crosses Tech Writer" and stopping Right: Continue checking - same path might also cross Documentation, UAT Tester, etc.

Mistake 5: Missing Shared Points

Wrong: Only checking for geometric crossings Right: Also check for paths sharing exact start/end coordinates

Common Issues and Solutions

Issue: False Positives at Endpoints

Symptom: Detections at valid node-to-node connections Fix: Increase endpoint tolerance from 0.01 to 0.05

Issue: Missed Visual Crossings

Symptom: Math says no crossings but visually there are Fix: Check stroke width, arrow markers, and rendering artifacts

Issue: Paths Too Close to Nodes

Symptom: Proximity warnings but no crossings Fix: Add routing margins, use wider node spacing

Best Practices

  1. Test Early and Often: Run detection after every layout change
  2. Use All Three Methods: Don't rely on just mathematical analysis
  3. Document Findings: Save screenshots and coordinate data
  4. Iterative Refinement: Fix one crossing at a time, re-test after each fix
  5. Validate Visually: Always check rendered output, not just data

Example Output

CROSSING DETECTION REPORT
=========================

Method 1: Parametric Line Intersection
- Paths analyzed: 30
- Crossings detected: 0
- Status: ✅ PASS

Method 2: Node-Path Proximity
- Nodes analyzed: 25
- Proximity issues: 0
- Status: ✅ PASS

Method 3: Shared Points Analysis
- Shared endpoints: 0
- Overlapping segments: 0
- Status: ✅ PASS

Method 4: Visual Screenshot Analysis
- Resolution: 1920x2000px
- Visual crossings: 0
- Status: ✅ PASS

OVERALL: ✅ NO CROSSINGS DETECTED
Diagram has a clean, crossing-free layout.

Worked Example: UAT Rework Path Analysis

This example demonstrates the complete detection process for a problematic path.

Input Path

<!-- UAT rework path -->
<path d="M 890 1180 L 550 1180 L 550 820 L 890 820" stroke="#ff6b6b" .../>

Step 1: Decompose into Segments

SegmentTypeFixed CoordRange
1Horizontaly=1180x: 550-890
2Verticalx=550y: 820-1180
3Horizontaly=820x: 550-890

Step 2: Relevant Node Bounds

Nodex-minx-maxy-miny-max
UAT Tester780100011401180
Tech Writer4907109601000
Documentation49071010501085
Developer7801000780820

Step 3: Check Each Segment Against Each Node

Segment 1 (Horizontal y=1180, x: 550-890):

  • UAT Tester: y=1180 within [1140,1180]? YES (touches edge). x:[550,890] overlaps [780,1000]? YES → CROSSING (edge)
  • Tech Writer: y=1180 within [960,1000]? NO → OK
  • Documentation: y=1180 within [1050,1085]? NO → OK
  • Developer: y=1180 within [780,820]? NO → OK

Segment 2 (Vertical x=550, y: 820-1180):

  • UAT Tester: x=550 within [780,1000]? NO → OK
  • Tech Writer: x=550 within [490,710]? YES. y:[820,1180] overlaps [960,1000]? YES → CROSSING
  • Documentation: x=550 within [490,710]? YES. y:[820,1180] overlaps [1050,1085]? YES → CROSSING
  • Developer: x=550 within [780,1000]? NO → OK

Segment 3 (Horizontal y=820, x: 550-890):

  • UAT Tester: y=820 within [1140,1180]? NO → OK
  • Tech Writer: y=820 within [960,1000]? NO → OK
  • Documentation: y=820 within [1050,1085]? NO → OK
  • Developer: y=820 within [780,820]? YES (touches edge). x:[550,890] overlaps [780,1000]? YES → ENDPOINT (valid)

Step 4: Final Report for This Path

UAT Rework Path Crossings:
- Segment 1 (y=1180): Touches UAT Tester bottom edge at x=780-890 (start point)
- Segment 2 (x=550): CROSSES Tech Writer (y=960-1000)
- Segment 2 (x=550): CROSSES Documentation (y=1050-1085)
- Segment 3 (y=820): Ends at Developer node (valid endpoint)

ISSUES FOUND: 2 node crossings (Tech Writer, Documentation)

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

36.61%
按下载量换算48

Claude

29.17%
按下载量换算39

Cursor

21.43%
按下载量换算28

Gemini CLI

10.39%
按下载量换算14

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

只读

该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills