AgentSkillsCN

gravatar-url

根据电子邮件地址生成 Gravatar 头像 URL。当用户要求获取 Gravatar URL、希望通过电子邮件生成头像,或需要为开发者提供个人头像的 URL 时,可使用此功能。

SKILL.md
--- frontmatter
name: gravatar-url
description: Generate a Gravatar avatar URL from an email address. Use when the user asks for a Gravatar URL, wants to generate an avatar from an email, or needs profile image URLs for developers.

Generate Gravatar URL

Generate a Gravatar avatar URL from an email address.

Usage

bash
npx tsx scripts/url.ts <email> [options]

Arguments

ArgumentRequiredDescription
emailYesEmail address

Options

OptionDescription
--size=NImage size in pixels (default: 80, max: 2048)
--default=TYPEDefault image type: mp, identicon, monsterid, wavatar, retro, robohash, blank (default: mp)
--rating=LEVELRating level: g, pg, r, x (default: g)
--force-defaultForce the default image even if user has a Gravatar

Output

code
Email: user@example.com
Hash: b48bf4373d7b7374351c0544f36f7fc3
URL: https://www.gravatar.com/avatar/b48bf4373d7b7374351c0544f36f7fc3?s=80&d=mp&r=g

Script Execution (Preferred)

bash
npx tsx scripts/url.ts <email> [options]

Options:

  • --size=N - Image size in pixels (default: 80, max: 2048)
  • --default=TYPE - Default image type: mp, identicon, monsterid, wavatar, retro, robohash, blank (default: mp)
  • --rating=LEVEL - Rating level: g, pg, r, x (default: g)
  • --force-default - Force the default image even if user has a Gravatar

Run from the gravatar plugin directory: ~/.claude/plugins/cache/gravatar/

Gravatar URL Format

code
https://www.gravatar.com/avatar/{hash}?{parameters}

The hash is an MD5 hash of the lowercase, trimmed email address.

URL Parameters

ParameterDescriptionDefaultOptions
sizeImage size in pixels801-2048
defaultDefault image when no Gravatar existsmpmp, identicon, monsterid, wavatar, retro, robohash, blank
ratingContent rating levelgg, pg, r, x
fForce default imagey (forced)y

Default Image Types

TypeDescription
mpMystery Person (simple, cartoon-style silhouette)
identiconGeometric pattern based on email hash
monsteridUnique monster generated from email hash
wavatarUnique face generated from email hash
retro8-bit arcade-style face
robohashUnique robot generated from email hash
blankTransparent PNG

Rating Levels

RatingDescription
gSuitable for all audiences
pgMay contain rude gestures or mild violence
rMay contain harsh language, violence, or partial nudity
xMay contain explicit content

Examples

Basic Gravatar URL:

bash
npx tsx scripts/url.ts user@example.com

Custom size (200px):

bash
npx tsx scripts/url.ts user@example.com --size=200

Use identicon for default:

bash
npx tsx scripts/url.ts user@example.com --default=identicon

Force default image (ignore user's Gravatar):

bash
npx tsx scripts/url.ts user@example.com --force-default --default=robohash

MD5 Hashing

Gravatar uses MD5 hash of the email address:

  1. Convert email to lowercase
  2. Trim whitespace
  3. Compute MD5 hash
  4. Use hex-encoded hash in URL

Example:

code
Email:   User@Example.COM
Step 1:  user@example.com
Step 2:  b48bf4373d7b7374351c0544f36f7fc3 (MD5)
URL:     https://www.gravatar.com/avatar/b48bf4373d7b7374351c0544f36f7fc3

Profile URLs

Gravatar also provides profile pages:

code
https://www.gravatar.com/{hash}

Replace /avatar/ with just the hash to get the profile page, which may contain additional information about the user.

Related

  • Use gravatar-check skill to verify if a Gravatar exists for an email
  • Use gravatar-download skill to download Gravatar images to local files
  • Use Gravatar profile URLs to get additional user information
  • Combine with npm or GitHub author emails to display author avatars
  • Use default images to provide consistent fallbacks

Use Cases

Developer Profiles

Generate avatar URLs for package maintainers:

bash
npx tsx scripts/url.ts maintainer@npmjs.com

Team Pages

Create consistent avatars for team members:

bash
npx tsx scripts/url.ts dev1@company.com --default=identicon --size=200
npx tsx scripts/url.ts dev2@company.com --default=identicon --size=200

User Comments

Display avatars for user comments:

bash
npx tsx scripts/url.ts commenter@example.com --rating=pg

Notes

  • Gravatar images are served over HTTPS
  • Images are cached by browsers and CDNs
  • URL generation requires no API calls - it's deterministic
  • Users must register on gravatar.com to set their avatar
  • Unregistered emails will show the default image