feishu_file_fetch
Implements a Clawdbot extension tool that downloads Feishu files by message_id and file_key, streams to disk with sha256, size limits, and path traversal protection. Use when the user asks to build or update the feishu_file_fetch tool, Feishu file download workflow, or Clawdbot extension handling message_id/file_key inputs.
Best use case
feishu_file_fetch is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Implements a Clawdbot extension tool that downloads Feishu files by message_id and file_key, streams to disk with sha256, size limits, and path traversal protection. Use when the user asks to build or update the feishu_file_fetch tool, Feishu file download workflow, or Clawdbot extension handling message_id/file_key inputs.
Teams using feishu_file_fetch should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/feishu-file-fetch/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How feishu_file_fetch Compares
| Feature / Agent | feishu_file_fetch | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Implements a Clawdbot extension tool that downloads Feishu files by message_id and file_key, streams to disk with sha256, size limits, and path traversal protection. Use when the user asks to build or update the feishu_file_fetch tool, Feishu file download workflow, or Clawdbot extension handling message_id/file_key inputs.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# feishu_file_fetch
## Quick start
Create or update the reference implementation at `scripts/feishu_file_fetch.py`. It should:
1. Accept JSON input: `{ message_id, file_key, type="file", outdir="/root/clawd/uploads", max_bytes=104857600 }`
2. Output JSON: `{ ok, path, filename, bytes, sha256, error? }`
3. Use `FEISHU_APP_ID` / `FEISHU_APP_SECRET` to fetch and cache `tenant_access_token` (refresh 2 minutes before expiry).
4. Download via `GET https://open.feishu.cn/open-apis/im/v1/messages/{message_id}/resources/{file_key}?type={type}` with `Authorization: Bearer <token>`.
5. Stream to `outdir/yyyyMMdd/`, parse filename from `Content-Disposition`, fallback to `file_key.bin`.
6. Compute sha256 while streaming; enforce `max_bytes` strictly (terminate and delete temp file if exceeded).
7. Prevent path traversal by ensuring final path stays within `outdir`.
8. Never log tokens or secrets.
## Runtime notes
- Use only stdlib to avoid dependency installs.
- If `Content-Length` exceeds `max_bytes`, fail early.
- Use a temp file in the target directory and `os.replace` on success.
## Example usage
```
echo '{"message_id":"om_xxx","file_key":"file_xxx"}' | python scripts/feishu_file_fetch.py
```
## Additional resources
- For API details and error handling notes, see [reference.md](reference.md)Related Skills
Send Me My Files - R2 upload with short lived signed urls
Upload files to Cloudflare R2, AWS S3, or any S3-compatible storage.
feishui-file-sender
Send files via Feishu channel using message tool with filePath parameter.
url-fetcher
Simple web content fetching without API keys or external dependencies.
filewave
Query and manage FileWave UEM device inventory via REST API.
file-repair-skill
You are the `file-repair` skill.
markdown-fetch
Optimizes web fetching by using Cloudflare's Markdown for Agents, reducing token consumption by ~80%.
x-tweet-fetcher
Fetch tweets from X/Twitter without login or API keys.
feishu-user
Feishu document operations (User Access Token version)
filesystem
Advanced filesystem operations - listing, searching, batch processing, and directory analysis for Clawdbot
perf-profiler
Profile and optimize application performance. Use when diagnosing slow code, measuring CPU/memory usage, generating flame graphs, benchmarking functions, load testing APIs, finding memory leaks, or optimizing database queries.
makefile-build
Write Makefiles for any project type. Use when setting up build automation, defining multi-target builds, managing dependencies between tasks, creating project task runners, or using Make for non-C projects (Go, Python, Docker, Node.js). Also covers Just and Task as modern alternatives.
feishu-bitable-creator
Create and populate Feishu (Lark) Bitable (multidimensional tables) with automated cleanup.