跳到主要内容

plugin-authoring 精选

Make a mod: a live pane, band, status line, toast or hook inside Claude Code (terminal or desktop Code tab), written as a plugin of function hooks that hot-reloads in this session. Load before writing or debugging a hooks module.

在 GitHub 打开

安装方式

cp -r Anthropic/claude-code/skills/plugin-authoring ~/.claude/skills/plugin-authoring

把该 skill 目录放进客户端 skills 目录。不同客户端的目录可能不同,Claude Code 默认是 ~/.claude/skills/

整仓一次性获取:git clone --depth 1 https://github.com/asgeirtj/system_prompts_leaks.git

依赖与权限

  • 无需 API Key
  • 无需联网
  • 依赖外部命令:node go make
  • 以上为按正文与 frontmatter 自动推断的信号,仅供参考;安装前建议先阅读原文。

SKILL.md 正文

来源 asgeirtj/system_prompts_leaks@a09e0e7 · 许可 CC0-1.0 · 内容未修改

WHERE TO WRITE IT. Write each mod in its own child folder, /Users/asgeirtj/.claude/dev-mods/74895c3a-80b2-48bc-85dc-9103e7c3e720/<mod-name>/, three files written directly:

  • .claude-plugin/plugin.json: { "name": "<mod-name>", "version": "0.1.0", "description": "<one line>" }
  • hooks/hooks.json: { "modules": ["./register.tsx"] }, one path, relative to that file
  • hooks/register.tsx (or .ts): the hooks module, export const register: Register = (on, options) => { ... }, the type imported from 'claude-code'

A mod that keeps values in $.state has a fourth file, types/index.d.ts: its type contract, declaring each value in interface PluginState under the mod's name, named in plugin.json as "types": "./types/index.d.ts". The module imports its value types from '../types', and claude plugin validate holds every $.state key the module names to that contract.

WHERE THE TYPES ARE. The engine writes them; there is no command to run. Before the mod has loaded: /private/tmp/claude-501/bundled-skills/2.1.294/56f72a089d917f30d0cee8aa023e8c65/plugin-authoring/types/claude-code.d.ts, this build's API and built-in tools, written as this skill loaded (this process's own folder: after a restart the next load of this skill writes and names a new one). Once the engine has loaded the mod (hot reloading enabled for this session, or a --plugin-dir folder), <mod folder>/.claude-plugin/types/ holds the same for the editor: claude-code/index.d.ts, the API; claude-code-tools/index.d.ts, so e.tool === "Bash" narrows e; claude-code-mcp/index.d.ts, the MCP tools connected when the mod last reloaded; each dependencies plugin's contract; and a tsconfig.json the mod's own extends, so tsc -p <mod folder> type-checks it. The API file carries every event's input and result, every noun and method on $ with its doc comment and an example, and every element's props, in about 14,000 lines: grep it for the name at hand ('tool.call', Pane: {, export type ToolCallResult) and read the declaration it lands on.

WHAT HAPPENS WHEN THE TURN ENDS. Loading this skill through the Skill tool or its slash command starts the engine's watch on the folder that holds the mod folders. The first file written under it makes the engine ask the person, once, right then, while the turn goes on: "Enable hot reloading for this session?", with How does this work? first, then Enable for this session and Not now. That question is the switch, and the person alone answers it: no permission mode, rule or hook does. On Enable for this session the folder joins the session's plugin folders and the mod loads when the turn ends, whole, and each later edit reloads it when the turn that made the edit ends. The answer reaches you as a notice at the start of your next turn, one of: enabled, with what the load came to; declined (the mods are written and load the next time this session starts; the person can ask for the question again); still open (a new prompt from the person takes the question down, and the engine asks again when that turn ends); or off, with the reason (nobody could be asked, as under claude -p; an organization's policy; an untrusted workspace). A process that restarted loads an enabled folder again by itself; otherwise its watch starts the next time this skill loads, and a manifest already in the folder raises the question when that turn ends.

A reload is a fresh load of the module: register runs again and session.start fires again. Values in $.state (the session's) and $.store (across sessions) are the host's and stay; the module's own variables start over.

A mod in one paragraph

on(event, matcher?, hook) adds a hook, and every hook is ($, e, next): $ is the engine interface, each call spelled noun then method; e is the event's input, a plain frozen value; next(e) runs the plugins beneath and then the engine's own behaviour, resolving to the event's result. A hook that returns without next answers for itself; next({ ...e, x }) rewrites what the rest sees. The module runs in an environment of its own, with no DOM and no Node: $ reaches everything outside it. JSX compiles against the global h, and the elements come from the drawing surface's own table, const { Box, Text, Button } = $.ui.resolve(e), where e.surface is terminal, desktop, vscode or mobile.

From the ask to the shape

Each example is one complete hooks module; with the two JSON files above, and its contract where it has one, it is a mod that loads, validates and type-checks on this build.

The person asks forWhat it isShown in
a pane, panel, sidebar, live view$.ui.open({ id, title }), drawn by a ui.render hook on { component: 'Pane', requestId: id }; opened by something the person did (a command they typed, a Button they pressed) it seats at any width; opened unasked (from session.start, a timer) it seats from 144 terminal columns and waits below that/private/tmp/claude-501/bundled-skills/2.1.294/56f72a089d917f30d0cee8aa023e8c65/plugin-authoring/examples/pane.tsx, its contract /private/tmp/claude-501/bundled-skills/2.1.294/56f72a089d917f30d0cee8aa023e8c65/plugin-authoring/examples/pane-state.d.ts
a band or row above the prompta ui.render hook on { component: 'AbovePrompt' } returning a tree, or next(e) with nothing to show/private/tmp/claude-501/bundled-skills/2.1.294/56f72a089d917f30d0cee8aa023e8c65/plugin-authoring/examples/band.tsx, its contract /private/tmp/claude-501/bundled-skills/2.1.294/56f72a089d917f30d0cee8aa023e8c65/plugin-authoring/examples/band-state.d.ts
a status line entry$.ui.status(text) from any hook; undefined clears it/private/tmp/claude-501/bundled-skills/2.1.294/56f72a089d917f30d0cee8aa023e8c65/plugin-authoring/examples/tool-call.ts
a toast$.ui.toast(text) from any hook/private/tmp/claude-501/bundled-skills/2.1.294/56f72a089d917f30d0cee8aa023e8c65/plugin-authoring/examples/band.tsx
block, rewrite or react to a tool callon('tool.call', { tool }, hook): return { deny }, call next({ ...e, ... }), or await next(e) and act on the result/private/tmp/claude-501/bundled-skills/2.1.294/56f72a089d917f30d0cee8aa023e8c65/plugin-authoring/examples/tool-call.ts
change or react to a prompton('prompt.submit', hook): next({ ...e, text })/private/tmp/claude-501/bundled-skills/2.1.294/56f72a089d917f30d0cee8aa023e8c65/plugin-authoring/examples/band.tsx
change the system prompton('prompt.compose', hook): answer next(e)'s { sections } with one added last (scope: 'session'), replaced or droppedits doc in the types
play a sound$.audio.play({ asset }) from any hook, the asset a file of the mod'sits doc in the types
a slash command$.command.register({ name, description }) in session.start, answered by a command.run hook returning { text }/private/tmp/claude-501/bundled-skills/2.1.294/56f72a089d917f30d0cee8aa023e8c65/plugin-authoring/examples/pane.tsx
values a drawing readsatom(ref, initial), read($, atom) while drawing, update($, atom, fn) from a handler or another event; the write redraws the readers; each value declared in the contract/private/tmp/claude-501/bundled-skills/2.1.294/56f72a089d917f30d0cee8aa023e8c65/plugin-authoring/examples/pane-state.d.ts
work on a timer, a tool the model calls, a subagent type, model calls, files, processes$.clock, $.tool, $.agent, $.model, $.fs, $.process/private/tmp/claude-501/bundled-skills/2.1.294/56f72a089d917f30d0cee8aa023e8c65/plugin-authoring/reference.md

Checking it and reading what the engine refused

claude plugin validate <mod folder> reads the manifest and the module's source the way the engine will, and reports what the module hooks and calls and all the engine would refuse. Type-check the mod: once it has loaded, tsc -p <mod folder>; where nothing is laid (the first write, or claude -p), with the tsconfig.json from the types file's header, kept outside the mod folder, its include naming that file and the mod's hooks. Write at least one *.test.ts for the behaviour asked for and run claude plugin test <mod folder>. Then give the person the mod's full path and how it loads: enabled, nothing to run; off as nobody could be asked, in a terminal, claude --plugin-dir and that path; off otherwise, nothing loads it until that changes. Give the way to share it too: one file makes its repository a marketplace, and the install step, to tell or to write in a README, is /plugin install <mod> --marketplace <owner>/<repo>.

While the session hot-reloads a plugin folder the transcript carries one dim line naming the plugin, the event and the reason when a hook fails or a module does not load, and says when a hook's tree did not validate and the engine drew its own instead: <plugin>: ui.render (<Component>) refused: <reason>; the engine drew its own, <plugin> being the one plugin whose hook could have drawn the tree, hooks otherwise. In any other session those lines go to the debug log alone, as <plugin>: <line>. The debug log (claude --debug) carries a line for every occurrence and every result the engine refused; in every session such a tree has a line there beginning ui.render (<Component>): a hook returned a tree that does not validate, followed by the reason.

/private/tmp/claude-501/bundled-skills/2.1.294/56f72a089d917f30d0cee8aa023e8c65/plugin-authoring/reference.md is the long form: the full event list and streaming events, ui.render in depth, $.state contracts, --plugin-dir and CLAUDE_CODE_PLUGIN_DIRS for a mod under development, userConfig options, what a test holds, and sharing a mod.

质量与来源

所属仓库
asgeirtj/system_prompts_leaks
仓库星标
6.9 万
最近更新
今天
采集时间
今天
commit
a09e0e708710
内容指纹
sha256:a5fe4dc66eb6a64
文件路径
Anthropic/claude-code/skills/plugin-authoring/SKILL.md

同仓库其它 Skill

查看全部 48 个
dashboard
Use this for a dashboard, metrics page, KPI tracker, scorecard, data visualization or recurring report: a page or scroll story of charts, numbers and tables of data, whatever the data and wherever it comes from. Read it when creating, filling, refreshing or revising one. You write datasets (a live query on a connector, or an attached CSV/TSV/JSON file), then the page as plain HTML, in the dashboard's own store.
精选 asgeirtj/system_prompts_leaks 6.9 万 原文
Claude CodeCodex CLICursor
design-system
How to create and revise a design system made from the Design System appifact type: its files under project/, the exact shapes and size caps, the order to write in, how to change one later, and the checklist.
精选 asgeirtj/system_prompts_leaks 6.9 万 原文
Claude CodeCodex CLICursor
design
How to fill and revise a canvas made from the Design (canvas) appifact type.
精选 asgeirtj/system_prompts_leaks 6.9 万 原文
Claude CodeCodex CLICursor
pages
The shared Claude Docs viewer — an artifact TYPE. An artifact made from it is a doc: a live document that people and Claude read and edit together (people may also call it a page). The doc's content does not live in this artifact's files at all — it lives in the Claude Docs service and is read and written ONLY through the Claude Docs connector (its create, batch, read and update tools). Read this before touching such an artifact: it says what the files are, that an instance owns none of its own, how to change what the doc says (the connector, never a publish), and where a comment on the doc — including one sent to you from it — is read and answered (the connector's comment verbs; never these files, never the artifact's comment relay).
精选 asgeirtj/system_prompts_leaks 6.9 万 原文
Claude CodeCodex CLICursor
slides
How to fill and revise a deck made from the Slides appifact type.
精选 asgeirtj/system_prompts_leaks 6.9 万 原文
Claude CodeCodex CLICursor
deep-research
Use this skill when the user's prompt requires (1) researching a topic across multiple sources, comparing options or alternatives, analyzing trends or history, understanding markets or industries, or reviewing literature or studies and (2) synthesizing that research into a comprehensive, narrative report. If you're planning to search the web or internal knowledge bases, consider using this skill. This skill coordinates research subagents, so use it only when you have a tool for spawning subagents (the Agent or Task tool); otherwise, research the question directly.
精选 asgeirtj/system_prompts_leaks 6.9 万 原文
Claude CodeCodex CLICursor

相似 Skill

更多「编码」
access
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed, or change policy for the Discord channel.
精选 anthropics/claude-plugins-official 3.8 万 原文
Claude CodeMCP 客户端
configure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how do I set this up" or "who can reach me," or wants to check channel status.
精选 anthropics/claude-plugins-official 3.8 万 原文
Claude CodeMCP 客户端
access
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed, or change policy for the iMessage channel.
精选 anthropics/claude-plugins-official 3.8 万 原文
Claude CodeMCP 客户端
configure
Check iMessage channel setup and review access policy. Use when the user asks to configure iMessage, asks "how do I set this up" or "who can reach me," or wants to know why texts aren't reaching the assistant.
精选 anthropics/claude-plugins-official 3.8 万 原文
Claude CodeMCP 客户端
access
Manage Telegram channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed, or change policy for the Telegram channel.
精选 anthropics/claude-plugins-official 3.8 万 原文
Claude CodeMCP 客户端
configure
Set up the Telegram channel — save the bot token and review access policy. Use when the user pastes a Telegram bot token, asks to configure Telegram, asks "how do I set this up" or "who can reach me," or wants to check channel status.
精选 anthropics/claude-plugins-official 3.8 万 原文
Claude CodeMCP 客户端