Agent skill

Add Widget

by GXFG in GXFG/newtab-naivetab

NaiveTab 浏览器扩展的 Widget 开发指南。当用户要在 newtab-naivetab 项目中新增 Widget 组件、添加新功能组件时使用。涵盖需要修改的完整文件清单、配置规范、类型注册等,防止遗漏关键步骤。

GPL-3.0Auto-check passedFrontend & Design

Install Add Widget

skills CLI
$ npx skills add GXFG/newtab-naivetab --skill add-widget -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install GXFG/newtab-naivetab add-widget --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/GXFG/newtab-naivetab.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/add-widget .claude/skills/add-widget && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
add-widget
GitHub stars
137
Token cost
~1.4k tokens
SKILL.md length
202 words
Files
2
Skills in repo
5
Repo updated
First seen
Licence
GPL-3.0

At a glance

NaiveTab 浏览器扩展的 Widget 开发指南。当用户要在 newtab-naivetab 项目中新增 Widget 组件、添加新功能组件时使用。涵盖需要修改的完整文件清单、配置规范、类型注册等,防止遗漏关键步骤。

  • Works in 7 steps: src/common/widget-constants.ts:代码列表与分组 → 新建 src/newtab/widgets/myWidget/config.ts → 新建 src/newtab/widgets/myWidget/index.vue → …
  • Frontend & Design work in your project
  • SKILL.md covers 必须修改的 6 个文件, 可选:添加专属设置面板 and 无需手动修改(自动处理)
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Add Widget is an agent skill from GXFG/newtab-naivetab. NaiveTab 浏览器扩展的 Widget 开发指南。当用户要在 newtab-naivetab 项目中新增 Widget 组件、添加新功能组件时使用。涵盖需要修改的完整文件清单、配置规范、类型注册等,防止遗漏关键步骤。

Its SKILL.md is about 1.4k tokens, which your agent loads only when the skill is triggered. The skill folder holds 1 other file (for example `reference.md`).

It sits in Frontend & Design. It works with Vue.js. The repository describes itself as: NaiveTab - newtab extension for browser |浏览器新标签页扩展|Visual keyboard for bookmarks & browser commands — one-press access. Drag & drop layout, full customization, focus mode, and…. The licence is GPL-3.0.

When your agent uses it

  • Frontend & Design work in your project

Example prompts

  • “/add-widget”

Workflow steps

7 steps, taken from the step headings in SKILL.md.

  1. src/common/widget-constants.ts:代码列表与分组
  2. 新建 src/newtab/widgets/myWidget/config.ts
  3. 新建 src/newtab/widgets/myWidget/index.vue
  4. 新建 src/newtab/widgets/myWidget/index.ts
  5. src/logic/constants/icons.ts ⚠️ 需修改两处,缺一不可
  6. src/common/widget-constants.ts 类型映射
  7. i18n:src/locales/zh-CN.json 和 en-US.json

What it can do on your machine

Read from SKILL.md and the folder at commit ae78a42. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are typescript, json and vue).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • icon-sets.iconify.design

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Add Widget loads about 1.4k tokens when it runs. Until then it costs about 31 tokens; SKILL.md has 202 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~31
When it runs · the whole SKILL.md, loaded when a task matches
~1.4k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from GXFG/newtab-naivetab at commit ae78a42, republished under its GPL-3.0 licence (© GXFG). 202 words, ~1,358 tokens.

Download SKILL.mdSave it as .claude/skills/add-widget/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
add-widget
description
NaiveTab 浏览器扩展的 Widget 开发指南。当用户要在 newtab-naivetab 项目中新增 Widget 组件、添加新功能组件时使用。涵盖需要修改的完整文件清单、配置规范、类型注册等,防止遗漏关键步骤。

NaiveTab Add Widget

新增 Widget 需按顺序完成以下步骤。完整模板参考见 reference.md。

完整注册点索引见 REGISTRY-MAP.md,新增时对照检查。

必须修改的 6 个文件

Step 1 — src/common/widget-constants.ts:代码列表与分组

WidgetCodes 不再手动维护联合类型,而是从 WIDGET_CODE_LIST 用 typeof 自动推导。 只需在列表数组中追加 code 即可。

WidgetConfigByCode 类型映射也在 src/common/widget-constants.ts 中(Step 6 处说明)。本 Step 处理以下三项:

1-A:添加到 WIDGET_CODE_LIST

ts
export const WIDGET_CODE_LIST = [
  // ...
  'myWidget',   // 顺序决定组件库抽屉中的排列顺序
] as const

1-B:(可选)若新 Widget 与其他 Widget 共用同一个 setting pane,需维护 WIDGET_SETTING_PANE_MAP

ts
export const WIDGET_SETTING_PANE_MAP: Partial<Record<WidgetCodes, settingPanes>> = {
  // ...
  myWidget: 'clockDate',   // ← 指向对应的 pane code
}

未在此 Map 中的 Widget,右键菜单会默认用自身 code 查找 pane(myWidget → pane myWidget)。

1-C:添加到 WIDGET_GROUPS 对应分组(用于组件库抽屉和专注设置按分类展示)

ts
export const WIDGET_GROUPS: Array<{
  labelKey: string
  codes: WidgetCodes[]
}> = [
  {
    labelKey: 'widgetGroup.timeAndDate',
    codes: ['clockDigital', ... , 'myWidget'], // ← 追加到对应分组(time/bookmark/tool 三选一)
  },
]

必须添加否则不会显示在组件库列表中。

Step 2 — 新建 src/newtab/widgets/myWidget/config.ts
ts
export const WIDGET_CODE = 'myWidget'
export const WIDGET_CONFIG = {
  enabled: false,
  layout: { xOffsetKey: 'left', xOffsetValue: 50, xTranslateValue: -50,
            yOffsetKey: 'top',  yOffsetValue: 50,  yTranslateValue: -50 },
  // 颜色字段统一用双元素数组:[浅色值, 深色值]
  fontColor: ['rgba(255,255,255,1)', 'rgba(0,0,0,1)'],
  // ... 其他配置
}
export type TWidgetConfig = typeof WIDGET_CONFIG
Step 3 — 新建 src/newtab/widgets/myWidget/index.vue
  • 用 WidgetWrap 作为根容器,直接子元素必须有 myWidget__container 的 class
  • 样式块外层 selector 为 #myWidget,容器需 position: absolute
  • 用 getStyleField(WIDGET_CODE, 'fieldName') 读取配置(自动处理颜色双数组/单位换算)
  • 用 getIsWidgetRender(WIDGET_CODE) + watch 控制定时任务生命周期
Step 4 — 新建 src/newtab/widgets/myWidget/index.ts
ts
import Index from './index.vue'
import { WIDGET_CODE, WIDGET_CONFIG } from './config'
import { WIDGET_ICON_META } from '@/logic/constants/icons'

export default {
  code: WIDGET_CODE,
  component: Index,
  config: WIDGET_CONFIG,
  iconName: WIDGET_ICON_META[WIDGET_CODE].iconName,
  iconSize: WIDGET_ICON_META[WIDGET_CODE].widgetSize,
  widgetLabel: 'setting.myWidget',   // i18n key
}
Step 5 — src/logic/constants/icons.ts ⚠️ 需修改两处,缺一不可

5-A:在 ICONS 对象中定义图标常量(图标来自 Iconify,需验证图标名存在):

ts
export const ICONS = {
  // ... 已有图标 ...
  myWidget: 'mdi:some-valid-icon',   // ← 先在这里定义
}

5-B:在 WIDGET_ICON_META 中引用(使用 ICONS.myWidget,禁止硬编码字符串):

ts
export const WIDGET_ICON_META: Record<WidgetCodes, WidgetIconMeta> = {
  // ... 已有条目 ...
  myWidget: { iconName: ICONS.myWidget, widgetSize: 30 },  // ← 引用常量
}

❌ 错误示范:iconName: 'mdi:some-icon'(硬编码字符串绕过了 ICONS 常量,难以统一维护)

设置面板中引用图标也必须使用 ICONS.xxx,新增专属 setting 面板时还需在 SETTING_ICON_META 中注册。

Step 6 — src/common/widget-constants.ts 类型映射
ts
// 在 WidgetConfigByCode 类型中追加一行(使用动态 import() 语法,无需单独 import)
myWidget: import('@/newtab/widgets/myWidget/config').TWidgetConfig

只需追加一行 key-value,不再需要单独的 import 语句。

Step 7 — i18n:src/locales/zh-CN.json 和 en-US.json
json
"setting": {
  "myWidget": "我的组件"
}

可选:添加专属设置面板

自 v2.0.0 起,所有设置面板统一管理在 src/setting/ 目录下。新增专属设置面板步骤:

步骤 1 — 新建面板文件

新建目录 src/setting/panes/myWidget/,并创建 index.vue:

vue
<template>
  <SettingFormWrap>
    <!-- 在这里使用原子组件(ColorField, FontField, SliderField, etc.)构建表单 -->
    <SwitchField
      v-model="localConfig.myWidget.enabled"
    />
    <ColorField
      v-model="localConfig.myWidget.fontColor"
      :label="$t('common.color')"
    />
    <!-- ... 更多表单项 -->
  </SettingFormWrap>
</template>

<script setup lang="ts">
import { SettingFormWrap } from '@/setting/components/SettingFormWrap'
import { SwitchField, ColorField } from '@/setting/fields'
import { localConfig } from '@/logic/config/state'
</script>

所有表单项必须使用 src/setting/fields 中提供的原子组件。

步骤 2 — 注册设置面板

在 src/setting/registry.ts 中注册:

在 SETTING_GROUPS 对应的分组(通常是 widget)的 items 数组添加配置项:

ts
{ code: 'myWidget', labelKey: 'setting.myWidget' },
步骤 3 — 添加设置图标元数据

在 src/logic/constants/icons.ts 的 SETTING_ICON_META 中注册:

ts
export const SETTING_ICON_META: Record<settingPanes, SettingIconMeta> = {
  // ...
  myWidget: { iconName: ICONS.myWidget, settingSize: 20 },
}

所有图标必须通过 ICONS 常量引用,禁止硬编码字符串。

步骤 4 — 建立 Widget 与 Setting Pane 的映射

在 src/common/widget-constants.ts 的 WIDGET_SETTING_PANE_MAP 中添加:

ts
export const WIDGET_SETTING_PANE_MAP: Partial<Record<WidgetCodes, settingPanes>> = {
  // ...
  myWidget: 'myWidget',   // Widget code 对应到 setting pane code
}

无需手动修改(自动处理)

文件机制
src/logic/config/defaults.tsimport.meta.glob('**/config.ts') 自动扫描收集
src/logic/config/state.ts遍历 WIDGET_CODE_LIST 动态创建 storage
src/logic/config/sync/遍历 defaultConfig 处理云同步/导入导出
src/newtab/Content.vue遍历 widgetsList 动态渲染
src/newtab/draft/DraftDrawer.vue遍历 widgetsList 展示组件库
src/newtab/widgets/registry.tsimport.meta.glob 自动扫描 widget index.ts 元信息

© GXFG, GPL-3.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 1 other file in .claude/skills/add-widget of GXFG/newtab-naivetab.

  • SKILL.md
  • reference.md

Open the folder on GitHubat commit ae78a42

Compare with similar skills

Add Widget next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Add Widget compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Add Widget this skillGXFG/newtab-naivetab137—~1.4kAutomated safety check: PassGPL-3.0
Tailwindcss Developmentanonaddy/anonaddy4.9k10 repos~865Automated safety check: PassMIT
GSAP Core Animationgreensock/gsap-skills16k4 repos~3.7kAutomated safety check: PassMIT
GSAP in Vue, Nuxt and Sveltegreensock/gsap-skills16k4 repos~2.6kAutomated safety check: PassMIT
Vuetify Playgroundvuetifyjs/vuetify41k—~730Automated safety check: PassCustom licence
Boneyard0xGF/boneyard7.5k—~2.2kAutomated safety check: NotesMIT

Similar skills

  • Tailwindcss Development

    anonaddy/anonaddy

    Always invoke when the user's message includes 'tailwind' in any form.

    4.9k GitHub starsUsed in 10 repos~865 tokens
    Frontend & DesignAuto-check passed
  • GSAP Core Animation

    greensock/gsap-skills

    Covers the GSAP core API for tweens, easing, staggers, defaults and matchMedia, and when to choose GSAP over CSS animations or other JavaScript animation libraries.

    16k GitHub starsUsed in 4 repos~3.7k tokens
    Frontend & DesignAuto-check passed
  • GSAP in Vue, Nuxt and Svelte

    greensock/gsap-skills

    Shows how to use GSAP in Vue, Nuxt, Svelte and other lifecycle-based frameworks: create after mount, scope selectors to the component, and revert on unmount.

    16k GitHub starsUsed in 4 repos~2.6k tokens
    Frontend & DesignAuto-check passed
  • Vuetify Playground

    vuetifyjs/vuetify

    Maintains the Vuetify repo's local Playground.vue so contributors get a realistic reproduction and a short demo they can paste into a pull request description.

    41k GitHub stars~730 tokensUpdated today
    Frontend & DesignAuto-check passed
  • Boneyard

    0xGF/boneyard

    Use boneyard-js to add, configure, debug, or rebuild skeleton screens.

    7.5k GitHub stars~2.2k tokensUpdated 1 mo ago
    Frontend & DesignAuto-check: notes
  • Rules for writing Vue 3 templates with Buefy components on Bulma CSS: install options, prop conventions, b-field wrapping, tables, theming and dialogs.

    9.5k GitHub stars~8.2k tokensUpdated 1 mo ago
    Frontend & DesignAuto-check passed

More from GXFG/newtab-naivetab

  • Add Command

    GXFG/newtab-naivetab

    NaiveTab 浏览器扩展的全局命令快捷键开发指南。当用户要新增/修改命令快捷键(如新增 tab 操作、页面滚动、窗口操作等命令)时使用。涵盖需要修改的完整文件清单、执行环境分类、类型注册等,防止遗漏关键步骤。

    137 GitHub stars~1.2k tokensUpdated 2 days ago
    Auto-check passed
  • Add I18n Locale

    GXFG/newtab-naivetab

    NaiveTab 浏览器扩展的 i18n 国际化开发指南。当用户要新增/修改翻译文本、添加多语言 key 时使用。涵盖中英文同步更新规则、变量替换模式等,防止遗漏或格式错误。

    137 GitHub stars~269 tokensUpdated 2 days ago
    Auto-check passed
  • Add Setting Pane

    GXFG/newtab-naivetab

    NaiveTab 浏览器扩展的 Setting 面板开发指南。当用户要新增 Setting 设置面板、添加新的设置页时使用。涵盖需要修改的完整文件清单、注册规范等,防止遗漏关键步骤。

    137 GitHub stars~279 tokensUpdated 2 days ago
    Auto-check passed
  • Config Migration

    GXFG/newtab-naivetab

    NaiveTab 浏览器扩展的配置迁移开发指南。当用户要修改持久化配置结构(新增/重命名/删除字段、修改类型)时使用。强制走 handleAppUpdate 迁移流程,防止破坏老用户数据。

    137 GitHub stars~345 tokensUpdated 2 days ago
    Auto-check passed

Works with

Questions about Add Widget

What does Add Widget do?

NaiveTab 浏览器扩展的 Widget 开发指南。当用户要在 newtab-naivetab 项目中新增 Widget 组件、添加新功能组件时使用。涵盖需要修改的完整文件清单、配置规范、类型注册等,防止遗漏关键步骤。. Add Widget is an agent skill from GXFG/newtab-naivetab.

When should I use Add Widget?

Add Widget fits situations like: frontend & Design work in your project.

How do I install Add Widget in Claude Code?

Run `npx skills add GXFG/newtab-naivetab --skill add-widget -a claude-code`. Or copy the skill folder (.claude/skills/add-widget in GXFG/newtab-naivetab) into .claude/skills/add-widget in your project. Claude Code loads it when a task matches its description.

How do I install Add Widget in Codex?

Run `npx skills add GXFG/newtab-naivetab --skill add-widget -a codex`. Or copy the skill folder (.claude/skills/add-widget in GXFG/newtab-naivetab) into .agents/skills/add-widget in your project. Codex loads it when a task matches its description.

Can I use Add Widget in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add GXFG/newtab-naivetab --skill add-widget -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/add-widget, .gemini/skills/add-widget, .github/skills/add-widget and .opencode/skills/add-widget in your project.

What does Add Widget need to run?

SKILL.md names no scripts, command-line tools or credentials: Add Widget is instructions for the agent only.

Does Add Widget access the network?

SKILL.md names 1 domain. As links in the text: icon-sets.iconify.design. This is read from the text; nothing was executed.

Is Add Widget safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Add Widget use?

Add Widget is published under the GPL-3.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Add Widget use?

About 1.4k tokens (SKILL.md is roughly 5.4k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Add Widget?

Skills that share tags, products or a category with Add Widget: Tailwindcss Development (anonaddy/anonaddy, 4.9k stars), GSAP Core Animation (greensock/gsap-skills, 16k stars), GSAP in Vue, Nuxt and Svelte (greensock/gsap-skills, 16k stars) and Vuetify Playground (vuetifyjs/vuetify, 41k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Add Widget?

GXFG (a GitHub user) maintains it in GXFG/newtab-naivetab, which has 137 GitHub stars. The repository holds 5 skills in this directory. The repository was last updated on October 7, 2026.

Source: GXFG/newtab-naivetab on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.