Skip to content
Agentmart
Submit a tool

media-images-and-files

Shows, picks and stores images - expo-image, picker, camera, a media store.

Skill by zakariaf

IndexedMIT★ 11
Write a review

Chalk Labs

Need help deploying media-images-and-files?

Chalk Labs sets up agents like this inside real teams: connected to your tools, tested on your data, with a human in the loop where it matters.

Book a call

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/zakariaf-media-images-and-files

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Shows, picks and stores images - expo-image, picker, camera, a media store. Use when adding photos, avatars, attachments, uploads or save-to-Photos, or images flicker. Not for icons (icons-app-icon-and-splash).

Use cases: design

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md and code. Checked Oct 26, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found
Runs as
Node.js package

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/media-images-and-files

What's inside

Skill name
media-images-and-files
Description
Shows, picks and stores images - expo-image, picker, camera, a media store. Use when adding photos, avatars, attachments, uploads or save-to-Photos, or images flicker. Not for icons (icons-app-icon-and-splash).
License
MIT
Instructions
198 lines in SKILL.md · view on GitHub

Before installing

  • Ships executable scripts

Files (53)

  • SKILL.md
  • shared.json · assets/
  • template-placeholders.json · assets/
  • architecture.json · examples/contracts/
  • task-photo-strip.tsx · examples/src/features/tasks/components/
  • task-photos-jobs.ts · examples/src/features/tasks/
  • use-task-photos-model.test.tsx · examples/src/features/tasks/
  • use-task-photos-model.ts · examples/src/features/tasks/
  • expo-file-system-file-transfer-adapter.ts · examples/src/services/file-transfer/
  • file-transfer-port.ts · examples/src/services/file-transfer/
  • expo-image-manipulator-image-resizer-adapter.ts · examples/src/services/image-resizer/
  • expo-media-library-photo-saver-adapter.ts · examples/src/services/photo-saver/
  • photo-saver-port.ts · examples/src/services/photo-saver/
  • task-photos-messages.en.json · examples/
  • displaying-images.md · references/
  • files-and-storage.md · references/
  • picking-and-capturing.md · references/
  • sharing-and-transfer.md · references/
  • testing-and-checker.md · references/
  • check-lib.mjs · scripts/
  • check-media.mjs · scripts/
  • media-rules.mjs · scripts/lib/
  • source-scan.mjs · scripts/lib/
  • selftest.mjs · scripts/
  • image-fit.test.ts · templates/src/core/media/
  • image-fit.ts · templates/src/core/media/
  • media-ref.test.ts · templates/src/core/media/
  • media-ref.ts · templates/src/core/media/
  • media-sweep.test.ts · templates/src/core/media/
  • media-sweep.ts · templates/src/core/media/
  • media-importer.test.ts · templates/src/data/media/
  • media-importer.ts · templates/src/data/media/
  • media-sweeper.test.ts · templates/src/data/media/
  • media-sweeper.ts · templates/src/data/media/
  • fake-image-resizer.test.ts · templates/src/services/image-resizer/
  • fake-image-resizer.ts · templates/src/services/image-resizer/
  • image-resizer-port.ts · templates/src/services/image-resizer/
  • expo-image-picker-media-picker-adapter.ts · templates/src/services/media-picker/
  • fake-media-picker.test.ts · templates/src/services/media-picker/
  • fake-media-picker.ts · templates/src/services/media-picker/
  • media-picker-port.ts · templates/src/services/media-picker/
  • expo-file-system-media-store-adapter.ts · templates/src/services/media-store/
  • fake-media-store.test.ts · templates/src/services/media-store/
  • fake-media-store.ts · templates/src/services/media-store/
  • media-store-port.ts · templates/src/services/media-store/
  • stored-image.test.tsx · templates/src/ui/media/
  • stored-image.tsx · templates/src/ui/media/
  • app.config.ts · tests/bases/app/
  • package.json · tests/bases/app/
  • tsconfig.json · tests/bases/app/
  • CASES.json · tests/fixtures/check-media/
  • SUITE.json · tests/fixtures/check-media/
  • EXPECT.txt · tests/fixtures/check-media/good/

SKILL.md (first lines)

# Media: images and files

Every content image is an expo-image view with a box, a cache policy for its kind of source, a recycling
key in recycled lists and a name (or a decorative mark); photos are picked or captured only from a
press, through ports, the camera only after the permission gate; every picked file is downscaled and
re-encoded once, copied into the app's media folder under a new name and its temporaries discarded;
records hold that name (a MediaRef), never a file URI; files are never overwritten, swept when orphaned,
and leave the device only through ports. A zero-dependency checker proves it on iOS and Android code alike.

## Rules that must hold

1. **Every content image renders with expo-image inside a box.** A `style` with width and height (or
   one plus `aspectRatio`, or flex in a sized parent); `contentFit`, never React Native's `resizeMode`,
   `defaultSource` or `fadeDuration`. Why: without a box the view is 0 x 0 or jumps when the image
   loads, and the compatibility props are deprecated. (`image-size`, `image-legacy-prop`)
2. **Every expo-image `<Image>` is named or marked decorative.** `accessible` with
   `accessibilityLabel={t(...)}` for content, `accessible={false}` for decoration. Why: expo-image is not
   an accessibility element by default, so VoiceOver and TalkBack skip a photo silently. (`image-a11y`)
3. **An image in a recycled list cell has a `recyclingKey`** (the row id). Why: FlashList reuses the
   cell and its image view shows the previous row's photo until the new one loads. (`list-recycling-key`)
4. **The cache policy matches the source.** Stored files `cachePolicy="memory"` (they are on disk
   already); public remote images the default disk cache; private images memory-only or caches cleared
   on sign-out. Why: a disk cache duplicates stored files and keeps private photos after sign-out.
5. **Pick and capture only from a press, through `MediaPickerPort`: images only, no base64, no EXIF.**
   Why: a picker opened from an effect surprises the person and reopens after a cancel; base64 puts
   megabytes on the JS heap; EXIF carries the GPS position. (`picker-on-press`, `picker-options`)
6. **The camera opens only after the permission gate; only `src/services/permissions/` asks.** The
   library picker needs no permission on iOS 14+ and Android; the picker adapter reads the camera
   state through the gate's access (injected), never through its own permission functions. Why: iOS
   rejects `launchCameraAsync` without the grant and Android shows the system dialog with no
   explanation; one gate handles denied, rationale and blocked on both. (`permission-outside-gate`)
7. **The app config declares only the capture and library permissions the code uses.**
   `cameraPermission: false` when nothing opens a camera, `microphonePermission: false` when nothing
   records; these block the permission for the whole app, so never while expo-camera or expo-audio
   needs it. A save-only app keeps `READ_MEDIA_IMAGES`/`VIDEO` out. Why: the defaults add
   `RECORD_AUDIO`, and Play restricts broad photo reads (its Photo and Video Permissions policy).
   (`unused-permission`)
8. **Every picked or captured image is downscaled and re-encoded once (2048 px long edge, JPEG 0.8),
   one at a time, before it is stored; image bytes never live in JS.** Why: a 12 MP photo decodes to
   49 MB; the re-encode drops EXIF and turns HEIC into JPEG; base64 data URIs cost memory twice and
   defeat every cache. (`data-uri`)
9. **Kept media lives in the media store (`Paths.document/media/`), never in the cache, and records
   hold a MediaRef (a plain file name), never a URI.** Resolve with `uriOf(ref)` at render time. Why:
   the system purges the cache, and the absolute path of the app's folders changes after an update or a
   restore, so a stored `file://` URI breaks. (`media-in-cache`, `stored-uri`)
10. **A changed image is a new file under a new name; nothing is overwritten.** Write the partial file,
    rename it into place, save the record, then remove the old file. Why: image caches are keyed by URI
    and keep showing old pixels, and a crash mid-write corrupts the only copy. (`overwrite-in-place`)
11. **Every stored file has one owner record, and an orphan sweep runs after startup and after a
    restore.** Save the record first, then delete the file; the sweep keeps every file this process
    imported and every file the restore's safety copy references (`protectedRefs`), and removes stale
    partial copies. Why: crashes and abandoned imports leave files no record references, and nothing
    else removes them; the undo of a restore needs its photos.
    (`sweep-wired`)
12. **Only current SDK 57 APIs.** expo-file-system's `File`/`Directory`/`Paths` and expo-media-library's
    object API; never their legacy main-entry functions or `/legacy` entries. Why: in SDK 57 the old
    functions compile (declared `@deprecated`) and throw at runtime; `documentDirectory` and
    `cacheDirectory` are no longer exported (a tsc error, or `undefined` in untyped code). (`legacy-api`)
13. **Images leave the device only through ports, from a press**: the share sheet (data-export-and-
    restore's `ShareSheetPort`), `PhotoSaverPort`, and `FileTransferPort` for uploads and downloads,
    with URLs from `src/api` and headers from the session. Why: one adapter per SDK, the app's network
    policy keeps its single entry per transport, and only re-encoded, metadata-free files leave.
    (`transfer-outside-port`)

## Workflow

1. Read [references/displaying-images.md](references/displaying-images.md) for any image on screen, and
   [references/picking-and-capturing.md](references/picking-and-capturing.md) plus
   [references/files-and-storage.md](references/files-and-storage.md) when the person adds photos.
2. Prerequisites: the Result module (error-handling-typed-results) and the composition root
   (architecture-and-boundaries). Install:
   `npx expo install expo-image-picker expo-image-manipulator expo-file-system expo-device expo-crypto`
   (SDK 57: `~57.0.20`, `~57.0.20`, `~57.0.7`, `~57.0.2`, `~57.0.3`; `expo-image ~57.0.5` ships with the template, expo-file-system often arrives
   with persistence-and-migrations; verified 2026-10-14; re-verify with `npx expo install --check`).
3. Stop and ask the developer to classify the new SDKs (an architecture decision): merge
   `examples/contracts/architecture.json` into `contracts/architecture.json` and add the packages to
   `VENDOR_SDK_PATHS` in `eslint.config.mjs` in one commit with a Gate-Change trailer.
4. Copy the templates: `templates/src/core/media/`, `templates/src/services/{media-picker,media-store,image-resizer}/`,
   `templates/src/data/media/`, `templates/src/ui/media/` (list `StoredImage` in the component catalogue,
   ui-component-library). Copy the resizer adapter from
   `examples/src/services/image-resizer/` once expo-image-manipulator is installed.
5. Set the picker plugin options in `app.config.ts` (picking-and-capturing.md, section 8): purpose texts
   from the catalogs (i18n-strings-and-catalogs), `false` for every permission no code uses (they block
   it for the whole app: check expo-camera and expo-audio first).
6. Compose once: the three adapters in `createDeviceServices` (fakes in `createTestServices`), the picker
   with `isCameraAllowed: async () => isPermissionAllowed(await permissions.access.camera.permission())`
   and `isCameraPresent: () => Platform.OS !== 'ios' || Device.isDevice` (expo-device; opening the camera
   on the iOS simulator crashes, picking-and-capturing.md section 5), and `createMediaImporter({ picker, resizer, store, nextMediaId })`; features read `useServices()`.
   In the startup work after the data layer opened (app-startup-and-bootstrap), `await
   importer.importPendingPick()` first, then `sweepMedia(...)` with the safety copy's refs as
   `protectedRefs` (files-and-storage.md section 9); sweep again after a restore. `nextMediaId` is
   `() => randomUUID().toLowerCase()` from expo-crypto (Hermes has no global `crypto.randomUUID`).
7. Store MediaRefs: a `*_ref TEXT` column through a migration (persistence-and-migrations) or a
   `MediaRef` field in a store; a repository method lists every ref for the sweep.
8. Build the feature from `examples/src/features/tasks/` (model hook, jobs, photo strip): "Take photo"
   calls permissions-and-system-prompts' `usePermissionGate` `requestAccess` and the capture runs from
   its `onAllowed`, the screen renders the gate's sheet; one message per failure kind, the busy state
   blocking a second press, a failed record save removing the new files, remove = save then delete.
9. Sharing, Photos, uploads: [references/sharing-and-transfer.md](references/sharing-and-transfer.md)
   and `examples/src/services/{photo-saver,file-transfer}/`; tell networking-and-server-state and
   privacy-and-store-declarations about a new transport or data type before it ships.
10. Run the tests ([references/testing-and-checker.md](references/testing-and-checker.md)):
    `npx jest src/core/media src/services/media-picker src/services/media-store src/services/image-resizer src/data/media src/ui/media --ci`
    and `npm run typecheck`.
11. After an adapter change, run the media drill on a named iOS simulator and Android emulator
    (testing-and-checker.md, section 3), or say in the report that it is owed.
12. Run `node ${CLAUDE_SKILL_DIR}/scripts/check-media.mjs .`; fix every `FAIL` line and rerun until it
    prints `RESULT: PASS`.

## Definition of done

- [ ] Every expo-image `<Image>` has a box, `contentFit` (no legacy props), a name or
      `accessible={false}`, a cache policy fit for its source, and a `recyclingKey` in recycled cells.
- [ ] Picks and captures run from presses through `MediaPickerPort`; images only, no base64, no EXIF;
      the camera behind the permission gate; no plugin declares an unused capture or library permission.
- [ ] Every picked image goes through the importer: downscaled to 2048 px, JPEG, one at a time, stored
      under a new MediaRef in `Paths.document/media/`, temporaries discarded, all or nothing per batch.
- [ ] Records and stores hold MediaRefs, resolved with `uriOf` at render; nothing overwrites a stored
      file; deletes save the record first; the sweep runs after startup and after a restore and keeps

From zakariaf/ReactNative-Skills, MIT.

Signals

Stars
11
Forks
2
Open issues
0
Last commit (this folder)
Oct 17, 2026 (1 month ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

Done for you

Rather not set it up yourself?

Chalk Labs scopes, builds and runs agents for your team: the task audit, the eval harness, the integrations and the weekly ops report. Fixed scope, priced before we start.

See how we build AI agents →Read the case studies

Chalk Labs is a two-founder AI and growth studio. We build AI agents, CRMs and MVPs for Web3 and AI companies, and have shipped 50+ product and token launches.

launches shipped
50+
launches shipped
media placements
500+
media placements
founders on every account
2
founders on every account

Press we've placed: Forbes · CoinDesk · Decrypt · Cointelegraph · The Block

Rahil Jain, Co-founder, Chalk Labs. Ex-Goldman Sachs engineer. You talk to the person who builds it.

Get media-images-and-files running in your business

Tell us what you want to automate. A founder replies within one working day with a plan, not a pitch deck.

Goes to the Chalk Labs founders, not the newsletter. Privacy

Need help deploying media-images-and-files?

CallGet help
Cite this page

media-images-and-files skill. Agent Mart. https://agentmart.dev/skills/zakariaf-media-images-and-files (last updated 2026-10-24)