ideal-postcodes/skills

ideal-postcodes-address-finder

Use this skill whenever the user wants address autocomplete, address suggestions as the user types, address validation in a form, UK address lookup, or any form field that should be auto-populated from a selected address — even if they don't name the package.

Quelltext ansehen

Verwendung

  1. Installationsbefehl kopieren und das Quellpaket vor der Installation in der eigenen Agentenumgebung prüfen.
  2. Benötigte Werkzeuge, Zugangsdaten und Hosts im Original prüfen.
  3. Eingabe und gewünschtes Ergebnis beschreiben und die Ausgabe mit den Quellen abgleichen.
npx skills add https://github.com/ideal-postcodes/skills --skill ideal-postcodes-address-finder

Vor dem Start

  • Die Installation umfasst weder Modellabo noch API-Kontingent oder Dateizugriffsrechte.
  • Sterne und Installationen zeigen Aktivität, keine unabhängige Qualitäts- oder Sicherheitsprüfung.
Originales Skill-Dokument

Aus dem Quell-Repository gerendert; Überschriften, Beispiele, Code, Tabellen, Links und Bilder bleiben erhalten.

Address Finder

Address autocomplete widget for the Ideal Postcodes API. Suggests addresses as the user types and populates form fields when one is selected.

Quick Start (npm + bundler)

bash
npm install @ideal-postcodes/address-finder
js
import { AddressFinder } from "@ideal-postcodes/address-finder";

const controller = AddressFinder.setup({
  apiKey: "ak_test",
  outputFields: {
    line_1: "#line_1",
    line_2: "#line_2",
    line_3: "#line_3",
    post_town: "#post_town",
    postcode: "#postcode",
  },
});

If your bundler chokes on the source package, use @ideal-postcodes/address-finder-bundled instead — same API, pre-transpiled and polyfilled.

Quick Start (CDN / drop-in script)

html
<script src="https://cdn.jsdelivr.net/npm/@ideal-postcodes/address-finder-bundled"></script>
<script>
  IdealPostcodes.AddressFinder.setup({
    apiKey: "ak_test",
    outputFields: {
      line_1: "#line_1",
      line_2: "#line_2",
      line_3: "#line_3",
      post_town: "#post_town",
      postcode: "#postcode",
    },
  });
</script>

React

Use AddressFinder.watch (not .setup) inside useEffect — it will pick up the input field once it mounts. See `react.md`.

Critical Gotchas

  • Use `AddressFinder.setup({...})` — not `new AddressFinder(...)`. It's a factory method, not a constructor.
  • `apiKey` is camelCase, not api_key or API_KEY.
  • `outputFields` is required — it's the map from address attributes (line_1, post_town, postcode, …) to your form's input selectors. Without it, the widget has nothing to populate.
  • Pin your CDN version in production. Pulling from @latest will silently break when a major bumps. Use @ideal-postcodes/address-finder-bundled@4 (or whatever current major).
  • Source vs bundled package: use @ideal-postcodes/address-finder for bundlers (smaller, tree-shakable). Use @ideal-postcodes/address-finder-bundled for <script> tags or if your bundler can't handle the source package.
  • API key allowed URLs. Frontend keys are restricted by domain. If requests fail with 403, check your key's allowed URL list at ideal-postcodes.co.uk/account — match scheme + host (e.g. https://example.com, no trailing slash, no path).
  • Country toolbar vs country restriction are independent. restrictCountries: ["GBR"] removes the country picker control inside the toolbar — it does not hide the toolbar bar itself. For a clean single-country setup with no toolbar on focus, also set hideToolbar: true. See `hide-toolbar.md`.
  • Bundler CSS import. The source package does not auto-inject CSS. Either import the stylesheet (@ideal-postcodes/address-finder/css/address-finder.css) or set injectStyle: true in the setup options.

For the long tail of error patterns and fixes, see `troubleshooting.md`.

When to read which reference

The references below are organised by intent. Read only the ones relevant to the user's task — not the whole list.

Setup and initialisation

React / single-page apps

Country handling

Filter / bias suggestions

Styling and UI

Form layout patterns

Address data

Concepts

Troubleshooting

Full documentation

The full Ideal Postcodes documentation — every guide, API reference, and integration — is available as a single file at llms.txt. Point your agent there for anything this skill doesn't cover.

Verwandte Aufgaben

aus demselben Repository

Weitere Skills

Alle Skills