← 返回 Skills 市场
hhngdcz

一键为项目生成完整的 `.claude` 配置体系。

作者 hhngdcz · GitHub ↗ · v1.0.1 · MIT-0
cross-platform ✓ 安全检测通过
107
总下载
0
收藏
0
当前安装
2
版本数
在 OpenClaw 中安装
/install hhngdcz
功能描述
为项目生成完整的 .claude 配置体系。通过问答引导生成 CLAUDE.md、settings.json、rules 等配置文件,并可从 ClawHub 安装 skills。
使用说明 (SKILL.md)

为当前项目生成完善的 .claude 配置体系。


阶段 1:扫描项目

静默执行,无需交互:

  1. 用 Glob 扫描目录结构(排除 node_modules.git__pycache__distbuild
  2. 识别包管理器文件(package.json / pyproject.toml / go.mod / pom.xml / Cargo.toml
  3. 从包管理器中提取可用脚本/任务命令
  4. 推断主要语言和项目类型
  5. 读取已有的 CLAUDE.md(如存在)
  6. 读取 .claude/settings.json(如存在)

阶段 2:安全敏感文件配置

AskUserQuestion(单选)询问:

  • 是,配置安全敏感文件屏蔽
  • 跳过

若用户选择跳过 → 直接进入阶段 3。

若用户选择是:

根据阶段 1 扫描到的目录结构和文件名(不读取文件内容),自动推荐可能的敏感文件/目录。

推荐规则(按文件名/路径模式匹配,命中则加入推荐列表):

模式 说明
.env / .env.* 环境变量文件
**/secrets/** secrets 目录
**/*.pem / **/*.key / **/*.jks / **/*.p12 证书与私钥
**/resources/application*.yml / **/resources/application*.yaml / **/resources/application*.properties Java/Spring 配置文件(可能含数据库密码、密钥等)
**/resources/bootstrap*.yml / **/resources/bootstrap*.properties Spring Cloud 引导配置
**/application-prod.* / **/application-production.* 生产配置文件
**/terraform/*.tfvars Terraform 变量
**/k8s/prod/** 生产 K8s 配置
**/docker-compose.prod.* 生产 Docker 配置

将命中的路径整理为推荐列表,用 AskUserQuestion(多选)展示:

  • 每个命中项作为一个选项,格式:{路径模式}{说明}
  • 最后一项:不屏蔽任何文件

若项目中未命中任何模式,仍展示常见选项(.env、secrets、证书)供用户选择。 若同时包含「不屏蔽任何文件」和其他项,忽略前者。


阶段 3:生成配置文件

3.1 创建目录骨架

先用 Glob 检查 .claude/ 目录以及子目录是否已存在。若已存在完整结构(agents、commands、rules、skills 子目录均在),告知用户「目录骨架已存在,跳过创建」。否则仅创建缺失的目录:

mkdir -p .claude/agents .claude/commands .claude/rules .claude/skills

3.2 处理 CLAUDE.md

  • 若已存在:不做任何修改,告知用户已跳过
  • 若不存在:用 AskUserQuestion 询问「项目根目录缺少 CLAUDE.md,是否通过 /init 生成?」(是 / 否)
    • 用户确认后:使用 Skill 工具在前台执行 /initskill: "init"),等待完成后再继续后续步骤
    • 用户拒绝则跳过

3.3 生成其余文件

已存在的文件跳过,settings.json 做深合并。

文件 内容
.claude/settings.json 根据包管理器填充 permissions.allow、根据用户选择填充 permissions.deny(敏感路径),其余字段留空骨架
.claude/settings.md settings.json 的字段说明 + 虚拟示例
.claude/README.md .claude 目录结构说明(各子目录用途、文件格式、settings.json 字段速查)
.claude/rules/coding-standards.md 根据语言生成基础编码规范

生成完成后,展示目录结构预览,标注各文件状态(✓ 新建 / ✓ 已合并 / ⊘ 已跳过)。


阶段 4:Skills Hub

为项目添加 skills

步骤 1:本地 skills

AskUserQuestion(单选)询问:

  • 是,从本地已有 skills 中选择
  • 跳过

若用户选择跳过 → 进入步骤 2。

若用户选择是:

  1. Glob 递归扫描以下路径下的所有 SKILL.md

    • ~/.claude/skills/**/SKILL.md — 用户自建 skills
    • ~/.claude/plugins/marketplaces/**/SKILL.md — 市场安装的 skills(目录结构多样,必须用递归匹配)

    排除 .gemini 目录下的重复文件(与上层目录内容相同)

  2. 读取每个 SKILL.md 的 frontmatter,提取 namedescription,去重

  3. 整理为表格展示。若总数超过 10 个,只展示前 10 个,并提示用户可输入 more 查看更多:

    本地可用 skills(共 N 个,显示前 10 个):
    
    | # | 名称 | 描述 | 来源 |
    |---|------|------|------|
    | 1 | xxx  | xxx  | 自建 / 市场 |
    | ...
    | 10 | xxx | xxx | 自建 / 市场 |
    
    输入 "more" 查看更多。
    

    若总数不超过 10 个则全部展示。

  4. AskUserQuestion 询问:

    • 输入要添加的 skills 编号(Other 输入,多个用逗号分隔)
    • 查看更多(输入 more,继续展示下一批 10 个)
    • 不添加任何 skills
  5. 用户选择后,将选中的 skills 目录复制到项目的 .claude/skills/ 下(保持原目录结构)


步骤 2:ClawHub 在线安装

参考:reference/clawhub.md

AskUserQuestion(单选)询问:

  • 是,从 ClawHub 搜索并安装更多 skills
  • 跳过

若用户选择跳过 → 直接进入阶段 5。

前置检查

运行 clawhub --version 检查 CLI 是否已安装。若未安装,提示用户:

ClawHub CLI 未安装,是否现在安装?
执行:npm i -g clawhub

AskUserQuestion 确认后执行安装。若用户拒绝安装 CLI → 直接进入阶段 5。

推荐与搜索

  1. 根据阶段 1 扫描到的项目类型、语言、包管理器,自动推荐 3~5 个搜索关键词(例如:Python 后端项目可推荐 pythonapitestingsecuritydevops

  2. 对每个关键词执行 clawhub search "{关键词}",汇总所有结果并去重

  3. 整理为表格展示给用户:

    根据项目特征为你推荐以下 skills:
    
    | # | 名称 | 描述 |
    |---|------|------|
    | 1 | xxx  | xxx  |
    | ...
    
  4. AskUserQuestion 询问:

    • 输入要安装的 skills 编号(Other 输入,多个用逗号分隔)
    • 搜索更多 skills(通过 Other 输入自定义关键词)
    • 跳过,不安装任何 skills
  5. 若用户选择安装:对每个选中的 skills 执行 clawhub install {skill-name} --dir .claude/skills

  6. 若用户输入自定义关键词:执行 clawhub search "{关键词}",展示结果,重复步骤 4

  7. 安装完成后,询问是否继续搜索安装更多 skills,循环直到用户选择结束。


阶段 5:输出汇总

输出最终结果

  1. 完整目录结构预览:列出所有文件,标注状态(✓ 新建 / ✓ 已合并 / ⊘ 已跳过)
  2. 已安装 skills 清单:列出通过 ClawHub 安装的 skills 名称(若有)
  3. 后续操作提示
    • 调整权限 → 编辑 .claude/settings.json
    • 新增规则 → 在 .claude/rules/ 添加 .md 文件
    • 新增命令 → 在 .claude/commands/ 添加 .md 文件
    • 浏览更多 skills → 访问 https://clawhub.ai/skills

防呆检查(全局约束)

写入任何文件之前必须遵守:

  1. CLAUDE.md:已存在则不做任何修改,直接跳过
  2. settings.json:已存在则读取后做 JSON 深合并,不直接覆盖
  3. 其余文件:已存在则跳过
  4. 写入验证:写入后用 Read 验证内容正确
  5. 密钥禁令:严禁在任何配置文件中写入 API Key、密码等密钥
安全使用建议
This skill appears to do what it says, but check these points before running it: (1) It will silently scan the project and, if you choose, will read SKILL.md files under your home (~/.claude/...) — only opt into local-skill import if you trust those files. (2) If you allow ClawHub installs the skill may prompt to run `npm i -g clawhub` and then use `clawhub install` to fetch code from the network — only proceed if you trust the ClawHub registry and are comfortable installing global npm packages. (3) When selecting local or remote skills to add, review their contents before copying/installing (they may include arbitrary files). (4) Although the SKILL.md states it will not write API keys/passwords into generated configs and will deep-merge existing settings, you should still review the generated `.claude/settings.json`, CLAUDE.md, and any copied skill files after the run and keep a backup of your repo before making changes.
功能分析
Type: OpenClaw Skill Name: hhngdcz Version: 1.0.1 The 'claude-config-generator' skill is a legitimate utility designed to set up a project's configuration environment. It performs project scanning, recommends security-sensitive files for exclusion (e.g., .env, .pem), and facilitates the installation of additional skills via the 'clawhub' CLI. All high-risk actions, such as installing the global npm package 'clawhub' or copying files from the user's home directory, are explicitly disclosed to the user through interactive prompts (AskUserQuestion) and align with the tool's stated purpose in SKILL.md and README.md.
能力评估
Purpose & Capability
The skill's name/description (generate a .claude config体系) match the instructions: scanning the repo, detecting package managers, generating .claude directory and files, and offering to add skills from local locations or ClawHub. It does not request unrelated environment variables or global credentials.
Instruction Scope
The instructions legitimately read project files needed for config generation (e.g., existing CLAUDE.md and .claude/settings.json). Phase 2 only uses filenames/path patterns (not file contents) to propose sensitive-file denies. Phase 4 will scan user home paths (~/.claude/...) and read SKILL.md frontmatter if the user opts to work with local skills — this is coherent with the 'import local skills' feature but means the skill will access files outside the project when you choose that option. Also, when you select skills to add, the skill copies their directories into the project, which will write arbitrary files chosen by the user.
Install Mechanism
The skill is instruction-only (no install spec). For online skill installation it invokes the ClawHub CLI and, if missing and with user consent, suggests installing it via `npm i -g clawhub`. That is coherent with the described feature but implies running a global npm install and using a network-retrieved CLI and packages — something the user should consent to and verify.
Credentials
No environment variables, credentials, or config paths are required by the skill. The declared operations (filesystem scans, local SKILL.md reading, optional use of ClawHub) are proportional to the purpose.
Persistence & Privilege
The skill does not request always:true or elevated platform privileges. It will create and write files under the project .claude/ directory (and copy selected skills there) as part of its stated purpose. Writes are constrained by the described safeguards (skip existing files, deep-merge settings.json, and post-write verification).
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install hhngdcz
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /hhngdcz 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.1
- 阶段 3.2 优化:生成 CLAUDE.md 时,改为使用 **Skill** 工具在前台执行 `/init` 并等待完成(原为 Bash 后台异步执行,不等待)。 - 移除阶段 5「等待后台任务」相关内容,输出汇总阶段不再包含后台任务检查。 - 其余执行逻辑保持不变,流程更直观。 - 纯文档更新,无代码文件改动。
v1.0.0
claude-config-generator 1.0.0 初始发布 - 自动扫描项目结构与类型,生成 .claude 配置体系骨架 - 引导屏蔽敏感文件,智能推荐常见安全路径 - 支持半自动生成 CLAUDE.md、settings.json、rules 等关键配置文件 - 集成本地与 ClawHub 市场 skill 安装流程 - 输出全流程状态与结果,防呆规则严格阻止误操作
元数据
Slug hhngdcz
版本 1.0.1
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 2
常见问题

一键为项目生成完整的 `.claude` 配置体系。 是什么?

为项目生成完整的 .claude 配置体系。通过问答引导生成 CLAUDE.md、settings.json、rules 等配置文件,并可从 ClawHub 安装 skills。 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 107 次。

如何安装 一键为项目生成完整的 `.claude` 配置体系。?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install hhngdcz」即可一键安装,无需额外配置。

一键为项目生成完整的 `.claude` 配置体系。 是免费的吗?

是的,一键为项目生成完整的 `.claude` 配置体系。 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

一键为项目生成完整的 `.claude` 配置体系。 支持哪些平台?

一键为项目生成完整的 `.claude` 配置体系。 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 一键为项目生成完整的 `.claude` 配置体系。?

由 hhngdcz(@hhngdcz)开发并维护,当前版本 v1.0.1。

💬 留言讨论