---
name: pagedrop
description: |
  Share agent-generated Markdown, HTML, TXT/plain-text, reports, notes, pages, or local files
  through PageDrop and return a controlled share URL. Use automatically when
  the user asks "share this", "send me a link", "make a PageDrop link",
  "publish this doc/page", "把这个分享给我", "用 PageDrop 弄个分享链接",
  "发我一个链接", "发布这个文档", or similar. Supports login-required links,
  public limited links, one-time links, password links, custom visit counts,
  expiry, and custom slugs.
metadata:
  version: 0.2.3
  homepage: http://117.72.193.223:10180
  requires:
    mcp_servers:
      - pagedrop
---

# PageDrop Skill

Use PageDrop when the user wants an AI-generated artifact or local file turned into a shareable URL. This skill is designed for Claude Code, Codex, Cursor, Claude Desktop, and other agent clients that support skills and/or MCP tools.

PageDrop requires a personal API token. Current default server is `http://117.72.193.223:10180` because PageDrop does not have a domain yet. In MCP mode the token is supplied to `@pagedrop/mcp` through `PAGEDROP_API_KEY`. In script fallback mode `pagedrop-share.sh` can read the token from env vars or common user config files, and remembers only the successful source, never the token text.

## Trigger Immediately

Do not wait for the user to say "use the PageDrop skill" if the intent is clear.

Typical trigger phrases:

- "share this", "send me a link", "make this a link", "publish this"
- "share the report/doc/page/file"
- "put this on PageDrop", "make a PageDrop link"
- "把这个分享给我", "用 PageDrop 弄个分享链接", "发我一个链接", "发布这个文档"
- "把刚才输出的内容分享给我", "把这个 HTML/Markdown/TXT 分享出去"

If the target content is the assistant's own generated answer and no file path is given, create a Markdown file from that content and upload it.

## Tools

Prefer MCP tools when available:

| Goal | Tool |
|---|---|
| Upload Markdown / HTML / TXT and create a share URL in one call | `pagedrop_upload({name, kind, content, share})` |
| Create another share link for an existing file | `pagedrop_share({fileId, ...})` |
| Revoke a share | `pagedrop_revoke({shareId})` |
| Fetch file metadata | `pagedrop_get({fileId})` |
| List uploaded files | `pagedrop_list({folderId?})` |
| Lint + normalize Markdown/HTML/TXT before upload | `pagedrop_validate({content, kind})` |

When MCP tools are not available but shell scripts can run, use:

```bash
packages/skill/scripts/pagedrop-share.sh [options] <file>
```

or stdin:

```bash
printf '%s' "$CONTENT" | packages/skill/scripts/pagedrop-share.sh \
  --stdin --name answer.md --kind MARKDOWN
```

## Share Policy Defaults

Apply these defaults exactly unless the user asks otherwise.

### 1. Normal "share this with me"

Default to login-required, unlimited visits:

```json
{ "requireLogin": true }
```

Use this for ordinary prompts like:

- "share this"
- "把这个分享给我"
- "use PageDrop to make a share link"

### 2. User asks for public / no-login

If the user says public, no login, anyone can open, or "不需要登录", default to 3 visits:

```json
{ "requireLogin": false, "maxVisits": 3 }
```

If the user gives a visit count, use that count:

```json
{ "requireLogin": false, "maxVisits": 10 }
```

### 3. User asks for one-time

One-time links are public by default and self-destruct after the first successful render:

```json
{ "requireLogin": false, "oneTime": true }
```

Do not add `maxVisits` yourself; the server forces max visits to 1 for one-time links.

### 4. User asks for password

Password links are password-gated and unlimited by default:

```json
{ "requireLogin": false, "password": "the-user-password" }
```

If the user also says a visit count, include it:

```json
{ "requireLogin": false, "password": "the-user-password", "maxVisits": 3 }
```

If the user explicitly asks for both login and password, combine them:

```json
{ "requireLogin": true, "password": "the-user-password" }
```

Never invent a password silently. If the user asks for a password link but does not provide a password, ask for the password or offer to generate one and show it to the user.

### 5. Expiry and slug

Do not set an expiry by default. Add `expiresInDays` only when the user asks for a lifetime such as "7 days", "until tomorrow", or "到周五".

Use `slug` only when the user asks for a readable/custom link. Otherwise let PageDrop generate the token.

## MCP Workflow

1. Identify the content:
   - Existing `.html`, `.htm`, `.md`, `.markdown`, `.txt`, `.text` file: read/upload that file.
   - Assistant-generated content: save as Markdown unless the user asks for HTML.
   - Logs, plain notes, and raw text: use `kind: "TEXT"` with a `.txt` filename.
   - Renderable HTML app/page: upload as HTML.
2. Determine the share policy from the rules above.
3. For agent-generated Markdown/HTML/TXT, run `pagedrop_validate` first when practical. Use the returned `normalized` content if it only reports info-level cleanup.
4. Prefer one-shot upload:

```json
{
  "name": "answer.md",
  "kind": "MARKDOWN",
  "content": "...",
  "share": { "requireLogin": true }
}
```

5. Return the URL plus a compact policy summary. Example:

```text
Shared with PageDrop:
https://.../s/...

Policy: login required, unlimited visits, no password.
```

Do not fetch the share URL to verify it. Fetching counts as a visit and can consume limited or one-time links.

## Script Fallback Workflow

Use the script when MCP tools are unavailable or the agent platform only exposes shell execution.

Environment:

```bash
export PAGEDROP_API_URL="http://117.72.193.223:10180"
export PAGEDROP_API_KEY="pd_xxxxxxxx_yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy"
```

For the current PageDrop deployment, `PAGEDROP_API_URL` can be omitted because the script defaults to `http://117.72.193.223:10180`. Set `PAGEDROP_API_URL` only when the user provides another PageDrop deployment.

Token lookup order:

1. `--api-key TOKEN` for this run only.
2. Previously remembered source in the state directory.
3. `PAGEDROP_API_KEY`, then `PAGEDROP_TOKEN`.
4. `--token-file PATH`, then `PAGEDROP_TOKEN_FILE`.
5. Common files: `~/.pagedrop/token`, `~/.pagedrop/config`, `~/.config/pagedrop/token`, `~/.config/pagedrop/config`, macOS `~/Library/Application Support/PageDrop/*`, Windows `%APPDATA%/PageDrop/*`.

When a user gives a token in the conversation, pass it as `PAGEDROP_API_KEY=...` for the command. The script will remember `env:PAGEDROP_API_KEY` as the source, not the token.

State/output directories are auto-created. Default state is `$XDG_STATE_HOME/pagedrop`, `%APPDATA%/PageDrop`, or `~/.pagedrop`; default output is `<state>/out`. Override with `PAGEDROP_STATE_DIR`, `PAGEDROP_OUTPUT_DIR`, or `--output-dir`. Stdin uploads are written into the output directory, and every run writes `last-share.json` there.

Default login-required share:

```bash
packages/skill/scripts/pagedrop-share.sh ./report.md
```

Public 3-visit share:

```bash
packages/skill/scripts/pagedrop-share.sh --public ./report.md
```

One-time share:

```bash
packages/skill/scripts/pagedrop-share.sh --one-time ./report.md
```

Password share, unlimited visits:

```bash
packages/skill/scripts/pagedrop-share.sh --password 'secret12' ./report.md
```

Password share with 5 visits:

```bash
packages/skill/scripts/pagedrop-share.sh --password 'secret12' --visits 5 ./report.md
```

Share assistant-generated text through stdin:

```bash
printf '%s' "$CONTENT" | packages/skill/scripts/pagedrop-share.sh \
  --stdin --name answer.md --kind MARKDOWN
```

Plain text:

```bash
printf '%s' "$CONTENT" | packages/skill/scripts/pagedrop-share.sh \
  --stdin --name notes.txt --kind TEXT
```

Use a token file:

```bash
printf 'PAGEDROP_API_KEY=pd_xxx\n' > ~/.pagedrop/config
packages/skill/scripts/pagedrop-share.sh ./report.md
```

Write artifacts to a chosen directory:

```bash
packages/skill/scripts/pagedrop-share.sh --output-dir ./pagedrop-out ./report.md
```

The first line of script output is the share URL. Later lines include `file_id`, `share_id`, `require_login`, `one_time`, `max_visits`, `has_password`, `token_source`, `output_dir`, and `metadata`.

Do not try to upload unsupported binary media such as video/audio/executables through this skill. The server enforces filename allowlists, content sniffing, size caps, virus scanning, and token rate limits.

## Error Handling

MCP errors are JSON text blocks. Script errors are stderr plus non-zero exit.

Use these branches:

- `UNAUTHENTICATED`: `PAGEDROP_API_KEY` is missing, invalid, or revoked. Ask the user to create a token in `/developers/tokens`.
- `RATE_LIMITED`: wait the `Retry-After` period if available, then retry once.
- `SLUG_TAKEN`: suggest another slug or retry without a slug.
- `DUPLICATE`: rename the upload filename or ask whether to replace.
- `OVER_QUOTA`: tell the user their PageDrop storage quota is full.
- `INFECTED`: the file was blocked by scanning; ask the user to regenerate or inspect it.
- `VALIDATION`: fix the file type/content, then retry.

Never print the API token. Never include passwords in logs beyond the immediate user-facing summary the user requested.

## Prompt Examples

- "把刚才这段内容分享给我" -> upload Markdown with `share: { "requireLogin": true }`.
- "公开分享，不需要登录" -> `share: { "requireLogin": false, "maxVisits": 3 }`.
- "公开分享，可以访问 10 次" -> `share: { "requireLogin": false, "maxVisits": 10 }`.
- "做成一次性链接" -> `share: { "requireLogin": false, "oneTime": true }`.
- "用密码 abc12345 分享给我" -> `share: { "requireLogin": false, "password": "abc12345" }`.
- "密码 abc12345，最多 3 次" -> `share: { "requireLogin": false, "password": "abc12345", "maxVisits": 3 }`.
- "需要登录，也加密码 abc12345" -> `share: { "requireLogin": true, "password": "abc12345" }`.

## Final Response Shape

After a successful upload, answer briefly:

```text
已上传到 PageDrop：
https://.../s/...

策略：需要登录；不限访问次数；无密码。
```

For public or password links, state the exact policy:

```text
策略：无需登录；最多 3 次访问；无密码。
```

or

```text
策略：无需登录；密码保护；不限访问次数。
```
