Skip to content

Commit 0fed132

Browse files
authored
chore: add agent skills for product usage and maintenance [no-ci] (#486)
* chore: add agent skills for product usage and maintenance Add 8 agent-agnostic skills under .agents/skills/ following the skills.sh convention (discoverable by OpenCode, Claude Code, Codex, Cursor, and 40+ other agent tools via `npx skills`). Product usage skills (7): - using-speech-to-text — /v1/listen REST + WSS - using-text-to-speech — /v1/speak REST + WSS - using-text-intelligence — /v1/read REST - using-audio-intelligence — /v1/listen analytics overlays - using-voice-agent — agent.deepgram.com/v1/agent/converse WSS - using-conversational-stt — /v2/listen Flux WSS - using-management-api — manage.v1.* + voice_agent.configurations Maintainer skill (1): - maintaining-js-sdk — JavaScript/TypeScript SDK maintenance workflow Each skill includes authentication, quick-start with real JavaScript/TypeScript code from examples/, key parameters, layered API references (in-repo, OpenAPI, AsyncAPI, Context7, product docs), gotchas, and sibling-skill routing. Add .agents to .fernignore so skills survive Fern regeneration. * docs: cross-reference deepgram/skills for central product knowledge Each product skill now points back to the `deepgram/skills` repo for the consolidated API reference, documentation finder, runnable recipes, third-party integration examples, and MCP setup. This SDK's skills stay language-idiomatic; the central skills stay cross-language. * chore: namespace skill names with deepgram-js- prefix Rename all 8 skill folders (and frontmatter `name` fields and sibling-skill cross-references) to avoid collisions when a user installs skills from multiple Deepgram SDK repos. Old → new: using-speech-to-text → deepgram-js-speech-to-text using-text-to-speech → deepgram-js-text-to-speech using-text-intelligence → deepgram-js-text-intelligence using-audio-intelligence → deepgram-js-audio-intelligence using-voice-agent → deepgram-js-voice-agent using-conversational-stt → deepgram-js-conversational-stt using-management-api → deepgram-js-management-api maintaining-js-sdk → deepgram-js-maintaining-sdk Previously each SDK published identically-named product skills (e.g. every SDK had `using-speech-to-text`), so installing skills from two SDKs would overwrite the first. The `deepgram-` prefix makes the vendor+language explicit and the names globally unique. * docs: sync maintainer skill and AGENTS.md with .fernignore (address Copilot feedback) Copilot flagged two threads on deepgram-js-maintaining-sdk/SKILL.md and asked that AGENTS.md be kept consistent. Both correct: - .agents/ was added to .fernignore in the initial commit but the maintainer skill's permanently-frozen list and note still claimed .agents/ wasn't frozen. - AGENTS.md agent-file bullet didn't list .agents/ either. All three source-of-truth surfaces now agree: CLAUDE.md, AGENTS.md, .claude/, .agents/ are permanently frozen. * docs: unify variable name and strip stray space (Copilot re-review feedback) All 8 new Copilot threads on PR #486: - 7 skills defined the client as `const client` in the auth section but the quick-start snippets below used `deepgramClient`. Renamed the auth variable to `deepgramClient` so every code block can be copy/pasted standalone without renaming. - deepgram-js-speech-to-text/SKILL.md: removed a trailing space inside the backticked `Token` auth scheme. Affected skills: deepgram-js-speech-to-text, deepgram-js-text-to-speech, deepgram-js-text-intelligence, deepgram-js-audio-intelligence, deepgram-js-voice-agent, deepgram-js-conversational-stt, deepgram-js-management-api. * docs: define vars in snippets, fix attribution, sync AGENTS.md (Copilot feedback) All 6 new Copilot threads on PR #486: - deepgram-js-management-api/SKILL.md: - Attribution now includes examples/32-management-project-models.ts (where `include_outdated: false` is actually demonstrated). - Declared `const projectId = process.env.DEEPGRAM_PROJECT_ID;` once at the top of each snippet and used `projectId` consistently instead of switching between `process.env.DEEPGRAM_PROJECT_ID` and an undefined `projectId` identifier. - deepgram-js-speech-to-text/SKILL.md + deepgram-js-conversational-stt/SKILL.md: WebSocket quick-start snippets referenced an undefined `audioStream`. Added the `createReadStream` setup (from the referenced examples) so the snippets are copy/paste runnable. - AGENTS.md: added `.mcp.json` to the permanently-frozen agent-file bullet so the list matches .fernignore and the maintainer skill.
1 parent 00ffcb2 commit 0fed132

10 files changed

Lines changed: 1004 additions & 2 deletions

File tree

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
---
2+
name: deepgram-js-audio-intelligence
3+
description: Use when writing or reviewing JavaScript/TypeScript in this repo that calls Deepgram audio analytics overlays on `/v1/listen` - summarize, topics, intents, sentiment, diarize, redact, detect_language, and entity detection. Same endpoint as plain STT, different params. Covers REST via `client.listen.v1.media.transcribeUrl` / `transcribeFile` and the WebSocket-supported subset on `client.listen.v1.createConnection()` / `connect()`. Use `deepgram-js-speech-to-text` for plain transcription and `deepgram-js-text-intelligence` for analytics on already-transcribed text. Triggers include "audio intelligence", "summarize audio", "diarize", "sentiment from audio", "redact PII", and "detect language audio".
4+
---
5+
6+
# Using Deepgram Audio Intelligence (JavaScript / TypeScript SDK)
7+
8+
Analytics overlays applied to `/v1/listen`: summaries, topics, intents, sentiment, language detection, diarization, redaction, entities. Same client surface as STT; turn features on with parameters.
9+
10+
## When to use this product
11+
12+
- You have **audio** and want analytics returned alongside the transcript.
13+
- REST is the primary path; the WebSocket path supports only a subset of intelligence features.
14+
15+
**Use a different skill when:**
16+
- You just want transcript output → `deepgram-js-speech-to-text`.
17+
- You already have text and want analytics on that text → `deepgram-js-text-intelligence`.
18+
- You need Flux turn-taking → `deepgram-js-conversational-stt`.
19+
- You need a full interactive voice agent → `deepgram-js-voice-agent`.
20+
21+
## Feature availability: REST vs WSS
22+
23+
| Feature | REST | WSS |
24+
|---|---|---|
25+
| `diarize` | yes | yes |
26+
| `redact` | yes | yes |
27+
| `detect_entities` | yes | yes |
28+
| `punctuate`, `smart_format` | yes | yes |
29+
| `summarize` | yes | no in current WSS connect args |
30+
| `topics` | yes | no |
31+
| `intents` | yes | no |
32+
| `sentiment` | yes | no |
33+
| `detect_language` | yes | no |
34+
35+
## Authentication
36+
37+
```js
38+
require("dotenv").config();
39+
40+
const { DeepgramClient } = require("@deepgram/sdk");
41+
42+
const deepgramClient = new DeepgramClient({
43+
apiKey: process.env.DEEPGRAM_API_KEY,
44+
});
45+
```
46+
47+
## Quick start — REST with analytics
48+
49+
From `examples/22-transcription-advanced-options.ts`:
50+
51+
```js
52+
const data = await deepgramClient.listen.v1.media.transcribeUrl({
53+
url: "https://dpgr.am/spacewalk.wav",
54+
model: "nova-3",
55+
language: "en",
56+
punctuate: true,
57+
paragraphs: true,
58+
utterances: true,
59+
smart_format: true,
60+
sentiment: true,
61+
topics: true,
62+
custom_topic: "custom_topic",
63+
custom_topic_mode: "extended",
64+
intents: true,
65+
custom_intent: "custom_intent",
66+
custom_intent_mode: "extended",
67+
detect_entities: true,
68+
detect_language: true,
69+
diarize: true,
70+
keyterm: ["keyword1", "keyword2"],
71+
redact: ["pci", "ssn"],
72+
});
73+
```
74+
75+
## Quick start — WSS subset
76+
77+
Start from `examples/07-transcription-live-websocket.ts` and keep the same socket flow, but only use WSS-supported intelligence flags such as `diarize`, `redact`, and `detect_entities` in the connection args.
78+
79+
```js
80+
const deepgramConnection = await deepgramClient.listen.v1.createConnection({
81+
model: "nova-3",
82+
diarize: true,
83+
redact: "pci",
84+
detect_entities: true,
85+
});
86+
```
87+
88+
## Key parameters / API surface
89+
90+
- Analytics flags: `summarize`, `topics`, `intents`, `sentiment`, `detect_language`, `detect_entities`, `diarize`, `redact`, `custom_topic`, `custom_topic_mode`, `custom_intent`, `custom_intent_mode`.
91+
- Standard STT flags still apply: `model`, `language`, `encoding`, `sample_rate`, `punctuate`, `smart_format`, `utterances`, `paragraphs`, `multichannel`.
92+
- Nova-3-specific biasing in repo examples uses `keyterm`, not `keywords`.
93+
94+
## API reference (layered)
95+
96+
1. **In-repo reference**: `reference.md``Listen V1 Media`; WSS subset behavior lives in `src/CustomClient.ts` and `src/api/resources/listen/resources/v1/client/{Client,Socket}.ts`.
97+
2. **Canonical OpenAPI (REST)**: https://developers.deepgram.com/openapi.yaml
98+
3. **Canonical AsyncAPI (WSS)**: https://developers.deepgram.com/asyncapi.yaml
99+
4. **Context7**: library ID `/llmstxt/developers_deepgram_llms_txt`
100+
5. **Product docs**:
101+
- https://developers.deepgram.com/docs/stt-intelligence-feature-overview
102+
- https://developers.deepgram.com/docs/summarization
103+
- https://developers.deepgram.com/docs/topic-detection
104+
- https://developers.deepgram.com/docs/intent-recognition
105+
- https://developers.deepgram.com/docs/sentiment-analysis
106+
- https://developers.deepgram.com/docs/language-detection
107+
- https://developers.deepgram.com/docs/redaction
108+
- https://developers.deepgram.com/docs/diarization
109+
110+
## Gotchas
111+
112+
1. **`summarize` on `/v1/listen` is versioned, not plain boolean.** The generated REST surface and examples point at `"v2"`.
113+
2. **Most intelligence flags are REST-only.** Current WSS connect args do not expose `topics`, `intents`, `sentiment`, `summarize`, or `detect_language`.
114+
3. **`redact` typing is looser in practice than in the generated alias.** Examples pass arrays like `["pci", "ssn"]`, even though `ListenV1Redact` itself is just a string alias.
115+
4. **Use `keyterm` for Nova-3 biasing.** `examples/22-transcription-advanced-options.ts` explicitly notes keywords are not supported for Nova-3.
116+
5. **Model/feature support is product-side.** `nova-3` is the safest choice when mixing many overlays.
117+
6. **Diarization quality depends on audio quality and duration.** Short or noisy clips churn speakers.
118+
119+
## Example files in this repo
120+
121+
- `examples/22-transcription-advanced-options.ts`
122+
- `examples/04-transcription-prerecorded-url.ts`
123+
- `examples/05-transcription-prerecorded-file.ts`
124+
- `examples/07-transcription-live-websocket.ts`
125+
126+
## Central product skills
127+
128+
For cross-language Deepgram product knowledge — the consolidated API reference, documentation finder, focused runnable recipes, third-party integration examples, and MCP setup — install the central skills:
129+
130+
```bash
131+
npx skills add deepgram/skills
132+
```
133+
134+
This SDK ships language-idiomatic code skills; `deepgram/skills` ships cross-language product knowledge (see `api`, `docs`, `recipes`, `examples`, `starters`, `setup-mcp`).
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
---
2+
name: deepgram-js-conversational-stt
3+
description: Use when writing or reviewing JavaScript/TypeScript in this repo that calls Deepgram Conversational STT v2 / Flux (`/v2/listen`) for turn-aware streaming transcription. Covers `client.listen.v2.createConnection()` / `connect()`, Flux models, and turn events like `TurnInfo`. Use `deepgram-js-speech-to-text` for standard v1 ASR and `deepgram-js-voice-agent` for full-duplex assistants. Triggers include "flux", "v2 listen", "conversational STT", "turn detection", "end of turn", "EOT", and "listen.v2".
4+
---
5+
6+
# Using Deepgram Conversational STT / Flux (JavaScript / TypeScript SDK)
7+
8+
Turn-aware streaming STT via `/v2/listen` for conversational audio and explicit turn events.
9+
10+
## When to use this product
11+
12+
- You need **turn-aware** transcription, not just a word stream.
13+
- You want Flux-style events like `TurnInfo` and `Connected`.
14+
- You are building a conversational interface but do **not** want the full Voice Agent runtime.
15+
16+
**Use a different skill when:**
17+
- You want general v1 transcription or prerecorded REST → `deepgram-js-speech-to-text`.
18+
- You want a hosted assistant with think + speak built in → `deepgram-js-voice-agent`.
19+
- You want analytics overlays like sentiment and summaries → `deepgram-js-audio-intelligence`.
20+
21+
## Authentication
22+
23+
```js
24+
require("dotenv").config();
25+
26+
const { DeepgramClient } = require("@deepgram/sdk");
27+
28+
const deepgramClient = new DeepgramClient({
29+
apiKey: process.env.DEEPGRAM_API_KEY,
30+
});
31+
```
32+
33+
## Quick start
34+
35+
From `examples/26-transcription-live-websocket-v2.ts`:
36+
37+
```js
38+
const deepgramConnection = await deepgramClient.listen.v2.createConnection({
39+
model: "flux-general-en",
40+
});
41+
42+
deepgramConnection.on("message", (data) => {
43+
if (data.type === "Connected") {
44+
console.log("Connected:", data);
45+
} else if (data.type === "TurnInfo") {
46+
console.log("Turn Info:", data);
47+
} else if (data.type === "FatalError") {
48+
deepgramConnection.close();
49+
}
50+
});
51+
52+
deepgramConnection.connect();
53+
await deepgramConnection.waitForOpen();
54+
55+
// Swap this for a live mic capture in real apps; the repo example uses
56+
// `createReadStream` over a sample file.
57+
const { createReadStream } = require("node:fs");
58+
const audioStream = createReadStream("samples/spacewalk.wav");
59+
60+
audioStream.on("data", (chunk) => {
61+
deepgramConnection.sendMedia(chunk);
62+
});
63+
64+
audioStream.on("end", () => {
65+
deepgramConnection.sendCloseStream({ type: "CloseStream" });
66+
});
67+
```
68+
69+
## Key parameters / API surface
70+
71+
- Connect args from `src/api/resources/listen/resources/v2/client/Client.ts`: `model`, `encoding`, `sample_rate`, `eager_eot_threshold`, `eot_threshold`, `eot_timeout_ms`, `keyterm`, `tag`, `mip_opt_out`.
72+
- Socket methods from `src/api/resources/listen/resources/v2/client/Socket.ts`: `sendMedia(...)`, `sendCloseStream(...)`, `sendListenV2Configure(...)`, `waitForOpen()`.
73+
- Custom wrapper additions from `src/CustomClient.ts`: `createConnection(...)` alias and Node-only `ping(...)` helper.
74+
75+
## Limitations
76+
77+
- The current generated `ListenV2Model` type only exposes `"flux-general-en"`.
78+
- Product docs mention broader Flux capabilities, but `flux-general-multi` / `language_hint` are **not** surfaced in this repo's generated types today.
79+
80+
## API reference (layered)
81+
82+
1. **In-repo reference**: `reference.md` does not currently document `listen.v2`; use `src/CustomClient.ts` and `src/api/resources/listen/resources/v2/client/{Client,Socket}.ts` as the in-repo source of truth.
83+
2. **Canonical OpenAPI (REST)**: https://developers.deepgram.com/openapi.yaml
84+
3. **Canonical AsyncAPI (WSS)**: https://developers.deepgram.com/asyncapi.yaml
85+
4. **Context7**: library ID `/llmstxt/developers_deepgram_llms_txt`
86+
5. **Product docs**:
87+
- https://developers.deepgram.com/reference/speech-to-text/listen-flux
88+
- https://developers.deepgram.com/docs/flux/quickstart
89+
- https://developers.deepgram.com/docs/flux/language-prompting
90+
91+
## Gotchas
92+
93+
1. **There is no REST path here.** This skill is `/v2/listen` WebSocket only.
94+
2. **Current repo typing only allows `flux-general-en`.** Treat multilingual Flux support as a product capability not yet reflected in this SDK surface.
95+
3. **Close with `sendCloseStream`, not `sendFinalize`.** Finalize is the v1 pattern.
96+
4. **`ping()` is Node-only.** `src/CustomClient.ts` throws in browsers because browser WS ping frames are not user-exposed.
97+
5. **`createConnection()` is lazy.** Call `connect()` after registering handlers.
98+
6. **The example explicitly warns about access/availability.** A 400 may mean your account or endpoint is not enabled yet, not that your socket code is wrong.
99+
7. **Omit `encoding` for containerized audio.** Keep it for raw PCM/Opus streams.
100+
101+
## Example files in this repo
102+
103+
- `examples/26-transcription-live-websocket-v2.ts`
104+
- `examples/27-deepgram-session-header.ts`
105+
106+
## Central product skills
107+
108+
For cross-language Deepgram product knowledge — the consolidated API reference, documentation finder, focused runnable recipes, third-party integration examples, and MCP setup — install the central skills:
109+
110+
```bash
111+
npx skills add deepgram/skills
112+
```
113+
114+
This SDK ships language-idiomatic code skills; `deepgram/skills` ships cross-language product knowledge (see `api`, `docs`, `recipes`, `examples`, `starters`, `setup-mcp`).
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
---
2+
name: deepgram-js-maintaining-sdk
3+
description: Use when regenerating this JavaScript/TypeScript SDK with Fern, editing `.fernignore`, preparing the repo for a generator release, reconciling hand-maintained files after regen, or deciding whether a file should be permanently frozen vs temporarily frozen. This SDK is Fern-generated - most files under `src/` should not be edited directly. Triggers include "fern regen", "regenerate SDK", ".fernignore", "unfreeze", "re-apply patches", "SDK regeneration", and "freeze classification".
4+
---
5+
6+
# Maintaining the Deepgram JavaScript / TypeScript SDK
7+
8+
This SDK is generated by [Fern](https://buildwithfern.com/). Most files under `src/` are auto-generated and should not be edited directly. Some files are hand-written or protected in `.fernignore` so Fern does not overwrite them.
9+
10+
When a new Fern generator release is available, prepare the repo so Fern can replace generated output, then re-apply any still-needed manual work after reviewing the diff.
11+
12+
## Freeze classification rules
13+
14+
Every entry in `.fernignore` falls into one of two categories. The comment above the entry is the first clue, but use these rules when in doubt.
15+
16+
### Never unfreeze (permanently frozen)
17+
18+
These files are entirely hand-written or repo-maintained. Fern should never own them.
19+
20+
How to identify:
21+
22+
- The file was created by Deepgram, not by Fern (`src/CustomClient.ts`, curated exports, helper scripts, hand-written tests).
23+
- The file is documentation, tooling, config, or examples managed outside generator output.
24+
- The file lives outside `src/api/` or deliberately wraps generated code.
25+
26+
Current permanently frozen entries from `.fernignore` / `AGENTS.md`:
27+
28+
- `src/CustomClient.ts` — custom wrapper for auth prefixing, session ID propagation, browser/Node WebSocket handling, reconnect behavior, binary message fixes, and `createConnection()` aliases
29+
- `src/index.ts` — curated re-exports with backwards-compatible namespace behavior
30+
- `scripts/fix-wire-test-imports.js`, `scripts/revert-wire-test-imports.js` — post-generation import fixups
31+
- `scripts/proxy-server.js` — development proxy
32+
- `scripts/validate-esm-build.mjs` — ESM build validation
33+
- `webpack.config.js` — browser bundle config
34+
- `tests/browser/` — browser-specific suite
35+
- `tests/esm-build.test.ts` — ESM validation test
36+
- `tests/unit/*` — hand-written unit tests
37+
- `tests/wire/websocket/` — hand-written websocket wire tests
38+
- `tests/wire/listen/v1/transcription.test.ts` — hand-written wire test
39+
- `vitest.config.mts` — test config
40+
- `Makefile` — developer command runner
41+
- `MIGRATION_GUIDE_V4_TO_V5.md` — migration docs
42+
- `README.md`, `CHANGELOG.md`, `docs/`, `examples/` — repo docs and examples
43+
- `.npmignore`, `.gitignore`, `.npmrc`, `.github/` — package/repo config
44+
- `CLAUDE.md`, `AGENTS.md`, `.claude/`, `.agents/`, `.mcp.json` — agent/tooling files
45+
46+
### Unfreeze for regen (temporarily frozen)
47+
48+
These are generated files with local patches. They stay frozen between regens, but should be temporarily swapped to `.bak` during a regen prep so Fern can overwrite the original path.
49+
50+
How to identify:
51+
52+
- Fern would recreate the file if it were removed.
53+
- Your current copy is a patched version of generator output, not a fully hand-written file.
54+
55+
Current temporarily frozen entries:
56+
57+
- **None right now.** `AGENTS.md` explicitly says all current `.fernignore` entries are permanently frozen.
58+
59+
If you patch a generated file in the future, add it to `.fernignore` with a comment explaining the patch and update this skill plus `AGENTS.md`.
60+
61+
## Prepare repo for regeneration
62+
63+
1. Create a branch from `main` named `lo/sdk-gen-<YYYY-MM-DD>`.
64+
2. Push it and open a PR titled `chore: SDK regeneration <YYYY-MM-DD>`.
65+
3. Read `.fernignore` and classify every entry.
66+
4. For each **temporarily frozen** file only:
67+
- copy it to `<filename>.bak` beside the original
68+
- replace the original path in `.fernignore` with the `.bak` path
69+
5. Leave permanently frozen entries untouched.
70+
6. Commit as `chore: unfreeze files pending regen` and push.
71+
72+
## After regeneration
73+
74+
1. Diff each `.bak` file against the newly generated original.
75+
2. Re-apply only the patches that are still needed.
76+
3. Change `.fernignore` entries from `.bak` back to the original path for files that still need freezing.
77+
4. Remove `.fernignore` entries entirely for files where the generator is now correct.
78+
5. Delete the `.bak` files.
79+
6. Run verification.
80+
7. Commit as `chore: re-apply manual patches after regen` and push.
81+
82+
## Verification commands
83+
84+
Repo guidance in `AGENTS.md` says:
85+
86+
```bash
87+
make build && make test && make lint
88+
```
89+
90+
Package scripts in `package.json` resolve to:
91+
92+
```bash
93+
pnpm build
94+
pnpm test
95+
pnpm lint
96+
pnpm check
97+
```
98+
99+
Relevant underlying commands today:
100+
101+
- `pnpm build``tsc --project ./tsconfig.cjs.json` + `tsc --project ./tsconfig.esm.json` + ESM rename script
102+
- `pnpm test``vitest`
103+
- `pnpm lint` / `pnpm check` → Biome lint/check
104+
105+
## JS-specific maintainer notes
106+
107+
1. **Do not edit most generated files under `src/api/` directly.** Prefer Fern input changes or post-regen patch review.
108+
2. **`src/CustomClient.ts` is the highest-risk permanent wrapper.** It carries auth prefixing, browser subprotocol auth, custom websocket startup, binary handling, and the user-facing `createConnection()` aliases used by examples.
109+
3. **The repo ships both CJS and ESM.** Validate both outputs after generator changes.
110+
4. **Browser behavior matters.** The wrapper intentionally diverges for browser WebSocket auth because browsers cannot send arbitrary socket headers.
111+
5. **`.agents/` is permanently frozen in `.fernignore`.** Treat these skills as hand-written documentation during regeneration; Fern will not touch the folder. Keep this note aligned with `AGENTS.md` whenever the frozen-file list changes.
112+
113+
## Source-of-truth note
114+
115+
`AGENTS.md` is the maintainer source of truth in this repo. Keep this skill aligned with it whenever the regeneration workflow or frozen-file list changes.

0 commit comments

Comments
 (0)