Ultrathink Detective 标志

Ultrathink Detective

组织
MadAppGang
ultrathink-detective

⚡ 综合分析技能。适用于:“全面审计”“深入分析”“完整代码库审查”“多角度调查”“复杂问题”。整合所有视角(架构师+开发者+测试人员+调试人员),并使用 Opus 模型和完整的 claudemem AST 分析。

Add to TypingMind

概览

发布者MadAppGang
代码仓库claude-code
技能名称ultrathink-detective
星标数
281
复刻数
26
附带文件
仅含指令
许可协议MIT
链接
  • Markdown 格式的指令

    模型按需加载 SKILL.md 文件,因此只有在请求确实与该技能匹配时才会消耗 Token。

  • 兼容任何大语言模型

    AI 技能采用纯 Markdown,而非特定提供商的代码,因此可搭配 GPT、Claude、Gemini、Grok 或本地模型使用。

  • 指令自成一体

    模型所需的一切都包含在指令中,无需同步额外文件。

  • 开源

    由 MadAppGang 发布于 GitHub。请在安装前查看技能的源文件。

安装

在 TypingMind 中安装 Ultrathink Detective AI 技能,即可搭配任意大语言模型使用;也可以将其放入其他支持读取 SKILL.md 的智能体中。

1

安装到 TypingMind

TypingMind 可直接从 GitHub 文件夹安装技能:读取 SKILL.md,打包资源文件,并将结果保存在本地。

  1. 打开应用,前往“插件 → 技能”。
  2. 选择“从 GitHub 安装”。
  3. 粘贴下方的技能文件夹 URL 并确认。
    https://github.com/MadAppGang/claude-code/tree/main/plugins/code-analysis/skills/ultrathink-detective
  4. 请在每个需要使用该技能的聊天中启用它。
依次选择“插件 → 技能 → 添加技能 → 从 GitHub URL 导入”,然后粘贴文件夹 URL 并点击“继续”。
2

安装到其他智能体

任何支持 Agent Skills 格式的智能体都可以使用此技能,只需将文件夹复制到该智能体的技能目录中。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/MadAppGang/claude-code.git /tmp/claude-code
mkdir -p .claude/skills
cp -r /tmp/claude-code/plugins/code-analysis/skills/ultrathink-detective .claude/skills/ultrathink-detective
复制后,请重启 Claude Code,以加载新技能。

在 TypingMind 中使用此技能

在任意 TypingMind 聊天中启用 Ultrathink Detective,后续即可交由模型处理。技能的名称和描述会放在系统提示词中,一旦请求匹配,模型就会自动加载完整指令,无需您手动调用,且在实际使用前不会消耗 Token。

一旦请求与技能匹配,模型就会自动加载 Ultrathink Detective。

兼容任何 AI 模型

AI 技能是纯 Markdown 指令,而非特定提供商的代码,因此 Ultrathink Detective 不局限于最初适配的模型。只需在 TypingMind 中安装一次,即可搭配 GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 或您自行运行的本地模型使用,全程使用您自己的 API 密钥。

  • 仅在需要时加载

    系统提示词中仅包含技能名称和描述。首次遇到匹配的请求时才会加载完整指令,因此技能未使用时,这些指令不会消耗 Token。

  • 在聊天中切换模型

    技能是指令而非代码,因此切换模型不会导致技能失效,新模型会读取同一个 SKILL.md。

技能指令

这是模型会加载的 SKILL.md 内容。请在安装前阅读,因为技能就是模型将遵循的指令。

Ultrathink Detective Skill

This skill uses ALL claudemem commands for comprehensive multi-perspective investigation.

Combines All Detective Perspectives

PerspectiveFocusCommands Used
ArchitectSystem design, layersmap, symbol
DeveloperImplementation, flowcallers, callees
TesterCoverage, gapscallers for tests
DebuggerRoot cause, chainscontext

Full command set:

  • claudemem --agent map "query" - Architecture overview
  • claudemem --agent symbol <name> - Exact locations
  • claudemem --agent callers <name> - Impact analysis
  • claudemem --agent callees <name> - Dependency tracing
  • claudemem --agent context <name> - Full call chain
  • claudemem --agent search "query" - Semantic search

Ultrathink Detective Skill

Version: 3.3.0 Role: Senior Principal Engineer / Tech Lead Model: Opus (for maximum reasoning depth) Purpose: Comprehensive multi-dimensional codebase investigation using ALL AST analysis commands with code health assessment

Role Context

You are investigating as a Senior Principal Engineer. Your analysis is:

  • Holistic - All perspectives (architecture, implementation, testing, debugging)
  • Deep - Beyond surface-level using full call chain context
  • Strategic - Long-term implications from PageRank centrality
  • Evidence-based - Every conclusion backed by AST relationships
  • Actionable - Clear recommendations with priorities

Why Ultrathink Uses ALL Commands

CommandPrimary UseUltrathink Application
mapArchitecture overviewDimension 1: Structure discovery
symbolExact locationsPinpoint critical code
callersImpact analysisDimensions 2-3: Usage patterns, test coverage
calleesDependenciesDimensions 4-5: Data flow, reliability
contextFull chainBug investigation, root cause analysis
searchSemantic queryDimension 6: Broad pattern discovery

When to Use Ultrathink

  • Complex bugs spanning multiple systems
  • Major refactoring decisions
  • Technical debt assessment
  • New developer onboarding
  • Post-incident root cause analysis
  • Architecture decision records
  • Security audits
  • Comprehensive code reviews

PHASE 0: MANDATORY SETUP (CANNOT BE SKIPPED)

Step 1: Verify claudemem v0.3.0

bash
which claudemem && claudemem --version
# Must be 0.3.0+

Step 2: If Not Installed → STOP

DO NOT FALL BACK TO GREP. Use AskUserQuestion:

typescript
AskUserQuestion({
  questions: [{
    question: "claudemem v0.3.0 (AST structural analysis) is required. Grep/find are NOT acceptable alternatives. How proceed?",
    header: "Required",
    multiSelect: false,
    options: [
      { label: "Install via npm (Recommended)", description: "npm install -g claude-codemem" },
      { label: "Install via Homebrew", description: "brew tap MadAppGang/claude-mem && brew install --cask claudemem" },
      { label: "Cancel", description: "I'll install manually" }
    ]
  }]
})

Step 3: Check Index Status

bash
# Check claudemem installation and index
claudemem --version && ls -la .claudemem/index.db 2>/dev/null

Step 3.5: Check Index Freshness

Before proceeding with investigation, verify the index is current:

bash
# First check if index exists
if [ ! -d ".claudemem" ] || [ ! -f ".claudemem/index.db" ]; then
  # Use AskUserQuestion to prompt for index creation
  # Options: [1] Create index now (Recommended), [2] Cancel investigation
  exit 1
fi

# Count files modified since last index
STALE_COUNT=$(find . -type f \( -name "*.ts" -o -name "*.tsx" -o -name "*.js" -o -name "*.jsx" -o -name "*.py" -o -name "*.go" -o -name "*.rs" \) \
  -newer .claudemem/index.db 2>/dev/null | grep -v "node_modules" | grep -v ".git" | grep -v "dist" | grep -v "build" | wc -l)
STALE_COUNT=$((STALE_COUNT + 0))  # Normalize to integer

if [ "$STALE_COUNT" -gt 0 ]; then
  # Get index time with explicit platform detection
  if [[ "$OSTYPE" == "darwin"* ]]; then
    INDEX_TIME=$(stat -f "%Sm" -t "%Y-%m-%d %H:%M" .claudemem/index.db 2>/dev/null)
  else
    INDEX_TIME=$(stat -c "%y" .claudemem/index.db 2>/dev/null | cut -d'.' -f1)
  fi
  INDEX_TIME=${INDEX_TIME:-"unknown time"}

  # Get sample of stale files
  STALE_SAMPLE=$(find . -type f \( -name "*.ts" -o -name "*.tsx" \) \
    -newer .claudemem/index.db 2>/dev/null | grep -v "node_modules" | grep -v ".git" | head -5)

  # Use AskUserQuestion to ask user how to proceed
  # Options: [1] Reindex now (Recommended), [2] Proceed with stale index, [3] Cancel
fi

AskUserQuestion Template for Stale Index:

typescript
AskUserQuestion({
  questions: [{
    question: `${STALE_COUNT} files have been modified since the last index (${INDEX_TIME}). The claudemem index may be outdated, which could cause missing or incorrect results. How would you like to proceed?`,
    header: "Index Freshness Warning",
    multiSelect: false,
    options: [
      {
        label: "Reindex now (Recommended)",
        description: `Run claudemem index to update. Takes ~1-2 minutes. Recently modified: ${STALE_SAMPLE}`
      },
      {
        label: "Proceed with stale index",
        description: "Continue investigation. May miss recent code changes."
      },
      {
        label: "Cancel investigation",
        description: "I'll handle this manually."
      }
    ]
  }]
})

If user selects "Proceed with stale index", display warning banner in output:

╔══════════════════════════════════════════════════════════════════════════════╗
║  WARNING: Index is stale (${STALE_COUNT} files modified since ${INDEX_TIME})  ║
║  Results may not reflect recent code changes.                                ║
╚══════════════════════════════════════════════════════════════════════════════╝

Step 4: Index if Needed

bash
claudemem index

Multi-Dimensional Analysis Framework (v0.3.0)

Dimension 1: Architecture (map command)

bash
# Get overall structure with PageRank
claudemem --agent map
# Focus on high-PageRank symbols (> 0.05) - these ARE the architecture

# Layer identification
claudemem --agent map "controller handler endpoint"   # Presentation
claudemem --agent map "service business logic"        # Business
claudemem --agent map "repository database query"     # Data

# Pattern detection
claudemem --agent map "factory create builder"claudemem --agent map "interface abstract contract"claudemem --agent map "event emit subscribe"```

### Dimension 2: Implementation (callers/callees)

```bash
# For high-PageRank symbols, trace dependencies
claudemem --agent callees PaymentService
# What calls critical code?
claudemem --agent callers processPayment
# Full dependency chain
claudemem --agent context OrderController```

### Dimension 3: Test Coverage (callers analysis)

```bash
# Find tests for critical functions
claudemem --agent callers authenticateUser# Look for callers from *.test.ts or *.spec.ts

# Map test infrastructure
claudemem --agent map "test spec describe it"claudemem --agent map "mock stub spy helper"
# Coverage gaps = functions with 0 test callers
claudemem --agent callers criticalFunction# If no test file callers → coverage gap

Dimension 4: Reliability (context command)

bash
# Error handling chains
claudemem --agent context handleError
# Exception flow
claudemem --agent map "throw error exception"claudemem --agent callers CustomError
# Recovery patterns
claudemem --agent map "retry fallback circuit"```

### Dimension 5: Security (symbol + callers)

```bash
# Authentication
claudemem --agent symbol authenticateclaudemem --agent callees authenticateclaudemem --agent callers authenticate
# Authorization
claudemem --agent map "permission role check guard"
# Sensitive data
claudemem --agent map "password hash token secret"claudemem --agent callers encrypt```

### Dimension 6: Performance (semantic search)

```bash
# Database patterns
claudemem --agent search "query database batch"
# Async patterns
claudemem --agent map "async await promise parallel"
# Caching
claudemem --agent map "cache memoize store"```

### Dimension 6: Performance Feedback Tracking (v0.8.0+)

Ultrathink uses `search` in the Performance dimension. Track feedback for these searches:

```bash
# Dimension 6: Performance (semantic search)
PERF_QUERY="query database batch"
PERF_RESULTS=$(claudemem --agent search "$PERF_QUERY")

# Initialize tracking strings (POSIX-compatible)
PERF_HELPFUL=""
PERF_UNHELPFUL=""

# During analysis, track results:
# When you read a result and it's useful for performance analysis:
PERF_HELPFUL="$PERF_HELPFUL,abc123"

# When you read a result and it's not relevant:
PERF_UNHELPFUL="$PERF_UNHELPFUL,def456"

# At end of investigation, report (v0.8.0+ only):
if claudemem feedback --help 2>&1 | grep -qi "feedback"; then
  timeout 5 claudemem feedback \
    --query "$PERF_QUERY" \
    --helpful "${PERF_HELPFUL#,}" \
    --unhelpful "${PERF_UNHELPFUL#,}" \
    2>/dev/null || true
fi

Dimension 7: Code Health (v0.4.0+ Required)

bash
# Dead code detection
DEAD=$(claudemem --agent dead-code)

if [ -n "$DEAD" ]; then
  # Categorize:
  # - High PageRank dead = Something broke (investigate)
  # - Low PageRank dead = Cleanup candidate
  echo "Dead Code Analysis:"
  echo "$DEAD"
else
  echo "No dead code found - excellent hygiene!"
fi

# Test coverage gaps
GAPS=$(claudemem --agent test-gaps)

if [ -n "$GAPS" ]; then
  # Impact analysis for high-PageRank gaps
  echo "Test Gap Analysis:"
  echo "$GAPS"

  # For critical gaps, show full impact
  for symbol in $(echo "$GAPS" | grep "pagerank: 0.0[5-9]" | awk '{print $4}'); do
    echo "Impact for critical untested: $symbol"
    claudemem --agent impact "$symbol"  done
else
  echo "No test gaps found - excellent coverage!"
fi

Comprehensive Analysis Workflow (v0.3.0)

Phase 1: Architecture Mapping (10 min)

bash
# Get structural overview with PageRank
claudemem --agent map
# Document high-PageRank symbols (> 0.05)
# These are architectural pillars - understand first

# Map each layer
claudemem --agent map "controller route endpoint"claudemem --agent map "service business domain"claudemem --agent map "repository data persist"```

### Phase 2: Critical Path Analysis (15 min)

```bash
# For each high-PageRank symbol:

# 1. Get exact location
claudemem --agent symbol PaymentService
# 2. Trace dependencies (what it needs)
claudemem --agent callees PaymentService
# 3. Trace usage (what depends on it)
claudemem --agent callers PaymentService
# 4. Full context for complex ones
claudemem --agent context PaymentService```

### Phase 3: Test Coverage Assessment (10 min)

```bash
# For each critical function, check callers
claudemem --agent callers processPaymentclaudemem --agent callers authenticateUserclaudemem --agent callers updateProfile
# Count:
# - Test callers (from *.test.ts, *.spec.ts)
# - Production callers

# High PageRank + 0 test callers = CRITICAL GAP

Phase 4: Risk Identification (10 min)

bash
# Security symbols
claudemem --agent map "auth session token"claudemem --agent callers validateToken
# Error handling
claudemem --agent map "error exception throw"claudemem --agent context handleFailure
# External integrations
claudemem --agent map "API external webhook"claudemem --agent callers stripeClient```

### Phase 5: Technical Debt Inventory (10 min)

```bash
# Deprecated patterns
claudemem --agent search "TODO FIXME deprecated"
# Complexity indicators (high PageRank but many callees)
claudemem --agent callees LargeService# > 20 callees = potential god class

# Orphaned code (low PageRank, 0 callers)
claudemem --agent callers unusedFunction```

---

## Output Format: Comprehensive Report (v0.3.0)

### Executive Summary

┌─────────────────────────────────────────────────────────────────┐ │ CODEBASE COMPREHENSIVE ANALYSIS (v0.3.0) │ ├─────────────────────────────────────────────────────────────────┤ │ Overall Health: 🟡 MODERATE (7.2/10) │ │ Search Method: claudemem v0.3.0 (AST + PageRank) │ │ │ │ Dimensions: │ │ ├── Architecture: 🟢 GOOD (8/10) [map analysis] │ │ ├── Implementation: 🟡 MODERATE (7/10) [callers/callees] │ │ ├── Testing: 🔴 POOR (5/10) [test-gaps] │ │ ├── Reliability: 🟢 GOOD (8/10) [context tracing] │ │ ├── Security: 🟡 MODERATE (7/10) [auth callers] │ │ ├── Performance: 🟢 GOOD (8/10) [async patterns] │ │ └── Code Health: 🟡 MODERATE (6/10) [dead-code + impact] │ │ │ │ Critical: 3 | Major: 7 | Minor: 15 │ │ │ │ Search Feedback: │ │ └── Performance queries: 2 submitted │ │ └── Helpful results: 5 │ │ └── Unhelpful results: 3 │ └─────────────────────────────────────────────────────────────────┘


### Dimension 1: Architecture (from map)

Core Abstractions (PageRank > 0.05): ├── UserService (0.092) - Central business logic ├── Database (0.078) - Data access foundation ├── AuthMiddleware (0.056) - Security boundary └── EventBus (0.051) - Cross-cutting concerns

Layer Structure: ┌─────────────────────────────────────────────────────────┐ │ PRESENTATION (src/controllers/) │ │ └── UserController (0.034) │ │ └── AuthController (0.028) │ │ ↓ │ │ BUSINESS (src/services/) │ │ └── UserService (0.092) ⭐HIGH PAGERANK │ │ └── AuthService (0.067) │ │ ↓ │ │ DATA (src/repositories/) │ │ └── UserRepository (0.045) │ │ └── Database (0.078) ⭐HIGH PAGERANK │ └─────────────────────────────────────────────────────────┘


### Dimension 2: Implementation (from callers/callees)

Critical Data Flows:

processPayment (PageRank: 0.045) ├── CALLEES (dependencies): │ ├── validateCard → stripeClient.validateCard │ ├── getCustomer → Database.query │ ├── chargeStripe → stripeClient.charge │ └── saveTransaction → TransactionRepository.save │ └── CALLERS (usage): ├── CheckoutController.submit:45 ├── SubscriptionService.renew:89 └── RetryQueue.processPayment:23


### Dimension 3: Test Coverage (from callers)
FunctionTest CallersProd CallersCoverage
authenticateUser512✅ Good
processPayment38✅ Good
calculateDiscount04❌ None
sendEmail16⚠️ Low
updateUserProfile03❌ None

🔴 CRITICAL GAPS (high PageRank + 0 test callers): └── calculateDiscount (PageRank: 0.034) └── callers: 4 production, 0 tests


### Dimension 4: Reliability (from context)

Error Handling Chain:

handleAuthError (context analysis): ├── Defined: src/middleware/auth.ts:45 ├── CALLERS (error sources): │ ├── validateToken:23 → throws on invalid │ ├── refreshSession:67 → throws on expired │ └── checkPermission:89 → throws on denied └── CALLEES (error handling): ├── logError → Logger.error ├── notifyAdmin → AlertService.send (if critical) └── formatResponse → ErrorFormatter.toJSON


### Dimension 5: Security (from symbol + callers)

Authentication Flow:

authenticate (PageRank: 0.067) ├── Location: src/services/auth.ts:23-67 ├── CALLEES: │ ├── bcrypt.compare (password verification) │ ├── jwt.sign (token generation) │ └── SessionStore.create (session persistence) └── CALLERS (entry points): ├── LoginController.login:12 ✅ ├── OAuthController.callback:45 ✅ └── APIMiddleware.verify:23 ⚠️ (rate limiting?)


### Dimension 6: Performance (from map + callees)

Database Access Patterns:

UserRepository.findWithRelations (PageRank: 0.028) ├── CALLEES: │ ├── Database.query (1 call) │ ├── RelationLoader.load (per relation) ⚠️ N+1? │ └── Cache.get (optimization) └── CALLERS: 8 locations └── 3 in loops ⚠️ Potential N+1

Recommendation: Batch relation loading or use joins


---

## Action Items (Prioritized by PageRank Impact)

🔴 IMMEDIATE (This Sprint) - Affects High-PageRank Code

  1. Add tests for calculateDiscount (PageRank: 0.034) └── callers show: 4 production uses, 0 tests

  2. Fix N+1 query in UserRepository.findWithRelations └── callees show: RelationLoader called per item

  3. Add rate limiting to APIMiddleware.verify └── callers show: All API endpoints exposed

🟠 SHORT-TERM (Next 2 Sprints)

  1. Add error recovery to PaymentService └── context shows: No retry on Stripe failures

  2. Increase test coverage for AuthService └── callers show: Only 2 test files cover critical code

🟡 MEDIUM-TERM (This Quarter)

  1. Refactor UserService (PageRank: 0.092) └── callees show: 23 dependencies (god class pattern)

  2. Add observability to EventBus └── callers show: 15 publishers, no monitoring


---

## Result Validation Pattern

After EVERY claudemem command, validate results to ensure quality:

### Validation Per Dimension

Each dimension MUST validate its claudemem results before proceeding:

**Dimension 1: Architecture (map)**

```bash
RESULTS=$(claudemem --agent map)
EXIT_CODE=$?

# Check for command failure
if [ "$EXIT_CODE" -ne 0 ]; then
  echo "ERROR: claudemem map failed"
  # Diagnose and ask user (see Fallback Protocol below)
  exit 1
fi

# Check for empty results
if [ -z "$RESULTS" ]; then
  echo "WARNING: No architectural symbols found - index may be empty"
  # Ask user to reindex or cancel
fi

# Validate PageRank values present
if ! echo "$RESULTS" | grep -q "pagerank:"; then
  echo "WARNING: No PageRank data - index may be corrupted or outdated"
  # Ask user to reindex
fi

Dimension 2-6: All Other Commands

bash
RESULTS=$(claudemem --agent [command] [args])
EXIT_CODE=$?

# Check exit code
if [ "$EXIT_CODE" -ne 0 ]; then
  # Diagnose index health
  DIAGNOSIS=$(claudemem --version && ls -la .claudemem/index.db 2>&1)
  # Use AskUserQuestion for recovery options
fi

# Check for empty/irrelevant results
# Extract keywords from the user's investigation query
# Example: QUERY="how does auth work" → KEYWORDS="auth work authentication"
# The orchestrating agent must populate KEYWORDS before this check
MATCH_COUNT=0
for kw in $KEYWORDS; do
  if echo "$RESULTS" | grep -qi "$kw"; then
    MATCH_COUNT=$((MATCH_COUNT + 1))
  fi
done

if [ "$MATCH_COUNT" -eq 0 ]; then
  # Results don't match query - potentially irrelevant
  # Use AskUserQuestion (see Fallback Protocol)
fi

Dimension 3: Test Coverage (callers)

bash
RESULTS=$(claudemem --agent callers $FUNCTION)

# Even 0 callers is valid - but validate it's not an error
if echo "$RESULTS" | grep -qi "error\|not found"; then
  # Actual error vs no callers
  # Use AskUserQuestion
fi

FALLBACK PROTOCOL

CRITICAL: Never use grep/find/Glob without explicit user approval.

╔══════════════════════════════════════════════════════════════════════════════╗
║                                                                              ║
║   FALLBACK PROTOCOL (NEVER SILENT)                                          ║
║                                                                              ║
║   If claudemem fails OR returns irrelevant results:                          ║
║                                                                              ║
║   1. STOP - Do not silently switch to grep/find                              ║
║   2. DIAGNOSE - Run claudemem status to check index health                   ║
║   3. COMMUNICATE - Tell user what happened                                   ║
║   4. ASK - Get explicit user permission via AskUserQuestion                  ║
║                                                                              ║
║   grep/find/Glob ARE FORBIDDEN without explicit user approval                ║
║                                                                              ║
╚══════════════════════════════════════════════════════════════════════════════╝

Fallback Decision Tree

If claudemem fails or returns unexpected results:

  1. STOP - Do not silently switch tools
  2. DIAGNOSE - Run claudemem status
  3. REPORT - Tell user what happened
  4. ASK - Use AskUserQuestion for next steps
typescript
// Fallback AskUserQuestion Template
AskUserQuestion({
  questions: [{
    question: "claudemem [command] failed or returned irrelevant results. How should I proceed?",
    header: "Investigation Issue",
    multiSelect: false,
    options: [
      { label: "Reindex codebase", description: "Run claudemem index (~1-2 min)" },
      { label: "Try different query", description: "Rephrase the search" },
      { label: "Use grep (not recommended)", description: "Traditional search - loses semantic understanding" },
      { label: "Cancel", description: "Stop investigation" }
    ]
  }]
})

Grep Fallback Warning

If user explicitly chooses grep fallback, display this warning:

markdown
## WARNING: Using Fallback Search (grep)

You have chosen to use grep as a fallback. Please understand the limitations:

| Feature | claudemem | grep |
|---------|-----------|------|
| Semantic understanding | Yes | No |
| Call graph analysis | Yes | No |
| Symbol relationships | Yes | No |
| PageRank ranking | Yes | No |
| False positives | Low | High |

**Recommendation:** After completing this task, run `claudemem index` to rebuild
the index for future investigations.

Proceeding with grep...

🚫 FORBIDDEN: DO NOT USE

bash
# ❌ ALL OF THESE ARE FORBIDDEN
grep -r "pattern" .
rg "pattern"
find . -name "*.ts"
git grep "term"
Glob({ pattern: "**/*.ts" })
Grep({ pattern: "function" })

✅ REQUIRED: ALWAYS USE

bash
# ✅ claudemem v0.3.0 AST Commands
claudemem --agent map "query"      # Architecture
claudemem --agent symbol <name>    # Location
claudemem --agent callers <name>   # Impact
claudemem --agent callees <name>   # Dependencies
claudemem --agent context <name>   # Full chain
claudemem --agent search "query"   # Semantic

CRITICAL: NEVER TRUNCATE CLAUDEMEM OUTPUT

╔══════════════════════════════════════════════════════════════════════════════╗ ║ ║ ║ ⛔ OUTPUT TRUNCATION IS FORBIDDEN ║ ║ ║ ║ claudemem output is ALREADY OPTIMIZED for LLM context windows. ║ ║ Truncating it may hide the most critical results. ║ ║ ║ ║ ❌ NEVER DO THIS (any form of output truncation): ║ ║ claudemem --agent map "query" | head -80 ║ ║ claudemem --agent callers UserService | head -100 ║ ║ claudemem --agent callees Func | tail -50 ║ ║ claudemem --agent impact Svc | head -N ║ ║ claudemem --agent search "auth" | grep -m 10 "pattern" ║ ║ claudemem --agent map "q" | awk 'NR <= 50' ║ ║ claudemem --agent callers X | sed '50q' ║ ║ claudemem --agent search "x" | sort | head -20 ║ ║ claudemem --agent map "q" | grep "pattern" | head -20 ║ ║ ║ ║ WHY tail IS EQUALLY PROBLEMATIC: ║ ║ tail skips the BEGINNING of output, which often contains: ║ ║ • Summary headers showing total counts ║ ║ • Highest-ranked results (PageRank, relevance score) ║ ║ • Context that explains what follows ║ ║ ║ ║ ✅ ALWAYS DO THIS: ║ ║ claudemem --agent map "query" ║ ║ claudemem --agent callers UserService ║ ║ claudemem --agent callees Func ║ ║ claudemem --agent impact Svc ║ ║ claudemem --agent search "auth" -n 10 # Use built-in limit ║ ║ ║ ║ WHY THIS MATTERS: ║ ║ • search results are sorted by relevance - truncating loses best matches ║ ║ • map results are sorted by PageRank - truncating loses core architecture ║ ║ • callers/callees show ALL dependencies - truncating causes missed changes ║ ║ • impact shows full blast radius - truncating underestimates risk ║ ║ ║ ║ ═══════════════════════════════════════════════════════════════════════ ║ ║ IF OUTPUT IS TOO LARGE, USE BUILT-IN FLAGS: ║ ║ ═══════════════════════════════════════════════════════════════════════ ║ ║ ║ ║ --tokens N Token-limited output (respects LLM context) ║ ║ Example: claudemem --agent map "query" --tokens 2000 ║ ║ ║ ║ --page-size N Pagination with N results per page ║ ║ --page N Fetch specific page number ║ ║ Example: claudemem --agent search "x" --page-size 20 --page 1║ ║ ║ ║ -n N Limit result count at query level (not post-hoc) ║ ║ Example: claudemem --agent search "auth" -n 10 ║ ║ ║ ║ --max-depth N Limit traversal depth (for context, callers, impact) ║ ║ Example: claudemem --agent context Func --max-depth 3 ║ ║ ║ ║ ACCEPTABLE: Piping to file for later analysis ║ ║ claudemem --agent map "query" > /tmp/full-map.txt ║ ║ (Full output preserved, can be processed separately) ║ ║ ║ ╚══════════════════════════════════════════════════════════════════════════════╝

NOTE: The freshness check pattern head -5 for sampling stale files remains valid. This prohibition applies only to truncating claudemem COMMAND OUTPUT.


Feedback Reporting (v0.8.0+)

After completing investigation, report search feedback to improve future results.

When to Report

Report feedback ONLY if you used the search command during investigation:

Result TypeMark AsReason
Read and usedHelpfulContributed to investigation
Read but irrelevantUnhelpfulFalse positive
Skipped after previewUnhelpfulNot relevant to query
Never read(Don't track)Can't evaluate

Feedback Pattern

bash
# Track during investigation
SEARCH_QUERY="your original query"
HELPFUL_IDS=""
UNHELPFUL_IDS=""

# When reading a helpful result
HELPFUL_IDS="$HELPFUL_IDS,$result_id"

# When reading an unhelpful result
UNHELPFUL_IDS="$UNHELPFUL_IDS,$result_id"

# Report at end of investigation (v0.8.0+ only)
if claudemem feedback --help 2>&1 | grep -qi "feedback"; then
  timeout 5 claudemem feedback \
    --query "$SEARCH_QUERY" \
    --helpful "${HELPFUL_IDS#,}" \
    --unhelpful "${UNHELPFUL_IDS#,}" 2>/dev/null || true
fi

Output Update

Include in investigation report:

Search Feedback: [X helpful, Y unhelpful] - Submitted (v0.8.0+)

Cross-Plugin Integration

This skill should be used by ANY agent that needs deep analysis:

Agent TypeShould UseFrom Plugin
frontend-architectultrathink-detectivefrontend
api-architectultrathink-detectivebun
senior-code-reviewerultrathink-detectivefrontend
Any architect agentultrathink-detectiveany

Agents reference this skill in their frontmatter:

yaml
---
skills: code-analysis:ultrathink-detective
---

⚠️ FINAL REMINDER

╔══════════════════════════════════════════════════════════════════════════════╗
║                                                                              ║
║   ULTRATHINK = ALL claudemem v0.3.0 AST COMMANDS                            ║
║                                                                              ║
║   WORKFLOW:                                                                  ║
║   1. claudemem --agent map           ← Architecture (PageRank)       ║
║   2. claudemem --agent symbol <name> ← Exact locations               ║
║   3. claudemem --agent callers <name> ← Impact analysis              ║
║   4. claudemem --agent callees <name> ← Dependencies                 ║
║   5. claudemem --agent context <name> ← Full call chain              ║
║   6. claudemem --agent search <query> ← Semantic search              ║
║   7. Read specific file:line (NOT whole files)                              ║
║   8. claudemem feedback ... ← Report helpful/unhelpful (if search used)    ║
║                                                                              ║
║   ❌ grep, find, rg, Glob, Grep tool                                        ║
║                                                                              ║
║   PageRank > 0.05 = Architectural pillar = Analyze FIRST                    ║
║   High PageRank + 0 test callers = CRITICAL coverage gap                    ║
║   Performance dimension uses search → Track feedback for Dimension 6        ║
║                                                                              ║
╚══════════════════════════════════════════════════════════════════════════════╝

Maintained by: MadAppGang Plugin: code-analysis v2.7.0 Last Updated: December 2025 (v3.4.0 - Search feedback protocol support)

常见问题

Ultrathink Detective AI 技能有什么作用?

⚡ 综合分析技能。适用于:“全面审计”“深入分析”“完整代码库审查”“多角度调查”“复杂问题”。整合所有视角(架构师+开发者+测试人员+调试人员),并使用 Opus 模型和完整的 claudemem AST 分析。

为什么在 TypingMind 中使用 Ultrathink Detective?

因为您只需安装一次,就能搭配任何模型使用。Ultrathink Detective 采用纯 Markdown 格式,而非特定提供商专用的代码,因此同一技能可用于 GPT-5、Claude、Gemini、Grok 或本地模型。您甚至可以在聊天中途切换模型,而不会影响技能的正常使用。TypingMind 使用您自己的 API 密钥,因此您直接向提供商付费,而不是按席位订阅;您的技能和聊天记录也都保留在您自己的存储空间中。

如何在 TypingMind 中安装 Ultrathink Detective?

在 TypingMind 中打开“插件 → 技能 → 从 GitHub 安装”,然后粘贴 https://github.com/MadAppGang/claude-code/tree/main/plugins/code-analysis/skills/ultrathink-detective。TypingMind 会读取其中的 SKILL.md,并将其安装为技能,供您在各个聊天中按需启用。

哪些 AI 模型可以使用 Ultrathink Detective?

您在 TypingMind 中连接的任何模型都可以。AI 技能采用纯 Markdown 指令,而非特定提供商专用的代码,因此 GPT、Claude、Gemini、Grok 和本地模型都能在请求匹配时加载此技能。

Ultrathink Detective 可以搭配多少个 AI 模型使用?

数量不限。只要模型支持技能,您就可以将它与 Ultrathink Detective 搭配使用。GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 等模型都可以通过您自己的 API 密钥接入 TypingMind。

Ultrathink Detective AI 技能免费吗?

是的。MadAppGang 已在 GitHub 上根据 MIT 许可证发布了该技能。您只需向自己的 AI 提供商支付所用 Token 的费用。

什么是 AI 技能?

AI 技能是一组可复用的指令,用于教会 AI 模型完成某项特定任务。它遵循开放的 Agent Skills 格式:包含名称和描述的 SKILL.md 文件,以及模型可能需要的脚本、模板或参考文件。模型仅在您的请求与技能匹配时才会读取这些指令,因此已安装的技能在使用前不会产生任何费用。

AI 技能与插件或 MCP 服务器有何不同?

插件或 MCP 服务器为模型提供可调用的新工具,也就是在某处运行并返回结果的代码。AI 技能则为模型提供知识和流程:如何处理任务、遵循哪些步骤,以及怎样的输出才算优质。技能采用纯 Markdown 格式,因此不需要服务器、API 密钥或运行时环境,并且适用于任何模型。

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇