A comprehensive grammar checking extension for pi — your AI coding agent.
Check grammar in text snippets, markdown files, or entire documents with intelligent corrections and flexible save options.
- Quick inline checks with
?grammarprefix - Interactive editor via
/grammarcommand - Markdown file analysis with
/grammar-filecommand - Flexible saving with overwrite or new file options via
/grammar-save - LLM-powered tools that work automatically when you ask for grammar help
- Rule-based pre-checks for common issues (50+ spelling errors, punctuation, capitalization)
- Smart markdown handling — preserves formatting, code blocks, and structure
Install the extension:
pi install git:github.com/soikat/pi-grammarOr try it without installing:
pi -e git:github.com/soikat/pi-grammarFor a quick grammar check on a single sentence or short text:
?grammar I has went to the store yesterday and buyed some grocerys.
The LLM will instantly analyze and provide corrections.
Open a multi-line editor for longer text:
/grammar
Or pass text directly as an argument:
/grammar I has went to the store yesterday.
/grammar-file ./README.md
Without arguments, you'll be prompted to enter the file path:
/grammar-file
What happens:
- The file is read and analyzed for grammar issues
- The LLM provides:
- List of issues found with explanations
- Complete corrected content in a
markdowncode block
- File context is saved for the next step
After reviewing the LLM's corrections, run:
/grammar-save
You'll be prompted to choose:
- Overwrite original file — Replaces the original with corrections (requires confirmation)
- Create new file (with -fixed suffix) — Saves as
filename-fixed.md - Create new file (custom name) — You choose the filename
Copy the corrected markdown content from the LLM's response and paste it into the editor that opens.
You can also ask the LLM directly and it will use the appropriate tool:
For files:
Check the grammar in ./docs/guide.md and fix any issues
For text:
Can you check the grammar in this paragraph: "Their going too the store to buy there grocerys."
The LLM has access to two tools:
grammar_check— For text snippets (rule-based + LLM analysis)grammar_check_file— For markdown files (can check, fix, and save)
The extension performs rule-based checks for:
✅ Spelling — 50+ common misspellings (recieve → receive, teh → the, etc.)
✅ Grammar — Article usage (a/an), comma splices, repeated words
✅ Punctuation — Missing spaces, double spaces
✅ Capitalization — Sentence starts after periods
✅ Style (detailed mode) — Passive voice, long sentences, weak words
Then the LLM performs deeper analysis for:
- Context-dependent corrections
- Complex grammar rules
- Natural phrasing improvements
- Markdown-specific handling (preserves code blocks, links, formatting)
# 1. Check the file
/grammar-file ./blog-post.md
# 2. Review corrections (LLM shows issues + corrected content)
# 3. Save it
/grammar-save
# Choose: "Create new file (with -fixed suffix)"
# Result: blog-post-fixed.md is createdCheck grammar in ./README.md, fix all issues, and save to a new file
The LLM will:
- Use
grammar_check_fileto analyze the file - Provide corrected content
- Save it to
README-fixed.md
?grammar Their going too the store to buy there grocerys
Instant feedback without leaving the editor.
| Command | Description |
|---|---|
?grammar <text> |
Quick inline grammar check |
/grammar [text] |
Open editor for multi-line check, or check provided text |
/grammar-file [path] |
Analyze grammar in a markdown file |
/grammar-save |
Save corrected content after /grammar-file |
| Tool | Description |
|---|---|
grammar_check |
Check grammar in text with rule-based + LLM analysis |
grammar_check_file |
Check grammar in markdown files with options to save |
While optimized for markdown files (.md, .markdown, .mdx), the extension can check grammar in any text file. You'll receive a warning for non-markdown files with the option to proceed.
- Rule-based pre-check scans for common issues
- LLM analysis provides nuanced corrections and context-aware fixes
- Smart markdown handling preserves:
- Code blocks (fenced and inline)
- Links and images
- Headers and formatting
- Lists and tables
File not found?
- Use relative paths from your current working directory
- Or use absolute paths:
/full/path/to/file.md
LLM not providing corrected content?
- Ask explicitly: "Please provide the full corrected content in a markdown code block"
- The extension expects content wrapped in
```markdownblocks
Want to check multiple files?
- Run
/grammar-filefor each file separately - Or ask the LLM: "Check grammar in all markdown files in ./docs/"
pi remove git:github.com/soikat/pi-grammarFound a bug or have a feature request? Open an issue on GitHub.
MIT