skillZs
LIVE SKILL TAGS
>>> LIVE SKILLS INDEX <<<
* OPEN SOURCE *
NO LOGIN, NO TRACKING
REAL INSTALL DATA
← back to all skills
thatguyinabeanie/trainers.gg1 installs

using-utils

Use when displaying enum or DB values in UI, handling errors, checking permissions, or working with the utils package

How do I install this agent skill?

npx skills add https://github.com/thatguyinabeanie/trainers.gg --skill using-utils
view source ↗

Is this agent skill safe to install?

  • Gen Agent Trust Hubpass

    This skill provides documentation and usage guidelines for a internal TypeScript utility package. No security risks were identified.

  • Socketpass

    No alerts

  • Snykpass

    Risk: LOW · No issues

What does this agent skill do?

@trainers/utils

Shared utilities — formatting, countries, tiers, permissions, label mapping, error handling. Pure TypeScript — no framework dependencies.

Key Modules

ModulePurpose
labels.tsgetLabel() — convert snake_case enum values to human-readable strings
error-handling.tsgetErrorMessage() — extract message from Error, Supabase error, or unknown
permissions.tsPERMISSIONS constants + PermissionKey type — security-critical
tiers.tsUser/org tier definitions, feature flags, pricing
countries.tsISO 3166-1 country codes and display names
format.tsDate, number, and string formatters
notifications.tsNotification type helpers

Critical Usage Rules

getLabel() is required whenever displaying enum/DB values in UI — never render raw snake_case values.

getErrorMessage(error, fallback, shouldSanitize?) handles all error types uniformly. Always use this instead of error.message directly.

escapeLike(str) — escape special characters for PostgREST like queries.

Usage Examples

getLabel()

import { getLabel } from "@trainers/utils";

// Convert DB enum values to display strings
getLabel("checked_in");    // "Checked In"
getLabel("not_started");   // "Not Started"
getLabel("in_progress");   // "In Progress"

// Use in components:
<span>{getLabel(tournament.status)}</span>

getErrorMessage()

import { getErrorMessage } from "@trainers/utils";

// In Server Actions:
catch (e) {
  return { success: false, error: getErrorMessage(e, "Something went wrong") };
}

// Handles: Error objects, Supabase PostgrestError, strings, unknown

Permissions

import { PERMISSIONS, type PermissionKey } from "@trainers/utils";

// Check user permissions against org/tournament roles
// Read permissions.ts for the full permission matrix

Formatting

import { formatTimeAgo } from "@trainers/utils";

formatTimeAgo(new Date("2024-01-01")); // "3 months ago"

Additional Exports

  • COUNTRIES — ISO country codes and display names
  • PERMISSIONS + PermissionKey — security-critical constants (read file directly for full list)
  • getUserTierFeatures(), getTournamentFeePercentage(), calculatePlatformFee() — tier/pricing logic
  • formatTimeAgo() — relative time formatting

Commands

pnpm --filter @trainers/utils test          # Run tests
pnpm --filter @trainers/utils test:watch    # Watch mode
pnpm --filter @trainers/utils typecheck     # Type checking

Add the canonical catalog link to the repository README so users can inspect current installs and available audits. The publishing guide covers the complete discovery path.

<a href="https://skillzs.dev/skills/thatguyinabeanie/trainers.gg/using-utils">View using-utils on skillZs</a>