Token导航 LogoToken导航TokenDH.com
研究检索external-servicegithub未标认证来源可访问clear审计提醒

serenaserena 搜索

Agent Skill

serena 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

2,712

周安装

113

GitHub Stars

968

下载量

904
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:serena(serena 搜索)
来源仓库:https://github.com/massgen/massgen
仓库路径:skills/serena
安装命令:
npx skills add https://github.com/massgen/massgen --skill serena
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/massgen/massgen --skill serena

简介

用于查找、检索和筛选与 serena 相关的信息。

  • 适合在 Codex、Claude、Cursor、Gemini CLI 中根据关键词或任务场景快速定位候选结果。
  • 通过 npx skills add 命令从指定 GitHub 仓库安装并使用。
  • 建议确认权限范围和维护状态,注意可能触发联网或文件读写操作。
  • serena 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

Serena: Symbol-Level Code Understanding

Navigate and manipulate code at the symbol level using IDE-like semantic analysis powered by Language Server Protocol (LSP).

How You Can Access Serena

You may have Serena available in one or both of these ways:

Option 1: Direct MCP Tools (if configured by your orchestrator) Check your available tools for:

  • find_symbol, find_referencing_symbols - Symbol lookup
  • rename_symbol, replace_symbol_body - Refactoring
  • insert_after_symbol, insert_before_symbol - Precise insertions
  • onboarding, activate_project - Project understanding
  • write_memory, read_memory - Save context
  • And 25+ more LSP-powered tools

If you see these tools, use them directly - they provide full Serena capabilities!

Option 2: CLI Commands (always available via execute_command) You can run serena commands using:

execute_command("uvx --from git+https://github.com/oraios/serena serena <command>")

This skill focuses on CLI usage patterns. If you have direct MCP tools, prefer those for better integration.

Purpose

The serena skill provides access to Serena, a coding agent toolkit that transforms text-based LLMs into symbol-aware code agents. Unlike traditional text search (ripgrep) or structural search (ast-grep), Serena understands code semantics through LSP integration.

Key capabilities:

  1. Symbol Discovery: Find classes, functions, variables, and types by name across 30+ languages
  2. Reference Tracking: Discover all locations where a symbol is referenced or used
  3. Precise Editing: Insert code at specific symbol locations with surgical precision

Serena operates at the symbol level rather than the text or syntax level, providing true IDE-like understanding of code structure, scope, and relationships.

When to Use This Skill

Use the serena skill when you need symbol-level code understanding:

Code Navigation:

  • Finding where a class, function, or variable is defined
  • Discovering all places where a symbol is used (call sites, imports, references)
  • Understanding code dependencies and relationships
  • Tracing execution flow through function calls

Code Understanding:

  • Analyzing impact of changes to a function or class
  • Understanding inheritance hierarchies and type relationships
  • Identifying dead code (symbols never referenced)
  • Mapping API usage patterns across a codebase

Code Refactoring:

  • Renaming symbols while tracking all usage locations
  • Adding methods or fields to specific classes
  • Inserting error handling after specific function calls
  • Modifying all call sites of a deprecated function

Choose serena over file-search (ripgrep/ast-grep) when:

  • You need to understand symbol semantics (not just text patterns)
  • You want to track references across files and modules
  • You need precise insertion points based on code structure
  • You're working with complex, multi-file codebases

Still use file-search when:

  • Searching for text patterns, comments, or strings
  • Finding todos, security issues, or documentation
  • You need faster, simpler pattern matching
  • Symbol-level precision isn't required

Language Support

Serena uses LSP servers for semantic analysis. Most common languages are supported out-of-the-box:

  • Python (pyright, jedi)
  • JavaScript/TypeScript (typescript-language-server)
  • Rust (rust-analyzer)
  • Go (gopls)
  • Java (jdtls)
  • C/C++ (clangd)
  • C#, Ruby, PHP, Kotlin, Swift, Scala, and 15+ more

The LSP servers provide symbol information for the language you're working with.

Core Operations

1. Finding Symbols (find_symbol)

Locate where a symbol is defined in your codebase.

Note: All examples below use the short form serena <command>. The full command is:

uvx --from git+https://github.com/oraios/serena serena <command>
# Find a class definition
execute_command("uvx --from git+https://github.com/oraios/serena serena find_symbol --name 'UserService' --type class")

# Find a function definition
execute_command("uvx --from git+https://github.com/oraios/serena serena find_symbol --name 'authenticate' --type function")

# Find a variable definition
execute_command("uvx --from git+https://github.com/oraios/serena serena find_symbol --name 'API_KEY' --type variable")

Use cases:

  • Locating the definition of a class before modifying it
  • Finding where a function is implemented
  • Understanding where constants are defined
  • Tracing type definitions in typed languages

Output format:

File: src/services/user_service.py
Line: 42
Symbol: UserService (class)
Context: class UserService(BaseService):

2. Finding References (find_referencing_symbols)

Discover all locations where a symbol is used, imported, or referenced.

# Find all usages of a class
execute_command("serena find_referencing_symbols --name 'UserService'")

# Find all call sites of a function
execute_command("serena find_referencing_symbols --name 'authenticate'")

# Find all reads/writes of a variable
execute_command("serena find_referencing_symbols --name 'API_KEY'")

Use cases:

  • Impact analysis before refactoring
  • Finding all call sites of a function
  • Tracking API usage across modules
  • Identifying unused symbols (zero references)
  • Understanding data flow and dependencies

Output format:

Found 12 references to 'authenticate':

1. src/api/routes.py:34
   authenticate(user_credentials)

2. src/middleware/auth.py:18
   from services import authenticate

3. tests/test_auth.py:56
   mock_authenticate = Mock(spec=authenticate)
...

3. Precise Code Insertion (insert_after_symbol)

Insert code at specific symbol locations with surgical precision.

# Add a method to a class
execute_command("""serena insert_after_symbol --name 'UserService' --type class --code '
    def get_user_by_email(self, email: str) -> Optional[User]:
        return self.db.query(User).filter_by(email=email).first()
'""")

# Insert error handling after a function call
execute_command("""serena insert_after_symbol --name 'database_query' --code '
    if result is None:
        raise DatabaseError("Query returned no results")
'""")

# Add a field to a dataclass
execute_command("""serena insert_after_symbol --name 'User' --type class --code '
    email_verified: bool = False
'""")

Use cases:

  • Adding methods to existing classes
  • Inserting validation or error handling
  • Adding fields to data structures
  • Injecting logging or monitoring code
  • Implementing missing functionality

Safety features:

  • Respects indentation and code formatting
  • Maintains syntactic validity
  • Positions code correctly within scope
  • Preserves existing code structure

Workflow Patterns

Pattern 1: Safe Refactoring

When changing a function signature or behavior:

# Step 1: Find the function definition
serena find_symbol --name 'process_payment' --type function

# Step 2: Find all call sites
serena find_referencing_symbols --name 'process_payment'

# Step 3: Analyze impact (review output)
# [Review all usage locations to understand impact]

# Step 4: Make changes with confidence
# [Update function and all call sites based on findings]

Pattern 2: Adding Functionality

When extending a class with new methods:

# Step 1: Locate the class
serena find_symbol --name 'PaymentProcessor' --type class

# Step 2: Verify no conflicts
serena find_symbol --name 'process_refund' --type function

# Step 3: Insert new method
serena insert_after_symbol --name 'PaymentProcessor' --type class --code '
    def process_refund(self, payment_id: str, amount: float) -> bool:
        # Implementation here
        pass
'

Pattern 3: Understanding Dependencies

When analyzing code relationships:

# Step 1: Find class definition
serena find_symbol --name 'DatabaseManager' --type class

# Step 2: Find all usages
serena find_referencing_symbols --name 'DatabaseManager'

# Step 3: For each usage, find what symbols use that code
# [Repeat reference tracking to build dependency graph]

Pattern 4: Dead Code Detection

When identifying unused code:

# Step 1: Find symbol definition
serena find_symbol --name 'legacy_auth_handler'

# Step 2: Check references
serena find_referencing_symbols --name 'legacy_auth_handler'

# Step 3: If zero references (except definition), mark for removal
# [If output shows only the definition, symbol is unused]

Integration with file-search

Serena and file-search (ripgrep/ast-grep) are complementary tools. Use them together:

When to Combine Tools

Use ripgrep THEN serena:

# 1. Find potential matches with ripgrep (fast, broad)
rg "authenticate" --type py

# 2. Narrow to specific symbol with serena (precise)
serena find_symbol --name 'authenticate' --type function
serena find_referencing_symbols --name 'authenticate'

Use serena THEN ripgrep:

# 1. Find symbol definition with serena
serena find_symbol --name 'UserService'

# 2. Search for related patterns with ripgrep
rg "UserService\(" --type py  # Find direct instantiations
rg "class.*UserService" --type py  # Find subclasses

Complementary Strengths

TaskBest ToolWhy
Find string literalsripgrepText-based, fast
Find TODOs/commentsripgrepText-based
Find symbol definitionserenaSymbol-aware
Find all referencesserenaSemantic understanding
Find code patternsast-grepSyntax-aware
Insert at symbolserenaPrecise positioning
Search across languagesripgrepLanguage-agnostic
Understand scopeserenaLSP semantic info

Best Practices

1. Start with Symbol Discovery

Always locate the symbol definition first:

# GOOD: Find definition, then references
serena find_symbol --name 'MyClass'
serena find_referencing_symbols --name 'MyClass'

# AVOID: Searching for references without confirming definition exists

2. Use Specific Symbol Types

Narrow searches with --type when possible:

# GOOD: Specific type reduces ambiguity
serena find_symbol --name 'User' --type class

# LESS PRECISE: May match User function, User variable, etc.
serena find_symbol --name 'User'

3. Verify Before Inserting

Always find the symbol before inserting code:

# GOOD: Verify target exists first
serena find_symbol --name 'PaymentService' --type class
# [Review output to confirm correct class]
serena insert_after_symbol --name 'PaymentService' --code '...'

# RISKY: Inserting without verification
serena insert_after_symbol --name 'PaymentService' --code '...'

4. Review Reference Counts

Check reference output for impact analysis:

# Find references and assess impact
serena find_referencing_symbols --name 'deprecated_function'
# If 50+ references, plan careful migration
# If 0 references, safe to remove

5. Combine with git diff

After insertions, verify changes:

serena insert_after_symbol --name 'MyClass' --code '...'
git diff  # Review actual changes before committing

Supported Languages

Serena supports 30+ languages through LSP integration:

Tier 1 (Fully tested):

  • Python, JavaScript, TypeScript, Rust, Go, Java, C/C++

Tier 2 (Community tested):

  • C#, Ruby, PHP, Kotlin, Swift, Scala

Tier 3 (Experimental):

  • Haskell, Elixir, Clojure, Erlang, Julia, R, and more

For the complete list and setup instructions, see Serena language support docs.

Limitations

When NOT to Use Serena

  1. Searching text/comments: Use ripgrep instead # WRONG TOOL: Serena doesn't search comments serena find_symbol --name "TODO" # RIGHT TOOL: Use ripgrep for text rg "TODO"
  2. Generated code: LSP may not index auto-generated files

- Use ripgrep for build artifacts, generated code

  1. Very large codebases: Symbol indexing can be slow

- Use ripgrep for initial broad searches - Use serena for precise follow-up

  1. Dynamic languages without types: Limited semantic info

- Python without type hints has reduced precision - JavaScript without TypeScript has fewer guarantees

Known Edge Cases

  • Ambiguous symbols: Multiple symbols with same name may require manual disambiguation
  • Macro-generated code: C/C++ macros may confuse LSP
  • Circular dependencies: May affect reference tracking accuracy
  • Incomplete projects: Missing dependencies can reduce LSP effectiveness

Performance Considerations

Token Efficiency

Serena is designed for token-efficient code navigation:

# Traditional approach (inefficient)
execute_command("cat entire_file.py")  # 1000+ tokens
# [Search for symbol manually in output]

# Serena approach (efficient)
serena find_symbol --name 'MyClass'  # 50 tokens
# [Get precise location immediately]

Speed Characteristics

  • Symbol lookup: Near-instant (LSP indexed)
  • Reference finding: Fast (O(log n) with indexing)
  • Code insertion: Instant (direct file modification)

Comparison with alternatives:

  • Ripgrep: Faster for text search (no semantic understanding)
  • AST-grep: Comparable speed (syntax vs semantic)
  • Serena: Slower initial startup (LSP indexing), faster precise queries

Troubleshooting

Symbol Not Found

If find_symbol returns no results:

  1. Verify symbol exists: Use ripgrep to confirm rg "class MyClass" --type py
  2. Check language server: Ensure LSP is configured for the language serena status # Check LSP server status
  3. Try case variations: Symbol names are case-sensitive serena find_symbol --name 'myclass' # Try different cases
  4. Rebuild index: Force LSP to re-index serena reindex # Rebuild symbol index

Too Many References

If find_referencing_symbols returns hundreds of results:

  1. Use file-search first: Narrow scope with ripgrep rg "MyClass" src/services/ # Limit to specific directory serena find_referencing_symbols --name 'MyClass' --path src/services/
  2. Filter by reference type: Focus on specific usage patterns # Look for imports only rg "from.* import.*MyClass" --type py
  3. Prioritize recent changes: Check git history first git log --all -p -S 'MyClass' --since="1 week ago"

Insertion Failures

If insert_after_symbol fails:

  1. Verify symbol exists: Find it first
  2. Check syntax: Ensure inserted code is valid
  3. Review indentation: Match surrounding code style
  4. Test incrementally: Insert small changes first

Resources

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Claude Code

28.17%
按下载量换算255

OpenCode

25.98%
按下载量换算235

Codex

18.89%
按下载量换算171

Antigravity

12.39%
按下载量换算112

Gemini CLI

9.22%
按下载量换算83

Cursor

4.07%
按下载量换算37

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

external-service

该 Skill 可能调用第三方服务、云服务或外部模型 API,使用前需要确认账号、额度、数据发送范围和服务条款。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。

来源信息

继续浏览同类 Skills