General
how-to-add-grammar-checking-to-your-ci-pipeline-in-5-minutes-2026
Table of contents
The Problem with Naive Grammar Checks in CIApproach 1: Pre-commit Hook (Fastest Feedback)Approach 2: GitHub Actions WorkflowApproach 3: Slack Integration for Team MessagesApproach 4: VS Code Extension for In-Editor FeedbackRecommended WorkflowFAQYour CI pipeline checks code quality, security, and style. But what about the prose in your READMEs, API docs, commit messages, and PR descriptions? That text lives in your repo too — and poor grammar in documentation costs more than you think.
This guide shows you how to add a code-aware grammar check to your CI without turning your pipeline into a strict gate that blocks merges over false positives.
Most grammar checkers fail in CI for two reasons:
False positives on code. A checker that flags
No skip mechanism. When the checker is wrong, developers either disable it entirely or learn to ignore it — defeating the purpose.
A code-aware checker solves both by treating code blocks, identifiers, and technical terms as protected content.
The quickest win is a pre-commit hook. It runs before the developer even pushes, catching issues in seconds rather than minutes.
``
Q: What if the checker flags something I disagree with?
That's the point of non-blocking mode. Flag, review, decide. If the suggestion is wrong, you can configure an ignore list or just leave it.
This guide shows you how to add a code-aware grammar check to your CI without turning your pipeline into a strict gate that blocks merges over false positives.
The Problem with Naive Grammar Checks in CI
Most grammar checkers fail in CI for two reasons:
getUserById() as broken English will break every PR with a function call in a comment.A code-aware checker solves both by treating code blocks, identifiers, and technical terms as protected content.
Approach 1: Pre-commit Hook (Fastest Feedback)
The quickest win is a pre-commit hook. It runs before the developer even pushes, catching issues in seconds rather than minutes.
Setup with pre-commit
``
yaml
# .pre-commit-config.yaml
repos:
- repo: local
hooks:
- id: lint-grammar
name: Grammar Check
entry: python scripts/run_lint_grammar.py
language: python
types: [text]
files: '\.(md|txt|rst)$'
exclude: '\.venv/|node_modules/|vendor/'
`
The hook script sends Markdown files to Lint's grammar API and returns exit code 0 (non-blocking) or 1 (blocking) based on your rules.
Non-blocking mode (recommended)
For a first pass, run the check but never fail the build. Instead, post a comment on the PR:
`python
import subprocess
result = subprocess.run(
["python", "scripts/check_grammar.py", "--non-blocking"],
capture_output=True
)
if result.returncode == 1:
print("Grammar suggestions found — please review in PR comments.")
`
This keeps the pipeline green while still surfacing issues.
Approach 2: GitHub Actions Workflow
For a CI-native approach, add a GitHub Actions workflow that runs on pull requests:
`yaml
# .github/workflows/grammar-check.yml
name: Grammar Check
on:
pull_request:
paths:
- "**.md"
- "docs/**"
- "**.rst"
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run grammar check
run: |
curl -X POST https://tools.aicreditsapi.com/tools/api/grammar-check -H 'Content-Type: application/json' -d '{"text": "'"$(cat README.md)"'", "mode": "technical"}'
`
Why this works
- File-based filtering. Only checks .md, .rst, and docs/ — never source code.
- Non-blocking. The workflow can be set to continue-on-error: true so it reports but doesn't fail.
- Code-aware. Lint preserves getUserById(), localhost, and other technical terms.
Approach 3: Slack Integration for Team Messages
If your team uses Slack for async communication, you can add grammar checking to team messages too.
See our [Slack integration guide](/tools/slack-integration) for details.
Approach 4: VS Code Extension for In-Editor Feedback
For developers who want feedback before pushing, the [VS Code extension](/tools/vscode-extension) provides real-time grammar checking as you write — no CI needed.
Recommended Workflow
| Stage | Tool | Blocking? | Speed |
|---|---|---|---|
| Writing | VS Code extension | No | Instant |
| Pre-commit | pre-commit hook | No (comment only) | < 5s |
| PR | GitHub Actions | No (warning only) | ~15s |
| Review | Manual check | Yes (final gate) | N/A |
The key principle: catch early, never block. Grammar is about clarity, not correctness police. A single flagged issue in a PR comment is worth more than a broken build.
FAQ
Q: Will this slow down my CI?
No. A grammar check on a typical README takes under 2 seconds. Even checking 10 documentation files adds less than 20 seconds to your pipeline.
Q: What about languages other than English?
Lint supports multiple languages. For Chinese-English technical docs, enable the bilingual mode which understands mixed-language content.
Q: Can I customize which files get checked?
Yes. Use the files filter in your pre-commit config or the paths` filter in GitHub Actions to target only documentation directories.Q: What if the checker flags something I disagree with?
That's the point of non-blocking mode. Flag, review, decide. If the suggestion is wrong, you can configure an ignore list or just leave it.
📌 Prices and tool count in this article may be outdated. Lint now ships 16 tools with Pro at $12/mo, or $60/year. See the current pricing page.
Stop letting Grammarly break your code
17 AI tools built for developers. Code-aware parsing.
Or upgrade to Pro for 500 checks a day · All tools · No ads