技能扫描
- 作者仓库星标 216
- 作者仓库 kagenti
- 领域
- 安全
- 作者声明的智能体
- 未找到明确声明;不据此推断已兼容或已测试
- 静态检查
- 88 / 100 · 启发式扫描,不代表运行安全
- 运行环境证据
- 未执行;当前没有隔离运行测试证据
- 作者 / 版本 / 许可证
- @kagenti · 未声明许可证
- 上下文用量评级
- 低消耗
- 接入复杂程度
- 需简单配置
- 是否需要外部接口密钥
- 不需要
- 兼容的系统
- Docker
- 运行环境要求
- Docker
- 检测到的文件与系统行为
-
- 只读
- 允许写入 / 修改
- 网络行为
- 仅限本地
- 安装命令数
- 无(仅作为资料)
需要注意: 未声明工具权限范围;实际权限由运行环境决定。
.claude/
├── settings.json
└── skills/
├── README.md # Generated by skills:scan
├── skills/SKILL.md
├── skills:write/SKILL.md
├── skills:validate/SKILL.md
├── skills:scan/SKILL.md
├── tdd/SKILL.md
├── tdd:ci/SKILL.md
├── rca/SKILL.md
├── rca:ci/SKILL.md
└── <detected>/SKILL.md
扫描技术标记: 检查 CI 配置: 检查部署模式: 检查测试结构:
根据调查结果,提出类别: 标记 · 建议技能 `.github/workflows/` · `ci:status`、`ci:monitoring`、`tdd:ci`、`rca:ci` `charts/` 或 `helm/` · `helm:debug` `Dockerfile` · `docker:build`、`docker:debug`
每个仓库都应该有这些(使用`skills:write`创建):技能·目的`skills:write`·如何创建技能`skills:validate`·如何验证技能`skills:scan`·此技能(自我参考)
使用自动批准模式创建`.claude/settings.json`:读取操作(kubectl get、日志、描述)→ 自动批准沙箱写入操作(kubectl 应用在开发集群上)→ 自动批准管理/破坏性操作→ 需要批准
对每项技能运行`skills:validate`:检查问题:Frontmatter 名称/目录不匹配旧式引用(破折号而不是冒号)缺少相关技能部分
将现有技能与存储库的实际技术堆栈进行比较: 运行“新存储库”流程的第 1 阶段来检测技术标记 将检测到的类别与现有技能类别进行比较 列出存储库中存在但没有技能的类别 列出引用不再使用的工具/模式的技能
对于每项现有技能,评估: 检查 · 标准可操作性 · 命令可复制粘贴,而不仅仅是文档长度 · 80-200 行(最多 300 行)。如果太长则分割新鲜度·命令和路径仍然匹配当前的存储库结构
如果`docs/developer/claude-code-skills.md`存在,请验证: 开发文档中列出的技能与实际技能匹配 - 没有陈旧的参考 开发文档中的工作流程图与技能图匹配 - 相同的节点,相同的流程 开发文档中的最佳实践由技能强制执行 - 工作树门、检查表项目 子技能表是准确的 - 输入、输出、调用与现实相符
# Scan Repository for Skills
Bootstrap skills for a new repo, or audit and update skills in an existing one.
```mermaid
flowchart TD
START(["/skills:scan"]) --> MODE{"Repo has skills?"}
MODE -->|No| NP1["Analyze Repo"]:::skills
MODE -->|Yes| EP1["Validate Existing"]:::skills
NP1 --> NP2["Identify Categories"]:::skills
NP2 --> NP3["Generate Core Skills"]:::skills
NP3 --> NP4["Generate settings.json"]:::skills
NP4 --> DONE([Skills bootstrapped])
EP1 --> EP2["Gap Analysis"]:::skills
EP2 --> EP3["Content Quality"]:::skills
EP3 --> EP4["Connection Analysis"]:::skills
EP4 --> EP5["Usefulness Rating"]:::skills
EP5 --> EP6["Generate Report"]:::skills
EP6 --> EP7["Update README"]:::skills
EP1 -->|Issues| WRITE["skills:write"]:::skills
EP6 -->|Gaps| WRITE
classDef skills fill:#607D8B,stroke:#333,color:white
```
## When to Use
- Setting up Claude Code skills in a new repository
- Auditing an existing repo for skill gaps
- Updating skills after the repo's tech stack or workflows changed
- Onboarding to a new codebase
## Mode: New Repo (no `.claude/skills/` exists)
### Phase 1: Analyze Repository Structure
Scan for technology markers:
```bash
ls -la Makefile pyproject.toml package.json Cargo.toml go.mod pom.xml 2>/dev/null
```
Check CI configuration:
```bash
ls .github/workflows/ .gitlab-ci.yml Jenkinsfile .circleci/ 2>/dev/null
```
Check deployment patterns:
```bash
ls -d charts/ helm/ k8s/ kubernetes/ deployments/ docker-compose* Dockerfile 2>/dev/null
```
Check test structure:
```bash
find . -type d -name "tests" -o -name "test" -o -name "__tests__" -o -name "e2e" 2>/dev/null | head -10
```
### Phase 2: Identify Skill Categories
Based on findings, propose categories:
| Marker | Suggested Skills |
|--------|-----------------|
| `.github/workflows/` | `ci:status`, `ci:monitoring`, `tdd:ci`, `rca:ci` |
| `charts/` or `helm/` | `helm:debug` |
| `Dockerfile` | `docker:build`, `docker:debug` |
| `tests/e2e/` | `tdd:ci`, `rca:ci` |
| Kubernetes manifests | `k8s:health`, `k8s:pods`, `k8s:logs` |
| Kind/minikube configs | `tdd:kind`, `rca:kind` |
| HyperShift/OpenShift | `tdd:hypershift`, `rca:hypershift` |
### Phase 3: Generate Core Skills
Every repo should have these (create with `skills:write`):
| Skill | Purpose |
|-------|---------|
| `skills:write` | How to create skills |
| `skills:validate` | How to validate skills |
| `skills:scan` | This skill (self-referential) |
| `tdd:ci` | CI-driven development loop (if CI exists) |
| `rca:ci` | Root cause analysis from CI logs (if CI exists) |
| `git:worktree` | Parallel development (if git repo) |
### Phase 4: Generate settings.json
Create `.claude/settings.json` with auto-approve patterns:
- Read operations (kubectl get, logs, describe) → auto-approve
- Sandbox write operations (kubectl apply on dev clusters) → auto-approve
- Management/destructive operations → require approval
## Mode: Existing Repo (`.claude/skills/` exists)
### Phase 1: Validate Existing Skills
Run `skills:validate` on every skill:
```bash
for f in .claude/skills/*/SKILL.md; do
dir=$(basename $(dirname "$f"))
name=$(grep '^name:' "$f" | sed 's/name: //' | tr -d ' ')
[ "$dir" = "$name" ] || echo "MISMATCH: $dir != $name"
done
```
Check for issues:
- Frontmatter name/directory mismatches
- Old-style references (dashes instead of colons)
- Missing Related Skills sections
- Chained commands in sandbox skills (breaks auto-approve)
### Phase 2: Gap Analysis
Compare existing skills against the repo's actual tech stack:
1. Run Phase 1 of the "New Repo" flow to detect technology markers
2. Compare detected categories against existing skill categories
3. List categories that exist in the repo but have no skills
4. List skills that reference tools/patterns no longer in use
### Phase 3: Content Quality Review
For each existing skill, assess:
| Check | Criteria |
|-------|----------|
| Actionability | Commands are copy-pasteable, not just documentation |
| Length | 80-200 lines (300 max). Split if too long |
| Freshness | Commands and paths still match current repo structure |
| Cross-links | Related Skills use colon notation and link to real skills |
| Auto-approve | Sandbox commands match settings.json patterns |
| Mermaid diagram | Workflow/router skills have embedded diagram matching textual flow |
| Dev docs consistency | Claims in `docs/developer/claude-code-skills.md` match actual skill behavior |
### Phase 3b: Developer Docs Consistency
If `docs/developer/claude-code-skills.md` exists, verify:
1. **Skills listed in dev docs match actual skills** — no stale references
2. **Workflow diagrams in dev docs match skill diagrams** — same nodes, same flow
3. **Best practices in dev docs are enforced by skills** — worktree gate, checklist items
4. **Sub-skill table is accurate** — inputs, outputs, invocations match reality
### Phase 4: Connection Analysis
For each skill, determine:
- **Outgoing links**: Skills referenced in Related Skills section
- **Incoming links**: Which other skills reference this one (search all files)
- **Broken refs**: References to skills that don't exist
- **Orphans**: Skills with no incoming references (only parent links)
Key metrics:
- Most connected skills (highest incoming refs) = hub skills
- Orphaned skills = may need cross-linking or deletion
- Broken refs = must fix before committing
### Phase 5: Usefulness Assessment
Rate each skill 1-5:
| Rating | Criteria |
|--------|----------|
| 5 | Decision trees, copy-paste commands, troubleshooting, used daily |
| 4 | Good reference with commands, covers edge cases |
| 3 | Useful but needs more actionability or is too long |
| 2 | Bare index or needs significant improvement |
| 1 | Redundant or too vague to help |
### Phase 6: Generate Report
Save to `/tmp/kagenti/skills-scan/`:
```bash
mkdir -p /tmp/kagenti/skills-scan
```
Output a structured report:
```markdown
## Skill Scan Report
### Inventory: X total (Y parents + Z leaves)
- Rated 5: N skills
- Rated 4: N skills
- Rated 3 or below: N skills (list)
### Validation Issues
- Failing validation: [list with specific issues]
- Broken references: [source → broken target]
- Over 300 lines: [list with line counts]
### Connection Analysis
- Most connected (hub skills): [top 5 with incoming ref count]
- Orphaned skills: [list with only parent refs]
- Workflow paths: TDD escalation, RCA escalation, Deploy chain
### Gap Analysis
- Missing skills for detected tech: [list]
- Stale skills referencing removed tech: [list]
### Diagram Coverage
- Skills with diagrams: [count]
- Skills needing diagrams: [list]
### Recommendations
1. Create: [new skills needed]
2. Update: [skills with issues]
3. Delete: [obsolete skills]
4. Merge: [overlapping skills]
5. Cross-link: [orphaned skills that should connect to workflows]
```
## Phase 7: Update Skills README
After completing the scan, update `.claude/skills/README.md`:
1. Regenerate the **Complete Skill Tree** (ASCII listing of all categories and leaves)
2. Update **Mermaid workflow diagrams** for root flows:
- TDD workflow (tdd → tdd:ci/tdd:hypershift/tdd:kind escalation)
- RCA workflow (rca → rca:ci/rca:hypershift/rca:kind escalation)
- CI workflow (ci → ci:status/ci:monitoring → rca:ci → tdd:ci)
- Skills meta workflow (skills:scan → skills:write → skills:validate → skills:retrospective)
- Deploy & debug workflow (kagenti:deploy → k8s:health → k8s:pods/logs)
- HyperShift lifecycle (setup → preflight → quotas → create → destroy)
3. Update the **Auto-Approve Policy** table
4. Verify all skills appear in the tree and diagrams
5. Check that no orphaned skills exist (every leaf should be reachable from a root flow)
The README is the main entry point for understanding the skills system.
It should always reflect the current state after a scan.
## Output (New Repo)
```
.claude/
├── settings.json
└── skills/
├── README.md # Generated by skills:scan
├── skills/SKILL.md
├── skills:write/SKILL.md
├── skills:validate/SKILL.md
├── skills:scan/SKILL.md
├── tdd/SKILL.md
├── tdd:ci/SKILL.md
├── rca/SKILL.md
├── rca:ci/SKILL.md
└── <detected>/SKILL.md
```
## Related Skills
- `skills:write` - Create individual skills
- `skills:validate` - Validate skill format
- `skills:retrospective` - Review and improve skills after sessions
- `tdd:ci` - Core TDD skill (always generated)
- `rca:ci` - Core RCA skill (always generated)
按说明文件中的顺序排列。
何时使用
第一阶段:分析存储库结构
第 2 阶段:确定技能类别
第三阶段:培养核心技能
第 4 阶段:生成 settings.json
文件/命令 -> .claude/skills/ · .github/workflows/ · ci:status · ci:monitoring · tdd:ci · rca:ci · charts/ · helm/
内容校验值 -> 792355ac8da9
当前原文的自动摘译,尚未人工审校。
何时使用
在新存储库中设置 Claude 代码技能 审核现有存储库是否存在技能差距 在存储库的技术堆栈或工作流程更改后更新技能 加入新的代码库
第 2 阶段:确定技能类别
根据调查结果,提出类别:标记·建议技能
.github/workflows/·ci:status、ci:monitoring、tdd:ci、rca:ci``charts/或helm/·helm:debug``Dockerfile·docker:build,docker:debug第三阶段:培养核心技能
每个存储库都应该有这些(使用
skills:write创建):技能·目的skills:write·如何创建技能skills:validate·如何验证技能skills:scan·此技能(自我参考)