# Skill Context Detection

Auto-detect work context (Dev vs Knowledge), use to tailor workflows based on current...

- Repository: https://github.com/nyldn/claude-octopus (4351 stars)
- Category: Engineering
- License: MIT
- Last updated: 2026-11-01
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add nyldn/claude-octopus --skill skill-context-detection -g -a claude-code -y`
Codex: `npx skills add nyldn/claude-octopus --skill skill-context-detection -g -a codex -y`
Cursor: `npx skills add nyldn/claude-octopus --skill skill-context-detection -g -a cursor -y`
Gemini CLI: `npx skills add nyldn/claude-octopus --skill skill-context-detection -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add nyldn/claude-octopus`

## Description

Auto-detect work context (Dev vs Knowledge), use to tailor workflows based on current task type

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Context Detection - Internal Skill

## Purpose

This skill provides **automatic context detection** to determine whether the user is working in a **Development context** (code-focused) or **Knowledge context** (research/strategy-focused). This replaces the manual `/octo:km` toggle with intelligent auto-detection.

## Detection Algorithm

When a workflow skill activates, detect context using these signals:

### Step 1: Check for Explicit Override

If user has explicitly set mode via `/octo:km on` or `/octo:km off`, respect that setting.

```bash
# Check if knowledge mode is explicitly set
if [[ -f ~/.claude-octopus/config/knowledge-mode ]]; then
  EXPLICIT_MODE=$(cat ~/.claude-octopus/config/knowledge-mode)
  if [[ "$EXPLICIT_MODE" == "on" ]]; then
    echo "knowledge"
    exit 0
  elif [[ "$EXPLICIT_MODE" == "off" ]]; then
    echo "dev"
    exit 0
  fi
fi
# If "auto" or not set, proceed with auto-detection
```

### Step 2: Analyze Prompt Content (Strongest Signal)

**Knowledge Context Indicators** (check prompt for these terms):
- Business/strategy: "market", "ROI", "stakeholders", "strategy", "business case", "competitive"
- Research: "literature", "synthesis", "academic", "papers", "research question"
- UX: "personas", "user research", "journey map", "pain points", "interviews"
- Deliverables: "presentation", "report", "PRD", "proposal", "executive summary"

**Dev Context Indicators** (check prompt for these terms):
- Technical: "API", "endpoint", "database", "function", "class", "module"
- Actions: "implement", "debug", "refactor", "test", "deploy", "build"
- Artifacts: "code", "tests", "migration", "schema", "controller"

**Scoring:**
- Count knowledge indicators in prompt
- Count dev indicators in prompt
- Higher count wins
- If tied, check project context (Step 3)

### Step 3: Analyze Project Context (Secondary Signal)

The rest: https://github.com/nyldn/claude-octopus/blob/HEAD/.claude/skills/skill-context-detection/SKILL.md
