# claude-plugin-first **Repository Path**: yhding/claude-plugin-first ## Basic Information - **Project Name**: claude-plugin-first - **Description**: claude code相关插件 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-05-27 - **Last Updated**: 2026-05-27 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 代码质量工具箱 — Claude Code 插件 一个覆盖所有组件类型的完整代码质量插件,包含 Skills、Agents、Hooks、 MCP 工具、后台监控和独立 CLI 工具。 ## 安装 ```bash # 从本地目录加载(开发/测试) claude --plugin-dir ./code-quality-plugin # 发布到 marketplace 后 claude plugin install code-quality@your-marketplace ``` 首次启用时,Claude Code 会询问三项配置: - **Lint 命令** — 例如 `npm run lint`、`ruff check .`、`golangci-lint run` - **格式化命令** — 例如 `prettier --write`、`black .`、`gofmt -w` - **严格模式** — 有 lint 错误时阻止文件写入(默认关闭) ## 技能(斜杠命令) | 命令 | 功能 | |---|---| | `/code-quality:review [路径]` | 按严重程度输出结构化代码审查报告 | | `/code-quality:fix [路径]` | 自动修复 lint 和格式化问题 | | `/code-quality:audit [security\|dependencies\|complexity\|all]` | 全项目健康审计 | ## Agents | Agent | 使用场景 | |---|---| | `code-reviewer` | 深度专家级审查 PR 或文件——只读,高精度 | | `auto-fixer` | 自主修复整个项目的 lint/format 问题 | 在 Claude Code 中通过 `/agents` 调用,或 Claude 会根据任务上下文自动使用。 ## Hooks(自动行为) | Hook | 触发时机 | 动作 | |---|---|---| | `PostToolUse` | 每次 Write/Edit 之后 | 对写入的文件运行格式化工具 | | `PreToolUse` | 每次 Write/Edit 之前 | 严格模式下:有 lint 错误时阻止写入 | | `SessionStart` | 会话启动时 | 打印当前 lint 状态摘要 | ## 后台监控 `lint-watcher` 监控器每 30 秒运行一次,发现新 lint 错误或错误解决时 主动通知 Claude——无需你手动询问。 ## MCP 工具 插件注册了 `code-quality-mcp` 服务器,为 Claude 提供两个结构化工具: - `lint_file(path)` — 返回 `{ status, errors, warnings, output }` - `format_file(path)` — 返回 `{ status, output }` 相比原始 CLI 文本,Claude 能获得机器可读的结构化 lint 结果。 ## CLI 工具(`cq`) 插件启用时,`cq` 自动加入 Claude 的 Bash 工具 PATH: ```bash cq lint src/ # lint 一个目录 cq format src/app.ts # 格式化一个文件 cq check . # lint + format 组合检查 ``` ## 目录结构 ``` code-quality-plugin/ ├── .claude-plugin/ │ └── plugin.json ← 元信息 + userConfig 配置项 ├── skills/ │ ├── review/SKILL.md ← /code-quality:review │ ├── fix/SKILL.md ← /code-quality:fix │ └── audit/SKILL.md ← /code-quality:audit ├── agents/ │ ├── code-reviewer.md ← 专家审查 agent(只读) │ └── auto-fixer.md ← 自主修复 agent ├── hooks/ │ └── hooks.json ← PostToolUse / PreToolUse / SessionStart ├── scripts/ │ ├── post-write.sh ← 写入后自动格式化 │ ├── pre-write.sh ← 严格模式 lint 拦截 │ ├── session-start.sh ← 启动时 lint 状态摘要 │ └── lint-watch.sh ← 后台监控循环 ├── monitors/ │ └── monitors.json ← 注册 lint-watcher ├── servers/ │ └── mcp-server.js ← MCP 服务器(lint_file、format_file) ├── .mcp.json ← MCP 服务器注册 └── bin/ └── cq ← CLI 工具,自动加入 Bash PATH ```