跳到正文
Skillpedia
网站与界面(前端)12k · #11517

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。它会读取这个技能并按说明操作。

可直接粘贴的消息

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

可以这样问 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

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能