ccoalm/ccl-skills / skills/skill-extraction-workflow
skill-extraction-workflow
Flagged复盘 / 沉淀 / 总结经验 / 补进技能 / 技能缺陷 / 流程优化 / would other teammates hit this / will we forget next time / teamwide recurrence / extract skill / post-mortem / 深度 review·审计技能仓库 / 对标外部技能包找 gap(benchmark superpowers·gstack 等) / 核查全局安装点(~/.config/opencode 等)旧快照是否遮蔽本仓技能 / 本仓(ccl-skills 等共享技能仓)OpenCode 项目配置·命令治理 → turn reusable lessons into durable CCL skills.
scripts/test_routing_pointer_integrity.sh
View on GitHub#!/usr/bin/env bash
# Contract test: the routing pointers and doc-vs-executor consistency landed by
# the deep-review-fix round must stay in place. Each grep targets the landed
# RULE TEXT (not a bare skill name), so deleting the rule while leaving the
# name elsewhere in the file still turns the lane red — these are the RED
# oracles cited by the corresponding source-register impact-chain rows (the
# Python arch/dev boundary's RED oracle is the eval bank fixture
# miss-refactor-python-unqualified, replayed in the same round, not this suite —
# and that replay is a one-time MANUAL advisory run: the bank grader needs a live
# `claude` CLI, so no registered lane re-runs it. This suite pins TEXT, never
# routing behaviour; see test_routing_bank_integrity.sh for the structural half.)
# Accepted-maintenance note: this is a literal-phrase anchor check over text the
# repo owns (same class as the anchor gates inside check-ccl-skills.sh);
# when one of these rules is intentionally reworded, update the token in the
# same diff.
set -u
# POINTER_ROOT overrides the tree under test (used by the RED-baseline proof
# and fixture tests); default is the repo this script is installed in.
ROOT="${POINTER_ROOT:-$(cd "$(dirname "$0")/../../.." && pwd)}"
# A redirected lane must be loud: env-injected POINTER_ROOT (CI/dev shell) makes
# the suite test a different tree than the caller expects.
[ -n "${POINTER_ROOT:-}" ] && echo "NOTICE: POINTER_ROOT set — testing tree: $ROOT" >&2
fail=0
check() { # <file> <token> <label>
if ! grep -qF "$2" "$1"; then
echo "FAIL: $3 missing ($1 :: $2)" >&2
fail=1
fi
}
check_frontmatter_present() { # <file> <token> <label> — token present in the
# YAML frontmatter block.
if [ ! -f "$1" ]; then
echo "FAIL: $3 target file missing ($1)" >&2
fail=1
return
fi
awk '/^---$/{c++; next} c==1' "$1" | grep -qF "$2" || { echo "FAIL: $3 missing from frontmatter ($1 :: $2)" >&2; fail=1; }
}
check_frontmatter_absent() { # <file> <token> <label> — token absent from the
# YAML frontmatter block (body may legitimately discuss the same words).
if [ ! -f "$1" ]; then
echo "FAIL: $3 target file missing ($1)" >&2
fail=1
return
fi
if awk '/^---$/{c++; next} c==1' "$1" | grep -qF "$2"; then
echo "FAIL: $3 present in frontmatter ($1 :: $2)" >&2
fail=1
fi
}
check_threshold_consistency() { # <root> <label> — the description-length numbers
# the authoring doc STATES must equal the ones check-ccl-skills.sh
# ENFORCES. This replaces four literal-value anchors (doc says "800", doc must
# not say "1024", script says 800, script says 600) with the property those
# anchors were standing in for. It is strictly stronger AND cheaper to keep:
# - stronger: any doc/executor disagreement fails, including numbers nobody
# hardcoded here, so a NEW stale value cannot slip in the way "1024" did;
# - cheaper: an intentional threshold change (e.g. 800 -> 700 on both sides
# in one diff) now passes instead of red-lining a correct change and
# forcing an unrelated edit to this file.
local root="$1" label="$2"
local doc="$root/skills/skill-extraction-workflow/references/description-authoring.md"
local exe="$root/skills/skill-extraction-workflow/scripts/check-ccl-skills.sh"
for f in "$doc" "$exe"; do
if [ ! -f "$f" ]; then
echo "FAIL: $label target file missing ($f)" >&2; fail=1; return
fi
done
local doc_hdr doc_max doc_warn exe_max exe_warn
# Each number is parsed via ITS OWN marker. A bare `above [0-9]+` is wrong:
# the doc states both thresholds in one sentence ("... above 800 chars and
# warns ... above 600"), so a first-match parse silently reads the block
# number as the warn number. (`description_long_for_opencode` cannot match
# inside `description_too_long_for_opencode` — that one reads "too_long".)
# `.` stands in for the doc's backtick to avoid shell command substitution.
doc_hdr=$(grep -oE '[0-9]+-character maximum' "$doc" | grep -oE '[0-9]+' | head -1)
doc_max=$(grep -oE 'description_too_long_for_opencode. above [0-9]+' "$doc" | grep -oE '[0-9]+$' | head -1)
doc_warn=$(grep -oE 'description_long_for_opencode. above [0-9]+' "$doc" | grep -oE '[0-9]+$' | head -1)
# Each executor threshold is read from the LINE carrying its own diagnostic
# name, not inferred as the max/min of every `desc.length >` in the file.
# Inferring by extreme is wrong in both directions: an unrelated comparison
# with a bigger/smaller bound false-reds a valid change, and an unrelated
# occurrence of the old value masks real drift in the one that matters.
# (`description_long_for_opencode` cannot match the block line, which reads
# `description_too_long_for_opencode`.)
# Collect EVERY threshold carrying each diagnostic name and require exactly one
# distinct value. `head -1` was wrong: a dead/older line for the same diagnostic
# sitting above the active one would be picked, so changing the ACTIVE threshold
# left this equal to the doc and false-greened real drift.
local exe_max_all exe_warn_all exe_max_n exe_warn_n
exe_max_all=$(grep 'description_too_long_for_opencode' "$exe" | grep -oE 'desc\.length > [0-9]+' | grep -oE '[0-9]+' | sort -u)
exe_warn_all=$(grep 'description_long_for_opencode' "$exe" | grep -oE 'desc\.length > [0-9]+' | grep -oE '[0-9]+' | sort -u)
exe_max_n=$(printf '%s\n' "$exe_max_all" | grep -c '[0-9]')
exe_warn_n=$(printf '%s\n' "$exe_warn_all" | grep -c '[0-9]')
if [ "$exe_max_n" -gt 1 ] || [ "$exe_warn_n" -gt 1 ]; then
echo "FAIL: $label executor declares conflicting thresholds for one diagnostic (max: $(echo $exe_max_all), warn: $(echo $exe_warn_all)) — a stale duplicate line would mask real drift" >&2
fail=1; return
fi
exe_max="$exe_max_all"
exe_warn="$exe_warn_all"
# An unparsed side must fail: an empty capture comparing equal to another
# empty capture is the silent-pass this whole check exists to prevent.
if [ -z "$doc_hdr" ] || [ -z "$doc_max" ] || [ -z "$doc_warn" ] || [ -z "$exe_max" ] || [ -z "$exe_warn" ]; then
echo "FAIL: $label could not parse thresholds (doc_hdr='$doc_hdr' doc_max='$doc_max' doc_warn='$doc_warn' exe_max='$exe_max' exe_warn='$exe_warn')" >&2
fail=1; return
fi
# The doc's own section heading must agree with its body sentence, or a reader
# who stops at the heading gets the stale number — the exact shape of the
# 1024-vs-800 drift this replaced.
if [ "$doc_hdr" != "$doc_max" ]; then
echo "FAIL: $label doc heading says $doc_hdr but its body says $doc_max" >&2; fail=1
fi
if [ "$doc_max" != "$exe_max" ]; then
echo "FAIL: $label doc states max=$doc_max but executor enforces max=$exe_max" >&2; fail=1
fi
if [ "$doc_warn" != "$exe_warn" ]; then
echo "FAIL: $label doc states warn=$doc_warn but executor warns at $exe_warn" >&2; fail=1
fi
}
check_absent() { # <file> <token> <label> — file must exist AND token absent;
# a missing/renamed target is a failure, never a pass.
if [ ! -f "$1" ]; then
echo "FAIL: $3 target file missing ($1)" >&2
fail=1
return
fi
if grep -qF "$2" "$1"; then
echo "FAIL: $3 must not be present ($1 :: $2)" >&2
fail=1
fi
}
check_line_all() { # <file> <selector> <label> <req...> — EVERY <req> must sit on
# ONE line that matches <selector>. Filtering the matched lines through each req in
# turn is what binds them to the same line: asserting each req against the whole set
# of matched lines lets two reqs pass on two different lines, so a contract that says
# "both owners on that line" would be satisfied while no line carries both.
# -e is required: a selector starting with "-" is otherwise parsed as an option.
local file="$1" sel="$2" label="$3"; shift 3
local out req
out=$(grep -F -e "$sel" "$file" 2>/dev/null)
if [ -z "$out" ]; then
echo "FAIL: $label missing ($file :: no line matches '$sel')" >&2; fail=1; return
fi
for req in "$@"; do
out=$(printf '%s\n' "$out" | grep -F -e "$req")
if [ -z "$out" ]; then
echo "FAIL: $label missing ($file :: one line matching '$sel' must also contain '$req')" >&2; fail=1; return
fi
done
}
# Self-pin: an emptied or truncated suite must fail, not pass. Update EXPECTED
# when adding/removing checks deliberately (same diff). Runs FIRST: a truncated
# tail removes real checks and the count goes red.
EXPECTED_CHECKS=36
actual_checks=$(grep -cE '^check([_a-z]+)? ' "$0")
if [ "$actual_checks" -ne "$EXPECTED_CHECKS" ]; then
echo "FAIL: suite self-pin: expected $EXPECTED_CHECKS checks, found $actual_checks" >&2
exit 1
fi
# Rollout routing pointers: the landed bullets, not the skill names alone.
check "$ROOT/skills/platform-release-engineering/SKILL.md" "must not own that coordination lifecycle" "rollout -> release-coordination boundary rule"
check "$ROOT/skills/platform-release-engineering/SKILL.md" "release document's substance and evidence discipline" "rollout -> release-doc-writer routing pointer"
# product-rd callback rule: the landed rule opening, not the skill name alone.
check "$ROOT/skills/product-rd-workflow/SKILL.md" "For research groundwork behind a selection or assessment decision" "product-rd -> multi-perspective-research callback rule"
# Doc-vs-executor consistency: the doc claims 800/600 and the executor enforces
# exactly those numbers — pin BOTH sides so a threshold change on either side
# turns the lane red instead of re-opening the doc-vs-script drift.
check_threshold_consistency "$ROOT" "doc-vs-executor description thresholds"
check "$ROOT/skills/skill-extraction-workflow/SKILL.md" "within the 800-char cap" "skill-extraction utterance-variant 800-cap rule (firing-path of the register row)"
# Routing-surface landings from the same round (description edits): pin the key
# trigger/skip tokens so a revert of any of them turns the lane red. Behavior
# oracle for these is the eval bank replay; these anchors are the cheap always-on guard.
check_frontmatter_present "$ROOT/skills/python-service-dev/SKILL.md" "重构 Python 服务里的某文件/某类(局部)" "python-service-dev localized-refactor trigger"
check_frontmatter_present "$ROOT/skills/python-service-dev/SKILL.md" "用 Python 写个命令行工具" "python-service-dev CLI trigger"
# description-scoped: the bare trigger must be gone from the frontmatter
# description line (body may legitimately discuss the boundary).
check_frontmatter_absent "$ROOT/skills/python-service-dev/SKILL.md" "Python 服务重构" "python-service-dev unqualified refactor trigger"
check_frontmatter_present "$ROOT/skills/software-architecture/SKILL.md" "Python 服务重构" "software-architecture unqualified Python refactor trigger"
check_frontmatter_present "$ROOT/skills/software-architecture/SKILL.md" "Go 服务重构" "software-architecture unqualified Go refactor trigger"
check_frontmatter_present "$ROOT/skills/miniapp-product-dev/SKILL.md" "重构这个小程序页面/组件(局部)" "miniapp localized-refactor trigger"
check_frontmatter_present "$ROOT/skills/terminal-cli-dev/SKILL.md" "用 Python 写个命令行工具\" → python-service-dev" "terminal-cli-dev language-stack CLI skip"
# Both legs of that skip clause must be reciprocated by the named stack owner,
# or the pointer sends the request to a skill that never advertises the work.
check_frontmatter_present "$ROOT/skills/go-microservice-dev/SKILL.md" "用 Go 写个命令行工具" "go-microservice-dev CLI trigger (reciprocal of terminal-cli-dev skip)"
check_frontmatter_present "$ROOT/skills/nodejs-service-dev/SKILL.md" "用 Node.js 写个命令行工具" "nodejs-service-dev CLI trigger (reciprocal of terminal-cli-dev skip)"
# The coordinator surface must carry the same carve-out, or product-rd keeps
# advertising terminal-cli-dev for language-stack CLI implementation.
check "$ROOT/skills/product-rd-workflow/SKILL.md" "must go to that language's dev skill when one owns it" "product-rd coordinator CLI carve-out (owner branch)"
# Both branches are pinned separately: anchoring only the owner branch lets the
# no-owner fallback be deleted while the suite stays green, which is exactly the
# routing hole (a CLI in a language with no dev owner) this rule closes.
check "$ROOT/skills/product-rd-workflow/SKILL.md" "no such dev owner stays with \`terminal-cli-dev\` as the default CLI owner" "product-rd coordinator CLI carve-out (no-owner fallback branch, incl. destination)"
# A routing-bank case cannot guard this: a multi-stage Node request selects
# product-rd-workflow from its own wording and stays green even when the
# coordinator omits the Node owner from its dispatch map. Pin the map itself —
# both the stack enumeration and the CLI carve-out list — or the omission that
# sent Node deliveries to a coordinator with no owner to dispatch to recurs
# invisibly, with the no-owner fallback above silently reclaiming Node CLIs.
check_line_all "$ROOT/skills/product-rd-workflow/SKILL.md" "- Development routing:" "product-rd Development-routing line carries the Node owner in BOTH the stack enumeration and the CLI carve-out" "\`nodejs-service-dev\` for Node.js services" "\`python-service-dev\`, \`nodejs-service-dev\`)"
# Node.js/TypeScript architecture is owned by software-architecture, read with its
# Node.js/TypeScript part. The design gate must say so on the Node line itself and
# keep both downstream owners there: naming only the architecture owner drops the
# implementation contract, and dropping the "do not substitute" clause re-opens the
# failure the earlier no-sibling rule closed — a Node service designed from the Go
# or Python stack defaults because they were the nearest-looking ones.
check_line_all "$ROOT/skills/product-rd-workflow/references/delivery-lifecycle.md" "For Node.js backend, worker, or CLI/tooling architecture" "product-rd design gate sends Node architecture to software-architecture and names both downstream owners on that line" "use \`software-architecture\` for this gate" "its Node.js/TypeScript part" "\`platform-*\` owners" "\`nodejs-service-dev\` for the Node-side implementation contract" "do not substitute the Go or Python stack defaults" "runs this gate here"
# The owner side of the same route: the entrypoint must actually carry the part the
# gate points at, the guard against borrowing a sibling stack's defaults, and the
# trigger that makes a Node/TypeScript architecture request reach it at all.
check "$ROOT/skills/software-architecture/SKILL.md" "### Node.js / TypeScript" "software-architecture carries a Node.js/TypeScript stack part"
check "$ROOT/skills/software-architecture/SKILL.md" "The Go and Python defaults above do not transfer" "software-architecture forbids borrowing sibling stack defaults for Node"
check_frontmatter_present "$ROOT/skills/software-architecture/SKILL.md" "Node.js·TypeScript 服务架构与服务边界" "software-architecture Node/TypeScript architecture trigger"
check_frontmatter_present "$ROOT/skills/nodejs-service-dev/SKILL.md" "architecture and service-boundary decisions to software-architecture" "nodejs-service-dev routes architecture to software-architecture"
check "$ROOT/skills/defect-diagnosis/SKILL.md" "A Node.js architecture or service-boundary issue -> \`software-architecture\`" "defect-diagnosis routes Node architecture defects to software-architecture"
check "$ROOT/skills/llm-inference-integration/SKILL.md" "its architecture decisions go to \`software-architecture\`" "llm-inference-integration routes Node host architecture to software-architecture"
# Both legs of the skip clause are pinned: an unanchored leg can be deleted while
# the reciprocal trigger anchor above stays green, and the eval fixtures assert
# terminal-cli-dev must NOT receive either request.
check_frontmatter_present "$ROOT/skills/terminal-cli-dev/SKILL.md" "Go CLI → go-microservice-dev" "terminal-cli-dev Go skip leg"
check_frontmatter_present "$ROOT/skills/terminal-cli-dev/SKILL.md" "Node.js CLI → nodejs-service-dev" "terminal-cli-dev Node.js skip leg"
# CLI interface design ownership: both surfaces must say terminal-cli-dev owns the
# command/flag/help contract even with nothing rendered, or non-rendered CLI design
# goes back to having no owner (terminal skipped it, the stack skills scope to
# implementation) — the gap two independent reviewer lanes hit.
check_frontmatter_present "$ROOT/skills/terminal-cli-dev/SKILL.md" "command/subcommand/flag/help contract (owned here even when nothing is rendered)" "terminal-cli-dev owns the non-rendered CLI contract"
check "$ROOT/skills/product-rd-workflow/SKILL.md" "command/subcommand/flag/help contract, which it owns even when nothing is rendered" "product-rd mirrors CLI-contract ownership"
# testing-strategy must not re-claim language-stack CLI test IMPLEMENTATION: that
# claim collided with the CLI carve-out every stack dev owner and the coordinator
# carry, so the line is scoped to the interface contract it actually owns.
check_line_all "$ROOT/skills/testing-strategy/SKILL.md" "- Use \`terminal-cli-dev\` for" "testing-strategy scopes terminal-cli-dev to the interface contract, not language-stack CLI implementation" "terminal interface contract"
check_frontmatter_present "$ROOT/skills/platform-release-engineering/SKILL.md" "上线范围确认 / 合并 main / 打 tag" "rollout description prod-release skip"
check "$ROOT/skills/app-cross-platform-dev/agents/openai.yaml" "React Native" "app-cross-platform-dev openai overlay RN parity"
# The Go playbook's Dependency Direction diagram must show import direction: read
# as imports, the arrow it used to draw told the domain to import a database
# adapter, against the rule text of the same section. The three import lines are
# pinned as WHOLE lines: a substring pin passes when a further arrow is appended
# to a line (`... -> domain -> infrastructure adapter`), which restores the
# contradiction. The absent pin covers singular and plural, and the run-time
# `calls` line does not contain it because an interface sits between.
check_exact_line() { # <file> <whole line> <label>
if ! grep -qxF -e "$2" "$1" 2>/dev/null; then
echo "FAIL: $3 missing as a whole line ($1 :: $2)" >&2
fail=1
fi
}
check_absent "$ROOT/skills/software-architecture/references/go-architecture-playbook.md" "domain -> infrastructure" "Go playbook diagram does not draw the domain importing adapters"
check_exact_line "$ROOT/skills/software-architecture/references/go-architecture-playbook.md" "imports: transport -> application/service -> domain" "Go playbook import line ends at the domain"
check_exact_line "$ROOT/skills/software-architecture/references/go-architecture-playbook.md" " infrastructure adapters -> domain" "Go playbook diagram shows adapters importing the domain"
check_exact_line "$ROOT/skills/software-architecture/references/go-architecture-playbook.md" " application/service -> generated clients/contracts" "Go playbook generated-code import line ends at the generated code"
check "$ROOT/skills/software-architecture/references/go-architecture-playbook.md" "The domain never imports an adapter package." "Go playbook states the domain import rule beside the diagram"
if [ "$fail" -eq 0 ]; then
echo "routing_pointer_integrity_ok"
fi
exit "$fail"
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |