plugins/code-analysis/skills/investigate/SKILL.md
Unified entry point for code investigation. Auto-routes to specialized detective based on query keywords. Use when investigation type is unclear or for general exploration.
npx skillsauth add madappgang/claude-code investigateInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Version: 1.0.0 Purpose: Keyword-based routing to specialized detective skills Pattern: Smart delegation via Task tool
This skill analyzes your investigation query and routes to the appropriate detective specialist:
Error/Debug (Priority 1) - Time-critical bug fixes
debugger-detectiveTesting (Priority 2) - Specialized test analysis
tester-detectiveArchitecture (Priority 3) - High-level understanding
architect-detectiveImplementation (Default, Priority 4) - Most common
developer-detectiveWhen multiple keywords from different categories are detected:
The investigation query should be available from the task description or user input.
# Query comes from the Task description or user request
INVESTIGATION_QUERY="${TASK_DESCRIPTION:-$USER_QUERY}"
# Normalize to lowercase for case-insensitive matching
QUERY_LOWER=$(echo "$INVESTIGATION_QUERY" | tr '[:upper:]' '[:lower:]')
# Priority 1: Error/Debug keywords
if echo "$QUERY_LOWER" | grep -qE "debug|error|broken|failing|crash"; then
DETECTIVE="debugger-detective"
KEYWORDS="debug/error keywords"
PRIORITY=1
RATIONALE="Bug fixes are time-critical and require call chain tracing"
# Priority 2: Testing keywords
elif echo "$QUERY_LOWER" | grep -qE "test|coverage|edge case|mock"; then
DETECTIVE="tester-detective"
KEYWORDS="test/coverage keywords"
PRIORITY=2
RATIONALE="Test analysis is specialized and requires callers analysis"
# Priority 3: Architecture keywords
elif echo "$QUERY_LOWER" | grep -qE "architecture|design|structure|layer"; then
DETECTIVE="architect-detective"
KEYWORDS="architecture/design keywords"
PRIORITY=3
RATIONALE="High-level understanding requires PageRank analysis"
# Priority 4: Implementation (default)
else
DETECTIVE="developer-detective"
KEYWORDS="implementation (default)"
PRIORITY=4
RATIONALE="Most common investigation type - data flow via callers/callees"
fi
Before delegating, inform the user of the routing decision:
echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "🔍 Investigation Routing"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
echo "Query: $INVESTIGATION_QUERY"
echo ""
echo "Detected: $KEYWORDS (Priority $PRIORITY)"
echo "Routing to: $DETECTIVE"
echo "Reason: $RATIONALE"
echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
Use the Task tool to delegate to the selected detective:
Task({
description: INVESTIGATION_QUERY,
agent: DETECTIVE,
context: {
routing_reason: `Auto-routed based on ${KEYWORDS}`,
original_query: INVESTIGATION_QUERY,
priority: PRIORITY
}
})
Input: "Why is login broken?"
Detection:
Feedback:
🔍 Investigation Routing
Query: Why is login broken?
Detected: debug/error keywords (Priority 1)
Routing to: debugger-detective
Reason: Bug fixes are time-critical and require call chain tracing
Input: "What's the test coverage for payment?"
Detection:
Feedback:
🔍 Investigation Routing
Query: What's the test coverage for payment?
Detected: test/coverage keywords (Priority 2)
Routing to: tester-detective
Reason: Test analysis is specialized and requires callers analysis
Input: "What's the architecture of the auth layer?"
Detection:
Feedback:
🔍 Investigation Routing
Query: What's the architecture of the auth layer?
Detected: architecture/design keywords (Priority 3)
Routing to: architect-detective
Reason: High-level understanding requires PageRank analysis
Input: "How does payment work?"
Detection:
Feedback:
🔍 Investigation Routing
Query: How does payment work?
Detected: implementation (default) (Priority 4)
Routing to: developer-detective
Reason: Most common investigation type - data flow via callers/callees
Input: "Debug the test coverage"
Detection:
Feedback:
🔍 Investigation Routing
Query: Debug the test coverage
Detected: debug/error keywords (Priority 1)
Routing to: debugger-detective
Reason: Bug fixes are time-critical and require call chain tracing
(Note: Also detected test keywords, but debug takes priority)
Here's the full workflow:
#!/bin/bash
# Get investigation query from task description
INVESTIGATION_QUERY="${TASK_DESCRIPTION}"
# Normalize to lowercase
QUERY_LOWER=$(echo "$INVESTIGATION_QUERY" | tr '[:upper:]' '[:lower:]')
# Keyword detection with priority routing
if echo "$QUERY_LOWER" | grep -qE "debug|error|broken|failing|crash"; then
DETECTIVE="debugger-detective"
KEYWORDS="debug/error keywords"
PRIORITY=1
RATIONALE="Bug fixes are time-critical and require call chain tracing"
elif echo "$QUERY_LOWER" | grep -qE "test|coverage|edge case|mock"; then
DETECTIVE="tester-detective"
KEYWORDS="test/coverage keywords"
PRIORITY=2
RATIONALE="Test analysis is specialized and requires callers analysis"
elif echo "$QUERY_LOWER" | grep -qE "architecture|design|structure|layer"; then
DETECTIVE="architect-detective"
KEYWORDS="architecture/design keywords"
PRIORITY=3
RATIONALE="High-level understanding requires PageRank analysis"
else
DETECTIVE="developer-detective"
KEYWORDS="implementation (default)"
PRIORITY=4
RATIONALE="Most common investigation type - data flow via callers/callees"
fi
# Show routing decision
echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "🔍 Investigation Routing"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
echo "Query: $INVESTIGATION_QUERY"
echo ""
echo "Detected: $KEYWORDS (Priority $PRIORITY)"
echo "Routing to: $DETECTIVE"
echo "Reason: $RATIONALE"
echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
Then use the Task tool to delegate:
Task({
description: INVESTIGATION_QUERY,
agent: DETECTIVE
})
If routing produces unexpected results:
// If user wants to override the routing
AskUserQuestion({
questions: [{
question: `Auto-routing selected ${DETECTIVE}. Override?`,
header: "Investigation Routing",
multiSelect: false,
options: [
{ label: "Continue with auto-routing", description: `Use ${DETECTIVE}` },
{ label: "debugger-detective", description: "Root cause analysis" },
{ label: "tester-detective", description: "Test coverage analysis" },
{ label: "architect-detective", description: "Architecture patterns" },
{ label: "developer-detective", description: "Implementation details" }
]
}]
})
This skill is additive only and does not change existing behavior:
| When to Use Investigate Skill | When to Use Direct Detective | |-------------------------------|------------------------------| | Investigation type unclear | You know which specialist you need | | General exploration | Parallel orchestration (multimodel plugin) | | Quick routing decision | Specific workflow requirements | | Learning/experimenting | Production automation |
Maintained by: MadAppGang Plugin: code-analysis v3.1.0 Last Updated: January 2026 (v1.0.0 - Initial release)
testing
A test skill for validation testing. Use when testing skill parsing and validation logic.
tools
--- name: bad-skill description: This skill has invalid YAML in frontmatter allowed-tools: [invalid, array, syntax prerequisites: not-an-array --- # Bad Skill This skill has malformed frontmatter that should fail parsing. The YAML has: - Unclosed array bracket - Wrong type for prerequisites (should be array, not string)
tools
Plugin release process for MAG Claude Plugins marketplace. Covers version bumping, marketplace.json updates, git tagging, and common mistakes. Use when releasing new plugin versions or troubleshooting update issues.
testing
Fetch trending programming models from OpenRouter rankings. Use when selecting models for multi-model review, updating model recommendations, or researching current AI coding trends. Provides model IDs, context windows, pricing, and usage statistics from the most recent week.