AgentSkillsCN

update-logic-index

利用Gemini AST分析,更新语义逻辑索引(.claude/logic_tree.md)。

SKILL.md
--- frontmatter
name: update-logic-index
description: Update the semantic logic index (.claude/logic_tree.md) using Gemini AST analysis.
allowed-tools: Read, Grep, Glob, Bash, Edit, Write
disable-model-invocation: true

Update Logic Index

Updates the semantic understanding of the codebase by scanning Python files, extracting function/class signatures, and generating incremental summaries using Gemini.

Process

  1. Check Configuration:

    • Check if .claude/logic_index_config exists.
    • If missing:
      • Create it from skills/update-logic-index/default_logic_config.template.
      • Use AskUserQuestion to prompt the user: "Configuration generated. Please review .claude/logic_index_config to exclude unnecessary directories (to save Tokens). Continue?"
    • If exists:
      • Read the file content.
      • Use AskUserQuestion to prompt the user: "Existing configuration found. The scan will run based on these rules (consuming Tokens). Proceed?"
  2. Execute Scanning:

    • If user confirms, run: python skills/update-logic-index/run.py

Configuration (Environment)

Requires the following environment variables (injected via settings.json > env):

  • GEMINI_API_KEY: Google Gemini API Key.
  • GEMINI_MODEL: Model name (default: gemini-3-flash-preview).
  • GEMINI_MAX_WORKERS: Concurrency limit (default: 5).
  • GEMINI_BASE_URL: (Optional) Custom API endpoint.

Output

Generates:

  1. .claude/logic_index.json: Incremental cache of AST hashes and summaries.
  2. .claude/logic_tree.md: Readable Markdown tree for context injection.

Summary Identification

  • [Doc] ...: The summary is directly extracted from the source code's Docstring (first 3 non-empty lines). No API cost.
  • Small utility function.: The function has no Docstring and is very short (< 3 lines). API call skipped to save tokens.
  • [Source] ... / [Sink] ...: LLM-generated summary identifying data flow origins or destinations.
  • (Plain Text): Generated by Gemini LLM. Consumed tokens.