xurl
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesexurl — Agent Skill Reference
xurl — Agent技能参考
xurlxurlInstallation
安装
Homebrew (macOS)
Homebrew(macOS)
bash
brew install --cask xdevplatform/tap/xurlbash
brew install --cask xdevplatform/tap/xurlnpm
npm
bash
npm install -g @xdevplatform/xurlbash
npm install -g @xdevplatform/xurlShell script
Shell脚本
bash
curl -fsSL https://raw.githubusercontent.com/xdevplatform/xurl/main/install.sh | bashInstalls to . If it's not in your PATH, the script will tell you what to add.
~/.local/binbash
curl -fsSL https://raw.githubusercontent.com/xdevplatform/xurl/main/install.sh | bash会安装到 。如果该目录不在你的PATH中,脚本会提示你需要添加的内容。
~/.local/binGo
Go
bash
go install github.com/xdevplatform/xurl@latestbash
go install github.com/xdevplatform/xurl@latestPrerequisites
前提条件
This skill requires the CLI utility: https://github.com/xdevplatform/xurl.
xurlBefore using any command you must be authenticated. Run to check.
xurl auth status使用此技能需要 CLI工具:https://github.com/xdevplatform/xurl。
xurl在使用任何命令前,你必须完成认证。运行 检查认证状态。
xurl auth statusSecret Safety (Mandatory)
密钥安全(强制要求)
- Never read, print, parse, summarize, upload, or send (or copies of it) to the LLM context.
~/.xurl - Never ask the user to paste credentials/tokens into chat.
- The user must fill with required secrets manually on their own machine.
~/.xurl - Do not recommend or execute auth commands with inline secrets in agent/LLM sessions.
- Warn that using CLI secret options in agent sessions can leak credentials (prompt/context, logs, shell history).
- Never use /
--verbosein agent/LLM sessions; it can expose sensitive headers/tokens in output.-v - Sensitive flags that must never be used in agent commands: ,
--bearer-token,--consumer-key,--consumer-secret,--access-token,--token-secret,--client-id.--client-secret - To verify whether at least one app with credentials is already registered, run: .
xurl auth status
- 切勿读取、打印、解析、总结、上传或发送 (或其副本)到LLM上下文。
~/.xurl - 切勿要求用户在聊天中粘贴凭证/令牌。
- 用户必须在自己的设备上手动将所需密钥填写到 中。
~/.xurl - 不要在Agent/LLM会话中推荐或执行带有内联密钥的认证命令。
- 警告用户:在Agent会话中使用CLI密钥选项可能会导致凭证泄露(提示/上下文、日志、Shell历史记录)。
- 切勿在Agent/LLM会话中使用 /
--verbose参数;它可能会在输出中暴露敏感的请求头/令牌。-v - 在Agent命令中绝对禁止使用的敏感标志:、
--bearer-token、--consumer-key、--consumer-secret、--access-token、--token-secret、--client-id。--client-secret - 要验证是否已注册至少一个带有凭证的应用,运行:。
xurl auth status
Register an app (recommended)
注册应用(推荐)
App credential registration must be done manually by the user outside the agent/LLM session.
After credentials are registered, authenticate with:
bash
xurl auth oauth2For multiple pre-configured apps, switch between them:
bash
xurl auth default prod-app # set default app
xurl auth default prod-app alice # set default app + user
xurl --app dev-app /2/users/me # one-off override应用凭证的注册必须由用户在Agent/LLM会话外手动完成。
注册凭证后,运行以下命令完成认证:
bash
xurl auth oauth2对于多个已预配置的应用,可通过以下方式切换:
bash
xurl auth default prod-app # 设置默认应用
xurl auth default prod-app alice # 设置默认应用和用户
xurl --app dev-app /2/users/me # 单次覆盖使用指定应用Other auth methods
其他认证方式
Examples with inline secret flags are intentionally omitted. If OAuth1 or app-only auth is needed, the user must run those commands manually outside agent/LLM context.
Tokens are persisted to in YAML format. Each app has its own isolated tokens. Do not read this file through the agent/LLM. Once authenticated, every command below will auto‑attach the right header.
~/.xurlAuthorization有意省略了带有内联密钥标志的示例。如果需要OAuth1或仅应用认证,用户必须在Agent/LLM上下文外手动运行相关命令。
令牌会以YAML格式持久化存储到 中。每个应用都有独立的令牌存储。切勿通过Agent/LLM读取此文件。完成认证后,以下所有命令都会自动附加正确的 请求头。
~/.xurlAuthorizationQuick Reference
快速参考
| Action | Command |
|---|---|
| Post | |
| Reply | |
| Quote | |
| Delete a post | |
| Read a post | |
| Search posts | |
| Who am I | |
| Look up a user | |
| Home timeline | |
| Mentions | |
| Like | |
| Unlike | |
| Repost | |
| Undo repost | |
| Bookmark | |
| Remove bookmark | |
| List bookmarks | |
| List likes | |
| Follow | |
| Unfollow | |
| List following | |
| List followers | |
| Block | |
| Unblock | |
| Mute | |
| Unmute | |
| Send DM | |
| List DMs | |
| Upload media | |
| Media status | |
| App Management | |
| Register app | Manual, outside agent (do not pass secrets via agent) |
| List apps | |
| Update app creds | Manual, outside agent (do not pass secrets via agent) |
| Remove app | |
| Set default (interactive) | |
| Set default (command) | |
| Use app per-request | |
| Auth status | |
Post IDs vs URLs: Anywhereappears above you can also paste a full post URL (e.g.POST_ID) — xurl extracts the ID automatically.https://x.com/user/status/1234567890
Usernames: Leadingis optional.@and@elonmuskboth work.elonmusk
| 操作 | 命令 |
|---|---|
| 发布推文 | |
| 回复推文 | |
| 引用推文 | |
| 删除推文 | |
| 读取推文 | |
| 搜索推文 | |
| 查看自身信息 | |
| 查询用户信息 | |
| 主页时间线 | |
| 提及我的推文 | |
| 点赞推文 | |
| 取消点赞 | |
| 转发推文 | |
| 取消转发 | |
| 收藏推文 | |
| 取消收藏 | |
| 查看收藏列表 | |
| 查看点赞列表 | |
| 关注用户 | |
| 取消关注 | |
| 查看关注列表 | |
| 查看粉丝列表 | |
| 屏蔽用户 | |
| 取消屏蔽 | |
| 静音用户 | |
| 取消静音 | |
| 发送私信 | |
| 查看私信列表 | |
| 上传媒体 | |
| 媒体状态查询 | |
| 应用管理 | |
| 注册应用 | 手动操作,在Agent外完成(切勿通过Agent传递密钥) |
| 查看应用列表 | |
| 更新应用凭证 | 手动操作,在Agent外完成(切勿通过Agent传递密钥) |
| 删除应用 | |
| 设置默认应用(交互式) | |
| 设置默认应用(命令式) | |
| 单次请求指定应用 | |
| 认证状态检查 | |
帖子ID与URL: 上述所有出现的地方,你也可以粘贴完整的推文URL(例如POST_ID)——xurl会自动提取ID。https://x.com/user/status/1234567890
用户名: 开头的是可选的。@和@elonmusk都可以正常使用。elonmusk
Command Details
命令详情
Posting
发布操作
bash
undefinedbash
undefinedSimple post
简单发布
xurl post "Hello world!"
xurl post "Hello world!"
Post with media (upload first, then attach)
带媒体的发布(先上传,再附加)
xurl media upload photo.jpg # → note the media_id from response
xurl post "Check this out" --media-id MEDIA_ID
xurl media upload photo.jpg # → 记录返回结果中的media_id
xurl post "Check this out" --media-id MEDIA_ID
Multiple media
多媒体发布
xurl post "Thread pics" --media-id 111 --media-id 222
xurl post "Thread pics" --media-id 111 --media-id 222
Reply to a post (by ID or URL)
回复推文(通过ID或URL)
xurl reply 1234567890 "Great point!"
xurl reply https://x.com/user/status/1234567890 "Agreed!"
xurl reply 1234567890 "Great point!"
xurl reply https://x.com/user/status/1234567890 "Agreed!"
Reply with media
带媒体的回复
xurl reply 1234567890 "Look at this" --media-id MEDIA_ID
xurl reply 1234567890 "Look at this" --media-id MEDIA_ID
Quote a post
引用推文
xurl quote 1234567890 "Adding my thoughts"
xurl quote 1234567890 "Adding my thoughts"
Delete your own post
删除自己的推文
xurl delete 1234567890
undefinedxurl delete 1234567890
undefinedReading
读取操作
bash
undefinedbash
undefinedRead a single post (returns author, text, metrics, entities)
读取单条推文(返回作者、文本、数据指标、实体信息)
xurl read 1234567890
xurl read https://x.com/user/status/1234567890
xurl read 1234567890
xurl read https://x.com/user/status/1234567890
Search recent posts (default 10 results)
搜索近期推文(默认返回10条结果)
xurl search "golang"
xurl search "from:elonmusk" -n 20
xurl search "#buildinpublic lang:en" -n 15
undefinedxurl search "golang"
xurl search "from:elonmusk" -n 20
xurl search "#buildinpublic lang:en" -n 15
undefinedUser Info
用户信息
bash
undefinedbash
undefinedYour own profile
查看自身资料
xurl whoami
xurl whoami
Look up any user
查询任意用户资料
xurl user elonmusk
xurl user @XDevelopers
undefinedxurl user elonmusk
xurl user @XDevelopers
undefinedTimelines & Mentions
时间线与提及
bash
undefinedbash
undefinedHome timeline (reverse chronological)
主页时间线(按时间倒序)
xurl timeline
xurl timeline -n 25
xurl timeline
xurl timeline -n 25
Your mentions
查看提及我的推文
xurl mentions
xurl mentions -n 20
undefinedxurl mentions
xurl mentions -n 20
undefinedEngagement
互动操作
bash
undefinedbash
undefinedLike / unlike
点赞 / 取消点赞
xurl like 1234567890
xurl unlike 1234567890
xurl like 1234567890
xurl unlike 1234567890
Repost / undo
转发 / 取消转发
xurl repost 1234567890
xurl unrepost 1234567890
xurl repost 1234567890
xurl unrepost 1234567890
Bookmark / remove
收藏 / 取消收藏
xurl bookmark 1234567890
xurl unbookmark 1234567890
xurl bookmark 1234567890
xurl unbookmark 1234567890
List your bookmarks / likes
查看我的收藏 / 点赞列表
xurl bookmarks -n 20
xurl likes -n 20
undefinedxurl bookmarks -n 20
xurl likes -n 20
undefinedSocial Graph
社交关系
bash
undefinedbash
undefinedFollow / unfollow
关注 / 取消关注
xurl follow @XDevelopers
xurl unfollow @XDevelopers
xurl follow @XDevelopers
xurl unfollow @XDevelopers
List who you follow / your followers
查看我关注的用户 / 我的粉丝
xurl following -n 50
xurl followers -n 50
xurl following -n 50
xurl followers -n 50
List another user's following/followers
查看其他用户的关注/粉丝列表
xurl following --of elonmusk -n 20
xurl followers --of elonmusk -n 20
xurl following --of elonmusk -n 20
xurl followers --of elonmusk -n 20
Block / unblock
屏蔽 / 取消屏蔽
xurl block @spammer
xurl unblock @spammer
xurl block @spammer
xurl unblock @spammer
Mute / unmute
静音 / 取消静音
xurl mute @annoying
xurl unmute @annoying
undefinedxurl mute @annoying
xurl unmute @annoying
undefinedDirect Messages
私信功能
bash
undefinedbash
undefinedSend a DM
发送私信
xurl dm @someuser "Hey, saw your post!"
xurl dm @someuser "Hey, saw your post!"
List recent DM events
查看近期私信记录
xurl dms
xurl dms -n 25
undefinedxurl dms
xurl dms -n 25
undefinedMedia Upload
媒体上传
bash
undefinedbash
undefinedUpload a file (auto‑detects type for images/videos)
上传文件(自动检测图片/视频类型)
xurl media upload photo.jpg
xurl media upload video.mp4
xurl media upload photo.jpg
xurl media upload video.mp4
Specify type and category explicitly
显式指定类型和分类
xurl media upload --media-type image/jpeg --category tweet_image photo.jpg
xurl media upload --media-type image/jpeg --category tweet_image photo.jpg
Check processing status (videos need server‑side processing)
检查处理状态(视频需要服务器端处理)
xurl media status MEDIA_ID
xurl media status --wait MEDIA_ID # poll until done
xurl media status MEDIA_ID
xurl media status --wait MEDIA_ID # 轮询直到处理完成
Full workflow: upload then post
完整流程:上传后发布
xurl media upload meme.png # response includes media id
xurl post "lol" --media-id MEDIA_ID
---xurl media upload meme.png # 返回结果包含媒体ID
xurl post "lol" --media-id MEDIA_ID
---Global Flags
全局标志
These flags work on every command:
| Flag | Short | Description |
|---|---|---|
| Use a specific registered app for this request (overrides default) | |
| Force auth type: | |
| | Which OAuth2 account to use (if you have multiple) |
| | Forbidden in agent/LLM sessions (can leak auth headers/tokens) |
| | Add |
这些标志适用于所有命令:
| 标志 | 简写 | 描述 |
|---|---|---|
| 为此请求使用指定的已注册应用(覆盖默认设置) | |
| 强制指定认证类型: | |
| | 指定要使用的OAuth2账户(如果你有多个账户) |
| | 在Agent/LLM会话中禁止使用(可能会泄露认证请求头/令牌) |
| | 添加 |
Raw API Access
原生API访问
The shortcut commands cover the most common operations. For anything else, use xurl's raw curl‑style mode — it works with any X API v2 endpoint:
bash
undefined快捷命令覆盖了最常见的操作。对于其他操作,可使用xurl的原生curl风格模式——它支持任意X API v2端点:
bash
undefinedGET request (default)
GET请求(默认)
xurl /2/users/me
xurl /2/users/me
POST with JSON body
带JSON请求体的POST请求
xurl -X POST /2/tweets -d '{"text":"Hello world!"}'
xurl -X POST /2/tweets -d '{"text":"Hello world!"}'
PUT, PATCH, DELETE
PUT、PATCH、DELETE请求
xurl -X DELETE /2/tweets/1234567890
xurl -X DELETE /2/tweets/1234567890
Custom headers
自定义请求头
xurl -H "Content-Type: application/json" /2/some/endpoint
xurl -H "Content-Type: application/json" /2/some/endpoint
Force streaming mode
强制流式模式
xurl -s /2/tweets/search/stream
xurl -s /2/tweets/search/stream
Full URLs also work
完整URL也可使用
---
---Streaming
流式处理
Streaming endpoints are auto‑detected. Known streaming endpoints include:
/2/tweets/search/stream/2/tweets/sample/stream/2/tweets/sample10/stream
You can force streaming on any endpoint with :
-sbash
xurl -s /2/some/endpoint流式端点会被自动检测。已知的流式端点包括:
/2/tweets/search/stream/2/tweets/sample/stream/2/tweets/sample10/stream
你可以使用 标志强制对任意端点启用流式处理:
-sbash
xurl -s /2/some/endpointOutput Format
输出格式
All commands return JSON to stdout, pretty‑printed with syntax highlighting. The output structure matches the X API v2 response format. A typical response looks like:
json
{
"data": {
"id": "1234567890",
"text": "Hello world!"
}
}Errors are also returned as JSON:
json
{
"errors": [
{
"message": "Not authorized",
"code": 403
}
]
}所有命令都会将JSON输出到标准输出,并带有语法高亮的格式化显示。输出结构与X API v2的响应格式一致。典型的响应如下:
json
{
"data": {
"id": "1234567890",
"text": "Hello world!"
}
}错误信息也会以JSON格式输出到标准输出(因此你仍然可以解析它们):
json
{
"errors": [
{
"message": "Not authorized",
"code": 403
}
]
}Common Workflows
常见工作流
Post with an image
发布带图片的推文
bash
undefinedbash
undefined1. Upload the image
1. 上传图片
xurl media upload photo.jpg
xurl media upload photo.jpg
2. Copy the media_id from the response, then post
2. 复制返回结果中的media_id,然后发布
xurl post "Check out this photo!" --media-id MEDIA_ID
undefinedxurl post "Check out this photo!" --media-id MEDIA_ID
undefinedReply to a conversation
回复对话
bash
undefinedbash
undefined1. Read the post to understand context
1. 读取推文了解上下文
xurl read https://x.com/user/status/1234567890
xurl read https://x.com/user/status/1234567890
2. Reply
2. 回复
xurl reply 1234567890 "Here are my thoughts..."
undefinedxurl reply 1234567890 "Here are my thoughts..."
undefinedSearch and engage
搜索并互动
bash
undefinedbash
undefined1. Search for relevant posts
1. 搜索相关推文
xurl search "topic of interest" -n 10
xurl search "topic of interest" -n 10
2. Like an interesting one
2. 为感兴趣的推文点赞
xurl like POST_ID_FROM_RESULTS
xurl like POST_ID_FROM_RESULTS
3. Reply to it
3. 回复该推文
xurl reply POST_ID_FROM_RESULTS "Great point!"
undefinedxurl reply POST_ID_FROM_RESULTS "Great point!"
undefinedCheck your activity
查看个人活动
bash
undefinedbash
undefinedSee who you are
查看自身信息
xurl whoami
xurl whoami
Check your mentions
查看提及我的推文
xurl mentions -n 20
xurl mentions -n 20
Check your timeline
查看主页时间线
xurl timeline -n 20
undefinedxurl timeline -n 20
undefinedSet up multiple apps
配置多应用
bash
undefinedbash
undefinedApp credentials must already be configured manually outside agent/LLM context.
应用凭证必须已在Agent/LLM上下文外手动配置完成。
Authenticate users on each pre-configured app
在每个预配置的应用上认证用户
xurl auth default prod
xurl auth oauth2 # authenticates on prod app
xurl auth default staging
xurl auth oauth2 # authenticates on staging app
xurl auth default prod
xurl auth oauth2 # 在prod应用上完成认证
xurl auth default staging
xurl auth oauth2 # 在staging应用上完成认证
Switch between them
在应用间切换
xurl auth default prod alice # prod app, alice user
xurl --app staging /2/users/me # one-off request against staging
---xurl auth default prod alice # prod应用,alice用户
xurl --app staging /2/users/me # 单次请求使用staging应用
---Error Handling
错误处理
- Non‑zero exit code on any error.
- API errors are printed as JSON to stdout (so you can still parse them).
- Auth errors suggest re‑running or checking your tokens.
xurl auth oauth2 - If a command requires your user ID (like, repost, bookmark, follow, etc.), xurl will automatically fetch it via . If that fails, you'll see an auth error.
/2/users/me
- 发生任何错误时,命令会返回非零退出码。
- API错误会以JSON格式输出到标准输出(因此你仍然可以解析它们)。
- 认证错误会建议重新运行 或检查令牌。
xurl auth oauth2 - 如果某个命令需要你的用户ID(比如点赞、转发、收藏、关注等),xurl会自动通过 获取。如果该请求失败,你会看到认证错误。
/2/users/me
Notes
注意事项
- Rate limits: The X API enforces rate limits per endpoint. If you get a 429 error, wait and retry. Write endpoints (post, reply, like, repost) have stricter limits than read endpoints.
- Scopes: OAuth 2.0 tokens are requested with broad scopes. If you get a 403 on a specific action, your token may lack the required scope — re‑run to get a fresh token.
xurl auth oauth2 - Token refresh: OAuth 2.0 tokens auto‑refresh when expired. No manual intervention needed.
- Multiple apps: Each app has its own isolated credentials and tokens. Configure credentials manually outside agent/LLM context, then switch with or
xurl auth default.--app - Multiple accounts: You can authenticate multiple OAuth 2.0 accounts per app and switch between them with /
--usernameor set a default with-u.xurl auth default APP USER - Default user: When no flag is given, xurl uses the default user for the active app (set via
-u). If no default user is set, it uses the first available token.xurl auth default - Token storage: is YAML. Each app stores its own credentials and tokens. Never read or send this file to LLM context.
~/.xurl
- 速率限制: X API对每个端点都有速率限制。如果收到429错误,请等待后重试。写入类端点(发布、回复、点赞、转发)的限制比读取类端点更严格。
- 权限范围: OAuth 2.0令牌会请求较广的权限范围。如果你在执行特定操作时收到403错误,你的令牌可能缺少所需的权限——重新运行 获取新的令牌。
xurl auth oauth2 - 令牌刷新: OAuth 2.0令牌过期时会自动刷新,无需手动干预。
- 多应用: 每个应用都有独立的凭证和令牌存储。在Agent/LLM上下文外手动配置凭证,然后使用 或
xurl auth default切换。--app - 多账户: 你可以在每个应用上认证多个OAuth 2.0账户,并使用 /
--username切换,或通过-u设置默认账户。xurl auth default APP USER - 默认用户: 当未指定 标志时,xurl会使用当前活动应用的默认用户(通过
-u设置)。如果未设置默认用户,它会使用第一个可用的令牌。xurl auth default - 令牌存储: 是YAML格式的文件。每个应用都存储自己的凭证和令牌。切勿读取或发送此文件到LLM上下文。
~/.xurl