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-perm-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.
About
Use cases: backend
Reviews
Write a reviewNo 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/perm-template
What's inside
- Skill name
perm-template- Description
- 管理和生成角色-菜单权限关联 SQL 模板。当用户需要将菜单/按钮权限分配给角色时调用此技能。
- License
- MIT
- Instructions
- 118 lines in SKILL.md · view on GitHub
Files (1)
- SKILL.md
SKILL.md (first lines)
---
name: "perm-template"
description: "管理和生成角色-菜单权限关联 SQL 模板。当用户需要将菜单/按钮权限分配给角色时调用此技能。"
---
# 权限模板技能
## 功能
生成 `system_role_menu` 权限关联 SQL,将菜单及其子按钮一次性分配给指定角色。配合 `menu-template` 使用:menu-template 创建菜单/按钮,perm-template 将菜单/按钮授权给角色。
## 核心规则
- 使用 `@role_code` 按角色标识查找角色 ID
- 使用 `@menu_component` 定位菜单(也可用 `@menu_permission`)
- **批量分配**:菜单及其所有子按钮一次性授权(`WHERE id = @menu_id OR parent_id = @menu_id`)
- 幂等插入:使用 `NOT EXISTS` 按 `(role_id, menu_id)` 去重
- 结果确认:输出角色+菜单+权限的关联视图
- 角色或菜单不存在时,`@role_id` / `@menu_id` 为 NULL,INSERT 不会执行
## SQL 规则
- 先查角色:`SELECT id FROM system_role WHERE code = @role_code AND deleted = b'0'`
- 再查菜单:`SELECT id FROM system_menu WHERE component = @menu_component AND deleted = b'0'`
- 批量 INSERT:`INSERT INTO system_role_menu SELECT @role_id, id, ... FROM system_menu WHERE (id = @menu_id OR parent_id = @menu_id) AND NOT EXISTS (...)`
- `tenant_id` 默认 `1`
## 模板
```sql
-- 角色-菜单权限分配
-- 使用前修改 @role_code 为目标角色标识,@menu_component 为目标菜单组件路径
SET @role_code := 'TODO_角色标识';
SET @menu_component := 'TODO_菜单组件路径';
-- 查角色
SELECT id, name, code, status
FROM system_role
WHERE code = @role_code AND deleted = b'0';
SET @role_id := (
SELECT id FROM system_role
WHERE code = @role_code AND deleted = b'0'
LIMIT 1
);
-- 查菜单
SELECT id, name, permission, type, component
FROM system_menu
WHERE component = @menu_component AND deleted = b'0';
SET @menu_id := (
SELECT id FROM system_menu
WHERE component = @menu_component AND deleted = b'0'
LIMIT 1
);
-- 分配菜单+子按钮给角色
INSERT INTO system_role_menu (role_id, menu_id, creator, create_time, updater, update_time, deleted, tenant_id)
SELECT @role_id, id, '1', NOW(), '1', NOW(), b'0', 1
FROM system_menu
WHERE deleted = b'0'
AND (id = @menu_id OR parent_id = @menu_id)
AND NOT EXISTS (
SELECT 1 FROM system_role_menu
WHERE role_id = @role_id AND menu_id = system_menu.id
);
-- 结果确认
SELECT
r.name AS 角色,
r.code AS 角色标识,
m.name AS 菜单,
m.permission AS 权限标识,
CASE m.type WHEN 1 THEN '目录' WHEN 2 THEN '菜单' WHEN 3 THEN '按钮' END AS 类型,
m.sort AS 排序
FROM system_role_menu rm
JOIN system_role r ON r.id = rm.role_id
JOIN system_menu m ON m.id = rm.menu_id
WHERE rm.role_id = @role_id
AND (m.id = @menu_id OR m.parent_id = @menu_id)
ORDER BY m.type, m.sort;
```
## 高级用法:按 permission 定位菜单
若菜单无 component(如纯目录),可用 `@menu_permission` 定位:
```sql
SET @menu_permission := 'TODO_菜单权限标识';
SET @menu_id := (
SELECT id FROM system_menu
WHERE permission = @menu_permission AND deleted = b'0'
LIMIT 1
);
```
## 高级用法:多角色批量授权
同一菜单授权给多个角色时,将 `@role_code` 改为列表循环或逐个执行:
```sql
-- 角色1
SET @role_code := 'role_a';
-- ... 完整分配逻辑 ...
-- 角色2
SET @role_code := 'role_b';
-- ... 完整分配逻辑 ...
```
## 使用
1. 确认目标角色标识(`system_role.code`,如 `tenant_admin`)和菜单组件路径(`system_menu.component`,如 `fms/reconciliation/cost/index`)。
2. 替换模板中的 `@role_code` 和 `@menu_component`。
3. 生成 SQL。推荐与 menu SQL 合并为同一文件(见 `UTIL-SQL管理规范.md`)。
4. 在 SQL 文件末尾附带**注释掉的回滚 SQL**(DELETE `system_role_menu` 语句),供人工手动回滚测试。
5. 不执行 SQL,除非用户明确要求。
6. 回传文件路径和涉及的角色、菜单。
## 注意
- 先查项目实际 `system_role_menu` 表结构;字段不同则按项目结构调整。
- 权限分配只需对菜单(`type=2`)执行一次,子按钮会自动包含。
- 若只需单独分配某个按钮(不分配父菜单),直接查按钮 ID 后单条 INSERT。From GFigting/carry-god, MIT.
More from GFigting/carry-god
- 0.558score
docs-maintainer
GFigting
维护、审阅并同步项目 docs 文档与代码、接口和业务规则。用户提到 docs、文档、项目说明、接口说明、文档同步或文档整理时使用。
SkillAFreshness: AClaude Code +9 - 0.539score
code-review
GFigting
Review the changes since a fixed point (commit, branch, tag, or merge-base) along two axes: Standards (does the code follow this repo's documented coding…
SkillAFreshness: AClaude Code +9 - 0.539score
grilling
GFigting
Grill the user relentlessly about a plan, decision, or idea.
SkillAFreshness: AClaude Code +9 - 0.519score
framework-optimization
GFigting
Use when improving cg-work's rules, workflows, templates, validators, directory conventions, or framework-native skills; not for project business-code…
SkillBFreshness: BClaude Code +9 - 0.518score
ecd-template
GFigting
管理和生成编码规则 SQL 模板。当用户需要创建或修改系统编码规则、业务单号规则、infra_ecd_tp/infra_ecd_dtl SQL 时调用此技能。
SkillBFreshness: BClaude Code +9 - 0.515score
dict-template
GFigting
管理和生成字典 SQL 模板。当用户需要创建或修改系统字典、从枚举提取字典项、生成幂等字典 SQL 时调用此技能。
SkillBFreshness: BClaude Code +9 - 0.515score
menu-template
GFigting
管理和生成菜单 SQL 模板。当用户需要创建或修改系统菜单、按钮权限、父级菜单关联 SQL 时调用此技能。
SkillBFreshness: BClaude Code +9 - 0.499score
codebase-design
GFigting
Shared vocabulary for designing deep modules.
SkillBFreshness: BClaude Code +9 - 0.499score
domain-modeling
GFigting
Build and sharpen a project's domain model.
SkillBFreshness: BClaude Code +9 - 0.498score
review
GFigting
Pre-landing PR review.
SkillBFreshness: BClaude Code +9 - 0.283score
reconciliation-tax-fix
GFigting
No description from the publisher yet.
SkillBFreshness: BClaude Code +9
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
- Repository
- github.com/GFigting/carry-god
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from GFigting
- 0.558score
docs-maintainer
GFigting
维护、审阅并同步项目 docs 文档与代码、接口和业务规则。用户提到 docs、文档、项目说明、接口说明、文档同步或文档整理时使用。
SkillAFreshness: AClaude Code +9 - 0.539score
code-review
GFigting
Review the changes since a fixed point (commit, branch, tag, or merge-base) along two axes: Standards (does the code follow this repo's documented coding…
SkillAFreshness: AClaude Code +9 - 0.539score
grilling
GFigting
Grill the user relentlessly about a plan, decision, or idea.
SkillAFreshness: AClaude Code +9 - 0.519score
framework-optimization
GFigting
Use when improving cg-work's rules, workflows, templates, validators, directory conventions, or framework-native skills; not for project business-code…
SkillBFreshness: BClaude Code +9 - 0.518score
ecd-template
GFigting
管理和生成编码规则 SQL 模板。当用户需要创建或修改系统编码规则、业务单号规则、infra_ecd_tp/infra_ecd_dtl SQL 时调用此技能。
SkillBFreshness: BClaude Code +9 - 0.515score
dict-template
GFigting
管理和生成字典 SQL 模板。当用户需要创建或修改系统字典、从枚举提取字典项、生成幂等字典 SQL 时调用此技能。
SkillBFreshness: BClaude Code +9
Cite this page
perm-template skill. Agent Mart. https://agentmart.dev/skills/gfigting-perm-template (last updated 2026-10-24)