# tflink-tmpfile Skill

Use this skill when an AI agent or IDE assistant needs to share a local file, generated artifact, screenshot, log, report, or short text payload through a temporary public URL.

## What tfLink Provides

- Upload endpoint: `https://tmpfile.link/api/upload`
- File limit: 100MB per upload
- Anonymous retention: 7 days
- Response fields: `downloadLink`, `downloadLinkEncoded`, `fileName`, `size`, `type`, `uploadedTo`
- Public website: `https://tmpfile.link`
- Raycast extension: `https://www.raycast.com/tflink-tmpfile/tflink-tmpfile`

## When to Use

- The user asks for a temporary link to a local artifact.
- The user needs to share a screenshot, image, log, archive, or generated document.
- The agent is running in a remote shell or IDE where direct file attachment is inconvenient.
- A workflow needs a short-lived URL for handoff, debugging, review, or mobile download.

## Safety Rules

- Do not upload secrets, credentials, private keys, tokens, production data, or sensitive personal information unless the user explicitly confirms.
- Treat returned links as public-by-URL.
- Prefer descriptive filenames before uploading.
- If the file is larger than 100MB, compress or split it only after user approval.
- Tell the user that anonymous uploads expire after 7 days.

## Basic Upload

Use multipart form data with the file field named `file`.

```bash
curl -X POST https://tmpfile.link/api/upload \
  -F "file=@/absolute/path/to/file.ext"
```

Parse the JSON response and return `downloadLinkEncoded` when present, otherwise return `downloadLink`.

## Authenticated Upload

If the user has provided tfLink credentials, include the optional headers.

```bash
curl -X POST https://tmpfile.link/api/upload \
  -H "X-User-Id: YOUR_USER_ID" \
  -H "X-Auth-Token: YOUR_AUTH_TOKEN" \
  -F "file=@/absolute/path/to/file.ext"
```

## Text Upload Pattern

When the user wants to share text output, write the text to a temporary `.txt` file with a meaningful name, upload that file, then remove the local temporary file if it was created only for upload.

```bash
printf '%s\n' "$CONTENT" > /tmp/tflink-note.txt
curl -X POST https://tmpfile.link/api/upload \
  -F "file=@/tmp/tflink-note.txt"
```

## Agent Response Format

After upload, respond with:

- The temporary URL
- The original filename
- The expiration note for anonymous uploads
- Any relevant warning if the content may be sensitive

Example:

```text
Uploaded: report.pdf
Link: https://d.tmpfile.link/public/...
Note: anonymous tfLink uploads expire after 7 days.
```

## Recommended Agent Workflow

1. Confirm the file exists and is under 100MB.
2. Avoid uploading sensitive material without explicit user confirmation.
3. Upload with `curl` or a native multipart client.
4. Prefer `downloadLinkEncoded` from the response.
5. Return the link concisely and mention the 7-day anonymous retention.
