agentleFS
Mostafashadow1Mostafashadow1/agent-skills/skills/tonely-ui-sounds/SKILL.md

tonely-ui-sounds

Skill0 starsChanged 11 days agoMITView on GitHub

Add UI feedback sounds (success/error/click/toggle/notification chimes) to a web app with the tonely npm package. Use when a task mentions sound effects, audio feedback, toast sounds, micro-interactions, or 'make the UI feel more alive' in React, Next.js, Vue, Svelte or vanilla JS.

  • Installs packages
  • Sends data out

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 0 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Not for: You need to play music, voice, or a specific recorded sound file.

    line 16
  2. Very specific:

    Check package.json first. If the project already uses use-sound (needs audio files), Howler.js (general audio player), keep using it unless …

    line 24
  3. Very specific:

    Import the singleton: import { tonely } from "tonely".

    line 27
  4. Very specific:

    Always give users a way to mute: tonely.setMuted(true).

    line 34

≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Tonely (tonely)

Tonely plays short UI feedback sounds (success, error, click, toggle...) synthesized at runtime with the Web Audio API. No audio files, no network requests, ~2.3 KB gzip, SSR-safe no-op on the server. Works with React, Next.js, Vue, Svelte and vanilla JS.

When to reach for it

  • The app needs sound feedback for actions: form saved, payment done, error, button click, toggle, delete, new notification.
  • You want sounds without shipping .mp3/.wav files or handling audio asset paths.
  • You need it to be safe in Next.js SSR, Server Components files and Server Actions flows (it does nothing on the server).
  • You want toast notifications (Sonner, shadcn/ui) to play a matching sound.

Not for: You need to play music, voice, or a specific recorded sound file. Use HTMLAudioElement or Howler.js. You need audio that plays without any prior user interaction. Browsers block that for every library.

Setup

npm install tonely

Check package.json first. If the project already uses use-sound (needs audio files), Howler.js (general audio player), keep using it unless the user asks to switch.

Rules

  • Import the singleton: import { tonely } from "tonely". Do not create an AudioContext yourself.
  • Available sounds: success, error, warning, info, click, pop, toggle(active), delete, glass, bubble. Do not invent other method names.
  • Themes: "modern" (default), "glass", "minimal", "playful", "retro". Set globally with tonely.setTheme(name) or per call with { theme }.
  • Per-call options: { volume, pitch, playbackRate, theme } where volume is 0 to 1.
  • The React hook lives in the subpath: import { useTonely } from "tonely/react". Files using it in Next.js App Router must start with "use client".
  • Calling tonely on the server is a safe no-op, but sounds only play in the browser after the first user gesture (autoplay policy). Trigger sounds from event handlers.
  • Map HTTP results with tonely.fromStatus(res.status) (2xx success, 3xx info, 4xx/5xx error), or wrap fetch with const f = tonely.wrapFetch().
  • Always give users a way to mute: tonely.setMuted(true). Keep sounds for meaningful events, not every hover.

Examples

Vanilla JS / any framework

import { tonely } from "tonely";

saveButton.addEventListener("click", async () => {
  tonely.click();
  const res = await fetch("/api/save", { method: "POST" });
  tonely.fromStatus(res.status); // 2xx -> success, 4xx/5xx -> error
});

React / Next.js client component

"use client";
import { useTonely } from "tonely/react";

export function PayButton() {
  const { click, success, error } = useTonely({ theme: "glass" });
  return (
    <button
      onClick={async () => {
        click();
        try { await pay(); success(); } catch { error(); }
      }}
    >
      Pay
    </button>
  );
}

Sonner / shadcn toasts with sound

import { toast as base } from "sonner";
import { tonely } from "tonely";

export const toast = {
  success: (m: string) => { tonely.success(); return base.success(m); },
  error: (m: string) => { tonely.error(); return base.error(m); },
  warning: (m: string) => { tonely.warning(); return base.warning(m); },
  info: (m: string) => { tonely.info(); return base.info(m); },
};

API

  • tonely.play(name, options?) and shortcuts success() error() warning() info() click() pop() toggle(active) delete() glass() bubble(); each returns Promise<boolean> (false on server or when muted).
  • tonely.fromStatus(status, options?), tonely.wrapFetch(), tonely.track(promise, options?).
  • tonely.setVolume(0..1), setMuted(bool), setTheme(theme) and matching getters.
  • createTonely(config?) for an isolated instance with { volume, theme, muted }.
  • tonely/react: useTonely(options?), TonelyProvider (config prop), useTonelyContext().

Docs: https://tone-ly.vercel.app/

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.