Skip to content

Include patterns

The include field uses glob patterns to specify which Markdown files contextlint validates.

{
"include": ["docs/**/*.md"]
}

This setting validates every Markdown file under the docs/ directory.

You can pass multiple globs as an array.

{
"include": ["docs/**/*.md", "specs/**/*.md", "adr/**/*.md"]
}

If you omit include, the default is ["**/*.md"] — every Markdown file in the repository is validated.

The validation target is resolved with the following precedence:

  1. CLI arguments (highest) — glob patterns passed directly on the command line
  2. include in the config file
  3. Default["**/*.md"]
Terminal window
# Validate only specs/ via CLI argument (overrides config's include)
npx contextlint "specs/**/*.md"

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.

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/**"]
}