Include patterns
The include field uses glob patterns to specify which Markdown files contextlint validates.
Basics
Section titled “Basics”{ "include": ["docs/**/*.md"]}This setting validates every Markdown file under the docs/ directory.
Multiple directories
Section titled “Multiple directories”You can pass multiple globs as an array.
{ "include": ["docs/**/*.md", "specs/**/*.md", "adr/**/*.md"]}Default
Section titled “Default”If you omit include, the default is ["**/*.md"] — every Markdown file in the repository is validated.
Precedence
Section titled “Precedence”The validation target is resolved with the following precedence:
- CLI arguments (highest) — glob patterns passed directly on the command line
includein the config file- Default —
["**/*.md"]
# Validate only specs/ via CLI argument (overrides config's include)npx contextlint "specs/**/*.md"Exclusion patterns
Section titled “Exclusion patterns”contextlint does not have a separate exclude field. To exclude paths, use glob negation patterns (!).
{ "include": ["docs/**/*.md", "!docs/_drafts/**"]}Anything not matched by include is excluded automatically, so narrowing include is effectively the same as exclusion.
Glob behavior
Section titled “Glob behavior”Internally, contextlint uses picomatch. Standard glob syntax such as *, **, ?, and [abc] is supported.
Directories that start with a dot (.claude/, .github/, etc.) are matched as well. If you keep Markdown files inside dot-directories and want to exclude them, write an explicit negation pattern.
{ "include": ["**/*.md", "!.claude/**", "!.github/**"]}