diffs
它能做什么
它指导 AI 使用 @pierre/diffs 库,在 React 或原生 JavaScript 中呈现带高亮的代码、补丁和审查界面。适用于开发代码查看功能的开发者。
适用场景
- ✓当你的网页应用需要以语法高亮显示代码文件或差异时。
- ✓当你要构建代码审查界面或合并冲突视图时。
- ✓当你在 React 或原生 JavaScript 中使用 @pierre/diffs 时。
技能链接
https://github.com/trycompai/crm/blob/release/.agents/skills/diffs/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“你能用 @pierre/diffs 库为我的 React 应用添加一个代码差异查看器吗?”
每周 5 个新技能,1 分钟读完。
工作原理
AI 会安装该包,选择匹配的 React 或编辑器参考,并使用库的组件呈现文件或差异。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
@pierre/diffs
Use @pierre/diffs to render syntax-highlighted files and diffs. Use its
optional editor, SSR, and worker entries for those capabilities.
Install
pnpm add @pierre/diffs
Install react and react-dom when the app uses the React entry.
Select an API reference
| Surface | Reference |
|---|---|
@pierre/diffs/react |
React API |
@pierre/diffs/edit |
Editor API |
Select a recipe
| Task | Recipe |
|---|---|
| Render a file or diff in React | Render with React |
| Build a virtualized review surface | Use CodeView |
| Edit a React surface or CodeView | Edit with React |
Not vendored here
These references were not copied into this skill. There is no local file for them. Read the package types and the upstream documentation instead.
- Core API: root components, parsing, and file extension APIs.
- Highlighting API: languages, themes, highlighter state, and streams.
- Low-level rendering API: renderers, managers, DOM helpers, and constants.
- Shared types: data, option, render, selection, and editor types.
- SSR API for
@pierre/diffs/ssr, and the recipe for preloading server markup. - Worker API for
@pierre/diffs/worker, and the recipe for a worker pool. - Recipes for vanilla JavaScript rendering and vanilla editing.
- Recipes for line annotations and selection.
- Recipe for registering a custom Shiki language or theme.
常见问题
它支持哪些框架?
它涵盖 React 和原生 JavaScript,并提到了服务端渲染和 Worker。
用户可以用它编辑代码吗?
可以。它有一个可选的编辑器入口,用于编辑界面。
所有参考文档都包含在内吗?
不是全部。有些参考资料没有复制到该技能中,因此 AI 必须阅读包的类型定义和上游文档来获取这些内容。
详情
作者的原始描述
Use when an app uses @pierre/diffs to render or edit code files, diffs, patches, merge conflicts, or CodeView review surfaces, including React, vanilla JavaScript, SSR, workers, annotations, selection, and custom Shiki languages or themes.
repo: trycompai/crm
热度
- GitHub 星标
- 12k
- 排名
- #11517
- 许可证
- MIT
- 更新时间
- 2026/11/1
评论
- …
同一仓库的更多技能
ai-elements
12k帮你的智能体用现成的组件构建 AI 聊天界面,包括对话、消息、工具显示和提示输入框。
ai-sdk
12k帮你的智能体使用 Vercel AI SDK 构建 AI 功能,包括文本生成、流式输出、工具调用和智能体。
better-accessibility
12k帮你的智能体让界面可以通过键盘和屏幕阅读器使用,涵盖焦点、标签、ARIA 和表单。
better-auth-best-practices
12k帮你的智能体按照官方文档步骤,在 TypeScript 应用中设置 Better Auth,实现登录、会话、OAuth 和插件。