smithery/asakuno

serena-mcp-guide

Serena MCPの使用ガイド。シンボルベースのコード編集、検索、リファクタリングのためのコマンドリファレンス。

Installation

$ npx skills add smithery/asakuno --skill serena-mcp-guide

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from smithery/asakuno.

npx skills add smithery/asakuno

Browse all from smithery/asakuno

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 4,617 B
  • docs SUMMARY.md 175 B

History

  1. First recorded snapshot · 0 installs

SKILL.md

Serena MCP 使用ガイド

概要

Serena MCPはシンボルベースのコード編集を提供するMCPサーバー。関数、クラス、メソッド単位での精密な編集が可能。

基本原則

  1. シンボルレベルで編集: ファイル全体ではなくシンボル単位で変更
  2. 参照確認を先に: 編集前に findreferencingsymbols で影響範囲を確認
  3. 増分実装: 大きな変更は小さなシンボル編集に分割

コマンドリファレンス

シンボル検索

find_symbol - シンボル検索

mcp__serena__find_symbol
name_path_pattern: 'SymbolName'      # 検索パターン
relative_path: 'src/path/'           # 検索範囲(省略可)
include_body: true                   # ソースコードを含める
depth: 1                             # 子要素の深さ
substring_matching: true             # 部分一致検索

namepathpatternの指定方法:

  • 単純名: "methodName" - 任意の場所のシンボル
  • 相対パス: "ClassName/methodName" - クラス内のメソッド
  • 絶対パス: "/ClassName/methodName" - 完全一致

findreferencingsymbols - 参照検索

mcp__serena__find_referencing_symbols
name_path: 'targetSymbol'
relative_path: 'src/path/to/file.ts'  # 必須: ファイルパス

シンボル編集

replacesymbolbody - シンボル置換

mcp__serena__replace_symbol_body
name_path: 'ComponentName/methodName'
relative_path: 'src/path/to/file.ts'
body: 'function methodName() {
  // 新しい実装
}'

注意: bodyにはシグネチャ行を含める。docstring/コメント/importsは含めない。

insertaftersymbol - シンボル後に挿入

mcp__serena__insert_after_symbol
name_path: 'ExistingSymbol'
relative_path: 'src/path/to/file.ts'
body: '
function newFunction() {
  // 新しいシンボル
}'

用途: 新しい関数、メソッド、クラスの追加

insertbeforesymbol - シンボル前に挿入

mcp__serena__insert_before_symbol
name_path: 'FirstSymbol'
relative_path: 'src/path/to/file.ts'
body: 'import { something } from "somewhere"
'

用途: ファイル先頭へのimport追加など

rename_symbol - シンボル名変更

mcp__serena__rename_symbol
name_path: 'oldName'
relative_path: 'src/path/to/file.ts'
new_name: 'newName'

コードベース全体で自動的にリネーム。

ファイル概要取得

getsymbolsoverview - ファイル内シンボル一覧

mcp__serena__get_symbols_overview
relative_path: 'src/path/to/file.ts'
depth: 1  # 子要素の深さ

用途: ファイル構造の把握、編集対象の特定

パターン検索

searchforpattern - 正規表現検索

mcp__serena__search_for_pattern
substring_pattern: 'searchPattern'
relative_path: 'src/'                      # 検索範囲
restrict_search_to_code_files: true        # コードファイルのみ
context_lines_before: 2
context_lines_after: 2

用途: シンボル名が不明な場合の探索

ワークフロー例

既存メソッドの修正

# 1. シンボルを検索して現状把握
mcp__serena__find_symbol
name_path_pattern: 'ClassName/methodName'
relative_path: 'src/'
include_body: true

# 2. 参照箇所を確認
mcp__serena__find_referencing_symbols
name_path: 'ClassName/methodName'
relative_path: 'src/path/to/file.ts'

# 3. シンボルを置換
mcp__serena__replace_symbol_body
name_path: 'ClassName/methodName'
relative_path: 'src/path/to/file.ts'
body: '...'

新しいメソッドの追加

# 1. ファイル構造を確認
mcp__serena__get_symbols_overview
relative_path: 'src/path/to/file.ts'
depth: 1

# 2. 既存メソッドの後に挿入
mcp__serena__insert_after_symbol
name_path: 'ClassName/existingMethod'
relative_path: 'src/path/to/file.ts'
body: '
  newMethod() {
    // 実装
  }'

トラブルシューティング

シンボルが見つからない

# substring_matchingで部分一致検索
mcp__serena__find_symbol
name_path_pattern: 'partialName'
relative_path: 'src/'
substring_matching: true

# または正規表現で検索
mcp__serena__search_for_pattern
substring_pattern: 'partialName'
relative_path: 'src/'

編集結果の確認

Serenaのシンボル編集ツールはエラーなく返れば成功。追加の確認は不要。