用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/majiayu000/claude-skill-registry --skill complexity-scorer命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
正在显示 SKILL.md
| name | complexity-scorer |
| version | 1.0.0 |
| description | Score task complexity using keyword matching and heuristics |
| author | workspace-hub |
| category | bash |
| tags | ["bash","complexity","scoring","keywords","analysis","classification"] |
| platforms | ["linux","macos"] |
Patterns for scoring task complexity using keyword matching, context analysis, and configurable heuristics. Extracted from workspace-hub's model selection system.
✅ Use when:
❌ Avoid when:
Define keyword categories with weights:
#!/bin/bash
# ABOUTME: Keyword-based complexity scoring
# ABOUTME: Pattern from workspace-hub suggest_model.sh
# Keyword categories with associated complexity impact
# High complexity keywords (score +3)
HIGH_COMPLEXITY="architecture|refactor|design|security|complex|multi-file|algorithm|optimization|strategy|planning|cross-repository|performance|migration|integration"
# Medium complexity keywords (score +1)
MEDIUM_COMPLEXITY="implement|feature|bug|fix|code review|documentation|test|update|add|create|build|configure|setup"
# Low complexity keywords (score -2)
LOW_COMPLEXITY="check|status|simple|quick|template|list|grep|find|search|summary|validation|exists|show|display|count|verify"
# Score based on keywords
score_keywords() {
local text="$1"
local text_lower=$(echo "$text" | tr '[:upper:]' '[:lower:]')
local score=0
# Check high complexity first (mutually exclusive)
if echo "$text_lower" | grep -qE "$HIGH_COMPLEXITY"; then
((score+=3))
elif echo "$text_lower" | grep -qE "$MEDIUM_COMPLEXITY"; then
((score+=1))
elif echo "" | grep -qE ;
((score-=))
}
task=
score=$(score_keywords )
Combine multiple factors for better accuracy:
#!/bin/bash
# ABOUTME: Multi-factor complexity scoring
# ABOUTME: Combines keywords, length, context
# Factor weights
declare -A WEIGHTS=(
["keywords"]=3
["length"]=1
["urgency"]=1
["scope"]=2
)
# Score task length
score_length() {
local text="$1"
local word_count=$(echo "$text" | wc -w)
if [[ $word_count -gt 20 ]]; then
echo 2 # Long = more complex
elif [[ $word_count -gt 10 ]]; then
echo 1
elif [[ $word_count -lt 5 ]]; then
echo -1 # Short = simpler
else
echo 0
fi
}
# Score urgency indicators
score_urgency() {
local text="$1"
local text_lower=$(echo "$text" | tr '[:upper:]' '[:lower:]')
if echo | grep -qE ;
2
| grep -qE ;
1
0
}
() {
text=
text_lower=$( | )
| grep -qE ;
2
| grep -qE ;
1
| grep -qE ;
-1
0
}
() {
text=
total=0
keyword_score=$(score_keywords )
length_score=$(score_length )
urgency_score=$(score_urgency )
scope_score=$(score_scope )
total=$((keyword_score * +
length_score * +
urgency_score * +
scope_score * ))
}
Adjust scores based on context (repository, domain, etc.):
#!/bin/bash
# ABOUTME: Context-aware complexity scoring
# ABOUTME: Adjusts based on repository tier, domain
# Repository tiers
TIER1_REPOS="workspace-hub|digitalmodel|energy|frontierdeepwater"
TIER2_REPOS="aceengineercode|assetutilities|worldenergydata|rock-oil-field"
TIER3_REPOS="doris|saipem|OGManufacturing|seanation"
PERSONAL_ACTIVE="aceengineer-admin|aceengineer-website"
PERSONAL_EXPERIMENTAL="hobbies|sd-work|acma-projects"
# Get repository tier
get_repo_tier() {
local repo="$1"
if echo "$repo" | grep -qE "$TIER1_REPOS"; then
echo "tier1"
elif echo "$repo" | grep -qE "$TIER2_REPOS"; then
echo "tier2"
elif echo "$repo" | grep -qE "$TIER3_REPOS"; then
echo "tier3"
elif echo "$repo" | grep -qE "$PERSONAL_ACTIVE"; then
echo
| grep -qE ;
}
() {
base_score=
repo=
adjusted=
tier=$(get_repo_tier )
tier1)
((adjusted+=))
;;
tier3|personal_experimental)
((adjusted-=))
;;
}
() {
task=
repo=
base_score=$(calculate_complexity )
final_score=$(adjust_for_context )
}
Map scores to categories:
#!/bin/bash
# ABOUTME: Map complexity scores to categories
# ABOUTME: Provides actionable classifications
# Classification thresholds
THRESHOLD_HIGH=5
THRESHOLD_MEDIUM=1
THRESHOLD_LOW=-2
# Classify score
classify_complexity() {
local score="$1"
if [[ $score -ge $THRESHOLD_HIGH ]]; then
echo "high"
elif [[ $score -ge $THRESHOLD_MEDIUM ]]; then
echo "medium"
elif [[ $score -ge $THRESHOLD_LOW ]]; then
echo "low"
else
echo "trivial"
fi
}
# Get recommendation based on classification
get_recommendation() {
local score="$1"
local classification=$(classify_complexity "$score")
case "$classification" in
high)
echo "OPUS"
echo "Use for complex architecture, multi-file refactoring, security analysis"
;;
medium)
;;
low)
;;
trivial)
;;
}
() {
score=
classification=$(classify_complexity )
high) ;;
medium) ;;
low) ;;
trivial) ;;
}
Add confidence to scoring:
#!/bin/bash
# ABOUTME: Confidence scoring for complexity estimates
# ABOUTME: Indicates reliability of the score
# Calculate confidence
calculate_confidence() {
local text="$1"
local confidence=50 # Base confidence
local word_count=$(echo "$text" | wc -w)
local keyword_matches=0
local text_lower=$(echo "$text" | tr '[:upper:]' '[:lower:]')
# More words = higher confidence (more context)
if [[ $word_count -gt 15 ]]; then
((confidence+=20))
elif [[ $word_count -gt 8 ]]; then
((confidence+=10))
elif [[ $word_count -lt 3 ]]; then
((confidence-=20))
fi
# Keyword matches boost confidence
for pattern in "$HIGH_COMPLEXITY" "$MEDIUM_COMPLEXITY" "$LOW_COMPLEXITY"; do
if echo "" | grep -qE ;
((keyword_matches++))
((confidence += keyword_matches * ))
[[ -gt 100 ]] && confidence=100
[[ -lt 10 ]] && confidence=10
}
() {
confidence=
[[ -ge 80 ]];
[[ -ge 60 ]];
[[ -ge 40 ]];
}
Adjust based on past accuracy:
#!/bin/bash
# ABOUTME: Historical learning for complexity scoring
# ABOUTME: Track and adjust based on actual outcomes
HISTORY_FILE="${HOME}/.complexity-scorer/history.log"
# Log prediction vs actual
log_outcome() {
local task="$1"
local predicted_score="$2"
local actual_complexity="$3" # user-provided feedback
local timestamp=$(date '+%Y-%m-%d_%H:%M:%S')
mkdir -p "$(dirname "$HISTORY_FILE")"
echo "${timestamp}|${predicted_score}|${actual_complexity}|${task}" >> "$HISTORY_FILE"
}
# Calculate prediction accuracy
calculate_accuracy() {
local correct=0
local total=0
while IFS='|' read -r ts predicted actual task; do
[[ "$ts" =~ ^#.*$ ]] && continue
[[ -z "$ts" ]] && continue
((total++))
local predicted_class=$(classify_complexity )
[[ == ]];
((correct++))
<
[[ -gt 0 ]];
$((correct * / total))
0
}
() {
IFS= -r ts predicted actual task;
predicted_class=$(classify_complexity )
[[ != ]];
<
}
#!/bin/bash
# ABOUTME: Complete task complexity scoring system
# ABOUTME: Multi-factor scoring with recommendations
set -e
# ─────────────────────────────────────────────────────────────────
# Configuration
# ─────────────────────────────────────────────────────────────────
# Colors
GREEN='\033[0;32m'
BLUE='\033[0;34m'
YELLOW='\033[1;33m'
CYAN='\033[0;36m'
RED='\033[0;31m'
NC='\033[0m'
# Keyword patterns
OPUS_KEYWORDS="architecture|refactor|design|security|complex|multi-file|algorithm|optimization|strategy|planning|cross-repository|performance|migration"
SONNET_KEYWORDS="implement|feature|bug|fix|code review|documentation|test|update|add|create|build"
HAIKU_KEYWORDS="check|status|simple|quick|template|list|grep|find|search|summary|validation|exists|show|display"
# Repository tiers
WORK_TIER1="workspace-hub|digitalmodel|energy|frontierdeepwater"
WORK_TIER2="aceengineercode|assetutilities|worldenergydata"
WORK_TIER3="doris|saipem|OGManufacturing"
PERSONAL="hobbies|sd-work|acma-projects"
# ─────────────────────────────────────────────────────────────────
# Scoring Functions
# ─────────────────────────────────────────────────────────────────
score_task() {
local task="$1"
local repo="${2:-}"
local task_lower=$(echo "$task" | tr '[:upper:]' )
score=0
| grep -qE ;
((score+=))
| grep -qE ;
((score+=))
| grep -qE ;
((score-=))
word_count=$( | -w)
[[ -gt 15 ]];
((score+=))
[[ -lt 5 ]];
((score-=))
[[ -n ]];
| grep -qE ;
((score+=))
| grep -qE ;
((score-=))
}
() {
score=
[[ -ge 3 ]];
[[ -ge 0 ]];
}
() {
repo=
| grep -qE ;
| grep -qE ;
| grep -qE ;
| grep -qE ;
}
() {
task=
repo=
score=$(score_task )
recommendation=$(get_recommendation )
tier=$(get_tier_name )
color
OPUS) color= ;;
SONNET) color= ;;
HAIKU) color= ;;
-e
-e
-e
[[ -n ]] && -e
-e
-e
-e
-e
task_lower=$( | )
| grep -qE ;
| grep -qE ;
| grep -qE ;
[[ -n ]] &&
-e
}
() {
<<
}
REPO=
SCORE_ONLY=
JSON_OUTPUT=
[[ -gt 0 ]];
-r|--repo)
REPO=
2
;;
-s|--score-only)
SCORE_ONLY=
;;
-j|--json)
JSON_OUTPUT=
;;
-h|--)
show_usage
0
;;
-*)
show_usage
1
;;
*)
;;
TASK=
[[ -z ]];
-p TASK
[[ -z ]];
1
[[ == ]];
score_task
[[ == ]];
score=$(score_task )
rec=$(get_recommendation )
<<
display_result