# minimatch — card for AI agents

Glob pattern matching library for file path filtering and pattern-based selections.

Category: Utilities · npm package `minimatch` · latest version 11.0.3 (checked 2026-11-01)
Install: `npm install minimatch`
License: BlueOak-1.0.0 (permissive)

In your own product (generator, app, hosted service): **yes**. Permissive license: ship it inside your own product, closed or open source, and keep its license and copyright notice.

## Numbers (AgentGid data)
- Gid Score: 65.6 (#642 of all tools, 77 of 408 in its category)
- Used in 30 public projects set up for AI coding agents (0.5%)
- Downloads last week: 1,018,012,295 (as of 2026-11-24), +37.3% over 4 weeks
- GitHub stars: 3,530 (as of 2026-11-24)
- Last push: 2026-11-20

## Often used with
Vitest 73.3%, Model Context Protocol SDK (JavaScript) 60.0%, tsx 56.7%, esbuild 50.0%, Anthropic SDK 50.0%, yaml 50.0%

## Checked alternatives (same job)
- glob: https://agentgid.com/tools/glob/agent.md

## Links
- AgentGid page: https://agentgid.com/tools/minimatch/
- Homepage: https://github.com/isaacs/minimatch#readme
- Repository: https://github.com/isaacs/minimatch


## minimatch: test file paths against wildcard patterns

minimatch is a small free JavaScript library that answers one question: does this file path match a pattern like src/**/*.ts or *.{png,jpg}? Your scripts and tools use it to pick, skip or group files by name. It only compares text; listing the files on disk is the job of the glob library, which uses minimatch inside.

### Where to use it
- Run only the changed tests: From the list of files changed in a pull request, keep only the test files and run just those.
- Keep secrets out of uploads: Before a deploy or backup script uploads a folder, it skips .env files, logs and build output by pattern. (idea, not from the official pages)
- Skip folders that cannot match: A tool that walks a big folder tree stops going into folders whose path can never fit the pattern.
- Find a file whose name has a star: Match a user's file called report[final]*.pdf by its exact name, without the brackets and star acting as wildcards.
- Accept photos in any letter case: An import tool picks up photo.JPG as well as photo.jpg when the user's rule says *.{png,jpg}.
- Let users set include rules: Your app's settings file takes lines like src/**/*.md, and the app treats only matching files. (idea, not from the official pages)

### How to start
- Add minimatch to a project that runs on Node.js 20, or 22 and newer.
- Import the named function and test a path against a pattern.

```
// hybrid module, load with require() or import
import { minimatch } from 'minimatch'
// or:
// const { minimatch } = require('minimatch')

minimatch('bar.foo', '*.foo') // true!
minimatch('bar.foo', '*.bar') // false!
```


### License
Free for any use, also in paid products, under the Blue Oak Model License 1.0.0. Anyone you give a copy of the code to must also get the license text or a link to it.

### Good to know
- Do not turn text typed by your users into patterns; the README warns any glob matcher can be abused that way.
- Patterns must use forward slashes, also on Windows; a backslash means the next character is literal.
- Files and folders whose names start with a dot are skipped by ** and * unless you turn on the dot option.
- Version 11 needs Node.js 20, or 22 and newer.

Checked 2026-11-10 against: https://github.com/isaacs/minimatch/blob/main/README.md, https://github.com/isaacs/minimatch/blob/main/LICENSE.md, https://github.com/isaacs/minimatch/blob/main/changelog.md, https://registry.npmjs.org/minimatch/11.0.5, https://registry.npmjs.org/minimatch, https://blueoakcouncil.org/license/1.0.0, https://github.com/micromatch/picomatch/blob/master/README.md

### Mistakes to avoid
- Don't: import minimatch from 'minimatch' → Do: import { minimatch } from 'minimatch' (There is no default export since 9.0; in our run the module had no default.)
- Don't: minimatch.makeRe(pattern) or new Minimatch(p).regexp → Do: Call minimatch(path, pattern) or mm.match(path); if you need a regular expression, use picomatch (Version 11 removed both; in our run makeRe was undefined.)
- Don't: Building a pattern with path.join() on Windows, such as src\*.ts → Do: Write patterns with / only, such as src/*.ts (A backslash escapes the next character; in our run src\*.ts did not match src/app.ts.)
- Don't: Expecting **/* to include .env or .github files → Do: Pass { dot: true } when dot files must match (Dot files are skipped by default; in our demo .env matched only with { dot: true }.)
- Don't: minimatch(path, req.query.pattern) with a pattern typed by a visitor → Do: Offer fixed patterns or escape the input with minimatch.escape() (Patterns from untrusted input can make any glob matcher slow or behave unexpectedly.)

### Questions
- Does it find files on my disk? No. It only says whether a path string fits a pattern; the glob library uses it to list files.
- Why does import minimatch from 'minimatch' fail? Since version 9 there is no default export; use import { minimatch } from 'minimatch'.
- Where did minimatch.makeRe go? Version 11 removed makeRe and the regexp property; it now matches each path part without regular expressions.
- Which wildcard features does it support? Brace sets like {png,jpg}, extended patterns like +(a|b), ** across folders and POSIX character classes.

---
AgentGid's catalog is curated: every entry was checked against the maker's official pages (registry, repository, license and pricing pages) on the date shown; a license value shows the quote it stands on wherever AgentGid has one. Usage numbers come from AgentGid's own scan of public repositories set up for AI coding agents. Claims by makers are reported, not tested by AgentGid.
