360 Secure SkillHub
360 安全技能中心

sem-integration

面向需要读取 git diff 输出的 Skill,提供 sem 语义差异工具的会话级可用性检测、首次使用时的安装提示与平台命令,以及在 sem 缺失时改用 git diff 分类筛选与文本搜索、生成同类实体结构的回退方案和影响分析模式。

athola
athola
热度 62.12
最近更新 2026-08-26 21:16:54
分类:开发依赖:代码执行 / 读写文件应用场景:代码审查 / DevOps / 工作流

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add nm-leyline-sem-integration
Metadata
name
sem-integration
description
Provides sem semantic-diff detection, install-on-first-use, and fallback patterns
version
1.9.8
triggers
["sem","semantic-diff","git","foundation","building skills that consume git diff output"]
metadata
{"openclaw":{"homepage":"https://github.com/athola/claude-night-market/tree/master/plugins/leyline","emoji":"🦞"}}
source
claude-night-market
source_plugin
leyline

Night Market Skill — ported from claude-night-market/leyline. For the full experience with agents, hooks, and commands, install the Claude Code plugin.

sem Integration

Foundation patterns for using sem semantic diffs in night-market skills.

When To Use

Consult this skill when building or modifying skills that consume git diff output. It provides the detection, installation, and fallback patterns.

When NOT To Use

  • Direct sem CLI usage (just run sem diff yourself)
  • Skills that don't consume diff output

Detection Pattern

Check sem availability once per session:

# Detection (cache per session)
_sem_check() {
  local cache="${CLAUDE_CODE_TMPDIR:-/tmp}/sem-available"
  if [ -f "$cache" ]; then
    cat "$cache"
    return
  fi
  if command -v sem &>/dev/null; then
    echo "1" | tee "$cache"
  else
    echo "0" | tee "$cache"
  fi
}

When _sem_check returns 0, offer installation. See modules/detection.md for install-on-first-use logic and platform-specific commands.

Semantic Diff Pattern

Primary path (sem available):

sem diff --format json <baseline>

Fallback path (sem unavailable):

git diff --name-only --diff-filter=A <baseline>
git diff --name-only --diff-filter=M <baseline>
git diff --name-only --diff-filter=D <baseline>
git diff --name-only --diff-filter=R <baseline>

See modules/fallback.md for output normalization that produces the same entity schema from both paths.

Impact Analysis Pattern

Primary path (sem available):

sem impact --json <file-or-entity>

Fallback path (sem unavailable): use rg/grep to trace callers by filename. See modules/fallback.md.