This skill covers how GrepAI splits code files into chunks for embedding, and how to optimize chunking for your codebase.
Works with
AI-first code editor with Composer
Before installing skills in Cursor, ensure your development environment meets these requirements:
node --versiongrepai-chunkingExecute the skills CLI command in your project's root directory to begin installation:
Fetches grepai-chunking from yoanbernabeu/grepai-skills and configures it for Cursor.
The CLI shows a list of agents. Use arrow keys and space to select Cursor:
Confirm successful installation by checking the skill directory location:
Restart Cursor to activate grepai-chunking. Access via /grepai-chunking in your agent's command palette.
We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.
Skills execute code in your environment. Always review source, verify the publisher, and test in isolation before production.
Submit your Claude Code skill and start earning
Automate repetitive workflows and reduce manual effort
Example
Generate reports, summarize documents, draft communications
Save 3-5 hours per week on routine tasks
Learn new skills, understand complex topics, get expert guidance
Example
Explain concepts, provide examples, suggest learning resources
Accelerate learning and skill development by 2x
Enhance output quality through reviews, suggestions, and refinements
Example
Review drafts, suggest improvements, catch errors
Improve work quality by 30-40% with less effort
0
total installs
0
this week
16
GitHub stars
0
upvotes
Run in your terminal
0
installs
0
this week
16
stars
This skill covers how GrepAI splits code files into chunks for embedding, and how to optimize chunking for your codebase.
Chunking is the process of splitting source files into smaller segments for embedding:
┌─────────────────────────────────────┐
│ Large Source File │
│ (1000+ tokens) │
└─────────────────────────────────────┘
↓
┌─────────┐ ┌─────────┐ ┌─────────┐
│ Chunk 1 │ │ Chunk 2 │ │ Chunk 3 │
│ ~512 │ │ ~512 │ │ ~512 │
│ tokens │ │ tokens │ │ tokens │
└─────────┘ └─────────┘ └─────────┘
↓
Each chunk gets
its own embedding
Embedding models have optimal input sizes:
# .grepai/config.yaml
chunking:
size: 512 # Tokens per chunk
overlap: 50 # Overlap between chunks
The target number of tokens per chunk.
| Size | Effect |
|---|---|
| 256 | More precise, less context |
| 512 | Balanced (default) |
| 1024 | More context, less precise |
Tokens shared between adjacent chunks. Preserves context at boundaries.
| Overlap | Effect |
|---|---|
| 0 | No overlap, may lose context at boundaries |
| 50 | Standard overlap (default) |
| 100 | More context, larger index |
With size=512 and overlap=50:
File: auth.go (1000 tokens)
Chunk 1: tokens 1-512
┌────────────────────────────────────┐
│ func Login(user, pass)... │
└────────────────────────────────────┘
↘
50 token overlap
↙
Chunk 2: tokens 463-974
┌────────────────────────────────────┐
│ ...validate credentials... │
└────────────────────────────────────┘
↘
50 token overlap
↙
Chunk 3: tokens 925-1000
┌──────────────┐
│ ...return │
└──────────────┘
chunking:
size: 768 # Larger to capture full methods
overlap: 75
chunking:
size: 512 # Standard size
overlap: 50
chunking:
size: 384 # Smaller for precise results
overlap: 40
chunking:
size: 384 # Capture individual functions
overlap: 40
chunking:
size: 768 # Capture more context
overlap: 100
chunking:
size: 512 # Balanced default
overlap: 50
GrepAI uses approximate token counting:
Example:
func calculateTotal(items []Item) float64 {
total := 0.0
for _, item := range items {
total += item.Price * float64(item.Quantity)
}
return total
}
≈ 45 tokens
Larger overlap = more chunks = larger index:
| Size | Overlap | Chunks per 10K tokens | Index Impact |
|---|---|---|---|
| 512 | 0 | ~20 | Smallest |
| 512 | 50 | ~22 | Standard |
| 512 | 100 | ~24 | +10% |
| 256 | 50 | ~44 | +100% |
Query: "authentication middleware"
Result: "...c.AbortWithStatus(401)..."
(Fragment, missing context)
Query: "authentication middleware"
Result: "func AuthMiddleware() gin.HandlerFunc {
return func(c *gin.Context) {
token := c.GetHeader("Authorization")
if token == "" {
c.AbortWithStatus(401)
return
}
// validate token...
}
}"
(Complete function with context)
Query: "authentication middleware"
Result: "// Multiple unrelated functions...
func AuthMiddleware()... (your match)
func LoggingMiddleware()...
func CORSMiddleware()..."
(Too much noise)
chunking:
size: 384
overlap: 40
rm .grepai/index.gob
grepai watch
grepai search "your query"
Before changing settings, save a search result:
grepai search "authentication" > before.txt
After changing settings and re-indexing:
grepai search "authentication" > after.txt
diff before.txt after.txt
GrepAI tries to split at logical boundaries:
This means actual chunk sizes may vary slightly from the target.
❌ Problem: Search results are too fragmented ✅ Solution: Increase chunk size:
chunking:
size: 768
❌ Problem: Search results have too much irrelevant context ✅ Solution: Decrease chunk size:
chunking:
size: 384
❌ Problem: Results miss related code at function boundaries ✅ Solution: Increase overlap:
chunking:
overlap: 100
❌ Problem: Index is too large ✅ Solutions:
Chunking status:
✅ Chunking Configuration
Size: 512 tokens
Overlap: 50 tokens
Index Statistics:
- Total files: 245
- Total chunks: 1,234
- Avg chunks/file: 5.0
- Avg chunk size: 478 tokens
Recommendations:
- Current settings are balanced
- Consider size: 384 for more precise results
- Consider size: 768 for more context
Prerequisites
Time Estimate
15-45 minutes depending on use case complexity
Steps
Common Pitfalls
✓ Do
✗ Don't
💡 Pro Tips
✓ Use when
Use when skill capabilities match your task, clear ROI on time saved, and you can validate outputs. Best for repetitive tasks, learning, and quality improvement.
✗ Avoid when
Avoid when task requires deep expertise you can't validate, involves sensitive decisions, or when learning process is more valuable than speed of completion.
davila7/claude-code-templates
intellectronica/agent-skills
am-will/codex-skills
sickn33/antigravity-awesome-skills
myzy-ai/dokie-ai-ppt
sickn33/antigravity-awesome-skills
grepai-chunking is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
grepai-chunking has been reliable in day-to-day use. Documentation quality is above average for community skills.
Solid pick for teams standardizing on skills: grepai-chunking is focused, and the summary matches what you get after install.
grepai-chunking reduced setup friction for our internal harness; good balance of opinion and flexibility.
We added grepai-chunking from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.
I recommend grepai-chunking for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.
grepai-chunking fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
grepai-chunking fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
Useful defaults in grepai-chunking — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.
We added grepai-chunking from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.
showing 1-10 of 29