skills/mdfind-search/SKILL.md
Search files using macOS Spotlight index via mdfind CLI. This skill should be used when searching for files by content, filename, or metadata across the filesystem. Faster than grep for broad content searches since Spotlight pre-indexes everything. Triggers include "find files containing", "search for documents", "locate files", "spotlight search", or any broad file search that would benefit from indexed search.
npx skillsauth add szoloth/skills mdfind-searchInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
macOS Spotlight maintains a constantly-updated index of all files. mdfind is the CLI interface to this index - blazing fast with zero setup, no RAG, no external tools.
| Scenario | Best tool |
|----------|-----------|
| Broad content search across many files | mdfind (pre-indexed, fast) |
| Regex patterns with line numbers/context | Grep (precise) |
| Find files by name pattern | Glob (simple) or mdfind (fuzzy) |
| Search by file metadata (date, type, size) | mdfind (Spotlight metadata) |
| Fuzzy/natural language file search | mdfind (tolerant) |
# Search current directory for content
mdfind -onlyin . "stakeholder feedback"
# Search specific path
mdfind -onlyin /path/to/project "authentication error"
# Search entire machine (omit -onlyin)
mdfind "quarterly report 2025"
# Find by filename pattern
mdfind -onlyin . "kMDItemFSName == '*charles*.md'"
# Case-insensitive filename
mdfind -onlyin . "kMDItemFSName == '*README*'c"
# Files modified in last 7 days
mdfind -onlyin . "kMDItemContentModificationDate > \$time.today(-7)"
# Files created today
mdfind -onlyin . "kMDItemContentCreationDate > \$time.today"
# Large files (> 10MB)
mdfind -onlyin . "kMDItemFSSize > 10000000"
# By file type
mdfind -onlyin . "kMDItemContentType == 'net.daringfireball.markdown'"
mdfind -onlyin . "kMDItemContentType == 'public.python-script'"
mdfind -onlyin . "kMDItemKind == 'PDF Document'"
# Markdown files containing "stakeholder"
mdfind -onlyin . "kMDItemContentType == 'net.daringfireball.markdown' && stakeholder"
# Recent TypeScript files with "auth"
mdfind -onlyin . "kMDItemContentType == 'public.source-code' && kMDItemFSName == '*.ts' && auth"
# PDFs modified this week
mdfind -onlyin . "kMDItemKind == 'PDF Document' && kMDItemContentModificationDate > \$time.today(-7)"
# OR conditions
mdfind -onlyin . "authentication || authorization"
# AND conditions (implicit with &&)
mdfind -onlyin . "user && login && error"
# Exclusion (use grep post-filter)
mdfind -onlyin . "config" | grep -v node_modules
| Attribute | Description | Example |
|-----------|-------------|---------|
| kMDItemFSName | Filename | "kMDItemFSName == '*.md'" |
| kMDItemContentType | UTI type | "kMDItemContentType == 'public.python-script'" |
| kMDItemKind | Human-readable type | "kMDItemKind == 'PDF Document'" |
| kMDItemContentModificationDate | Modified date | "> \$time.today(-7)" |
| kMDItemContentCreationDate | Created date | "> \$time.today(-30)" |
| kMDItemFSSize | File size (bytes) | "> 1000000" |
| kMDItemTextContent | File contents | "kMDItemTextContent == '*error*'" |
| kMDItemAuthors | Document authors | "kMDItemAuthors == 'Sam'" |
| kMDItemTitle | Document title | "kMDItemTitle == '*quarterly*'" |
$time.now # Current time
$time.today # Start of today
$time.today(-1) # Yesterday
$time.today(-7) # 7 days ago
$time.this_week # Start of this week
$time.this_month # Start of this month
$time.this_year # Start of this year
$time.iso(2025-01-15) # Specific date
| Flag | Description |
|------|-------------|
| -onlyin <path> | Scope search to directory |
| -name <pattern> | Search by filename only |
| -live | Keep running, show new matches |
| -count | Just return count of matches |
| -0 | Null-separate output (for xargs) |
# Find all meeting notes from January
mdfind -onlyin . "kMDItemFSName == '*meeting*' && kMDItemContentModificationDate > \$time.iso(2025-01-01) && kMDItemContentModificationDate < \$time.iso(2025-02-01)"
# What did I work on today?
mdfind -onlyin . "kMDItemContentModificationDate > \$time.today"
# What got modified in last hour?
mdfind -onlyin . "kMDItemContentModificationDate > \$time.now(-3600)"
# All Python files mentioning "async"
mdfind -onlyin . "kMDItemContentType == 'public.python-script' && async"
# All images
mdfind -onlyin . "kMDItemContentTypeTree == 'public.image'"
# Find files then read them
mdfind -onlyin . "quarterly report" | head -5 | xargs -I {} echo "File: {}"
# Count matches
mdfind -onlyin . -count "TODO"
# Live monitoring for new matches
mdfind -onlyin . -live "error log"
# Force reindex of a directory
mdimport /path/to/directory
# Check indexing status
mdutil -s /
# List available attributes for a file
mdls /path/to/file.md
# Test query syntax
mdfind -onlyin . "kMDItemFSName == '*.md'" 2>&1 | head
When searching this repository:
mdfind -onlyin . "search terms" for broad discoverymdfind is especially valuable for:
content-media
Fetch transcripts from YouTube videos for summarization and analysis.
documentation
This skill should be used when reviewing or editing written drafts to ensure they match Sam's personal style guide. It prioritizes voice preservation and anti-beige detection while catching structural gaps. Triggers on requests to review, edit, or improve written content.
tools
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.
development
Web search and content extraction using Brave Search. Use when researching topics, finding documentation, extracting article content, or gathering information from the web. No browser required - works headlessly.