# Xiaohongshu Comment

> Automate one-comment engagement on XiaoHongShu via mcporter + xiaohongshu-mcp. Use when the user asks to pick a random post from home recommendations and publish a comment, with dry-run preview, exclusion filters (for self/blocked users), and local rate-limit/history safeguards.

- Skill: `growvv/xiaohongshu-comment` (Agent Skill, multi-file: 5 files)
- Install (CLI): `npx skillmds@latest add growvv/xiaohongshu-comment`
- Raw SKILL.md: https://api.skillmd.com/api/skills/growvv/xiaohongshu-comment/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: growvv (https://skillmd.com/u/growvv)
- Updated: 2026-09-22
- Page: https://skillmd.com/skills/growvv/xiaohongshu-comment

---


# XiaoHongShu Comment

## Overview

Use this skill to post exactly one random comment to XiaoHongShu in each run.
Prefer dry-run first, then publish after confirming the selected post and comment text.

## Prerequisites

- `python3`
- `mcporter` (with a running `xiaohongshu-mcp` server)
- XiaoHongShu account already logged in

Quick dependency check:
- `scripts/check_dependencies.sh`

## Quick Workflow

1. Verify login:
   - `mcporter call "xiaohongshu.check_login_status()"`
2. Run dry-run selection first:
   - `scripts/random_home_comment.py --dry-run`
3. Publish one comment when preview looks good:
   - `scripts/random_home_comment.py --comment "your comment"`
4. Verify result:
   - Check CLI output for success, or inspect target feed manually.

## Main Script

Use:
- `scripts/random_home_comment.py`

Default behavior:
- Use `xiaohongshu.list_feeds()` to fetch home recommendations.
- Filter to commentable notes with `feed_id` + `xsec_token`.
- Pick one random post.
- Pick one random comment candidate.
- Post one comment via `xiaohongshu.post_comment_to_feed(...)`.
- Save local history to `~/.agent-reach/xiaohongshu-mcp/comment_history.json`.
- Enforce a minimum interval of 30 minutes between comments.
- Skip previously-commented feed IDs unless explicitly allowed.

## Recommended Commands

Dry run with fallback search keyword (useful when home feed capture fails):
- `scripts/random_home_comment.py --dry-run --fallback-search-keyword "AI"`

Post one fixed comment:
- `scripts/random_home_comment.py --comment "Great perspective, thanks for sharing."`

Use a comment pool file (one line per comment, `#` as comment line):
- `scripts/random_home_comment.py --comment-file ~/xhs_comments.txt`

Exclude your own account by nickname:
- `scripts/random_home_comment.py --exclude-nickname "your-nickname"`

Allow re-commenting old feed IDs and reduce interval:
- `scripts/random_home_comment.py --allow-repeat-feed --min-interval-minutes 5`

## Operational Rules

Apply these rules in every run:
- Post at most one comment per command execution.
- Run dry-run first unless the user clearly asks to post immediately.
- Keep comments human-like and context-relevant.
- Respect user-provided exclusions and interval settings.
- Stop and report if login is invalid or feed capture fails.

## Troubleshooting

`list_feeds()` returns no data:
- Retry once.
- If still failing, run with `--fallback-search-keyword`.
- If needed, restart `xiaohongshu-mcp` in non-headless mode and try again.

Not logged in:
- Run the login flow first (for example `xiaohongshu-login-darwin-arm64`), then retry.

Comment rejected or failed:
- Retry with a shorter, safer comment.
- Switch to dry-run to inspect selected feed and input values.

## Scripts

`scripts/random_home_comment.py`
- Randomly select and comment one post.
- Supports `--dry-run`, `--comment`, `--comment-file`, exclusion filters, interval control, history, and optional search fallback.

