Delivery Save Diagnostics Playbook
Role
Use this skill when Codex needs 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. Recast from the original export-download-debugging/SKILL.md material as the delivery-save-diagnostics-playbook procedure.
Source Trace
- Original Markdown:
export-download-debugging/SKILL.md
- Reformulated skill name:
delivery-save-diagnostics-playbook
- Source category:
web-artifacts
Operating Guidance
Follow the rewritten material below as the working procedure. Keep code blocks, commands, file paths, URLs, dimensions, and API names exact when applying the skill.
Use this when an export or download appears to execute 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, review the
will-download path: 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 verify 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.
- Execute focused export tests, then
pnpm --filter @open-design/web typecheck.
- If Electron download handling changed, also execute
pnpm --filter @open-design/desktop typecheck.
- Before landing, execute
pnpm guard, review 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.
1---2name: delivery-save-diagnostics-playbook3description: |4 Use this skill when Codex needs 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. Recast from the original export-download-debugging/SKILL.md material as the delivery-save-diagnostics-playbook procedure.5metadata:6 source: https://skillmd.com/skills/gabriel7silva/delivery-save-diagnostics-playbook7---89# Delivery Save Diagnostics Playbook1011## Role1213Use this skill when Codex needs 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. Recast from the original export-download-debugging/SKILL.md material as the delivery-save-diagnostics-playbook procedure.1415## Source Trace1617- Original Markdown: `export-download-debugging/SKILL.md`18- Reformulated skill name: `delivery-save-diagnostics-playbook`19- Source category: `web-artifacts`2021## Operating Guidance2223Follow the rewritten material below as the working procedure. Keep code blocks, commands, file paths, URLs, dimensions, and API names exact when applying the skill.2425Use this when an export or download appears to execute but produces an empty,26missing, or unusable file. It is tuned for browser previews, iframe capture,27and Electron shells.2829## Core rule3031Separate capture from save. Prove the export payload has non-zero bytes before32debugging the destination path. A 0 KB file often means the native picker or33host created the target file, then the write failed or was blocked.3435## Evidence3637- Record the payload type, MIME type, byte length, object URL or data URL path,38 and thrown error name/message.39- Check browser console output and app logs around `showSaveFilePicker`,40 `createWritable`, `<a download>`, `URL.createObjectURL`, and URL revocation.41- In Electron, review the `will-download` path: filename, MIME, file extension,42 save dialog filters, cancellation, and final file size.43- Confirm the actual downloaded file size on disk and whether it opens in a44 normal image viewer.4546## Fix order47481. Prepare and verify the export payload first; disable Save until bytes are49 available.502. Prefer the simplest stable save channel for the host. If51 `showSaveFilePicker().createWritable()` fails, is sandboxed, or creates empty52 files, route to `<a download>` or Electron's download manager instead.533. Avoid opening a native picker before the payload is ready. This prevents the54 host from creating an empty destination file on later write failure.554. For PNG fallback, prefer a verified non-empty data URL when blob URLs,56 revocation timing, CSP, or iframe sandboxing are suspicious.575. In Electron, add explicit Save As filters for exported image extensions58 (`.png`, `.jpg`, `.jpeg`, `.webp`) so users can choose a real image target.596. Keep the UI restrained: format selection, filename/path hint, clear pending60 and error states, and one primary save action.6162## Validation6364- Add or update tests for non-empty payload preparation, fallback save behavior,65 file extension/MIME mapping, and UI disabled/error states.66- Execute focused export tests, then `pnpm --filter @open-design/web typecheck`.67- If Electron download handling changed, also execute68 `pnpm --filter @open-design/desktop typecheck`.69- Before landing, execute `pnpm guard`, review the staged diff for unrelated files,70 generated artifacts, and accidental secrets, then use the repository's PR71 quality-gate workflow if the fix is being prepared for review.