本文へスキップ
Skillpedia
WebサイトとUI(フロントエンド)7.6k · #13168

native-navigation

できること

このスキルは、Agent-Native アプリで、コードでページを移動させるボタンではなく、本物のリンクをどのような場合に使うべきかを示します。Cmd+クリック、中クリック、キーボード操作が機能し続けるようにします。画面上のナビゲーションを作る開発者向けです。

使う場面

  • ✓別のページを開くべきボタンやカードを追加するとき。
  • ✓ナビゲーションの操作が Cmd+クリックや中クリックに反応しないとき。
  • ✓アプリ内のリンクと外部リンクのどちらを使うか決める必要があるとき。

スキルのリンク

https://github.com/BuilderIO/agent-native/blob/main/.agents/skills/native-navigation/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/BuilderIO/agent-native/blob/main/.agents/skills/native-navigation/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“プロジェクトのカードを変更して、プロジェクトページを開くようにしてください。Cmd+クリックでも使えるようにしてください。”

毎週5つの新しいスキル。1分で読めます。

仕組み

開発者は、アプリ内のページにはルーターのリンクを、外部や新しいタブで開くページには通常のリンクを使います。必要に応じて、ボタンをリンクで囲みます。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

Native Navigation

Rule

Pure navigation must render a real React Router <Link> for same-SPA routes, a native <a href> for external/public or explicit new-tab destinations, or a shadcn Button asChild wrapper around one. Do not use a button whose only job is to call navigate(), window.open(), or window.location.

Why

Browser modifier-click, middle-click, keyboard activation, accessibility, and normal client-side routing come from real links. Imperative JavaScript navigation hides the destination and blocks those browser semantics.

How

import { Link } from "react-router";

<Link to={`/items/${item.id}`}>...</Link>

<Button asChild>
  <Link to="/settings">Settings</Link>
</Button>

<a href={previewUrl} target="_blank" rel="noopener noreferrer">
  Preview
</a>
  • Use Link for same-SPA internal routes.
  • Use <a> when the URL is external, crosses an app/public boundary, is an auth or sign-in destination, or intentionally opens in a new tab.
  • Preserve query strings and hashes in to or href.
  • For cards with nested actions, link only the non-interactive card region or use a transparent Link overlay; never nest links or buttons.
  • If selection mode changes click behavior, prevent default only for an unmodified primary click and preserve modified clicks.

Keep imperative navigation for post-mutation redirects, OAuth and popup flows, downloads, media/blob URLs, playback, keyboard shortcuts, and stateful tabs.

Review

Search for onClick={() => navigate, window.open, window.location, onAuxClick, and buttons whose only purpose is routing. For each candidate, confirm whether it is pure navigation or a stateful workflow before changing it.

Verify the rendered DOM exposes an href, then test normal click, Cmd/Ctrl-click, middle-click, keyboard Enter, and nested controls where applicable. Run oxfmt and focused app tests or typechecks for the touched package.

Related Skills

  • client-side-routing
  • frontend-design
  • shadcn-ui
よくある質問

ページの移動にボタンを使ってはいけないのはなぜですか?

ボタンは移動先を隠し、Cmd+クリックや中クリックなどのブラウザの動作を妨げるからです。

コードによる移動が正しい場合もありますか?

あります。更新後のリダイレクトや、サインインやポップアップの流れでは、コードによる移動を使うべきだとスキルは述べています。

中にボタンがあるカードはどうしますか?

操作できない部分だけをリンクにします。リンクやボタンを入れ子にしないよう、スキルは指示しています。

詳細

作者による元の説明

Use when adding or reviewing UI navigation so internal routes preserve normal SPA behavior plus Cmd/Ctrl-click and middle-click new-tab semantics.

repo: BuilderIO/agent-native

人気

GitHubのスター
7.6k
ランキング
#13168
ライセンス
MIT
更新日
2026/11/2

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル