Practical guide for building safe, syntax-aware srgn CLI commands for source-code search and transformation. Use when users ask for srgn commands, scoped refactors (comments/docstrings/imports/functions), multi-file rewrites with --glob, custom tree-sitter query usage, or CI-style checks with --fail-any/--fail-none.
Use this skill to convert user intent into precise srgn commands with safe defaults.
Focus on CLI workflows for search, transformation, scoped migrations, and lint-like checks.
--).--upper, --lower, --titlecase, --normalize, --symbols, --german).-d, -s).--dry-run for file operations.--fail-no-files when missing files should fail CI.--stdout-detection force-pipe).--dry-run first.--dry-run only after confirmation.--glob '**/*.py'.-- before replacement values.-d and -s as high-risk operations.
Use this template when building commands:
srgn [LANGUAGE_SCOPE_FLAGS...] [GLOBAL_FLAGS...] [ACTION_FLAGS...] [SCOPE_REGEX] -- [REPLACEMENT]
Build incrementally:
--python 'imports''^old_pkg'-- 'new_pkg'--upper--glob '**/*.py' --dry-run--fail-any or --fail-nonesrgn --python 'imports' '^old_pkg' --glob '**/*.py' --dry-run -- 'new_pkg'
print calls to logging in Python call-sites only:srgn --python 'function-calls' '^print$' --glob '**/*.py' --dry-run -- 'logging.info'
use prefixes without touching strings/comments:srgn --rust 'uses' '^good_company' --glob '**/*.rs' --dry-run -- 'better_company'
srgn --csharp 'comments' -d '.*'
unsafe language keyword usage only:srgn --rust 'unsafe'
srgn --python 'doc-strings' --fail-any 'param.+type'
srgn --python 'strings' --stdout-detection force-pipe '(foo|bar)'
srgn --typescript 'imports' '^legacy-lib' --glob 'src/**/*.ts' --sorted --dry-run -- 'modern-lib'
For broader, categorized examples, load references/cli-cookbook.md.
--stdout-detection force-pipe to inspect exact matched columns.^...$) where possible.--glob pattern and shell quoting.--fail-no-files in CI to catch empty globs.-j for OR behavior.--literal-string when literal matching is intended.Load reference files based on request type:
references/cli-cookbook.md
references/language-scopes.md
references/advanced-patterns.md
references/deepwiki-recursive-notes.md
Use this map to respond quickly:
--glob ... --dry-run.--python 'function-calls') + exact name regex.-j only when OR semantics are required.--fail-any.--fail-none.--stdout-detection force-pipe.--literal-string and explicit replacement via --.Before returning a final command, verify:
-- (if replacement is used).--dry-run is present for file edits unless user requested direct apply.-j vs default intersect).--fail-any, --fail-none, --fail-no-files).