跳到正文
Skillpedia
通用编程7.6k · #13130

adding-a-feature

它能做什么

这项技能是为 Agent-Native 应用添加功能的清单。它确保界面、操作、智能体指令和共享应用状态都得到更新。适合希望智能体与界面保持一致的开发者。

适用场景

  • ✓当你要为应用添加会带来数据或新能力的功能时。
  • ✓当界面中出现新功能,但智能体无法使用它的时候。
  • ✓当你希望确认改动只涉及需要的部分的时候。

技能链接

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

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/BuilderIO/agent-native/blob/main/.agents/skills/adding-a-feature/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“你能为这个应用添加一个任务跟踪功能吗?请确保智能体也能创建和列出任务。”

每周 5 个新技能,1 分钟读完。

工作原理

智能体按顺序处理四个部分:用户界面、操作、智能体指令和共享状态。凡是改动未涉及的部分,都会跳过。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Adding a Feature — The Four-Area Checklist

Rule

Every new feature MUST update all four areas. Skipping any one breaks the agent-native contract — the agent and UI must always be equal partners.

Scope check first: this is the checklist for a feature that adds app data or a new capability. A restyle, a copy change, or a screen with no new data model and no new agent-visible operation only needs the areas it actually touches — do not manufacture actions, state keys, or a skill for it.

Why

Agent-Native apps are defined by parity: everything the UI can do, the agent can do, and vice versa. A feature that only has UI is invisible to the agent. A feature that only has scripts is invisible to the user. A feature without app-state sync means the agent is blind to what the user is doing.

The Checklist

When you add a new feature, work through these four areas in order:

1. UI Component

Build the user-facing interface — a page, component, dialog, or route. Use useActionQuery and useActionMutation from @agent-native/core/client/hooks to call actions for data fetching and mutations. Do not create a custom REST endpoint just so React can call action-backed data; the action endpoint already exists.

Agent edits must refresh the UI without a background poll. Local chat-run tool completions invalidate action queries and source counters after each side-effecting tool and again at run end. There are two query paths:

  • useActionQuery / useActionMutation — local action mutations invalidate ['action'] observers, and chat-run tool completions invalidate them for agent writes. No background sync opt-in is needed for the current user's agent run. Prefer this path.
  • Raw useQuery with custom keys — fold useChangeVersions([<source>, "action"]) from @agent-native/core/client/hooks into the queryKey and set placeholderData: (prev) => prev. Local chat-run side effects bump those counters too. Remote changes require the page's explicit useDbSync({ realtime: { reason } }) opt-in only when data changes without the current user acting and must appear before refresh.

Never opt in public, anonymous, marketing, docs, or SSR routes, settings, forms, or read-mostly lists. Refetch those on focus or navigation. Shared Slides editing and the Mail inbox are the current first-party examples that need remote updates. Each opted-in open tab adds a shared background transport and one poll per idle interval; hidden tabs pause, and idle polling backs off to 1, 2, then 5 minutes. See real-time-sync for the decision rule and examples.

import { useChangeVersions } from "@agent-native/core/client/hooks";
import { useQuery } from "@tanstack/react-query";

const v = useChangeVersions(["dashboards", "action"]);
useQuery({
  queryKey: ["dashboard", id, v],
  queryFn: () => fetchDashboard(id),
  placeholderData: (prev) => prev, // no flicker on refetch
});

See the real-time-sync skill for the full pattern and source catalog.

2. Action

Create an action in actions/ using defineAction. This serves double duty: the agent calls it as a tool, and the UI calls it through useActionQuery / useActionMutation while the framework owns the HTTP transport. Set http: { method: "GET" } for read actions, leave default for writes, or set http: false for agent-only actions like navigate and view-screen.

Before adding a new route or endpoint, inspect the existing actions. Reuse an action if it already covers the business operation, extend it if the shared contract is incomplete, or create a new defineAction if the agent and UI both need the capability. Do not add pass-through /api/* routes that re-export actions. If client code needs a new framework/app route, expose a named helper or hook first and use that helper from components and docs.

For provider-backed analysis/query/reporting integrations, do not turn every provider endpoint or filter into a rigid action. Prefer the shared provider-api-catalog / provider-api-docs / provider-api-request pattern from @agent-native/core/provider-api, then add narrow convenience actions only for workflows that truly deserve a first-class shortcut. Treat this as a capability requirement, not a nice-to-have: convenience actions must not become the ceiling of what the agent can ask the provider to do. Pair broad provider access with staging or sandboxed code execution when responses may be too large for chat context. If p

常见问题

小的视觉改动也需要四个部分都改吗?

不需要。调整样式或修改文案时,只需改动实际涉及的部分。

为什么智能体和界面必须一致?

技能说明,只在界面中可见的功能,智能体无法使用;反过来也是个问题。

智能体能看到用户正在做什么吗?

技能涵盖应用状态同步,使智能体能够看到当前的界面。

详情

作者的原始描述

The four-area checklist every new feature must complete. Use when adding any feature, integration, or capability to ensure the agent and UI stay in parity.

repo: BuilderIO/agent-native

热度

GitHub 星标
7.6k
排名
#13130
许可证
MIT
更新时间
2026/11/2

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能