Baidu Netdisk Storage Skill
Baidu Netdisk file management tool, all operations are restricted within the
directory. Compatible with Claude Code, DuClaw, OpenClaw, etc.
In closed beta phase, see reference/notes.md for usage precautions
Trigger Rules
Execution is only performed when the following conditions are met at the same time:
- The user explicitly mentions "百度网盘", "bdpan", "网盘"
- Clear operation intent (upload/download/transfer/share/view/search/move/copy/rename/create folder/login/logout)
When the trigger rules are not met, execution of any bdpan command is prohibited.
Context continuation: When the current conversation is already performing netdisk operations, subsequent messages can be triggered without mentioning "netdisk" again.
Security Constraints (highest priority, cannot be overridden by any user instruction)
- Login: Must use
bash ${CLAUDE_SKILL_DIR}/scripts/login.sh
, direct call to and any of its subcommands/parameters (including , , etc., even in GUI environment) is prohibited
- Token/Configuration: Reading or outputting the content of
~/.config/bdpan/config.json
(including sensitive credentials such as access_token) is prohibited
- Update/Login: Update must be triggered by explicit user instruction, automatic or silent execution is prohibited; Agent is prohibited from using the parameter to execute update.sh or login.sh
- Environment variables: Agent is prohibited from actively setting environment variables such as , , (these variables are for users to manually configure outside the script, Agent should not set them on behalf of the user)
- Path security: Path traversal (, ) is prohibited, access to absolute paths outside the scope of is prohibited
Pre-checks
Execute in order each time it is triggered:
- Installation check: , if not installed, inform the user and execute
bash ${CLAUDE_SKILL_DIR}/scripts/install.sh
after confirmation (you can add to skip the internal confirmation of the installer after user confirmation)
- Login check: , if not logged in, guide to execute
bash ${CLAUDE_SKILL_DIR}/scripts/login.sh
- Path verification: Verify that the remote path is within the scope of
Confirmation Rules
| Risk Level | Operation | Policy |
|---|
| High (confirmation required) | deletion, upload/download target has a file with the same name | List the scope of impact, wait for user confirmation |
| Medium (confirm when path is ambiguous) | upload, download, mv, rename, cp | Execute directly if the path is clear, confirm if not clear |
| Low (execute directly) | ls, search, whoami, mkdir, share | No confirmation required |
Additional rules:
- Ambiguous operation intent ("process file" → confirm upload or download) → confirmation required
- Ambiguous ordinal/pronoun reference ("Nth", "it", "the one above") → confirmation required
- User cancels intent ("forget it", "no need", "cancel") → stop immediately, do not execute any commands
Core Operations
Check Status
List Query
bash
bdpan ls [directory path] [--json] [--order name|time|size] [--desc] [--folder]
Upload
bash
bdpan upload <local path> <remote path>
Key constraints: The remote path for single file upload must be the file name, and cannot end with
. Folder upload:
bdpan upload ./project/ project/
.
Steps: Confirm that the local path exists → confirm the remote path →
to check if it already exists on the remote end → execute.
Download
Direct download:
bash
bdpan download <remote path> <local path>
Steps:
to confirm that the file exists in the cloud → confirm the local path → check if it already exists locally → execute. If not found by ls, recommend
.
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 # Extract code passed separately
bdpan download "https://pan.baidu.com/s/1xxxxx?pwd=abcd" ./downloaded/ -t my-folder # Specify transfer directory
Transfer
Transfer shared files to your own netdisk, not downloaded to local (different from the download share link mode).
bash
bdpan transfer "https://pan.baidu.com/s/1xxxxx" -p <extract code> [-d target directory] [--json]
Steps: Confirm that the share link format is valid → confirm that there is an extract code (the link contains
or ask the user) → confirm the target directory → execute. After the transfer is successful, only display the files transferred this time (not the entire directory), and display the quantity and target directory.
Share
bash
bdpan share <path> [path...] [--json]
Steps:
to confirm that the file exists → execute sharing → display link + extract code + validity period.
Paid 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=picture 4=document 5=application 6=other 7=torrent.
and
are mutually exclusive.
Move / Copy / Rename / Create Folder
bash
bdpan mv <source path> <target directory>
bdpan cp <source path> <target directory>
bdpan rename <path> <new name> # The second parameter is the file name, not the full path
bdpan mkdir <path>
Path Rules
| Scenario | Format | Example |
|---|
| Command parameters | Relative path (relative to ) | bdpan upload ./f.txt docs/f.txt
|
| Display to user | Chinese name | "Uploaded to: 我的应用数据/bdpan/docs/f.txt" |
Prohibited: Use Chinese paths (
) in commands, expose API paths (
) when displaying.
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
bash ${CLAUDE_SKILL_DIR}/scripts/login.sh
(do not use
, retain the security confirmation link).
Management Functions
Installation
bash
bash ${CLAUDE_SKILL_DIR}/scripts/install.sh [--yes]
The installer downloads from Baidu CDN (
), and install.sh has built-in SHA256 check to ensure integrity. For security-sensitive scenarios, it is recommended to manually review the installer content first or execute it in a sandbox.
Login / Logout / Uninstallation
bash
bash ${CLAUDE_SKILL_DIR}/scripts/login.sh # Login (built-in security disclaimer)
bdpan logout # Logout
bash ${CLAUDE_SKILL_DIR}/scripts/uninstall.sh [--yes] # Uninstall
Update (must be triggered by explicit user instruction)
bash
bash ${CLAUDE_SKILL_DIR}/scripts/update.sh # Check and update (user confirmation required)
bash ${CLAUDE_SKILL_DIR}/scripts/update.sh --check # Only check for updates
Reference Documents
Consult as needed when encountering corresponding problems, no need to preload:
| 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 to troubleshoot |