export-download-debugging
できること
このツールは、ダウンロードや書き出しを試みたファイルがうまくいかなかった原因を調べるのに役立ちます。特に画像について、ファイルを保存する前に正しく作成されているかを確認します。
使う場面
- ✓ダウンロードや書き出しは成功したように見えるのに、ファイルが空になってしまうとき。
- ✓ダウンロードした画像ファイルが開けない、または壊れているとき。
- ✓ブラウザやアプリの「名前を付けて保存」機能で問題が起きているとき。
スキルのリンク
https://github.com/nexu-io/open-design/blob/main/skills/export-download-debugging/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“書き出した画像が0 KBのファイルになってしまいます。直す方法を教えてもらえますか?”
毎週5つの新しいスキル。1分で読めます。
仕組み
まず、ファイルのデータが正しく生成されているかを確認します。正しく生成されていれば、より単純で信頼性の高い方法でファイルを保存しようとします。これにより、空のファイルができてしまうよくある問題を避けられます。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
Export Download Debugging
Use this when an export or download appears to run but produces an empty, missing, or unusable file. It is tuned for browser previews, iframe capture, and Electron shells.
Core rule
Separate capture from save. Prove the export payload has non-zero bytes before debugging the destination path. A 0 KB file often means the native picker or host created the target file, then the write failed or was blocked.
Evidence
- Record the payload type, MIME type, byte length, object URL or data URL path, and thrown error name/message.
- Check browser console output and app logs around
showSaveFilePicker,createWritable,<a download>,URL.createObjectURL, and URL revocation. - In Electron, inspect the
will-downloadpath: filename, MIME, file extension, save dialog filters, cancellation, and final file size. - Confirm the actual downloaded file size on disk and whether it opens in a normal image viewer.
Fix order
- Prepare and validate the export payload first; disable Save until bytes are available.
- Prefer the simplest stable save channel for the host. If
showSaveFilePicker().createWritable()fails, is sandboxed, or creates empty files, route to<a download>or Electron's download manager instead. - Avoid opening a native picker before the payload is ready. This prevents the host from creating an empty destination file on later write failure.
- For PNG fallback, prefer a verified non-empty data URL when blob URLs, revocation timing, CSP, or iframe sandboxing are suspicious.
- In Electron, add explicit Save As filters for exported image extensions
(
.png,.jpg,.jpeg,.webp) so users can choose a real image target. - Keep the UI restrained: format selection, filename/path hint, clear pending and error states, and one primary save action.
Validation
- Add or update tests for non-empty payload preparation, fallback save behavior, file extension/MIME mapping, and UI disabled/error states.
- Run focused export tests, then
pnpm --filter @open-design/web typecheck. - If Electron download handling changed, also run
pnpm --filter @open-design/desktop typecheck. - Before landing, run
pnpm guard, inspect the staged diff for unrelated files, generated artifacts, and accidental secrets, then use the repository's PR quality-gate workflow if the fix is being prepared for review.
よくある質問
なぜファイルが空になるのですか?
多くの場合、システムがパソコン上にファイルを作成したものの、実際のデータの書き込みが完了する前に失敗したりブロックされたりすることが原因です。
「ペイロード」とは何ですか?
ペイロードとは、書き出しやダウンロードしようとしている情報やデータのことです。画像のピクセルデータや、文書の内容などが該当します。
「Blob/Data URL」とは何ですか?
画像などのデータを、別個のファイルを用意せずにブラウザ内で直接扱うための方式です。このツールは、それらが正しく機能しているかを確認します。
詳細
作者による元の説明
Diagnose and fix browser, preview, or Electron export/download failures, especially image export issues involving Save As, Blob/Data URLs, the File System Access API, createWritable failures, and 0 KB files.
repo: nexu-io/open-design
人気
- GitHubのスター
- 101k
- ランキング
- #1150
- ライセンス
- Apache-2.0
- 更新日
- 2026/10/15
コメント
- …
このリポジトリの他のスキル
sample-plugin
101kエージェントがテスト用のメタデータファイルを作成できるようにします。さまざまな状況でコードが正しく動作することを確認する助けになります。
aster-atelier
101kエージェントが、クラシックな雰囲気のアート系ウェブサイトを作成できるようにします。映画のような雰囲気を出すために、洗練された画像、青い空、セリフ体のフォントを使用します。
audio-jingle
101kエージェントがジングルや効果音などのオーディオを生成できるようにします。音楽や音声を作成し、その結果をオーディオファイルとして保存できます。
blog-post
101kエージェントが長文の記事やブログ記事を書けるようにします。画像、引用、著者情報を入れるスペースも含まれています。
似ているスキル
test-driven-development
311k機能や修正を作る前に、まず失敗するテストを書き、それが失敗するのを確認してから、合格させる最小のコードを書くようエージェントに教えます。
verification-before-completion
311kタスク、修正、ビルドが完了した、または合格したと主張する前に、実際のチェックを実行し、その出力を読むようエージェントに教えます。
migrate-to-shoehorn
310kテストファイル内の危険な型キャストを、shoehornライブラリに置き換え、テストが部分的なデータを使いつつ型チェックを通るようにします。