用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/laicluse/agent-fieldkit --skill pattern-memory命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
Use when corrective work, migrations, living docs, or temporary diagnostic tests leave superseded residue, or before handoff.
Use when corrective work, migrations, living docs, or temporary diagnostic tests leave superseded residue, or before handoff.
Reference for git-discipline commit bodies, trailers, hook denials, examples, and escape hatches.
| name | pattern-memory |
| description | Search local Pattern Memory before implementing reusable code, interaction, or convention patterns. |
| args | <implementation intent> |
if [ -n "${CLAUDE_PLUGIN_ROOT:-}" ]; then
node "${CLAUDE_PLUGIN_ROOT}/bin/check-broadcast"
fi
If the command produces output, the pattern-memory plugin was updated since the last time you saw the broadcast on this machine. Show the output verbatim in a markdown block, prefixed with one short sentence ("pattern-memory was updated; here is what changed."). Then continue with the rest of this skill.
If the command produces no output, say nothing about updates and proceed.
Pattern Memory is a local-first registry of reusable implementation patterns. It is not the pattern content itself; it is the lookup workflow over local Markdown files under ${LAICLUSE_HOME:-$HOME/.laicluse}/patterns by default.
Use it before implementing a reusable code pattern, product interaction, build/versioning convention, architecture recipe, or named implementation principle. It is especially relevant when the task sounds like "make this behave like X", "use the same convention as Y", "reuse the principle from Z", or "set up a new major feature/module/app/plugin".
resolve_pattern_memory_root() {
if [ -n "${CLAUDE_PLUGIN_ROOT:-}" ]; then
printf '%s\n' "$CLAUDE_PLUGIN_ROOT"
return 0
fi
if command -v codex >/dev/null 2>&1; then
codex plugin list --json \
| ruby -rjson -e 'data = JSON.parse(STDIN.read); item = data.fetch("installed").find { |plugin| plugin.fetch("pluginId") == "pattern-memory@laicluse-agent-fieldkit" }; abort "pattern-memory@laicluse-agent-fieldkit is not installed" unless item; puts item.fetch("source").fetch("path")'
return $?
fi
return 1
}
PLUGIN_ROOT="$(resolve_pattern_memory_root)" || { echo "pattern-memory plugin root not found" >&2; exit 1; }
PATTERN_MEMORY="$PLUGIN_ROOT/bin/pattern-memory"
Initialize the local store if it does not exist:
node "$PATTERN_MEMORY" init
Search with concrete surface terms from the task:
node "$PATTERN_MEMORY" search "<implementation intent>"
Read matching pattern files before implementing.
Inspect the current repository and any relevant available precedent code.
Treat the current repository as ground truth; Pattern Memory supplies candidates and constraints, not a blind answer.
Implement only after reconciling the pattern with the codebase in front of you.
Pattern files distinguish sanitized handles from private recall pointers:
exemplars: public-safe handles that may be named in summaries and docs.precedents: private implementation pointers. Read them only to inspect code. Never copy them into commits, PR bodies, public docs, generated examples, or messages for third parties.visibility: private, shareable, or public-example.When writing any shareable artifact, use the pattern's public-safe language. Do not surface concrete app names, private repo names, local paths, or origin stories from precedents.
Do not silently auto-capture patterns. When a new reusable pattern appears, draft it only when the operator asks or when the active task explicitly includes pattern capture. New notes start as status: draft; promote to verified only after the pattern has a clear recipe and verification evidence.
Before relying on a changed Pattern Memory store, run:
node "$PATTERN_MEMORY" validate
If validation reports a stale index, run:
node "$PATTERN_MEMORY" index