| name | xiaohongshu-publish-and-data |
| description | Publish Xiaohongshu image-notes by attaching to a logged-in Chrome via CDP (--cdp-url). Use when the user asks to 发布小红书图文, 上传小红书笔记, or validate creator login in CDP Chrome. |
Xiaohongshu Publish And Data
Language
Match the user's language.
Use This Skill For
- Publish a Xiaohongshu image-note from Markdown or explicit CLI inputs through CDP-attached real Chrome.
- Confirm the CDP Chrome session can reach the creator publish page.
Do not use this skill for password-based login automation, CAPTCHA bypass, QR automation, video publishing, scheduled publishing, draft-only workflows, or multi-account orchestration.
Runtime Requirement
Publishing requires a logged-in real Chrome started with remote debugging and --cdp-url.
Do not document or recommend publishing with only --state and a Playwright-launched browser. That path cannot reliably click the 发布 button on Xiaohongshu creator center.
Resolve Paths And Runtime
Determine this SKILL.md directory as {baseDir}. Use scripts from {baseDir}/scripts.
- Use
npx tsx if dependencies are already installed.
- Run
npm install inside {baseDir}/scripts only when dependencies are missing.
- Ask the user to install Node.js LTS only when Node.js is unavailable.
Choose The Workflow
- Publish image-note:
post-note.ts + --cdp-url
- Optional environment check:
check-environment.ts
Run one-time setup only when dependencies are missing or Chrome/CDP is not configured yet.
One-Time Setup
One-Time Setup Progress:
- [ ] Step 1: Install dependencies in {baseDir}/scripts
- [ ] Step 2: Install Google Chrome (not Playwright-only Chromium for publish)
- [ ] Step 3: Log in to https://creator.xiaohongshu.com/ in your Chrome profile
- [ ] Step 4: Learn the CDP launch command for your OS
- [ ] Step 5: Run one successful publish with --cdp-url
cd {baseDir}/scripts
npm install
npx tsx check-environment.ts
Start Chrome With CDP (required before every publish session)
Close all Chrome windows first, then start Chrome with remote debugging.
Windows (PowerShell):
& "C:\Program Files\Google\Chrome\Application\chrome.exe" `
--remote-debugging-port=9222 `
--user-data-dir="$env:LOCALAPPDATA\Google\Chrome\User Data"
macOS:
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome \
--remote-debugging-port=9222 \
--user-data-dir="$HOME/Library/Application Support/Google/Chrome"
Linux:
google-chrome \
--remote-debugging-port=9222 \
--user-data-dir="$HOME/.config/google-chrome"
Use a dedicated profile directory if your main Chrome profile is already open.
Optional environment variable instead of repeating the flag:
export XHS_CDP_URL=http://127.0.0.1:9222
Recurring Workflow: Publish Image-Note
Publish Workflow Progress:
- [ ] Step 1: Start logged-in Chrome with --remote-debugging-port=9222
- [ ] Step 2: Run post-note.ts with --file or explicit --images/--title/--note and --cdp-url
- [ ] Step 3: Confirm success from JSON output (POST web_api/sns/v2/note or success URL)
- [ ] Step 4: Report result files and warnings
Recommended command:
npx tsx {baseDir}/scripts/post-note.ts \
--file <note.md> \
--cdp-url http://127.0.0.1:9222
Rules:
- Pass Xiaohongshu-ready Markdown directly when using
--file.
- Do not convert long-form article Markdown into Xiaohongshu format inside this skill.
- Publishes immediately by clicking the red
发布 button via Chrome Accessibility + CDP; does not use 暂存离开.
- Xiaohongshu web drafts are browser-local and not supported.
- Note body must not be empty; if frontmatter has no body, the script uses the title as default description.
- If publish fails, inspect warnings (click method, validation toast) and the failure screenshot in
scripts/xhs-output/.
References
Content writing rules: ../guidance/writing/platform/xiaohongshu.md
Safety And Boundaries
- Do not ask for account password, SMS code, or login QR secrets in automation.
- Do not commit
.auth/, .chrome-cdp-profile/, or output artifacts into git.
--draft is ignored with a warning; this skill publishes directly.
- If Xiaohongshu introduces new required fields, stop after surfacing the missing selector or warning instead of guessing hidden values.