@jakevin7: 今天偶然间又翻到了@yetone 之前的 构建 typeless 的 prompt, 真的是很精髓。 细细品味了下,有一点提示词即是 harness 的感觉。 里面包含了个人对于项目边界的约束和对项目整个的设计。没有多余的废话,但是把该约…
摘要
分享了一个基于Claude生成的macOS菜单栏语音输入应用的源码Prompt,该Prompt详细描述了应用的功能需求,体现了高效的Prompt设计。
查看缓存全文
缓存时间: 2026/06/26 08:07
今天偶然间又翻到了@yetone 之前的 构建 typeless 的 prompt, 真的是很精髓。 细细品味了下,有一点提示词即是 harness 的感觉。 里面包含了个人对于项目边界的约束和对项目整个的设计。没有多余的废话,但是把该约束的细节都约束到了。
https://github.com/yetone/voice-input-src/blob/master/README_CN.md…
yetone/voice-input-src
Source: https://github.com/yetone/voice-input-src
中文 | English
Source Code
claude \
--dangerously-skip-permissions \
--output-format=stream-json \
--verbose \
-p "Please implement a macOS menu-bar voice input app (Swift, macOS 14+) with the following requirements:
1. Hold the Fn key to record, release to inject the transcribed text into the currently focused input field. Use streaming transcription (Apple Speech Recognition framework) as preferred approach. Monitor Fn key globally via CGEvent tap, suppressing the Fn event to prevent triggering the emoji picker.
2. Default language must be Simplified Chinese (zh-CN), ensuring Chinese input recognition works out of the box. Also provide language switching options in the menu bar (English, Simplified Chinese, Traditional Chinese, Japanese, Korean). Language selection is stored in UserDefaults.
3. While recording, display an elegant frameless capsule-shaped floating window centered at the bottom of the screen — no traffic lights or titlebar. Use NSPanel (nonactivatingPanel) + NSVisualEffectView (.hudWindow material), sufficient height (56px, corner radius 28px), containing:
- 5 vertical bar waveform animation on the left (44×32px), driven by real-time audio RMS levels (no hardcoded fake animations) — louder speech produces larger waveforms, quiet moments produce smaller ones. Bar weights are [0.5, 0.8, 1.0, 0.75, 0.55] creating a natural center-high, sides-low effect. Smooth envelope (attack 40%, release 15%), add ±4% random jitter per bar for organic feel. Waveforms should be large enough to be clearly visible.
- Text label on the right (elastic width 160-560px) showing real-time transcription, capsule elastically widens as text grows
- Entry spring animation (0.35s), text width smooth transition (0.25s), exit scale animation (0.22s)
4. Text injection uses clipboard + simulated Cmd+V paste. Before injection, detect the current input method: if it is a CJK input method, temporarily switch to an ASCII input source (ABC/US keyboard) before pasting, then restore the original input method after paste completes — this prevents CJK input methods from intercepting Cmd+V. Restore original clipboard contents after injection.
5. Integrate LLM to improve speech recognition accuracy, especially for mixed Chinese-English scenarios. Use an OpenAI-compatible API (configurable API Base URL, API Key, Model) to refine transcribed text. The LLM system prompt must be very conservative in corrections: only fix obvious speech recognition errors (e.g., Chinese homophone errors, English technical terms mistakenly converted to Chinese like 配森→Python, 杰森→JSON). Never rewrite, polish, or remove any content that appears correct — if the input looks correct, return it as-is.
6. Provide an LLM Refinement submenu in the menu bar with an enable/disable toggle and a Settings entry. The Settings window contains three input fields: API Base URL, API Key, Model — the API Key field must support being fully cleared — plus Test and Save buttons. After releasing Fn, if LLM is enabled and configured, the floating window shows a Refining... status, waiting for the LLM response before injecting the final text.
7. The app runs in LSUIElement mode (menu bar icon only, no Dock icon). Build with Swift Package Manager, provide a Makefile (build/run/install/clean), build output is a signed .app bundle."
Dist
https://github.com/yetone/voice-input-dist
相似文章
@berryxia: 兄弟们,想认真学提示词工程,周末花这 25 分钟是非常值得! 这个就是来自于 Anthropic 官方的 Prompting 101 课程,带你从零搭建一个能落地的 prompt 任务: 1. 语气背景 2. XML 结构 3. Few-…
Anthropic 官方推出的 Prompting 101 课程,系统讲解如何从零构建实用 prompt,涵盖语气背景、XML 结构、Few-shot 示例、输出格式化和预填充等核心技巧。
@leanxbt: https://x.com/leanxbt/status/2070852461494202609
一篇详细介绍Loop Prompt Engineering的文章,这是一种通过基于数据集评估迭代重写提示来自动化提示优化的方法,重点强调避免递归陷阱。
@Mikocrypto11: 大多数人以为 prompting 只是把句子写得更好 Anthropic 这个 32 分钟 workshop 讲的是另一件事: 为什么这完全不够 它拆的不是 prompt hacks 不是“act as” 也不是又一个 $300 的课程 …
Anthropic 的一个 32 分钟 workshop 强调,好的 prompt 不是单句技巧,而是一套可测试、可改进的工作流,涉及目标设定、边界定义、自我检查与边缘情况处理。
@Soranlan: https://x.com/0xCodez/status/2057916333396816330/video/1… 这半小时免费公开课,含金量碾压一堆天价 prompt engineering 课程。 核心不是教你怎么把 prompt 写…
这半小时免费公开课(Anthropic Prompting Playbook)强调工程化判断,包括控制案例、边缘测试和人机接管,比昂贵课程更有价值。
@RealCodedAlpha: 看完这张疑似 Anthropic 内部优化的 Fable 5 Prompt 结构,我才意识到:大多数人写 Prompt,其实一开始方向就错了! 很多人以为好 Prompt = 更长、更复杂、更多技巧、更多角色设定。 但这张图给出的结构非常…
这篇推文介绍了一种源自Anthropic内部优化的Fable 5 Prompt结构,强调写提示词时应聚焦于目标、边界和验收标准,而不是冗长的指令,尤其对于更强的模型(如Claude、Codex)应避免教模型如何思考。