一键导入
create-component
Create a new agentick JSX component. Use when asked to add a component, create a UI primitive, or build a reusable agent building block.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Create a new agentick JSX component. Use when asked to add a component, create a UI primitive, or build a reusable agent building block.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Create a new agentick tool using createTool. Use when asked to add a tool, create a tool, or implement tool functionality.
Add a new package to the agentick monorepo. Use when creating a new @agentick/* package.
Create a new agentick lifecycle hook or custom hook. Use when asked to add a hook, create reactive behavior, or implement lifecycle logic.
Build, typecheck, and test the agentick monorepo. Use when asked to verify changes, run checks, or ensure nothing is broken.
Test an agentick agent with mock model responses. Use when asked to write tests, test an agent, or verify agent behavior.
Create a new model adapter for agentick. Use when asked to add support for a new model provider (Anthropic, Mistral, Cohere, etc).
| name | create-component |
| description | Create a new agentick JSX component. Use when asked to add a component, create a UI primitive, or build a reusable agent building block. |
Agentick components are React components. They render to the fiber tree, and the compiler transforms the tree into model context.
<message>, <section>, <tool>, <entry>)<H1>, <List>, <Table>)packages/core/src/jsx/components/:// packages/core/src/jsx/components/my-component.tsx
import React, { useEffect, useDebugValue } from "react";
import { useCom } from "../../hooks/context";
import type { ComponentBaseProps } from "./index";
export interface MyComponentProps extends ComponentBaseProps {
title: string;
children?: React.ReactNode;
}
export function MyComponent({ title, children }: MyComponentProps) {
const ctx = useCom();
useDebugValue("MyComponent");
return (
<section id={`my-${title}`}>
{title && <h2>{title}</h2>}
{children}
</section>
);
}
MyComponent.displayName = "MyComponent";
// packages/core/src/jsx/components/index.ts
export { MyComponent } from "./my-component";
export type { MyComponentProps } from "./my-component";
// packages/core/src/index.ts
export { MyComponent } from "./jsx/components";
These are the low-level elements the reconciler understands:
| Element | Purpose |
|---|---|
<message> | A message in the timeline |
<section> | A content section with id |
<tool> | A tool registration |
<entry> | A timeline entry |
<system> | System prompt content |
Components compose these to produce model context.
Before creating new ones, check packages/core/src/jsx/components/semantic.tsx:
<H1>, <H2>, <H3>, <Header>, <Paragraph>, <List>, <ListItem>, <Table>, <Row>, <Column>
And content blocks in packages/core/src/jsx/components/content.tsx:
<Text>, <Image>, <Code>, <Json>, <Document>, <Audio>, <Video>
Components that set up state without rendering visible content:
export function MyConfig({ apiKey }: { apiKey: string }) {
const ctx = useCom();
useEffect(() => {
ctx.setState("apiKey", apiKey);
}, [apiKey]);
return React.createElement(React.Fragment, null);
}
packages/core/src/jsx/components/packages/core/src/jsx/components/index.tspackages/core/src/jsx/components/primitives.tspackages/core/src/jsx/components/semantic.tsxpackages/core/src/jsx/components/content.tsxpackages/core/src/jsx/components/messages.tsxpackages/core/src/jsx/ARCHITECTURE.mdimport { describe, it, expect, afterEach } from "vitest";
import { createTestAdapter, compileAgent, cleanup } from "@agentick/core/testing";
describe("MyComponent", () => {
afterEach(() => cleanup());
it("renders to model context", async () => {
const adapter = createTestAdapter({ defaultResponse: "ok" });
const { compiled } = await compileAgent(() => (
<>
<Model model={adapter} />
<MyComponent title="Test">Content here</MyComponent>
<Timeline />
</>
));
// Verify the compiled output includes your component's content
});
});
After creating, run:
pnpm --filter @agentick/core typecheck
pnpm --filter @agentick/core test