Scripts2026年5月24日·1 分钟阅读

howdoi — Instant Coding Answers from the Command Line

Search Stack Overflow and programming documentation from your terminal and get concise code snippets without leaving your workflow.

Agent 就绪

Agent 可直接安装

这个资产可安装;Agent 先选择当前运行时、检查安装计划,再运行匹配命令。

Native · 98/100策略:允许
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Single
信任
信任等级:Established
入口
howdoi Overview
直接安装命令
npx -y tokrepo@latest install 4dd1c181-576b-11f1-9bc6-00163e2b0d79 --target codex

先 dry-run 确认安装计划,再运行此命令。

Introduction

howdoi fetches concise answers to programming questions directly from your terminal. It scrapes top-voted Stack Overflow responses and returns code snippets, saving developers from context-switching to a browser.

What howdoi Does

  • Answers free-form programming questions with code snippets from Stack Overflow
  • Returns the top-voted answer by default or all answers with the -a flag
  • Supports colorized output with syntax highlighting
  • Provides a REPL mode for interactive question sessions
  • Caches responses locally to speed up repeated queries

Architecture Overview

howdoi is a Python CLI that uses search engines to find relevant Stack Overflow threads, then parses the HTML to extract the highest-scored code blocks. It employs a local cache (file-based or optional Redis) to avoid repeated network calls. The tool can use Google, Bing, or DuckDuckGo as the search backend.

Self-Hosting & Configuration

  • Install via pip install howdoi or pipx install howdoi
  • Set HOWDOI_SEARCH_ENGINE to choose between google, bing, or duckduckgo
  • Configure cache directory with HOWDOI_CACHE environment variable
  • Use HOWDOI_COLORIZE=1 to enable syntax-highlighted output
  • Integrate into editors via the included Emacs and Vim plugins

Key Features

  • Answers returned as ready-to-paste code snippets
  • Multiple search engine backends for reliability
  • Local caching reduces latency for repeated lookups
  • Colorized terminal output with language detection
  • Importable as a Python library for programmatic use

Comparison with Similar Tools

  • cheat.sh — serves curated cheat sheets; howdoi searches live Stack Overflow answers
  • tldr-pages — short man-page alternatives for commands; howdoi answers arbitrary coding questions
  • Stack Overflow CLI — official SO search; howdoi extracts code snippets rather than full pages
  • ShellGPT — LLM-powered answers; howdoi uses proven human-written solutions from SO

FAQ

Q: Does howdoi require an API key? A: No. It uses web scraping to retrieve answers without authentication.

Q: How accurate are the answers? A: howdoi returns the top-voted Stack Overflow answer, which reflects community consensus but may not always fit your exact context.

Q: Can I use howdoi in scripts? A: Yes. Import it as a Python library with from howdoi import howdoi and call howdoi.howdoi(query).

Q: Does it support languages other than English? A: Queries work best in English since it searches English-language Stack Overflow.

Sources

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产