cli-context
Explains the CLI app architecture and capabilities. Use when working on CLI features, debugging CLI issues, or needing to understand the TTS pipeline, emotion annotation, or command flags.
Best use case
cli-context is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Explains the CLI app architecture and capabilities. Use when working on CLI features, debugging CLI issues, or needing to understand the TTS pipeline, emotion annotation, or command flags.
Teams using cli-context should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/cli-context/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How cli-context Compares
| Feature / Agent | cli-context | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Explains the CLI app architecture and capabilities. Use when working on CLI features, debugging CLI issues, or needing to understand the TTS pipeline, emotion annotation, or command flags.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Cartesia Download CLI - Architecture Reference
## Overview
テキストから Cartesia TTS API で音声を生成する CLI ツール。Claude LLM による感情アノテーション付き。
## Package Structure
```
apps/cli/src/
├── cli.ts # gunshi エントリポイント
├── types.ts # RawCliArgs, RcConfig, AppError
├── commands/
│ └── download.ts # download コマンド実装
└── core/
├── config.ts # 設定解決 (args → env → rc → defaults)
├── io.ts # ファイル I/O 抽象化 (neverthrow)
└── format-error.ts # ユーザー向けエラーメッセージ
packages/core/src/
├── types.ts # TtsConfig, TtsClient, TextAnnotator
├── pipeline.ts # TTS ストリーミングパイプライン
├── tts-client.ts # Cartesia API ラッパー
├── annotator.ts # アノテーターファクトリ
├── marker-parser.ts # [SEP] マーカーパーサー
├── wav.ts # WAV ヘッダービルダー
└── providers/
└── claude-annotator.ts # Claude 感情アノテーション
```
## Command: download
```bash
cartesia-download [flags]
```
| Flag | Short | Default | Description |
| -------------------- | ----- | -------------------------- | ------------------------ |
| `--text` | `-t` | — | 読み上げテキスト |
| `--input` | `-i` | — | テキストファイルパス |
| `--voice-id` | | — | Cartesia Voice ID (必須) |
| `--output` | `-o` | — | WAV 出力パス |
| `--model` | `-m` | `sonic-3` | TTS モデル ID |
| `--sample-rate` | | `44100` | サンプルレート (Hz) |
| `--provider` | | `claude` | LLM プロバイダー |
| `--provider-model` | | `claude-sonnet-4-20250514` | LLM モデル |
| `--provider-api-key` | | — | LLM API キー |
| `--no-annotate` | | `false` | 感情アノテーション無効化 |
## Data Flow
```
テキスト入力 (--text / --input ファイル)
↓
設定解決 (CLI args > env vars > .cartesiarc.json > defaults)
↓
[感情アノテーション] Claude が SSML タグ + [SEP] マーカーを挿入
↓
チャンクごとに Cartesia TTS API → PCM ストリーム → stdout
↓
[--output 指定時] WAV ファイル + アノテーション済みテキスト (.txt) 保存
```
## Emotion Annotation
Claude が以下の SSML タグをテキストに挿入する:
- `<emotion value="happy|sad|angry|excited|..."/>` — 感情
- `<speed ratio="0.5-1.0"/>` — 速度 (1.0 以下)
- `<volume ratio="0.5-2.0"/>` — 音量
使用可能な感情値: neutral, angry, excited, content, sad, scared, happy, curious, sarcastic, hesitant, confident, calm, surprised
`[SEP]` マーカーでチャンク分割し、チャンクごとに TTS API を呼ぶことでリアルタイムストリーミングを実現。
## Config Resolution Priority
1. **CLI args** (最優先)
2. **環境変数** (`CARTESIA_API_KEY`, `CARTESIA_VOICE_ID`, `ANTHROPIC_API_KEY`)
3. **RC ファイル** (`.cartesiarc.json` — ディレクトリを上方探索)
4. **デフォルト値** (model: sonic-3, sampleRate: 44100)
## Error Types
| Error | Cause |
| --------------------- | --------------------------- |
| `MissingApiKey` | CARTESIA_API_KEY 未設定 |
| `MissingVoiceId` | Voice ID 未指定 |
| `MissingText` | --text も --input も未指定 |
| `FileReadError` | 入力ファイル読み取り失敗 |
| `FileWriteError` | 出力ファイル書き込み失敗 |
| `TtsApiError` | Cartesia API エラー |
| `AnnotationError` | Claude API エラー |
| `UnsupportedProvider` | "claude" 以外のプロバイダー |
## Key Design Patterns
- **neverthrow**: 全ての I/O は `ResultAsync` でエラーハンドリング
- **DI**: `io`, `ttsClient`, `annotator` は外部注入 (テスタビリティ)
- **Streaming**: PCM チャンクを逐次 stdout に書き出し、リアルタイム再生可能
- **Immutable**: const only, 関数型パターンRelated Skills
extracting-ai-context
Extracts and manages AI context (skills, AGENTS.md) from workflow-kotlin library JARs. Use when setting up AI tooling for a workflow-kotlin project, updating skills after a library version change, or configuring agent-specific directories.
create-agent-with-sanity-context
Build AI agents with structured access to Sanity content via Context MCP. Covers Studio setup, agent implementation, and advanced patterns like client-side tools and custom rendering.
context-optimizer
Analyzes Copilot Chat debug logs, agent definitions, skills, and instruction files to audit context window utilization. Provides log parsing, turn-cost profiling, redundancy detection, hand-off gap analysis, and optimization recommendations. Use when optimizing agent context efficiency, identifying where to add subagent hand-offs, or reducing token waste across agent systems.
context-fundamentals
Understand the components, mechanics, and constraints of context in agent systems. Use when designing agent architectures, debugging context-related failures, or optimizing context usage.
context-engineering
Use when designing agent system prompts, optimizing RAG retrieval, or when context is too expensive or slow. Reduces tokens while maintaining quality through strategic positioning and attention-aware design.
context-degradation
Recognize patterns of context failure: lost-in-middle, poisoning, distraction, and clash
context-assembler
Assembles relevant context for agent spawns with prioritized ranking. Ranks packages by relevance, enforces token budgets with graduated zones, captures error patterns for learning, and supports configurable per-agent retrieval limits.
Codebase context
Create a lightweight codebase_context.md that anchors the idea in the existing repo (modules, constraints, extension points). Generic framework prompt.
agent-context-system
A persistent local-only memory system for AI coding agents. Two files, one idea — AGENTS.md (committed, shared) + .agents.local.md (gitignored, personal). Agents read both at session start, update the scratchpad at session end, and promote stable patterns over time. Works across Claude Code, Cursor, Copilot, Windsurf. Subagent-ready. No plugins, no infrastructure, no background processes.
add-route-context
为Flutter页面添加路由上下文记录功能,支持日期等参数的AI上下文识别。当需要让AI助手通过"询问当前上下文"功能获取页面状态(如日期、ID等参数)时使用。适用场景:(1) 日期驱动的页面(日记、活动、日历等),(2) ID驱动的页面(用户详情、订单详情等),(3) 任何需要AI理解当前页面参数的场景
localsetup-context
Localsetup v2 framework context - overview, invariants, and skills index. Load first when working in a repo that uses Localsetup v2. Use when starting work in this repo or when user asks about framework rules.
context7-skills
Use when a user asks to search, install, list, or remove skills with the Context7 ctx7 skills CLI (including npx ctx7) and needs correct subcommands or client flags.