location-input
Installation
Review the source and dependencies with a prompt. A package is available to download.
Install with an AI assistant
Copy the prompt so your assistant can review the pinned revision and dependencies first.
View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "location-input" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-88885ee73577d1e83dc73ea48e21a86dff7bcaffe2bffb95ba0f640defa34164. Verify the upstream source and version against https://github.com/swyxio/skills before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.
Source and setup
github.com
Setup guidance pending
See the original source for supported tools, dependencies, and permissions.
Installation test pending
For building or optimizing city/country form inputs that support accessible autocomplete, abbreviation matching, and optionally offer browser-location-based suggestions. Intended for address fields in applicant information, profiles, or registration forms; street-level address validation and precise geofencing require other solutions.
Introduction source: third_party · swyxio · 0.0.1 Reference
SkillPi interpretation
- Tasks
- Build or improve city/country form inputs with accessible autocomplete, abbreviation matching, and optional browser-location suggestions. Use for applicant, profile, or registration location fields; street-address validation and exact geofencing require a different approach.
- Inputs and outputs
- Make a location field easy to complete while preserving the person's intended answer. Infer the required precision from the product: “Where are you based?” normally needs a city or country, and current device location may differ from home. Implement only the requested controls; this skill does not authorize deployment or changes to unrelated forms.
- Testing
- Not tested
Browse files
Frontmatter
name: location-input
description: Build or improve city/country form inputs with accessible autocomplete, abbreviation matching, and optional browser-location suggestions. Use for applicant, profile, or registration location fields; street-address validation and exact geofencing require a different approach.Location input
Make a location field easy to complete while preserving the person's intended answer. Infer the required precision from the product: “Where are you based?” normally needs a city or country, and current device location may differ from home. Implement only the requested controls; this skill does not authorize deployment or changes to unrelated forms.
Choose data and controls
- Prefer an editable combobox with manual selection. Keep custom text valid unless the product explicitly requires a canonical place. Do not silently expand an abbreviation or replace text on blur.
- Reuse the project's accessible combobox when suitable. Inspect its current documentation and types before introducing another dependency. React Aria supports
allowsCustomValue; its async collections can needallowsEmptyCollectionand an empty/loading renderer so typing before data arrives still opens suggestions. - For broad city coverage without per-query costs, consider a lazy-loaded local index from GeoNames cities15000 plus countryInfo and administrative-region names. Measure payload size and search responsiveness; avoid bundling the full dataset into initial application JavaScript. A remote service is appropriate when coverage, localization, or geographic precision justifies it.
- Keep the dataset reproducible and attributed under its actual license. A population-filtered list omits small towns and is not a complete geography database. Retain free text for missing locations.
- Build a small explicit alias layer against stable place IDs: SF → San Francisco, NYC → New York City, Bangalore → Bengaluru, UK → United Kingdom. Do not infer arbitrary acronyms or silently map a metro area to its central city. Add alternate names/local scripts when required by the audience.
Search and selection
Show city, relevant region, and country together to distinguish repeated names. Support country-only answers when the field permits them. Normalize case, accents, and separators for matching while preserving display names. Rank exact names and curated aliases above prefixes, then broader word matches; population can break ties rather than override a stronger match.
Start with about five suggestions, adapted to available mobile space. Preserve Arrow Up/Down, Enter selection, Escape dismissal, Tab navigation, visible focus, and screen-reader labels. Ensure selecting a result does not also advance or submit the form. Allow a no-match answer to remain unchanged.
Represent loading, no matches, and fetch failure separately. A failed dataset fetch must not leave a perpetual “Loading…” message or block ordinary typing. If filtering is already performed externally, check that the component does not filter aliases out again using its own label-only matching.
Store the chosen display label or custom text through the existing form state, draft, validation, and submission path. Add canonical IDs or country codes only when needed by the product; preserve the distinction between selected and unverified free text. Do not expand the schema solely to anticipate future analytics.
Optional “Use current location”
Request geolocation only after the person activates the button. Use a one-shot browser request with visible pending/error feedback; HTTPS, browser support, and user permission are prerequisites. Prefer ordinary accuracy for city-level input. A request timeout may exclude time spent waiting for permission, so don't promise a fixed total duration.
Coordinates are not a city name. Choose one of these deliberately:
- Nearby-city suggestion: calculate locally against city coordinates and explicitly ask the user to confirm it. Nearest-city matching does not establish municipal boundaries or the correct side of a border. Bound accepted distance and reported device uncertainty for the product; the example application used 50 km and 25 km respectively, not universal defaults.
- Reverse geocoding: use an appropriate provider when accurate administrative labels are required. Verify current terms, coverage, and costs. Disclose coordinate transmission where applicable; do not claim location stays local when calling an external geocoder.
Keep the result editable and avoid overwriting typed text while a request is pending. Invalidate stale results when the input changes, a newer request starts, or the field unmounts. Recover from denial, timeout, unsupported browsers, poor accuracy, and missing city data with a usable manual entry. Retain only the location information the form needs; city-level forms ordinarily do not need precise coordinates saved or logged.
Verify the interaction
Test representative aliases, accented names, repeated city names with region/country qualifiers, country-only matches, and a town absent from the dataset. Test typing before the data finishes loading, keyboard and pointer selection, Escape, blur, and persistence through the existing form path.
Use a simulated geolocation for success and an explicit denied-permission result for failure. Merely clearing a browser test context's permissions can leave a prompt pending rather than simulate denial. Verify that a detected suggestion requires confirmation and that late results cannot overwrite edits. Block the dataset request once and confirm that free text still works.
Inspect desktop and mobile dropdowns for width, wrapping, contrast, overflow, and touch targets. Scope test locators to this field or its listbox: unrelated native selects also expose combobox and option roles. Do not submit real applications as part of a UI-only check.
Primary references
Consult current documentation when selecting an implementation or diagnosing library behavior:
- W3C editable combobox patterns
- React Aria ComboBox
- GeoNames downloads and attribution
- Browser Geolocation API
- Baymard autocomplete research — adapt its ecommerce findings to form entry rather than importing every search behavior.
Current listing version
0.0.1
Quality assessment
Out of 100 · Assessment report from SkillPi LAB.
Highlights
- 提供本地 GeoNames 索引与远程服务的权衡建议
- 强调保留用户自由文本输入,避免过度规范化
- 明确区分城市级输入与街道级验证的适用边界
Areas to improve
-
Description in the wrong location Reported severity: Minor
顶层 frontmatter 中 description 字段内容与 skill_body 内重复,但 body 内有更详细说明
Recommendation: 建议将详细描述移至顶层 frontmatter,body 内可简要引用
Highlights
- 触发词覆盖 autocomplete、abbreviation matching、browser-location 等关键能力
Highlights
- 分阶段实施路径清晰:数据选择→搜索→定位→验证
- 包含可量化的交互参数建议(如5条建议、50km距离阈值)
Areas to improve
-
部分实现细节依赖外部状态管理 Reported severity: Minor
如“Store the chosen display label through the existing form state”需开发者确保状态一致性
Recommendation: 建议补充状态管理集成示例或注意事项
Highlights
- 覆盖定位权限拒绝、超时、数据集加载失败等多类异常
- 强调不可自动覆盖用户输入,保障可控性
The arithmetic mean of the first four original scores, rounded to a whole number.
Static text checks
100 / 100 · skillpi-20261123-no-r3-v1
No current rules matched the text.
This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.
Permissions and checks before use
Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.
These common operations were not identified in the main document. This does not mean no permissions or risks exist.
Domains or addresses referenced in the document
These addresses may be documentation links or examples, not an approved network allowlist. Verify actual destinations and outgoing data before use.
- baymard.com
- developer.mozilla.org
- react-aria.adobe.com
- www.geonames.org
- www.w3.org
Security rating and access scope
safe · Static evidence review; not a runtime safety guarantee.
Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.
User discussion
No verified reviews yet.