| name | complexity-scorer-1-keyword-based-scoring |
| description | Sub-skill of complexity-scorer: 1. Keyword-Based Scoring (+1). |
| version | 1.0.0 |
| category | _core |
| type | reference |
| scripts_exempt | true |
1. Keyword-Based Scoring (+1)
1. Keyword-Based Scoring
Define keyword categories with weights:
#!/bin/bash
HIGH_COMPLEXITY="architecture|refactor|design|security|complex|multi-file|algorithm|optimization|strategy|planning|cross-repository|performance|migration|integration"
MEDIUM_COMPLEXITY="implement|feature|bug|fix|code review|documentation|test|update|add|create|build|configure|setup"
LOW_COMPLEXITY="check|status|simple|quick|template|list|grep|find|search|summary|validation|exists|show|display|count|verify"
score_keywords() {
local text="$1"
local text_lower=$(echo "$text" | tr '[:upper:]' '[:lower:]')
local score=0
if echo "$text_lower" | grep -qE "$HIGH_COMPLEXITY"; then
((score+=3))
elif echo "$text_lower" | grep -qE "$MEDIUM_COMPLEXITY"; then
((score+=1))
elif echo "$text_lower" | grep -qE "$LOW_COMPLEXITY"; then
((score-=2))
fi
echo $score
}
task="Design the authentication system architecture"
score=$(score_keywords "$task")
echo "Complexity score: $score"
2. Multi-Factor Scoring
Combine multiple factors for better accuracy:
#!/bin/bash
declare -A WEIGHTS=(
["keywords"]=3
["length"]=1
["urgency"]=1
["scope"]=2
)
score_length() {
local text="$1"
local word_count=$(echo "$text" | wc -w)
if [[ $word_count -gt 20 ]]; then
echo 2
elif [[ $word_count -gt 10 ]]; then
echo 1
elif [[ $word_count -lt 5 ]]; then
echo -1
else
echo 0
fi
}
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 * ))
}