Chuyển đến nội dung
Skillpedia
Website và giao diện (frontend)7.6k · #13168

native-navigation

Skill này làm gì

Skill này nêu khi nào nên dùng liên kết thật để điều hướng trong ứng dụng Agent-Native, thay vì một nút di chuyển trang bằng code. Nó giữ cho Cmd-click, click chuột giữa và thao tác bằng bàn phím vẫn hoạt động. Skill dành cho lập trình viên xây dựng điều hướng trong giao diện.

Khi nào nên dùng

  • ✓Khi bạn thêm một nút hoặc thẻ cần mở một trang khác trong ứng dụng.
  • ✓Khi một điều khiển điều hướng không phản hồi Cmd-click hoặc click chuột giữa.
  • ✓Khi bạn cần quyết định giữa liên kết nội bộ và liên kết bên ngoài.

Liên kết skill

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

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/BuilderIO/agent-native/blob/main/.agents/skills/native-navigation/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Bạn có thể đổi các thẻ dự án để mở trang dự án và vẫn hoạt động với Cmd-click không?”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Lập trình viên dùng liên kết của router cho các trang bên trong ứng dụng, liên kết thường cho trang bên ngoài hoặc tab mới, và bọc một nút trong liên kết khi cần.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

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
Câu hỏi thường gặp

Vì sao không dùng nút để điều hướng?

Nút che giấu đích đến và chặn các hành vi trình duyệt như Cmd-click và click chuột giữa.

Khi nào điều hướng bằng code vẫn đúng?

Skill nói giữ nó cho các chuyển hướng sau cập nhật, cùng các luồng đăng nhập và cửa sổ bật lên.

Còn thẻ có nút bên trong thì sao?

Skill nói chỉ liên kết phần không tương tác của thẻ, và tuyệt đối không lồng liên kết hoặc nút vào nhau.

Chi tiết

Mô tả gốc của tác giả

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

Độ phổ biến

Sao GitHub
7.6k
Vị trí xếp hạng
#13168
Giấy phép
MIT
Cập nhật
2/11/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự