/scout:scout-patternfrom scout
Counts lines matching a literal string or regex in source files using `scout pattern`, across the current working tree or git history. Useful for tracking code patterns, TODOs, or migration progress over time.
Ships in scout. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
scout patternSearch sources for a literal substring or a regex, in the current working tree or across commits. Every matching line comes back with its file and line number.
Run scout pattern --help for flags — it is the source of truth. This file covers what the help does not say.
{
"metrics": [
{ "pattern": "import Testing" },
{ "pattern": "// TODO:", "commits": ["abc123", "def456"] },
{ "pattern": "DispatchQueue\\.(main|global)", "isRegex": true }
],
"extensions": ["swift", "m"],
"git": { "repoPath": "/path/to/repo", "clean": true }
}
extensions is a top-level field, not per metric — one run searches one set of extensions, and the default leaves Objective-C, JSON and YAML invisible unless asked for. On the command line the same thing is --extensions swift,m — comma-separated, unlike the config array.
isRegex switches a metric from substring matching to NSRegularExpression. It is config-only — there is no CLI flag, so a regex metric needs a config file. In JSON every backslash doubles: "\\btry!\\s", "@available\\(.*deprecated".
{
"commit": "abc1234def5678",
"date": "2025-01-15T07:30:00Z",
"results": [
{
"pattern": "import UIKit",
"matches": [
{ "file": "Sources/App.swift", "line": 1 },
{ "file": "Sources/View.swift", "line": 1 }
]
}
]
}
matches | length counts matching lines, not occurrences. The search walks the file line by line and records a line once, however many times the pattern appears on it — import UIKit; import Combine on one line is one entry. For a file count, [.matches[].file] | unique | length.
Because matching is per line, a regex can never span a newline: func .*\n.*async finds nothing.
scout pattern "import UIKit" "import SwiftUI" --output /tmp/pattern.json
jq -r '.[] | .results[] | "\(.pattern)\t\(.matches | length)\t\([.matches[].file] | unique | length)"' \
/tmp/pattern.json
No --commits, so scout reads the files as they are — uncommitted changes included — and changes nothing in git: no checkout, no clean. Start here; replay history only when the question is about change over time.
Columns: pattern, matching lines, files touched.
cat > /tmp/pattern.json <<'JSON'
{ "metrics": [ { "pattern": "\\btry!\\s", "isRegex": true }, { "pattern": "\\w+!", "isRegex": true } ] }
JSON
scout pattern --config /tmp/pattern.json --output /tmp/unsafe.json
jq -r '.[] | .date as $d | .results[] | [$d, .pattern, (.matches | length)] | @csv' /tmp/pattern.json
jq -r '.[-1].results[] | select(.pattern == "// TODO:") | .matches[].file' /tmp/pattern.json \
| sort | uniq -c | sort -rn | head -20
// import UIKit inside a comment counts just as much.isRegex exists only in the config.extensions when counting in Objective-C, Kotlin or config files — the default silently returns zero.extensions to binary or non-UTF-8 files. One .strings file in UTF-16, one .png, one .pdf and the whole run dies with NSCocoaErrorDomain Code=259; --output keeps only the commits that finished before the abort..github, .claude-plugin and friends are skipped. Vendored trees like Pods/ are not hidden, so those are counted — filter the JSON.class X: UIView misses class X: UIControl; that's scout-types.scout-types — inheritance-aware counting, including base classes from the SDK.scout (umbrella) — output envelope, per-metric commits, --git-clean footgun, detached HEAD after a historical run.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
pattern-counting, git-history, code-search, migration-tracking
npx claudepluginhub dodobrands/scout --plugin scout6 skills in this plugin
/scoutPlan and run a multi-metric measurement of a repository with the `scout` CLI, and pick which subcommand a request needs. Trigger on cross-cutting intent rather than a single number, e.g. "build a dashboard of codebase metrics", "measure how this repo changed over two years", "I need numbers for the UIKit-to-SwiftUI migration from several angles", "set up a monthly metrics job in CI", "what can we even measure about this codebase?", "which scout command do I want for this?", "collect these metrics at the same commits so the series line up", "how do I run this over history without wrecking my working copy?". Also the place for anything shared across metrics — replaying over git history, the output envelope, config vs CLI precedence, and the ways a historical run damages a working checkout. Single-axis questions belong to `scout-types`, `scout-files`, `scout-pattern`, `scout-loc` or `scout-build-settings`./scout-build-settingsExtract Xcode build settings per target with `scout build-settings`. Trigger when the question is about project configuration rather than source code, e.g. "which Swift version do our targets build with?", "what is our minimum iOS deployment target?", "which modules still have strict concurrency off?", "when did we move to Swift 6?", "show SWIFT_VERSION per target across the last year". Discovers `.xcodeproj` files by glob and can run setup commands first, so Tuist and XcodeGen projects work too. macOS only./scout-filesCount files by extension with `scout files` and replay that count over git history. Use it whenever the answer is a per-extension inventory or how one moved over time — "сколько сторибордов было год назад и сколько сейчас", "how many yml files were in .github a year ago versus now", "how did the markdown file count change per quarter", "file counts for swift, storyboard and xib at these three commits", "a burn-down of our graphql files across the last 12 months as data I can chart", "export swift/storyboard/xib counts as json every month for Grafana", "an inventory of every .sh file with its path", "track the disappearance of our .nib files, one point per quarter". Any extension counts, not only iOS ones. A bare count in the current checkout is a job for find; this skill earns its place when the question spans commits, needs the paths, or has to produce data that lines up with the other scout metrics. It counts files, never their size on disk./scout-locCount lines of code with `scout loc`, a `cloc` wrapper that can replay the count over git history. Trigger when the question is about size rather than count, e.g. "how many lines of Swift do we have?", "how did the codebase grow over two years?", "lines of code per module", "how much Objective-C is left in the legacy module?", "app code versus test code". Takes several languages per metric plus directory include/exclude filters./scout-typesCount Swift types by inheritance with `scout types`. Trigger when the question is about how many types derive from a base, e.g. "how many UIViewControllers do we have?", "list every SwiftUI View in this repo", "how many XCTestCase subclasses are left?", "list every subclass of our BaseViewModel with its file path", "how many types inherit from UseCase<*>, where the generic parameter varies?", "count our BaseCoordinator subclasses", "track adoption of our new Repository<*> base class across commits since january", "did UIKit screens shrink over the last year?", "which files declare UIView subclasses?". Resolves inheritance through the source and through the Xcode SDK, so `UICollectionViewCell` subclasses count as `UIView`.Other plugins' skills for the same job