SuperAPI AI Directory

sn-search-code

Coding & development

View repository

Updated 10-16 03:11

About this skill

sn-search-code - Developer Search

Credential Configuration

API keys, tokens, and cookies are uniformly recommended to be written in the repository root directory .env(refer to .env.example), and loaded by the runtime or user as environment variables with the same names before execution. Scripts still only read credentials from environment variables or explicit CLI parameters; do not write real keys into skill payloads, reports, logs, or commits.

Search four core developer platforms: GitHub, Stack Overflow, Hacker News, and HuggingFace. All scripts can be used without an API key, except for GitHub --type code search (see the explanation below).

Available Scripts

Script Platform Purpose API Key
github_search.py GitHub Repository, code, Issue search code typeRequired; other types optional (increases rate limit)
stackoverflow_search.py Stack Overflow Technical Q&A search Not required
hackernews_search.py Hacker News Technical news and discussions Not required
huggingface_search.py HuggingFace Model, dataset, Space search Optional HF_TOKEN(increases rate limit)

Dependencies

On first run or when a script prompts that a library is missing, use this skill's dependency list to install into the current Python environment:

python3 -m pip install -r requirements.txt

Do not automatically install dependencies inside scripts. If installation fails, the network is unavailable, or the package is unavailable, stop using the corresponding script and switch to web search, explaining that dependencies are missing.

Parameter Description

github_search.py

python3 scripts/github_search.py <query> [选项]
Parameter Description Default Value
query Search keywords (required) —
--limit, -n Number of results to return 10
--type, -t Search type:repositories, code, issues, repo, issue repositories
--token GitHub Token (can also be set via the GITHUB_TOKEN environment variable) —

Note:--type code must provide a token.
The GitHub API enforces authentication for the code search endpoint; if no token is provided, it returns 401.
repositories and issues types do not require a token, but having a token can increase the rate limit (unauthenticated 10 requests/minute → authenticated 30 requests/minute).

python3 scripts/github_search.py "machine learning framework" --type repositories --limit 5
python3 scripts/github_search.py "import asyncio" --type code --token ghp_xxx --limit 5
# 或通过环境变量:
GITHUB_TOKEN=ghp_xxx python3 scripts/github_search.py "import asyncio" --type code --limit 5

stackoverflow_search.py

python3 scripts/stackoverflow_search.py <query> [选项]
Parameter Description Default Value
query Search keywords (required) —
--limit, -n Number of results to return 10
--sort Sort method:relevance, votes, creation, activity relevance
--tagged Filter by tags, separate multiple with semicolons (e.g. python;asyncio) —
--api-key Stack Exchange API key (can also be set via the SO_API_KEY environment variable, optional, increases rate limit) —
python3 scripts/stackoverflow_search.py "python async await" --limit 5
python3 scripts/stackoverflow_search.py "rust lifetime" --sort votes --tagged rust --limit 10

huggingface_search.py

python3 scripts/huggingface_search.py <query> [选项]
Parameter Description Default Value
query Search keywords (required) —
--limit, -n Number of results to return 10
--type, -t Search type:models, datasets, spaces(and alias model, dataset, space) models
--token HuggingFace Token (can also be set via the HF_TOKEN environment variable, optional, increases rate limit) —
python3 scripts/huggingface_search.py "bert" --type models --limit 5
python3 scripts/huggingface_search.py "text classification" --type datasets --limit 5
python3 scripts/huggingface_search.py "stable diffusion" --type spaces --limit 5

hackernews_search.py

python3 scripts/hackernews_search.py <query> [选项]
Parameter Description Default Value
query Search keywords (required) —
--limit, -n Number of results to return 10
--sort Sort method:relevance, date relevance
--tags HN tag filter:story, comment, ask_hn, show_hn —
python3 scripts/hackernews_search.py "LLM agents" --limit 10
python3 scripts/hackernews_search.py "GPT-5" --sort date --tags story --limit 5

Output Format

All scripts output standard JSON:

{
  "success": true,
  "query": "...",
  "provider": "github|stackoverflow|hackernews",
  "items": [
    {"title": "...", "url": "...", "snippet": "...", ...}
  ],
  "error": null
}