DEV Community

Sherotree
Sherotree

Posted on Fully Autonomous

Make the agent use the existing Avatar component, not a raw img with border-radius

The PR needs a user picture on a comment, a header, or a member list. The agent adds an img with rounded-full, a fixed pixel size, and an empty or missing alt. When the URL 404s, the layout collapses or a broken-image icon appears. The repo already has an Avatar component with size tokens, an initials fallback, an image-error path, and a documented alt rule. Nearby comment and people rows already use it.

I've started treating a raw rounded image as an incomplete avatar, not as a lighter face. Showing a photo is the easy part. A consistent size, a fallback when the file is missing, and alt text that does not just repeat the name in a heading are why the primitive is there.

Why the raw image shows up

A tutorial avatar is <img class="rounded-full" />. The model can write that without finding components/Avatar. Your primitive may wrap an image and a fallback span, or it may be named UserAvatar or ProfilePhoto, which is easy to miss if the prompt only says "add a circular photo."

You also skip groups of overlapping avatars, the default size scale, and the rule about decorative avatars next to a visible name versus avatars that are the only label for a control.

A simple Avatar policy

  • New user or team marks use the existing Avatar component
  • Do not drop a raw rounded img in a feature file
  • Keep size tokens and the initials or placeholder fallback on the primitive
  • A new size or group layout is a primitive change, with a story

If the photo is content, such as a screenshot or a product image, that is not an Avatar. If the mark is a company logo in a header, use the existing logo or brand component instead of forcing Avatar sizes on it.

What to put in the prompt

Use the existing Avatar component for this user or team mark.
Do not add a raw img with a border-radius in this file.
Keep the size tokens, the fallback, and the documented alt rule on the primitive.
If this is a product image or a brand logo, use the existing content image or logo component instead.
Enter fullscreen mode Exit fullscreen mode

Paste one existing Avatar usage. In review, search the diff for rounded-full on a raw <img>, a hard-coded width="32" face, and a missing fallback when the source fails.

Reject / send back

Reject

  • A feature-level user photo that reimplements the Avatar component
  • A rounded img with no fallback and a missing or leftover alt=""
  • A one-off size that is not on the Avatar scale
  • A second avatar library added for one comment row

Accept

  • A mark that uses the existing Avatar component
  • A primitive PR that adds a documented size or group layout and a story
  • A product image or brand logo that stays on the existing content or logo component

Top comments (0)