smartquote
$ npm i smartquoteWhat are smart quotes?
Smart quotes are the curly or sloped quotation marks used in typography. Straight "dumb" quotes are a typewriter-era limitation and shouldn’t be used in user-facing text.
| Type | Dumb | Smart |
|---|---|---|
| Double quotes | " " | “ ” |
| Single quotes | ' ' | ‘ ’ |
Why this exists
Some LLMs (all Anthropic models, for instance) are incapable of outputting smart quotes, even when explicitly asked—and Anthropic has confirmed this won’t be fixed anytime soon. This package provides a streaming transform for AI output and an ESLint rule/autofix for vibe-coded JSX/TSX.
Usage
Vercel AI SDK
import { streamText } from "ai";
import { anthropic } from "@ai-sdk/anthropic";
import { smartQuoteTransform } from "smartquote/ai-sdk";
const result = streamText({
model: anthropic("claude-sonnet-4-5"),
prompt: "How do I print Hello World in JS?",
experimental_transform: smartQuoteTransform(),
});TransformStream
import { smartQuoteTransform } from "smartquote";
const response = await fetch("/api/stream");
const transformed = response.body
.pipeThrough(new TextDecoderStream())
.pipeThrough(smartQuoteTransform());AsyncIterable
import { smartQuoteAsyncIterable } from "smartquote";
for await (const chunk of smartQuoteAsyncIterable(stream)) {
process.stdout.write(chunk);
}ESLint plugin
// eslint.config.js
import { plugin } from 'smartquote/eslint';
export default [{
plugins: { smartquote: plugin },
rules: { 'smartquote/smart-quotes': 'error' }
}];