If you write apps or notes on iPhone, you have probably had the same small frustration I have: you want one sentence rewritten, or three lines summarized, and switching to the Claude app, pasting, prompting, copying back is just enough friction to break your flow. I rewrite App Store descriptions dozens of times a day, and that friction was quietly costing me momentum.
The fix that stuck for me was driving Claude directly from the iOS Shortcuts app. With three small recipes pinned to my share sheet — Polish, Summarize, and Translate-to-English — I can highlight any text in Mail, Notes, or Slack and get a Claude-edited version on the clipboard in two taps. After a couple of weeks I stopped opening the Claude app for short tasks entirely.
This article is the recipe I wish someone had handed me when I started. It is opinionated for indie developers: the API key never lives on the device, the proxy is one Cloudflare Workers file, and every mode is a single string change.
Why route through a Cloudflare Workers proxy
Shortcuts can fire HTTP requests directly using the "Get Contents of URL" action, so technically you could point it straight at https://api.anthropic.com/v1/messages. In day-to-day use, two things make me reach for a small proxy instead.
- Your API key ends up everywhere. Shortcuts sync over iCloud, get AirDropped to friends, and live in plain text inside the recipe. Once that key is on your device, it is one accidental share away from being public.
- You will want to change models or tweak prompts later. Editing every device individually gets old fast. With a proxy you change one Worker and every iPhone in the family picks it up instantly.
Here is the shape of the system:
iPhone Shortcut
↓ POST { text, mode } + X-Shortcut-Token
Cloudflare Workers (proxy, API key in secrets)
↓ Anthropic Messages API
Claude
If you have not built a thin Anthropic proxy on Workers before, the broader patterns are covered in Claude API × Cloudflare Workers — Building Edge AI Microservices. For this recipe we keep things deliberately small: no streaming, no auth backend, just a single POST endpoint.
Step 1 — Stand up the proxy on Cloudflare Workers
Run wrangler init shortcut-claude-proxy and replace src/index.ts with the version below. This is what I actually run; comments included.
// src/index.ts — relays a single Shortcut request to Claude
export interface Env {
ANTHROPIC_API_KEY: string; // wrangler secret put ANTHROPIC_API_KEY
SHORTCUT_TOKEN: string; // shared secret for your phones
}
const SYSTEM_PROMPTS: Record<string, string> = {
polish: "Rewrite the input text so wording and sentence flow read naturally. Preserve meaning. Reply with the rewritten text only — no preamble or quotes.",
summary: "Summarize the input in three or fewer bullet points, each under 80 characters.",
english: "Translate the input to natural, idiomatic English as a native writer would phrase it.",
};
export default {
async fetch(req: Request, env: Env): Promise<Response> {
if (req.method !== "POST") return new Response("Method Not Allowed", { status: 405 });
// Simple shared-secret check. If a token leaks, change it on the Worker side.
if (req.headers.get("X-Shortcut-Token") !== env.SHORTCUT_TOKEN) {
return new Response("Unauthorized", { status: 401 });
}
const { text, mode = "polish" } = await req.json<{ text: string; mode?: string }>();
const system = SYSTEM_PROMPTS[mode] ?? SYSTEM_PROMPTS.polish;
const apiRes = await fetch("https://api.anthropic.com/v1/messages", {
method: "POST",
headers: {
"x-api-key": env.ANTHROPIC_API_KEY,
"anthropic-version": "2023-06-01",
"content-type": "application/json",
},
body: JSON.stringify({
model: "claude-sonnet-4-6",
max_tokens: 1024,
system,
messages: [{ role: "user", content: text }],
}),
});
if (!apiRes.ok) {
// Surfacing the upstream body makes the Shortcut error sheet useful.
return new Response(await apiRes.text(), { status: apiRes.status });
}
const data = await apiRes.json<{ content: { type: string; text: string }[] }>();
const out = data.content.find((c) => c.type === "text")?.text ?? "";
return new Response(out, { headers: { "content-type": "text/plain; charset=utf-8" } });
},
};The endpoint deliberately returns plain text, not JSON. That removes one parsing step on the Shortcut side and means the rewritten text can flow straight into "Copy to Clipboard". The fewer Shortcut actions you stack, the more reliable the recipe is on flaky cellular connections.
Deploy in three commands:
# Store the API key as a secret — never embed it in the Shortcut
wrangler secret put ANTHROPIC_API_KEY
# Random long string, used by your phones to authenticate
wrangler secret put SHORTCUT_TOKEN
wrangler deployIf you want a defensive layer for the inevitable 429, Handling Claude API Rate Limits and 429 Errors goes into the retry strategies that fit best with a single-request edge proxy like this one.
Step 2 — Build the iOS Shortcut
Open Shortcuts, create a new shortcut, and toggle "Show in Share Sheet" with "Text" allowed. Then assemble the actions:
- Get Shortcut Input — accept text from the share sheet.
- Text — build the JSON payload:
{"text":"<input>","mode":"polish"}. - URL — your Worker's URL (for example
https://shortcut-claude-proxy.example.workers.dev). - Get Contents of URL
- Method: POST
- Headers:
Content-Type: application/json,X-Shortcut-Token: <your token> - Request Body: File → the Text from step 2
- Copy to Clipboard + Show Result
That is the whole recipe. From any Mail draft, Note, or Slack message, highlight the text, share to "Polish", and the cleaned-up version is on your clipboard a few seconds later. I keep three variants pinned: Polish, Summarize, and Translate. They differ only in the mode value embedded in the JSON.
One small detail on the Translate recipe: if you preserve newlines through the proxy by adding "Keep line breaks intact" to the system prompt, bullet lists translate without collapsing into a single paragraph. Edits like this happen in one Worker file and are live on every device the next second — no Shortcut redeploy needed.
Three things that bit me in real-world use
1. Long inputs make Shortcuts look frozen
A 2,000-character input to Sonnet can take 5–10 seconds to come back, and Shortcuts shows nothing during the wait. The first week I assumed the recipe was broken and triggered the share sheet three times in a row, generating duplicate API calls I did not want to pay for. Fix: I added a "Show Notification: Working…" action right before the URL fetch. It is dumb but it works — once you see "the action started" you stop double-tapping.
2. Hidden characters from Notes break JSON parsing
iOS Notes embeds invisible rich-text artifacts that can corrupt the JSON body. Symptom: the Worker rejects the request with a JSON parse error and you stare at the recipe wondering what changed. Fix: insert a "Replace Text" action that strips zero-width spaces (U+200B) and BOM characters (U+FEFF) before serializing. I lost two hours to this; you should not.
3. One token = bad blast radius
I started with a single SHORTCUT_TOKEN. Then I gave my partner the same Shortcut, and when she sold an old iPhone we realized the Shortcut went with it. Now I provision per-device tokens — SHORTCUT_TOKEN_MASAKI, SHORTCUT_TOKEN_FAMILY — and the Worker checks against an allow-list. Revoking one device is a one-line edit. This is the kind of thing you only get burned by once.
Recipes worth adding once the basics feel natural
Once Polish, Summarize, and Translate are wired up, adding a fourth or fifth recipe is just a new entry in SYSTEM_PROMPTS and a clone of the Shortcut. These are the ones I use daily:
- Task split —
mode=splitwith a system prompt like "Extract concrete next actions from the input as a bulleted list of at most five items." Turns rambling notes into a clean to-do. - Title candidates —
mode=titlesreturns three to five headline options for a draft. I use this for App Store promotional text more than for blog posts now. - Meeting follow-ups —
mode=followupsseparates "decisions made" and "action items" from a transcript. Pasting the result into Notes finishes half of my meeting minutes.
The title candidates recipe pairs nicely with Mastering Claude API Structured Output — JSON Mode and Tool Use if you want JSON-shaped responses. With JSON output you can return a title plus three description variants in one call, and the Shortcut can populate multiple clipboard targets.
What to do next
If you already have an iPhone, the whole setup takes about 30 minutes. Sign up for Cloudflare, deploy the Worker, build one Shortcut, and live with just the Polish recipe for a day. That single recipe is enough to convince you whether the friction of switching to the Claude app was actually slowing you down. After a week, add a second mode by appending one entry to SYSTEM_PROMPTS. I was up to five within ten days.
Keeping the API key off the phone is the part that quietly matters. The day you want to share the same recipe with a partner, family member, or teammate, the proxy lets you hand over the convenience without handing over the key — that is a small architectural choice with a big peace-of-mind payoff.