{"id":"ast-grep-find","name":"ast-grep-find","summary":"ast-grep MCPによるASTベースのコード検索およびリファクタリング","body":"# AST-Grep Find\n\nStructural code search that understands syntax. Find patterns like function calls, imports, class definitions - not just text.\n\n## When to Use\n\n- Find code patterns (ignores strings/comments)\n- Search for function calls, class definitions, imports\n- Refactor code with AST precision\n- Rename variables/functions across codebase\n\n## Usage\n\n### Search for a pattern\n```bash\nuv run python -m runtime.harness scripts/ast_grep_find.py \\\n    --pattern \"import asyncio\" --language python\n```\n\n### Search in specific directory\n```bash\nuv run python -m runtime.harness scripts/ast_grep_find.py \\\n    --pattern \"async def \\$FUNC(\\$\\$\\$)\" --language python --path \"./src\"\n```\n\n### Refactor/replace pattern\n```bash\nuv run python -m runtime.harness scripts/ast_grep_find.py \\\n    --pattern \"console.log(\\$MSG)\" --replace \"logger.info(\\$MSG)\" \\\n    --language javascript\n```\n\n### Dry run (preview changes)\n```bash\nuv run python -m runtime.harness scripts/ast_grep_find.py \\\n    --pattern \"print(\\$X)\" --replace \"logger.info(\\$X)\" \\\n    --language python --dry-run\n```\n\n## Parameters\n\n| Parameter | Description |\n|-----------|-------------|\n| `--pattern` | AST pattern to search (required) |\n| `--language` | Language: `python`, `javascript`, `typescript`, `go`, etc. |\n| `--path` | Directory to search (default: `.`) |\n| `--glob` | File glob pattern (e.g., `**/*.py`) |\n| `--replace` | Replacement pattern for refactoring |\n| `--dry-run` | Preview changes without applying |\n| `--context` | Lines of context (default: 2) |\n\n## Pattern Syntax\n\n| Syntax | Meaning |\n|--------|---------|\n| `$NAME` | Match single node (variable, expression) |\n| `$$$` | Match multiple nodes (arguments, statements) |\n| `$_` | Match any single node (wildcard) |\n\n## Examples\n\n```bash\n# Find all function definitions\nuv run python -m runtime.harness scripts/ast_grep_find.py \\\n    --pattern \"def \\$FUNC(\\$\\$\\$):\" --language python\n\n# Find console.log calls\nuv run python -m runtime.harness scripts/ast_grep_find.py \\\n    --pattern \"console.log(\\$\\$\\$)\" --language javascript\n\n# Replace print with logging\nuv run python -m runtime.harness scripts/ast_grep_find.py \\\n    --pattern \"print(\\$X)\" --replace \"logging.info(\\$X)\" \\\n    --language python --dry-run\n```\n\n## vs morph/warpgrep\n\n| Tool | Best For |\n|------|----------|\n| **ast-grep** | Structural patterns (understands code syntax) |\n| **warpgrep** | Fast text/regex search (20x faster grep) |\n\nUse ast-grep when you need syntax-aware matching. Use warpgrep for raw speed.\n\n## MCP Server Required\n\nRequires `ast-grep` server in mcp_config.json.","author":"@parcadei","ownerProfile":null,"authorContacts":null,"sourceUrl":"https://github.com/parcadei/Continuous-Claude-v3/tree/main/.claude/skills/ast-grep-find","license":"MIT","category":"coding","lang":"en","tokens":673,"stars":0,"calls30d":1,"claimed":false,"visibility":"public","origin":"crawler","version":"0.1.0","createdAt":"2026-08-22","updatedAt":"2026-08-22","files":[],"requires":{"mcp":[],"tools":["Bash","Read"]},"safety":{"flags":[],"scannedAt":"2026-08-22","hasScripts":false,"networkEndpoints":[]}}