davidortinau/maui-skills/maui-speech-to-text

Claude Code and agent skill by davidortinau/maui-skills

Trust tier 3
  • community
  • ext:[{"type":"plugin","description":"Custom plugin integration"}]
Source check pending

Checking that the SKILL.md file is still in the repository.

Add speech-to-text voice input to .NET MAUI apps using CommunityToolkit.Maui. Covers speech recognition, microphone permissions, and hands-free text entry. Works with any UI pattern (XAML/MVVM, C# Markup, MauiReactor). USE FOR: "speech to text", "voice input", "speech recognition", "microphone input", "voice command", "dictation", "SpeechToText", "hands-free text", "transcribe speech". DO NOT USE FOR: text-to-speech output (different feature), media playback (use maui-media-picker), or general permissions (use maui-permissions).

Install

npx vskill@latest install davidortinau/maui-skills/maui-speech-to-text

Semi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard

SKILL.md

Speech-to-Text — Gotchas & Best Practices

For full service implementation, types, and UI integration patterns, see references/speech-to-text-api.md.

Critical: Permission Handling

Always request permissions before starting speech recognition. Both microphone and speech permissions are required.

csharp
// ❌ Starting recognition without checking permissions
var result = await _speechService.StartListeningAsync();
// ✅ Always check permissions first
if (!await _speechService.RequestPermissionsAsync())
return; // Gracefully handle denial
var result = await _speechService.StartListeningAsync(cancellationToken);
⚠️ iOS Requires Both Permission Descriptions

Missing either NSSpeechRecognitionUsageDescription or NSMicrophoneUsageDescription in Info.plist will cause a runtime crash — not a graceful failure.

⚠️ Android: Permission Re-prompt

On Android, if the user denies the RECORD_AUDIO permission twice, the OS stops showing the prompt. You must guide users to Settings manually.

Common Mistakes

❌ No Timeout — Indefinite Listening

Always set a timeout to prevent indefinite listening sessions that drain battery:

csharp
// ❌ No timeout — listens forever if no speech detected
await _speechToText.StartListenAsync(options, CancellationToken.None);
// ✅ Use a combined timeout + user cancellation token
using var timeoutCts = new CancellationTokenSource(TimeSpan.FromSeconds(60));
using var combinedCts = CancellationTokenSource.CreateLinkedTokenSource(
userCancellationToken, timeoutCts.Token);
await _speechToText.StartListenAsync(options, combinedCts.Token);
❌ Not Unsubscribing Event Handlers

Leaking event subscriptions causes duplicate processing and memory leaks:

csharp
// ❌ Subscribe without unsubscribe
_speechToText.RecognitionResultUpdated += OnRecognitionResultUpdated;
// ✅ Always unsubscribe in finally block
try
{
_speechToText.RecognitionResultUpdated += OnRecognitionResultUpdated;
// ... listen ...
}
finally
{
_speechToText.RecognitionResultUpdated -= OnRecognitionResultUpdated;
}
❌ Not Disposing CancellationTokenSource
csharp
// ❌ Leaked CTS
_currentCts = new CancellationTokenSource();
// ✅ Dispose in finally
try { /* ... */ }
finally
{
_currentCts?.Dispose();
_currentCts = null;
}

Platform Pitfalls

PlatformPitfall
iOSMissing either plist key → runtime crash
AndroidUser denies permission twice → OS stops prompting; must redirect to Settings
AllNo timeout → battery drain from indefinite listening
AllCalling StartListeningAsync while already listening → returns error, not exception

Architecture Tips

  1. Wrap `ISpeechToText` in a service — Don't use SpeechToText.Default directly in ViewModels. Wrap in ISpeechRecognitionService for testability and state management.
  1. Use partial results for UX — Subscribe to PartialResultReceived for live transcription feedback. Users expect to see words appear as they speak.
  1. Continuous listening = loop with delay — Loop StartListeningAsync with small delays (Task.Delay(100)) for conversation mode.
  1. Guard against double-start — Check state before starting:

``csharp if (State == SpeechRecognitionState.Listening) return new SpeechRecognitionResultDto { Success = false, ErrorMessage = "Already listening" }; ``

  1. Natural language output — CommunityToolkit.Maui returns normalized, punctuated text — not raw phonemes. No post-processing needed for basic use cases.
  1. UI-agnostic service — The ISpeechRecognitionService pattern works identically with XAML/MVVM, C# Markup, and MauiReactor. See references/speech-to-text-api.md for all three patterns.

Checklist

  • [ ] CommunityToolkit.Maui NuGet installed (look up current version)
  • [ ] UseMauiCommunityToolkit() called in MauiProgram.cs
  • [ ] ISpeechToText registered as singleton via DI
  • [ ] iOS: Both NSSpeechRecognitionUsageDescription and NSMicrophoneUsageDescription in Info.plist
  • [ ] Android: RECORD_AUDIO permission in AndroidManifest.xml
  • [ ] Permissions checked before every StartListeningAsync call
  • [ ] Timeout configured (recommend 60 seconds max)
  • [ ] Event handlers unsubscribed in finally blocks
  • [ ] CancellationTokenSource disposed after use

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
107
Repository forks
16
7-day trend score
23

Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 4 Apr 2026, 7 months ago.

Extension points

  • pluginCustom plugin integration

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/davidortinau/maui-skills/maui-speech-to-text/badge)](https://verified-skill.com/skills/davidortinau/maui-skills/maui-speech-to-text)

Something wrong with this skill or its page? Tell us.