Skip to content

fix-social-link-previews

An agent skill for Codex and Claude Code that audits, creates, repairs, and verifies the large-image previews a website shows when its links are shared.

Role
Agent workflow design and automation engineering
Scope
Agent workflow, validation automation, and packaging
Status
Published npm package v0.3.0
A correct web page beside a crawler view that sees only a broken link card

Problem

A page can look correct in the browser while link-preview crawlers see missing or client-only metadata, an image that is too small or unreachable, or an old card the platform has cached. Implementation problems and cache problems need different fixes, and confusing them leads teams to rewrite correct metadata or wait on a cache that will never refresh.

Constraints

  1. C1

    Social platforms select and cache cards with proprietary rules that cannot be simulated or controlled.

  2. C2

    Metadata must be visible to crawlers in the server HTML, and image URLs must be reachable remotely.

  3. C3

    Dimension checks are deterministic only for PNG, JPEG, and supported WebP encodings.

Architecture

The skill inspects the repository and framework against a social-preview standard, then runs a deterministic checker over the raw HTML and image response. It preserves, repairs, or creates metadata and assets as needed, and verifies the result locally and on the deployed site.

01

Skill workflow

Repository and framework inspection identifies how the app sets metadata and compares it with the social-preview standard.

02

Automation

A deterministic HTML and image checker reports through exit codes 0, 1, and 2 so agents can tell outcomes apart.

03

Verification

A preserve, repair, or create workflow is followed by verification on the local build and on the deployed site.

Decisions

D1

Separate implementation eligibility from cache symptoms

Missing tags or a bad image are code problems, while a stale card is a platform cache problem that no code change fixes. Diagnosing them separately avoids fixing the wrong one.

D2

Make the smallest framework-native repair

Valid metadata is kept as it is, and changes use the framework's own way of setting tags, which keeps the diff small and consistent with the rest of the app.

D3

Standardize new preview assets at 1200×630

One size keeps new assets predictable. The checker still reads bytes, type, and dimensions from the file itself, because an extension can claim a format the file does not have.

Contribution

  • Built auditing of the raw HTML, meta tags, and image response.
  • Implemented raster dimension validation and explicit exit codes.
  • Codified framework patterns and a social-preview standard.
  • Added installer, checker, and package-contract tests.

Outcomes

  • Agents can tell a missing card apart from a cached one.
  • Incomplete, relative, or client-only metadata is repaired at its source.
  • A branded large-image asset is created only when one is needed.
  • Agents verify the local implementation and deployed crawler eligibility without promising a platform-specific layout.

Verified stack

  • Agent Skills
  • JavaScript
  • Node.js
  • npm
  • GitHub Actions
  • CI/CD

Working through something similar?

Share your challenge, scope, and timeline to start a focused conversation.