Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

AI Address Parser

БесплатноБез исполняемых скриптовНе проверен

Parses a free-text address blob (supplier email, Google Maps result, business card) into structured fields (street, postal code, city, state, country…

clarezoeот clarezoe401 установка в других каталогах

Об этом скилле

AI Address Parser

Turns messy pasted address text into structured form fields using an OpenAI-compatible chat-completions endpoint in JSON mode, applied non-destructively so it never clobbers fields the user already filled in.


Step 1: Design the Output Schema

Extract exactly the fields your form needs, no more. A typical set:

{
  "address": "",
  "postalCode": "",
  "city": "",
  "state": "",
  "country": "",
  "contact": "",
  "phone": "",
  "confidence": "high"
}
  • Every address field is a string, including postalCode — never coerce it to a number. Many countries' postal codes have leading zeros or embedded spaces (e.g. Swedish 123 45), and a numeric type silently destroys both.
  • Add a confidence enum (high / medium / low) so the UI can flag results worth double-checking instead of presenting every parse as equally certain.
  • Do not add fields the codebase has deliberately left unvalidated (e.g. skip an ISO country-code enum or a postal-code regex if the rest of the app treats these as free text — matching the model's output format to the app's actual validation avoids introducing a stricter contract than the rest of the system has).

Step 2: Write the Extraction Prompt

The prompt is the actual product here — get these rules right:

  • Field-by-field extraction rules. Spell out what belongs in each field explicitly, especially the boundary between fields that are easy to blend. Example: "address = street line(s) only — never repeat city/postal/country into it." Without this, models happily dump the whole address into one field.
  • Empty-string-not-guess rule. State directly: "If a field cannot be confidently determined, return an empty string — never guess, never write 'N/A' or 'unknown'." Models default to filling every field with something; this rule is what makes partial/ambiguous input safe to merge.
  • Postal-code-as-string rule. Tell the model explicitly to preserve leading zeros and the country's native format as a string.
  • Normalize country to one format. If the app's country field is free text (no ISO enum), ask for the full English country name so results are consistent and human-readable, matching whatever format the rest of the app already uses for that field.
  • Length limits. If the target fields have max-length constraints, state each one's limit in the prompt so the model self-truncates, then truncate again defensively server-side (see Step 5).
  • End the prompt with Return ONLY this JSON object: followed by the exact empty-valued schema, then the raw input text.

Step 3: Make the Request

Call the OpenAI-compatible chat-completions endpoint (POST {base_url}/chat/completions) with:

  • model: the configured model name
  • messages: a single user message containing the prompt from Step 2
  • response_format: { type: 'json_object' } — forces JSON-mode output where the provider supports it
  • A generous timeout (60-90s) — parsing calls are not always fast
  • Do not send a temperature parameter. Some newer models reject the request outright (HTTP 400) if temperature is present at all, rather than ignoring it. Omit it entirely instead of setting a default.
  • Auth via a bearer token from server-side config — never expose the key to the client.

Step 4: Parse the Response Defensively

Some models wrap JSON-mode output in markdown code fences despite response_format. Parse with a fallback:

try JSON.parse(raw)
catch: extract the first `{...}` block via a greedy regex (`/\{[\s\S]*\}/`) and JSON.parse that instead
catch again: treat as unparseable

Validate the parsed result against the Step 1 schema (e.g. with a schema library). On validation failure, return a distinct error ("AI returned an unexpected format — try again") rather than surfacing a raw parse error. On the network/API call failing, return a separate error ("parsing failed — try again"). Log the raw content (truncated) server-side for debugging, but do not leak it to the client.

Step 5: Enforce Limits Server-Side

Re-apply the same length limits from Step 2 by slicing each returned string server-side before returning it to the client. Prompt instructions are not guarantees — treat them as best-effort and enforce the real constraint in code.

Step 6: Merge Non-Destructively on the Client

This is the rule that makes the feature safe to ship: only write a parsed field into the form if the form's current value for that field is empty, and skip any field the model returned as an empty string.

if (!form.city && result.city) form.city = result.city

Never overwrite a field the user already typed, even if the parse result disagrees with it — the user's own input is always authoritative. Surface the confidence field when it is low so the admin knows to manually verify before saving, but do not block the merge on it.

Step 7: Test These Failure Modes

Before shipping, run the parser against:

  • A multi-line address block (typica
Полный SKILL.md на ClawHub

Установить AI Address Parser в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Read
Write
Edit

FAQ

Что делает скилл AI Address Parser?

Parses a free-text address blob (supplier email, Google Maps result, business card) into structured fields (street, postal code, city, state, country, contact, phone) via an LLM chat-completions call. Use when a form has separate address inputs and you want a paste-a-blob-to-autofill affordance instead of manual field-by-field entry.

Как установить скилл AI Address Parser?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл AI Address Parser запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить AI Address Parser с