CommunityImagegithub.com

rtaylor-talmark/ep-skills

Download an agency insignia/logo/patch/badge from a URL, remove its background, resize it to 512x512, save it as .png and .jpg named after the EP customer prefix, and upload both to the EP insignia S3 bucket (prod-ep-cmh-insignia). Use when the user wants to add, replace, or update a customer's/agency's insignia, logo, patch, or badge image in Essential Personnel (EP).

What is ep-skills?

ep-skills is a Claude Code agent skill that download an agency insignia/logo/patch/badge from a URL, remove its background, resize it to 512x512, save it as .png and .jpg named after the EP customer prefix, and upload both to the EP insignia S3 bucket (prod-ep-cmh-insignia). Use when the user wants to add, replace, or update a customer's/agency's insignia, logo, patch, or badge image in Essential Personnel (EP).

Works with~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/rtaylor-talmark/ep-skills/tree/HEAD/skills/ep-insignia

Installed? Explore more Image skills: steipete/songsee, affaan-m/frontend-design, mattpocock/improve-codebase-architecture · View all 6 →

Ask in your favorite AI

Open a new chat with this agent skill pre-loaded.

Documentation

EP Insignia

Turns a source image URL into the two insignia files EP expects and uploads them to s3://prod-ep-cmh-insignia (EP AWS account 405995789491, region us-east-2).

Conventions, matching the files already in the bucket:

  • Key: <prefix>.png and <prefix>.jpg at the bucket root, where <prefix> is the EP customer prefix (lowercase, e.g. audubonpd, alexanderncsheriff).
  • Both are 512x512. The insignia is trimmed, scaled to fit, and centered with a small margin.
  • PNG has a transparent background. JPG has a white background.
  • Content types are image/png and image/jpeg. The bucket uses BucketOwnerEnforced, so don't set ACLs.

Inputs

  1. Source URL. If the user didn't give one, ask for it. A local file path also works.
  2. Customer prefix. If it wasn't provided, ask for it. Don't guess it from the agency name. Normalize it to lowercase and reject anything other than a-z 0-9 - _.

Steps

1. Process the image

Use a fresh working directory in the scratchpad (or mktemp -d), then run:

uv run -q <skill_dir>/scripts/process_insignia.py "<url>" "<prefix>" "<workdir>"

uv installs the dependencies from the script's inline metadata. The first time AI background removal runs, it downloads a ~180 MB model to ~/.u2net.

The default background mode (--bg auto) works like this:

  • If the source already has a transparent background, it's left as-is.
  • If the border is a single solid colour (typically white), only the background connected to the edges is removed. White lettering or details inside the badge are kept.
  • Otherwise it uses AI segmentation (rembg isnet-general-use).

Overrides: --bg ai, --bg flood, and --bg none force a mode. --margin N sets the padding in px (default 4).

If the download fails with 403 or 429, or the URL is an SVG or a web page rather than an image, tell the user and ask for a direct image link. They can also download the file themselves and pass the local path.

2. Review before uploading

Build a preview of the PNG over a contrasting colour, next to the JPG:

convert \( <workdir>/<prefix>.png -background '#c33' -flatten \) <workdir>/<prefix>.jpg +append <workdir>/preview.png

Open preview.png with the Read tool and check it:

  • No leftover background (halo, box, or fringe on the red side).
  • No missing parts of the insignia (holes where interior white was removed, or text that was cut off).
  • It's the right agency.

If the result is wrong, re-run with a different --bg mode. Show the preview to the user, along with the background method the script reported and any warning about a small source image.

3. Check AWS access and existing files

aws sts get-caller-identity --query Account --output text   # expect 405995789491
aws s3 ls s3://prod-ep-cmh-insignia/<prefix>.

If <prefix>.png or <prefix>.jpg already exists, tell the user. This is a production bucket, so get explicit confirmation before overwriting. Back up the existing files first:

aws s3 cp s3://prod-ep-cmh-insignia/<prefix>.png <workdir>/backup/<prefix>.png
aws s3 cp s3://prod-ep-cmh-insignia/<prefix>.jpg <workdir>/backup/<prefix>.jpg

Even when nothing exists yet, confirm the upload with the user after showing the preview.

4. Upload

aws s3 cp <workdir>/<prefix>.png s3://prod-ep-cmh-insignia/<prefix>.png --content-type image/png
aws s3 cp <workdir>/<prefix>.jpg s3://prod-ep-cmh-insignia/<prefix>.jpg --content-type image/jpeg

Verify the upload with aws s3 ls s3://prod-ep-cmh-insignia/<prefix>., then report both S3 keys, their sizes, and where any backups were saved.

Related Skills