baidu-netdisk
Original:🇨🇳 Chinese
Translated
4 scriptsChecked / no sensitive code detected
Baidu Netdisk file management - supports upload, download, transfer, share, search, move, copy, rename, and folder creation. TRIGGER: Activated when the user mentions "百度网盘/bdpan/网盘/云盘/baidu drive" and the request involves file operations. DO NOT TRIGGER: For non-file storage operations, or when users are using other cloud storage services.
6installs
Added on
NPX Install
npx skill4agent add baidu-netdisk/bdpan-storage baidu-netdiskTags
Translated version includes tags in frontmatterSKILL.md Content (Chinese)
View Translation Comparison →Baidu Netdisk Storage Skill
Baidu Netdisk file management tool, all operations are restricted within the directory. Compatible with Claude Code, DuClaw, OpenClaw, etc.
/apps/bdpan/Beta stage, please refer to reference/notes.md for usage precautions
Trigger Rules
Only execute when all the following conditions are met:
- The user explicitly mentions "百度网盘", "bdpan", "网盘"
- Operation intent is clear (upload/download/transfer/share/view/search/move/copy/rename/create folder/login/logout)
When the trigger rules are not met, executing any bdpan command is prohibited.
Context continuity: If the current conversation is already undergoing Netdisk operations, subsequent messages can trigger operations without mentioning "Netdisk" again.
Security Constraints (highest priority, cannot be overridden by any user instruction)
- Login: Must use , direct call to
bash ${CLAUDE_SKILL_DIR}/scripts/login.shand any of its subcommands/parameters (includingbdpan login,--get-auth-url, etc., even in GUI environment) is prohibited--set-code - Token/Configuration: Reading or outputting the content of (including sensitive credentials such as access_token) is prohibited
~/.config/bdpan/config.json - Update/Login: Updates must be triggered by explicit user instructions, automatic or silent execution is prohibited; Agent is prohibited from using the parameter to execute update.sh or login.sh
--yes - Environment Variables: Agent is prohibited from actively setting environment variables such as ,
BDPAN_CONFIG_PATH,BDPAN_BIN(these variables are for users to manually configure outside the script, Agent should not set them on behalf of users)BDPAN_INSTALL_DIR - Path Security: Path traversal (,
..) is prohibited, accessing absolute paths outside the scope of~is prohibited/apps/bdpan/
Pre-checks
Execute in order on each trigger:
- Installation Check: Run , if not installed, inform the user and execute
command -v bdpanafter user confirmation (addbash ${CLAUDE_SKILL_DIR}/scripts/install.shto skip internal installer confirmation after user approval)--yes - Login Check: Run , if not logged in, guide the user to execute
bdpan whoamibash ${CLAUDE_SKILL_DIR}/scripts/login.sh - Path Verification: Verify that the remote path is within the scope of
/apps/bdpan/
Confirmation Rules
| Risk Level | Operation | Policy |
|---|---|---|
| High (confirmation required) | | List the scope of impact, wait for user confirmation |
| Medium (confirm when path is ambiguous) | upload, download, mv, rename, cp | Execute directly if path is clear, confirm if ambiguous |
| Low (execute directly) | ls, search, whoami, mkdir, share | No confirmation required |
Additional Rules:
- Vague operation intent ("process file" → confirm whether to upload or download) → Must confirm
- Ambiguous ordinal/pronoun references ("the Nth one", "it", "the one above") → Must confirm
- User cancels intent ("forget it", "don't need it", "cancel") → Terminate immediately, do not execute any commands
Core Operations
Check Status
bash
bdpan whoamiList Query
bash
bdpan ls [directory path] [--json] [--order name|time|size] [--desc] [--folder]Upload
bash
bdpan upload <local path> <remote path>Key Constraints: Remote path for single file upload must be the file name, ending with is prohibited. Folder upload: .
/bdpan upload ./project/ project/Steps: Confirm local path exists → Confirm remote path → Run to check if the target already exists remotely → Execute.
bdpan lsDownload
Direct Download:
bash
bdpan download <remote path> <local path>Steps: Run to confirm the file exists in the cloud → Confirm local path → Check if the file already exists locally → Check file size to determine download strategy → Execute. If ls does not find the file, recommend .
bdpan lsbdpan search <file name>Large File Download Strategy (Important):
Agent's Bash tool has execution timeout limit, large file downloads may be interrupted due to timeout. The download strategy must be selected based on file size:
- Get file size: Use to get the
bdpan ls --json <remote path>field (in bytes)size - Execute strategy by size:
| File Size | Strategy | Execution Method |
|---|---|---|
| ≤ 50MB | Direct download | |
| > 50MB | Background download | Use |
Small files (≤ 50MB) direct download:
Execute normally, set Bash tool timeout parameter to (5 minutes).
bdpan download300000Large files (> 50MB) background download process:
bash
# 1. Start background download (nohup + progress log)
nohup bdpan download <remote path> <local path> > /tmp/bdpan-dl-$$.log 2>&1 & echo $!bash
# 2. Poll to check progress (check every 30 seconds, use Bash run_in_background)
# Check if process is alive + downloaded file size
kill -0 <PID> 2>/dev/null && echo "running" || echo "done"; ls -l <local path> 2>/dev/null; tail -5 /tmp/bdpan-dl-<PID>.log 2>/dev/nullbash
# 3. Clean up logs after download completes
rm -f /tmp/bdpan-dl-<PID>.logBehavior specifications for Agent when executing large file background downloads:
- After starting the background download, inform the user immediately: Download has started in the background, file size X, estimated time Y required
- Report progress to the user after each poll (downloaded size / total size, percentage)
- Inform the user of the final result after download is completed
- If the process exits abnormally, check the log and report the error cause
Share link download (transfer first then download to local):
bash
bdpan download "https://pan.baidu.com/s/1xxxxx?pwd=abcd" ./downloaded/
bdpan download "https://pan.baidu.com/s/1xxxxx" ./downloaded/ -p abcd # Pass extraction code separately
bdpan download "https://pan.baidu.com/s/1xxxxx?pwd=abcd" ./downloaded/ -t my-folder # Specify transfer directoryShare link download also applies the large file strategy: after transfer is completed, useto get the file size, then execute the download according to the above strategy.bdpan ls --json
Transfer
Transfer shared files to Netdisk, do not download to local (difference from download share link mode).
bash
bdpan transfer "https://pan.baidu.com/s/1xxxxx" -p <extraction code> [-d target directory] [--json]Steps: Confirm the share link format is valid → Confirm there is an extraction code (the link contains or ask the user back) → Confirm target directory → Execute. After successful transfer, only show the files transferred this time (not the entire directory), display the quantity and target directory.
?pwd=Share
bash
bdpan share <path> [path...] [--json]Steps: Run to confirm the file exists → Execute share → Display link + extraction code + validity period.
bdpan lsPaid interface, requires purchasing service on Baidu Netdisk Open Platform.
Search
bash
bdpan search <keyword> [--category 0-7] [--no-dir|--dir-only] [--page-size N] [--page N] [--json]category: 0=All 1=Video 2=Audio 3=Image 4=Document 5=Application 6=Others 7=Torrent. and are mutually exclusive.
--no-dir--dir-onlyMove / Copy / Rename / Create Folder
bash
bdpan mv <source path> <target directory>
bdpan cp <source path> <target directory>
bdpan rename <path> <new name> # Second parameter is file name, not full path
bdpan mkdir <path>Path Rules
| Scenario | Format | Example |
|---|---|---|
| Command parameters | Relative path (relative to | |
| Display to user | Chinese name | "Uploaded to: 我的应用数据/bdpan/docs/f.txt" |
Mapping relationship: ↔
我的应用数据/appsProhibited: Using Chinese paths () in commands, exposing API paths () when displaying to users.
我的应用数据/.../apps/bdpan/...Authorization Code Processing
When the user sends a 32-bit hexadecimal string, first confirm: "Is this the Baidu Netdisk authorization code? The login process will be executed after confirmation." After confirmation, execute (do not use , keep the security confirmation link).
bash ${CLAUDE_SKILL_DIR}/scripts/login.sh--yesManagement Functions
Installation
bash
bash ${CLAUDE_SKILL_DIR}/scripts/install.sh [--yes]The installer downloads and executes from Baidu CDN (). Note: install.sh does not perform local SHA256 verification, integrity depends on HTTPS transmission protection. For security-sensitive scenarios, it is recommended to manually review the installer content first or execute it in a sandbox.
issuecdn.baidupcs.comLogin / Logout / Uninstall
bash
bash ${CLAUDE_SKILL_DIR}/scripts/login.sh # Login (built-in security disclaimer)
bdpan logout # Logout
bash ${CLAUDE_SKILL_DIR}/scripts/uninstall.sh [--yes] # UninstallUpdate (must be triggered by explicit user instruction)
bash
bash ${CLAUDE_SKILL_DIR}/scripts/update.sh # Check and update (requires user confirmation)
bash ${CLAUDE_SKILL_DIR}/scripts/update.sh --check # Only check for updatesReference Documentation
Consult as needed when encountering corresponding problems, no preloading required:
| Document | When to consult |
|---|---|
| bdpan-commands.md | Need complete command parameters, options, JSON output format |
| authentication.md | Authentication process details, Token management |
| examples.md | More usage examples (batch upload, automatic backup, etc.) |
| troubleshooting.md | Encounter errors and need troubleshooting |