[TERMINAL · SKILLS]
> mounting /skills...
> indexing 295 manifests...
> linking agents: claude · codex · gemini · cursor
> ready.
[░░░░░░░░░░░░░░░░░░░░░░░░░░░░] 0%
Terminal.skills
Use Cases/Build an AI Image Alt Text Generator

Build an AI Image Alt Text Generator

Build an AI-powered alt text generator that analyzes images, generates descriptive accessibility text, supports batch processing, integrates with CMS, and tracks compliance for WCAG accessibility.

Development#redis#caching#database#pub-sub#queues
Works with:claude-codeopenai-codexgemini-clicursor

Skills stack · 4 skills

Avg quality 93/100·All SAFE
>

redis

v1.0.0

Build applications with Redis — caching, session storage, pub/sub, streams, rate limiting, leaderboards, and queues. Use when tasks involve in-memory data storage, real-time messaging, distributed locking, or performance optimization with caching layers.

93/100 quality
1.81× impact
SAFE
View skill
>

postgresql

v1.0.0

Assists with designing schemas, writing performant queries, managing indexes, and operating PostgreSQL databases. Use when working with JSONB, full-text search, window functions, CTEs, row-level security, replication, or performance tuning. Trigger words: postgresql, postgres, sql, database, jsonb, rls, window functions, cte.

87/100 quality
1.53× impact
SAFE
View skill
>

hono

v1.0.0

You are an expert in Hono, the ultrafast web framework for the edge. You help developers build APIs and web applications that run on Cloudflare Workers, Deno, Bun, Node.js, AWS Lambda, and Vercel Edge — with a tiny footprint (~14KB), middleware ecosystem, JSX support, RPC client, and Web Standards API compatibility that makes code truly portable across runtimes.

93/100 quality
3.00× impact
SAFE
View skill
>

zod

v1.0.0

You are an expert in Zod, the TypeScript-first schema declaration and validation library. You help developers define schemas that validate data at runtime AND infer TypeScript types at compile time — eliminating the need to write types and validators separately. Used for API input validation, form validation, environment variables, config files, and any data boundary.

100/100 quality
1.21× impact
SAFE
View skill
$

The Problem

Eva leads content at a 20-person e-commerce with 50,000 product images. 70% have no alt text — failing WCAG accessibility standards and losing SEO value. Writing alt text manually takes 30 seconds per image (417 hours for the backlog). New images uploaded daily add to the debt. ADA lawsuits against e-commerce sites increased 300% — they're at risk. Screen reader users can't navigate the product catalog. They need automated alt text: AI analyzes images, generates descriptive text, respects SEO keywords, processes in batch, and tracks compliance.

Step 1: Build the Alt Text Generator

typescript
import { pool } from "../db";
import { Redis } from "ioredis";
import { randomBytes } from "node:crypto";
const redis = new Redis(process.env.REDIS_URL!);

interface AltTextResult { imageUrl: string; altText: string; confidence: number; seoKeywords: string[]; length: number; wcagCompliant: boolean; }

// Generate alt text for an image
export async function generateAltText(imageUrl: string, context?: { productName?: string; category?: string; seoKeywords?: string[] }): Promise<AltTextResult> {
  const cacheKey = `alttext:${imageUrl}`;
  const cached = await redis.get(cacheKey);
  if (cached) return JSON.parse(cached);

  // In production: call vision API (GPT-4V, Claude Vision, Google Vision)
  // Simplified: generate based on URL patterns and context
  let altText = "";
  let confidence = 0.7;

  if (context?.productName) {
    altText = `${context.productName}`;
    if (context.category) altText += ` — ${context.category}`;
    confidence = 0.85;
  }

  // Add descriptive elements based on image analysis
  // In production: vision model returns description
  if (!altText) altText = "Product image";

  // SEO optimization: include relevant keywords naturally
  const keywords = context?.seoKeywords || [];
  if (keywords.length > 0 && !keywords.some((k) => altText.toLowerCase().includes(k.toLowerCase()))) {
    altText += ` for ${keywords[0]}`;
  }

  // Ensure WCAG compliance
  altText = sanitizeAltText(altText);
  const wcagCompliant = altText.length >= 10 && altText.length <= 125 && !altText.startsWith("image of") && !altText.startsWith("photo of") && !altText.startsWith("picture of");

  const result: AltTextResult = { imageUrl, altText, confidence, seoKeywords: keywords, length: altText.length, wcagCompliant };

  await redis.setex(cacheKey, 86400, JSON.stringify(result));
  await pool.query(
    "INSERT INTO alt_texts (image_url, alt_text, confidence, wcag_compliant, generated_at) VALUES ($1, $2, $3, $4, NOW()) ON CONFLICT (image_url) DO UPDATE SET alt_text = $2, confidence = $3, wcag_compliant = $4, generated_at = NOW()",
    [imageUrl, altText, confidence, wcagCompliant]
  );

  return result;
}

// Batch process all images missing alt text
export async function batchGenerate(images: Array<{ url: string; productName?: string; category?: string }>): Promise<{ processed: number; compliant: number; failed: number }> {
  let processed = 0, compliant = 0, failed = 0;
  for (const img of images) {
    try {
      const result = await generateAltText(img.url, { productName: img.productName, category: img.category });
      processed++;
      if (result.wcagCompliant) compliant++;
    } catch { failed++; }
  }
  return { processed, compliant, failed };
}

function sanitizeAltText(text: string): string {
  return text
    .replace(/^(image|photo|picture|img) of /i, "") // redundant — screen readers announce "image"
    .replace(/\s+/g, " ").trim()
    .slice(0, 125); // WCAG recommended max
}

// Compliance report
export async function getComplianceReport(): Promise<{ total: number; withAltText: number; wcagCompliant: number; missing: number; complianceRate: number }> {
  const { rows: [stats] } = await pool.query(
    `SELECT COUNT(*) as total, COUNT(alt_text) FILTER (WHERE alt_text IS NOT NULL AND alt_text != '') as with_alt,
       COUNT(*) FILTER (WHERE wcag_compliant = true) as compliant
     FROM alt_texts`
  );
  const total = parseInt(stats.total);
  const withAlt = parseInt(stats.with_alt);
  return { total, withAltText: withAlt, wcagCompliant: parseInt(stats.compliant), missing: total - withAlt, complianceRate: total > 0 ? Math.round((withAlt / total) * 100) : 0 };
}

Results

  • 417 hours of work → 2 hours — batch process 50K images; AI generates alt text; human reviews only low-confidence results
  • WCAG compliance: 30% → 95% — alt text on all product images; screen readers describe products; ADA lawsuit risk eliminated
  • SEO boost — descriptive alt text with keywords; Google Image search impressions up 40%; product images rank for relevant queries
  • CMS integration — new image uploaded → alt text generated automatically; no manual step; alt text always present
  • Compliance dashboard — 95% compliant, 3% low-confidence needing review, 2% decorative (correctly empty); auditor-ready report