context-awareness
O que ela faz
Esta skill explica como um aplicativo Agent-Native informa ao agente o que está na tela. Cobre o estado de navegação, os detalhes dos registros visíveis e a seleção atual. É para desenvolvedores que querem que o agente aja sobre o que o usuário vê.
Quando usar
- ✓Quando o agente pergunta a qual item você se refere, mesmo com um item aberto na tela.
- ✓Quando você quer que o agente aja sobre a seleção atual em um aplicativo.
- ✓Quando você está depurando por que o agente parece não saber da tela atual.
Link da skill
https://github.com/BuilderIO/agent-native/blob/main/.agents/skills/context-awareness/SKILL.mdCopie e cole na sua IA (Claude, ChatGPT ou Cursor) pedindo para seguir as instruções.
Como usar
O jeito mais fácil: copie a mensagem e cole na sua IA. Ela lê a skill e segue as instruções.
Mensagem pronta para colar
Para Claude Code, Codex ou Cursor: rode na pasta do projeto e a skill fica instalada.
Baixe o SKILL.md e coloque na pasta de skills do seu agente.
Exemplo do que pedir para a IA
“Pode fazer o agente saber qual e-mail está aberto para eu pedir que ele responda sem precisar citar o e-mail?”
5 skills novas por semana. 1 minuto de leitura.
Como funciona
O aplicativo grava seu estado de tela atual em um hook de estado de rota compartilhado quando a página muda. Cada turno do agente inclui um instantâneo da tela atual, para que ele conheça a visão e o item selecionado.
Conteúdo técnico (SKILL.md original)
Texto original do autor, em inglês, direto do GitHub.
Context Awareness
Rule
Apps can sync semantic navigation state when the route changes by using the
shared route-state hook. When screen context is available, Core includes a
<current-screen> snapshot in each agent turn, so the agent can get basic
route context without first calling another tool. Apps can add concise
visible-record details to that snapshot and expose selection in tab-scoped
state.
Why
Without context awareness, the agent is blind. It asks "which email?" when the user is staring at one. It cannot act on the current selection, cannot provide relevant suggestions, and cannot modify what the user sees. Context awareness is what makes the agent feel like a collaborator rather than a disconnected chatbot.
The Core Patterns
1. Navigation State (navigation key)
Use the shared route-state hook to write a tab-scoped navigation key as the
route changes. Include semantic screen state such as the view, open IDs, active
tab, and focused object.
UI side — use useAgentRouteState in the app's route-state hook. The app
can wrap it in an app-owned useNavigationState hook to map route paths to
semantic views and consume the agent's navigate command.
// app/hooks/use-navigation-state.ts
import { useAgentRouteState } from "@agent-native/core/client/navigation";
import { TAB_ID } from "@/lib/tab-id";
export function useNavigationState() {
useAgentRouteState({
browserTabId: TAB_ID,
requestSource: TAB_ID,
getNavigationState: ({ pathname, searchParams }) => ({
view:
pathname === "/"
? "home"
: pathname === "/sign-in"
? "sign-in"
: pathname.replace(/^\/+/, ""),
// Optional semantic alias. Raw query params are already exposed in
// <current-url> and controllable with set-search-params.
label: searchParams.get("label"),
}),
getCommandPath: (command: any) =>
command.path ?? `/${command.view === "home" ? "home" : command.view}`,
});
}
The default scaffold uses /home for home and /sign-in for authentication;
/ redirects according to the configured home route. Map navigation to the
app's actual routes and pass an explicit path for destinations that do not
follow the /<view> convention.
TAB_ID comes from the framework's getBrowserTabId() (see the scaffolded app/lib/tab-id.ts; never redefine it). The server resolves tab-scoped application_state writes and page-local WebMCP calls (X-Agent-Native-Browser-Tab) against this same id, so a hand-rolled random id silently breaks selection sync for hidden and background tabs.
Agent side — read before acting:
import { readAppState } from "@agent-native/core/application-state";
const navigation = await readAppState("navigation");
// e.g. { view: "thread", threadId: "abc123", subject: "Re: Q3 Planning" }
What to include in navigation state:
view— the current page/section (e.g., "inbox", "form-builder", "dashboard")- Item IDs — the selected/open item (e.g.,
threadId,formId,issueKey) - Semantic aliases — label names, active tabs, focused row, or stable filter names the agent should reason about
- Focused object IDs and active tabs that are not already represented by URL state
Keep text-selection ranges and excerpts in the tab-scoped selection key, not
in navigation.
Raw URL query params are already synced by the framework to __url__ and shown to the built-in agent as <current-url>. Keep shareable filters in URL state, then use view-screen to summarize important query params as activeFilters when helpful.
Keep application_state values small. Do not store pasted files, base64 images,
recording chunks, screenshots, or other large blobs in navigation or app-state
keys; upload them and store only a URL or storage handle.
Selection state
For app-owned per-tab selection, suffix the key with TAB_ID; requestSource
labels the write origin but does not scope the key. Keep the value to stable ids
and a short label or excerpt, never the full document:
import { writeClientAppState } from "@agent-native/core/client/hooks";
import { TAB_ID } from "@/lib/tab-id";
await writeClientAppState(
`selection:${TAB_ID}`,
{ kind: "text", id: "artifact-123", text: "short excerpt" },
{ requestSource: TAB_ID },
);
A server action can read that tab's value with
readAppStateForCurrentTab("selection"). A view-screen result may include the
selection and a specific next a
Perguntas frequentes
O que está incluído no instantâneo?
Inclui a visão atual e detalhes como IDs abertos, a aba ativa e o registro em foco.
O agente precisa chamar uma ferramenta para ver a tela?
O contexto básico da rota é incluído em cada turno, então não é preciso uma chamada extra de ferramenta para isso.
O agente pode mudar o que eu vejo?
A skill cobre actions de navegação que permitem ao agente levar o usuário a uma tela.
Detalhes
Descrição original do autor
How the agent knows what the user is looking at. Use when exposing UI state to the agent, implementing view-screen or navigate actions, wiring navigation state, or debugging agent context issues.
repo: BuilderIO/agent-native
Popularidade
- Estrelas no GitHub
- 7,6 mil
- Posição no ranking
- #13148
- Licença
- MIT
- Atualizada em
- 02/11/2026
Comentários
- …
Mais skills deste repositório
design-exploration
7,6 milAjuda seu agente a explorar várias direções de design de interface lado a lado, deixar você escolher uma e depois refinar o design escolhido.
visual-edit
7,6 milAjuda seu agente a abrir um aplicativo local em execução em um editor visual, para que você possa revisar e editar as telas reais juntos.
turn-into-app
7,6 milTransforma um fluxo de trabalho, uma planilha ou um projeto em um aplicativo visual bem acabado, com telas preenchidas e um agente trabalhando por trás dos controles.
visual-plan
7,6 milTransforma um plano em texto simples em um plano visual interativo, com diagramas, mapas de arquivos, trechos de código e perguntas em aberto.
Skills parecidas
angular-developer
280 milAjuda seu agente a criar código Angular e a dar conselhos sobre a estrutura do projeto. É útil para iniciar novos projetos, criar partes do código ou melhorar a performance e acessibilidade.
frontend-a11y
280 milAjuda seu agente a tornar interfaces web acessíveis para todos. Ele garante que sites e apps funcionem bem com leitores de tela e navegação por teclado.
frontend-patterns
280 milFaz seu agente aplicar padrões modernos no desenvolvimento frontend. Ele otimiza performance, gerencia estado e segue boas práticas em React e Next.js.