Claude-skill-registry ccs-delegation
install
source · Clone the upstream repo
git clone https://github.com/majiayu000/claude-skill-registry
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/ccs-delegation" ~/.claude/skills/majiayu000-claude-skill-registry-ccs-delegation && rm -rf "$T"
manifest:
skills/data/ccs-delegation/SKILL.mdsource content
CCS Delegation
Delegate deterministic tasks to cost-optimized models via CCS CLI.
Core Concept
Execute tasks via alternative models using:
- Initial delegation:
ccs {profile} -p "task" - Session continuation:
ccs {profile}:continue -p "follow-up"
Profile Selection:
- Auto-select from
via task analysis~/.ccs/config.json - Profiles: glm (cost-optimized), kimi (long-context/reasoning), custom profiles
- Override:
flag forces specific profile--{profile}
User Invocation Patterns
Users trigger delegation naturally:
- "use ccs [task]" - Auto-select best profile
- "use ccs --glm [task]" - Force GLM profile
- "use ccs --kimi [task]" - Force Kimi profile
- "use ccs:continue [task]" - Continue last session
Examples:
- "use ccs to fix typos in README.md"
- "use ccs to analyze the entire architecture"
- "use ccs --glm to add unit tests"
- "use ccs:continue to commit the changes"
Agent Response Protocol
For
:/ccs [task]
-
Parse override flag
- Scan task for pattern:
--(\w+) - If match:
, remove flag from task, skip to step 5profile = match[1] - If no match: continue to step 2
- Scan task for pattern:
-
Discover profiles
- Read
using Read tool~/.ccs/config.json - Extract
→Object.keys(config.profiles)availableProfiles[] - If file missing → Error: "CCS not configured. Run: ccs doctor"
- If empty → Error: "No profiles in config.json"
- Read
-
Analyze task requirements
- Scan task for keywords:
→/(think|analyze|reason|debug|investigate|evaluate)/ineedsReasoning = true
→/(architecture|entire|all files|codebase|analyze all)/ineedsLongContext = true
→/(typo|test|refactor|update|fix)/ipreferCostOptimized = true
- Scan task for keywords:
-
Select profile
- For each profile in
: classify by name pattern (see Profile Characteristic Inference table)availableProfiles - If
: filter profiles whereneedsReasoning
→ prefer kimireasoning=true - Else if
: filter profiles whereneedsLongContext
→ prefer kimicontext=long - Else: filter profiles where
→ prefer glmcost=low selectedProfile = filteredProfiles[0]- If
: fallback tofilteredProfiles.length === 0
if exists, else first availableglm - If no profiles: Error
- For each profile in
-
Enhance prompt
- If task mentions files: gather context using Read tool
- Add: file paths, current implementation, expected behavior, success criteria
- Preserve slash commands at task start (e.g.,
,/cook
)/commit
-
Execute delegation
- Run:
via Bash toolccs {selectedProfile} -p "$enhancedPrompt"
- Run:
-
Report results
- Log: "Selected {profile} (reason: {reasoning/long-context/cost-optimized})"
- Report: Cost (USD), Duration (sec), Session ID, Exit code
For
:/ccs:continue [follow-up]
-
Detect profile
- Read
using Read tool~/.ccs/delegation-sessions.json - Find most recent session (latest timestamp)
- Extract profile name from session data
- If no sessions → Error: "No previous delegation. Use /ccs first"
- Read
-
Parse override flag
- Scan follow-up for pattern:
--(\w+) - If match:
, remove flag from follow-up, log profile switchprofile = match[1] - If no match: use detected profile from step 1
- Scan follow-up for pattern:
-
Enhance prompt
- Review previous work (check what was accomplished)
- Add: previous context, incomplete tasks, validation criteria
- Preserve slash commands at start
-
Execute continuation
- Run:
via Bash toolccs {profile}:continue -p "$enhancedPrompt"
- Run:
-
Report results
- Report: Profile, Session #, Incremental cost, Total cost, Duration, Exit code
Decision Framework
Delegate when:
- Simple refactoring, tests, typos, documentation
- Deterministic, well-defined scope
- No discussion/decisions needed
Keep in main when:
- Architecture/design decisions
- Security-critical code
- Complex debugging requiring investigation
- Performance optimization
- Breaking changes/migrations
Profile Selection Logic
Task Analysis Keywords (scan task string with regex):
| Pattern | Variable | Example |
|---|---|---|
| | "think about caching" |
| | "analyze all files" |
| | "fix typo in README" |
Profile Characteristic Inference (classify by name pattern):
| Profile Pattern | Cost | Context | Reasoning |
|---|---|---|---|
| low | standard | false |
| medium | long | true |
| high | standard | false |
| others | low | standard | false |
Selection Algorithm (apply filters sequentially):
profiles = Object.keys(config.profiles) classified = profiles.map(p => ({name: p, ...inferCharacteristics(p)})) if (needsReasoning): filtered = classified.filter(p => p.reasoning === true).sort(['kimi']) else if (needsLongContext): filtered = classified.filter(p => p.context === 'long').sort(['kimi']) else: filtered = classified.filter(p => p.cost === 'low').sort(['glm', ...]) selected = filtered[0] || profiles.find(p => p === 'glm') || profiles[0] if (!selected): throw Error("No profiles configured") log("Selected {selected} (reason: {reasoning|long-context|cost-optimized})")
Override Logic:
- Parse task for
. If match:/--(\w+)/
, remove from task, skip selectionprofile = match[1]
Example Delegation Tasks
Good candidates:
- "/ccs add unit tests for UserService using Jest" → Auto-selects: glm (simple task)
- "/ccs analyze entire architecture in src/" → Auto-selects: kimi (long-context)
- "/ccs think about the best database schema design" → Auto-selects: kimi (reasoning)
- "/ccs --glm refactor parseConfig to use destructuring" → Forces: glm (override)
Bad candidates (keep in main):
- "implement OAuth" (too complex, needs design)
- "improve performance" (requires profiling)
- "fix the bug" (needs investigation)
Execution
Commands:
- Intelligent delegation (auto-select profile)/ccs "task"
- Force specific profile/ccs --{profile} "task"
- Continue last session (auto-detect profile)/ccs:continue "follow-up"
- Continue with profile switch/ccs:continue --{profile} "follow-up"
Agent via Bash:
- Auto:
ccs {auto-selected} -p "task" - Continue:
ccs {detected}:continue -p "follow-up"
References
Template:
CLAUDE.md.template - Copy to user's CLAUDE.md for auto-delegation config
Troubleshooting: references/troubleshooting.md