Index of every page on this site: llms.txt
All skills
cocoindex-io avatar

/cocoindex-diagrams

@90c98f4
by CocoIndexcocoindex-io/cocoindex12k stars
931
Run it yourself

This skill should be used when creating, editing, or reviewing inline SVG diagrams for the CocoIndex docs site (anything under docs/src/content/docs/**). It encodes the component-based primitive system under docs/src/components/diagrams/, the palette + shape semantics, the preview-and-verify loop using headless Chrome with the /docs base path, and the pitfalls that cost iterations to discover. Trigger phrases include "add a diagram to the docs", "edit this diagram", "replace the SVG in core_concepts", "make a diagram for processing_component", "check how the diagram looks".

Use this Skill: https://skilld.dev/gh/cocoindex-io/cocoindex/cocoindex-diagrams

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencesworkflow.md

≈673 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Preview-and-verify workflow

Diagrams are visual artifacts. "The build compiled" is not sufficient evidence that they render correctly — always screenshot and look.

The base-path gotcha

The docs site configures base: '/docs' in astro.config.mjs. As a result, the built HTML references CSS at /docs/_astro/.... If the local preview server is rooted at dist/ without mirroring that prefix, the CSS returns 404, all CSS variables are undefined, and every SVG fill: var(--cream) resolves to black.

Symptom: All diagram boxes render as solid black rectangles, but text labels are visible. This is NOT a code bug. Fix the server, not the diagram.

The scripts/preview.sh script handles this correctly by rsyncing the dist/ output into a docs/ subdirectory before serving.

Running the preview

scripts/preview.sh <docs-slug> [crop-y-top]
# Example: scripts/preview.sh programming_guide/core_concepts
# Example: scripts/preview.sh programming_guide/core_concepts 3300

The script:

  1. Runs npm run build inside docs/.
  2. Rsyncs docs/dist/ → a temp directory under docs/.
  3. Kills any stale server on port 8765, starts fresh on next free port.
  4. Screenshots the page with headless Chrome at 1400x5200, scale 1.
  5. Saves full-page PNG + an optional crop.
  6. Prints the paths.

Read the PNGs back with the Read tool. Claude Code is multimodal — it can see and critique the rendered output.

Locating a specific diagram in the page

Full-page screenshots are tall. To find your diagram:

  1. Start with a wide crop covering a plausible range:
    magick /tmp/dg-preview/full.png -crop 1400x500+0+3300 /tmp/dg-preview/crop.png
  2. Read the crop. If the target diagram isn't there, adjust the y-offset (e.g. +2500, +3500, +4000).
  3. For layout scrutiny, crop tight and omit surrounding prose.

Iteration loop

  1. Edit the .astro file.
  2. Run scripts/preview.sh <slug>.
  3. Read the PNG.
  4. Compare with intent; identify specific issues (overlap, opacity, wrong shape, wrong color).
  5. Edit again, repeat.

Expect 2–4 cycles for any non-trivial diagram. First render almost always surfaces issues invisible from code (e.g., labels overlapping icons).

When to skip preview

Minor text/label edits that don't affect layout (e.g. fixing a typo in a label string) can skip preview if the diagram otherwise passed a recent review. Everything that touches coordinates, shape choices, or new primitives needs a preview.

Cleanup

The preview script writes to /tmp/dg-preview/ and starts a local HTTP server. Both clean up on next run. If a port gets stuck:

lsof -ti:8765 | xargs kill -9

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts6mo3 checks · Risk SAFE
  • Gen Agent Trust Hub6mo

    This skill provides a specialized workflow for creating SVG diagrams for the CocoIndex documentation site using Astro components. It includes a library of shape primitives, layout idioms, and a preview script (preview.sh) that builds the site and captures screenshots using headless Chrome for visual verification. No malicious patterns or security vulnerabilities were identified.

  • Socket6mo

    No alerts

  • Snyk6mo

    Risk: LOW · No issues

Signed by skilld at 90c98f4. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 3 days ago.

Activeupdated 6 months ago

README badge

README badge for cocoindex-io/cocoindex/cocoindex-diagrams