Skip to content

Commit 80e21bb

Browse files
doc: add claude skill and AI entry point
1 parent e96bcf3 commit 80e21bb

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

website/advanced/prompting.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,26 @@ This guide outlines several existing methods for leveraging AI with ast-grep.
66
The field of AI is constantly evolving. The approaches detailed here are for reference, and we encourage you to explore and discover the best ways to utilize ast-grep with emerging AI technologies.
77
:::
88

9+
## Using ast-grep with Claude Code Skill
10+
11+
This skill teaches Claude how to write and use ast-grep rules to perform advanced code searches. Unlike traditional text-based search (grep, ripgrep), ast-grep understands the structure of your code, allowing you to find patterns like:
12+
13+
- "Find all async functions that don't have error handling"
14+
- "Locate all React components that use a specific hook"
15+
- "Find functions with more than 3 parameters"
16+
- "Search for console.log calls inside class methods"
17+
18+
Clone or download the [ast-grep skill repository](https://github.com/ast-grep/claude-skill) to your Claude Code skills directory:
19+
20+
```bash
21+
# If you have a skills directory configured
22+
cp -r ast-grep ~/.claude-code/skills/
23+
24+
# Or place it wherever your Claude Code skills are located
25+
```
26+
27+
The skill should be automatically detected by Claude Code. You can verify by checking available skills in Claude Code.
28+
929
## Simple Prompting in `AGENTS.md`
1030

1131
For everyday development, you can instruct your AI agent to use ast-grep for code searching and analysis. This method is straightforward but requires a model with up-to-date knowledge of ast-grep to be effective. If the model is not familiar with the tool, it may not utilize it as instructed.

website/index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ hero:
2020
text: Quickstart
2121
link: /guide/quick-start.html
2222
- theme: alt
23-
text: Introduction
23+
text: Intro
2424
link: /guide/introduction.html
2525
- theme: alt
2626
text: Examples
2727
link: /catalog/
2828
- theme: alt
29-
text: GitHub
30-
link: https://github.com/ast-grep/ast-grep
29+
text: With AI
30+
link: /advanced/prompting.html
3131

3232
features:
3333
- icon: ⚡️

0 commit comments

Comments
 (0)