Agent skill

Xhs CLI

by jackwener in jackwener/xhs-cli

Headless-browser-based CLI skill for Xiaohongshu (小红书, RedNote, XHS) to search notes, read posts, browse profiles, like, favorite, comment, and publish from the terminal

Apache-2.0Auto-check: warningsProductivity & Automation

Install Xhs CLI

The automated check flagged lines worth reading first. See the safety section below.

skills CLI
$ npx skills add jackwener/xhs-cli --skill xhs-cli -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install jackwener/xhs-cli xhs-cli --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
xhs-cli
GitHub stars
663
Token cost
~1.1k tokens
SKILL.md length
195 words
Files
22 (incl. scripts)
Skills in repo
1
Repo updated
First seen
Licence
Apache-2.0

At a glance

Headless-browser-based CLI skill for Xiaohongshu (小红书, RedNote, XHS) to search notes, read posts, browse profiles, like, favorite, comment, and publish from the terminal

  • Tasks that involve Browser automation
  • SKILL.md covers Prerequisites, Authentication, Command Reference and JSON Output, plus 3 more sections
  • Runs Python and Shell scripts from its folder; calls jq, python3 and uv

What it does

Xhs CLI is an agent skill from jackwener/xhs-cli. Headless-browser-based CLI skill for Xiaohongshu (小红书, RedNote, XHS) to search notes, read posts, browse profiles, like, favorite, comment, and publish from the terminal

Its SKILL.md is about 1.1k tokens, which your agent loads only when the skill is triggered. The skill folder holds 25 other files, including scripts (for example `.github/workflows/ci.yml`, `.github/workflows/publish.yml` and `CHANGELOG.md`).

It sits in Productivity & Automation, covering Browser automation. It works with Xiaohongshu and Python. The repository describes itself as: 小红书命令行工具 — 搜索、阅读、点赞、收藏、评论,全在终端完成 | Xiaohongshu CLI. The licence is Apache-2.0.

When your agent uses it

  • Tasks that involve Browser automation

Example prompts

  • “/xhs-cli”

Requirements

  • Python 3
  • A Bash shell

What it can do on your machine

Read from SKILL.md and the folder at commit 3ce7141. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 1 file in scripts/ (Python and Shell, from the files we listed), which the agent can run.

    Shell commands in SKILL.md call:

    • jq
    • python3
    • uv

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • github.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Xhs CLI loads about 1.1k tokens when it runs. Until then it costs about 44 tokens; SKILL.md has 195 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~44
When it runs · the whole SKILL.md, loaded when a task matches
~1.1k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check: warnings

The automated check found patterns that need a careful read before installing.

  • WarningMentions a credentials file (SSH keys, cloud or package-manager tokens)SKILL.md:38
    gin                      # Auto-extract Chrome cookies
  • WarningMentions a credentials file (SSH keys, cloud or package-manager tokens)SKILL.md:42
    . If unavailable, it auto-detects local Chrome cookies via browser-cookie3. If extraction fails, QR code login is availa

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from jackwener/xhs-cli at commit 3ce7141, republished under its Apache-2.0 licence (© jackwener). 195 words, ~1,109 tokens.

Download SKILL.mdSave it as .claude/skills/xhs-cli/SKILL.md (or your agent's skills folder). This skill also uses 21 other files; get the full folder from GitHub.
name
xhs-cli
description
Headless-browser-based CLI skill for Xiaohongshu (小红书, RedNote, XHS) to search notes, read posts, browse profiles, like, favorite, comment, and publish from the terminal
author
jackwener
version
1.0.0
tags
xhs, xiaohongshu, 小红书, rednote, social-media, cli

[!NOTE] An alternative package xiaohongshu-cli is available, which uses a reverse-engineered API and runs faster. This package (xhs-cli) uses a headless browser (camoufox) approach — slower but more resilient against risk-control detection. Choose whichever best fits your needs.

xhs-cli Skill

A CLI tool for interacting with Xiaohongshu (小红书). Use it to search notes, read details, browse user profiles, and perform interactions like liking, favoriting, and commenting.

Prerequisites

bash
# Install (requires Python 3.8+)
uv tool install xhs-cli
# Or: pipx install xhs-cli

Authentication

All commands require valid cookies to function.

bash
xhs status                     # Check saved login session (no browser extraction)
xhs login                      # Auto-extract Chrome cookies
xhs login --cookie "a1=..."    # Or provide cookies manually

Authentication first uses saved local cookies. If unavailable, it auto-detects local Chrome cookies via browser-cookie3. If extraction fails, QR code login is available.

Command Reference

bash
xhs search "咖啡"              # Search notes (rich table output)
xhs search "咖啡" --json       # Raw JSON output
Read Note
bash
# View note (xsec_token auto-resolved from search cache)
xhs read <note_id>
xhs read <note_id> --comments  # Include comments
xhs read <note_id> --xsec-token <token>  # Manual token
xhs read <note_id> --json
User
bash
# Look up user profile (by internal user_id, hex format)
xhs user <user_id>
xhs user <user_id> --json

# List user's published notes
xhs user-posts <user_id>
xhs user-posts <user_id> --json

# Followers / Following
xhs followers <user_id>
xhs following <user_id>
Discovery
bash
xhs feed                       # Explore page recommended feed
xhs feed --json
xhs topics "旅行"              # Search topics/hashtags
xhs topics "旅行" --json
Interactions (require login)
bash
# Like / Unlike (xsec_token auto-resolved)
xhs like <note_id>
xhs like <note_id> --undo

# Favorite / Unfavorite
xhs favorite <note_id>
xhs favorite <note_id> --undo

# Comment
xhs comment <note_id> "好棒!"

# Delete your own note
xhs delete <note_id>
Favorites
bash
xhs favorites                  # List your favorites
xhs favorites --max 10         # Limit count
xhs favorites --json
Post
bash
xhs post "标题" --image photo1.jpg --image photo2.jpg --content "正文"
xhs post "标题" --image photo1.jpg --content "正文" --json
Account
bash
xhs status                     # Quick saved-session check
xhs whoami                     # Full profile info
xhs whoami --json
xhs login                      # Login
xhs logout                     # Clear cookies

JSON Output

Major query commands support --json for machine-readable output:

bash
xhs search "咖啡" --json | jq '.[0].id'           # First note ID
xhs whoami --json | jq '.userInfo.userId'          # Your user ID
xhs favorites --json | jq '.[0].displayTitle'      # First favorite title

Common Patterns for AI Agents

bash
# Get your user ID for further queries
xhs whoami --json | python3 -c "import sys,json; d=json.load(sys.stdin); print(d.get('userInfo',{}).get('userId',''))"

# Search and get note IDs (xsec_token auto-cached for later use)
xhs search "topic" --json | python3 -c "import sys,json; [print(n['id']) for n in json.load(sys.stdin)[:3]]"

# Check login before performing actions
xhs status && xhs like <note_id>

# Read a note with comments for summarization
xhs read <note_id> --comments --json

Error Handling

  • Commands exit with code 0 on success, non-zero on failure
  • Error messages are prefixed with ❌
  • Login-required commands show clear instruction to run xhs login
  • xsec_token is auto-resolved from cache; manual --xsec-token available as fallback

Safety Notes

  • Do not ask users to share raw cookie values in chat logs.
  • Prefer auto-extraction via xhs login over manual cookie input.
  • If auth fails, ask the user to re-login via xhs login.

© jackwener, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 21 other files (scripts) in the repository root of jackwener/xhs-cli.

  • SKILL.md
  • .github/workflows/ci.yml
  • .github/workflows/publish.yml
  • .gitignore
  • CHANGELOG.md
  • LICENSE
  • README.md
  • README_EN.md
  • pyproject.toml
  • scripts/smoke_local.sh
  • tests/conftest.py
  • tests/test_auth.py
  • tests/test_cli.py
  • tests/test_client.py
  • tests/test_integration.py
  • uv.lock
  • xhs_cli
  • … and 5 more

Open the folder on GitHubat commit 3ce7141

Compare with similar skills

Xhs CLI next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Xhs CLI compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Xhs CLI this skilljackwener/xhs-cli663—~1.1kAutomated safety check: WarnApache-2.0
Xiaohongshu HubOpenMinis/MinisSkills440—~2.7kAutomated safety check: PassMIT
Browser Automation Edge Casesaden-hive/hive11k—~1.8kAutomated safety check: PassMIT
Skyvern Browser AutomationSkyvern-AI/skyvern23k—~1.9kAutomated safety check: PassAGPL-3.0
AI Search Hubminsight-ai-info/AI-Search-Hub1.3k—~1.3kAutomated safety check: PassNone
Browser Use Terminalbrowser-use/terminal651—~2.1kAutomated safety check: PassMIT

Similar skills

  • Xiaohongshu Hub

    OpenMinis/MinisSkills

    Skill for reading and writing Xiaohongshu (XHS) data using Python + UV.

    440 GitHub stars~2.7k tokensUpdated 2 days ago
    Productivity & AutomationAuto-check passed
  • Step-by-step procedure for debugging browser automation failures on complex sites such as LinkedIn, Twitter/X, single-page apps and Shadow DOM pages.

    11k GitHub stars~1.8k tokensUpdated 23 days ago
    Productivity & AutomationAuto-check passed
  • Skyvern Browser Automation

    Skyvern-AI/skyvern

    Automates websites with Skyvern's AI browser agent to fill forms, extract data, download files, log in and run multi-step workflows through SDKs, REST, MCP or a CLI.

    23k GitHub stars~1.9k tokensUpdated today
    Productivity & AutomationAuto-check passed
  • AI Search Hub

    minsight-ai-info/AI-Search-Hub

    Run the AI Search Hub browser automation scripts for Yuanbao, LongCat, Doubao, Qwen, Gemini, Grok, and MiniMax.

    1.3k GitHub stars~1.3k tokensUpdated 5 mo ago
    Productivity & AutomationAuto-check passed
  • Browser Use Terminal

    browser-use/terminal

    Direct browser control via the Browser Use Terminal CLI. An agent skill from browser-use/terminal.

    651 GitHub stars~2.1k tokensUpdated 1 mo ago
    Productivity & AutomationAuto-check passed
  • Browser Tools

    981377660LMT/algorithm-study

    Interactive browser automation via Chrome DevTools Protocol.

    278 GitHub starsUsed in 1 repo~1.3k tokens
    Productivity & AutomationAuto-check passed

Questions about Xhs CLI

What does Xhs CLI do?

Headless-browser-based CLI skill for Xiaohongshu (小红书, RedNote, XHS) to search notes, read posts, browse profiles, like, favorite, comment, and publish from the terminal. Xhs CLI is an agent skill from jackwener/xhs-cli.

When should I use Xhs CLI?

Xhs CLI fits situations like: tasks that involve Browser automation.

How do I install Xhs CLI in Claude Code?

Run `npx skills add jackwener/xhs-cli --skill xhs-cli -a claude-code`. Or copy the skill folder (the jackwener/xhs-cli repository) into .claude/skills/xhs-cli in your project. Claude Code loads it when a task matches its description.

How do I install Xhs CLI in Codex?

Run `npx skills add jackwener/xhs-cli --skill xhs-cli -a codex`. Or copy the skill folder (the jackwener/xhs-cli repository) into .agents/skills/xhs-cli in your project. Codex loads it when a task matches its description.

Can I use Xhs CLI in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add jackwener/xhs-cli --skill xhs-cli -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/xhs-cli, .gemini/skills/xhs-cli, .github/skills/xhs-cli and .opencode/skills/xhs-cli in your project.

What does Xhs CLI need to run?

Going by SKILL.md and its folder, Xhs CLI needs Python and a shell for the scripts in its folder and the command-line tools its instructions call (jq, python3 and uv). Our summary lists: Python 3; A Bash shell.

Does Xhs CLI access the network?

SKILL.md names 1 domain. As links in the text: github.com. This is read from the text; nothing was executed.

Is Xhs CLI safe to install?

Our automated static check of SKILL.md flagged 2 warning(s): mentions a credentials file (ssh keys, cloud or package-manager tokens). Read the flagged lines before installing; the check is not a guarantee either way. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Xhs CLI use?

Xhs CLI is published under the Apache-2.0 licence (from the LICENSE file in the skill folder). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Xhs CLI use?

About 1.1k tokens (SKILL.md is roughly 4.4k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Xhs CLI?

Skills that share tags, products or a category with Xhs CLI: Xiaohongshu Hub (OpenMinis/MinisSkills, 440 stars), Browser Automation Edge Cases (aden-hive/hive, 11k stars), Skyvern Browser Automation (Skyvern-AI/skyvern, 23k stars) and AI Search Hub (minsight-ai-info/AI-Search-Hub, 1.3k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Xhs CLI?

jackwener (a GitHub user) maintains it in jackwener/xhs-cli, which has 663 GitHub stars. The repository was last updated on March 14, 2026.

Source: jackwener/xhs-cli on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.