Skip to content
Agentmart
Submit a tool

menu-template

管理和生成菜单 SQL 模板。当用户需要创建或修改系统菜单、按钮权限、父级菜单关联 SQL 时调用此技能。

Skill by GFigting

IndexedMIT
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/gfigting-menu-template

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

管理和生成菜单 SQL 模板。当用户需要创建或修改系统菜单、按钮权限、父级菜单关联 SQL 时调用此技能。

Use cases: backend

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/menu-template

What's inside

Skill name
menu-template
Description
管理和生成菜单 SQL 模板。当用户需要创建或修改系统菜单、按钮权限、父级菜单关联 SQL 时调用此技能。
License
MIT
Instructions
131 lines in SKILL.md · view on GitHub

Files (1)

  • SKILL.md

SKILL.md (first lines)

---
name: "menu-template"
description: "管理和生成菜单 SQL 模板。当用户需要创建或修改系统菜单、按钮权限、父级菜单关联 SQL 时调用此技能。"
---

# 菜单模板技能

## 功能
生成 `system_menu` 菜单 SQL,包含菜单和按钮权限。

## 核心规则
- 优先生成单个 SQL 文件,包含父级查询、菜单插入、按钮插入、结果确认。
- 不猜父级菜单 ID;让用户提供父级菜单名称。
- 使用 `@parent_name` 按 `name = @parent_name` 查询父级菜单。
- 新目录或菜单无父级时,允许 `@parent_name := NULL` 或空字符串,`parent_id` 使用 `0`。
- 顶级目录通常用 `type=1`、`parent_id=0`、`component=NULL`,路径按项目约定使用 `/xxx` 或 `xxx`。
- 若父级名称可能重复,脚本先输出查询结果;默认取 `id` 最小的一条。
- 不自动创建父级菜单,除非用户明确要求。
- 插入语句要幂等:使用 `WHERE NOT EXISTS` 防重复。
- 菜单、按钮都写全 `visible/keep_alive/always_show/creator/create_time/updater/update_time/deleted` 等字段,除非项目表结构不同。
- 非自动迁移脚本不要使用 Flyway `V*` 文件名;若仓库忽略非 `V*` SQL,需要同步调整 `.gitignore` 或按项目规则命名。

## 字段说明
- `name`:菜单/按钮名称
- `permission`:权限标识;按钮必填,菜单可放查询权限
- `type`:类型;`1=目录`、`2=菜单`、`3=按钮`
- `sort`:显示顺序
- `parent_id`:父菜单 ID
- `path`:路由路径
- `icon`:图标
- `component`:组件路径
- `component_name`:组件名称,仅菜单需要
- `status`:状态,`0=启用`

## 推荐模板
```sql
-- 使用前修改 @parent_name 为父级菜单名称,例如:对账管理。
-- 若新增顶级目录或菜单无父级,设置为 NULL 或空字符串,parent_id 自动使用 0。
SET @parent_name := 'TODO_父级菜单名称';

-- 父级查询
SELECT id, name, type, sort, parent_id, path, component, component_name
FROM system_menu
WHERE deleted = b'0'
  AND type IN (1, 2)
  AND @parent_name IS NOT NULL
  AND @parent_name <> ''
  AND name = @parent_name
ORDER BY id;

SET @parent_id := IF(
    @parent_name IS NULL OR @parent_name = '',
    0,
    (
        SELECT id
        FROM system_menu
        WHERE deleted = b'0'
          AND type IN (1, 2)
          AND name = @parent_name
        ORDER BY id
        LIMIT 1
    )
);

-- 菜单
INSERT INTO system_menu (
    name, permission, type, sort, parent_id,
    path, icon, component, component_name, status,
    visible, keep_alive, always_show,
    creator, create_time, updater, update_time, deleted
)
SELECT
    '菜单名称', 'module:resource:query', 2, 10, @parent_id,
    'route-path', 'ep:menu', 'module/resource/index', 'ComponentName', 0,
    b'1', b'1', b'1',
    '1', NOW(), '1', NOW(), b'0'
WHERE @parent_id IS NOT NULL
  AND NOT EXISTS (
      SELECT 1 FROM system_menu
      WHERE deleted = b'0'
        AND parent_id = @parent_id
        AND (component = 'module/resource/index' OR permission = 'module:resource:query' OR name = '菜单名称')
  );

SET @menu_id := (
    SELECT id
    FROM system_menu
    WHERE deleted = b'0'
      AND component = 'module/resource/index'
    ORDER BY id DESC
    LIMIT 1
);

-- 按钮
INSERT INTO system_menu (
    name, permission, type, sort, parent_id,
    path, icon, component, component_name, status,
    visible, keep_alive, always_show,
    creator, create_time, updater, update_time, deleted
)
SELECT
    '菜单查询', 'module:resource:query', 3, 1, @menu_id,
    '', '', '', NULL, 0,
    b'1', b'1', b'1',
    '1', NOW(), '1', NOW(), b'0'
WHERE @menu_id IS NOT NULL
  AND NOT EXISTS (
      SELECT 1 FROM system_menu
      WHERE deleted = b'0'
        AND parent_id = @menu_id
        AND permission = 'module:resource:query'
  );

-- 结果确认
SELECT id, name, permission, type, sort, parent_id, path, icon, component, component_name, status
FROM system_menu
WHERE deleted = b'0'
  AND (id = @menu_id OR parent_id = @menu_id)
ORDER BY type, sort, id;
```

From GFigting/carry-god, MIT.

More from GFigting/carry-god

Signals

Stars
0
Forks
0
Open issues
0
Last commit (this folder)
Sep 4, 2026 (1 month ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from GFigting

Cite this page

menu-template skill. Agent Mart. https://agentmart.dev/skills/gfigting-menu-template (last updated 2026-10-24)