batch-operations
/batch-operations
Stosuje jedną zmianę w wielu plikach bezpiecznie: podgląd, wykonanie i weryfikacja przy zmianach nazw i migracjach.
- Autor
- Reprograme ↗
- Repozytorium
- redevkit ↗
- Licencja
- MIT
- Ostatnia zmiana repozytorium
- 12.11.2026
Ocena i bezpieczeństwo
- Pliki w paczce
- 1
- Skrypty
- 0
- Komentarze HTML
- 0
- Adresy URL w SKILL.md
- 0
Brak sygnałów. Repozytorium zmienione 12.11.2026, bez odwołań do wycofanych modeli i API.
MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.
Co robi i kiedy
Stosuje jedną zmianę w wielu plikach bezpiecznie: podgląd, wykonanie i weryfikacja przy zmianach nazw i migracjach.
Oryginalny opis (EN)
Apply one change across many files safely - preview, execute, verify. Use for renames, bulk edits and migrations.
Jak działa
- When to Use
- Batch Operation Protocol
- Splitting a Large Batch Across Subagents
- Common Batch Patterns
- Safety Rules
- Related Skills
Podgląd SKILL.md
---
name: batch-operations
description: Apply one change across many files safely - preview, execute, verify. Use for renames, bulk edits and migrations.
---
# Batch Operations
> Apply consistent changes across many files at once. One pattern, many targets.
## When to Use
**Good for:**
- Renaming a function/component across all files that use it
- Adding an import to every file in a directory
- Updating version numbers across package files
- Applying the same code pattern to multiple similar files
- Migrating from one API to another across the codebase
- Adding/removing a field from all similar data structures
**Not for:**
- Single-file edits (edit directly)
- Unique changes per file (handle individually)
- Changes that need per-file judgment (split by domain and delegate, see below)
## Batch Operation Protocol
### Step 1: Define the Pattern
```text
What: [exact text/pattern to find]
Replace: [exact replacement text]
Scope: [file glob pattern, e.g., "src/**/*.tsx"]
Exclude: [files to skip, e.g., "**/*.test.tsx"]
```
### Step 2: Preview Before Executing
```bash
# Find all affected files FIRST
grep -rl "oldPattern" src/ --include="*.ts"
# Count matches
grep -rc "oldPattern" src/ --include="*.ts" | grep -v ":0$"
# Show context for each match
grep -rn "oldPattern" src/ --include="*.ts"
```
> **NEVER batch-modify without previewing first.** Show the preview to the user, or as a
> subagent return it to the caller (shared question protocol). A batch
> that deletes code or touches many files outside the current feature is a destructive action
> (gate G4): stop and get explicit confirmation.
### Step 3: Execute the Batch
For text replacements:
```bash
# Linux/macOS (GNU sed; on macOS use: sed -i '' ...)
find src -name "*.ts" -exec sed -i 's/oldPattern/newPattern/g' {} +
```
```powershell
# Windows (PowerShell): explicit UTF-8 on read and write (PowerShell 7: utf8NoBOM)
Get-ChildItem -Path src -Recurse -Filter *.ts |
ForEach-Object {
$text = Get-Content $_.FullName -Raw -Encoding UTF8
Set-Content $_.FullName ($text -replace 'oldPattern','newPattern') -NoNewline -Encoding utf8
}
```
Prefer the file-editing tool when the file count allows it. Encoding rules for shell writes:
`{{SKILL:powershell-windows}}` (section 2, "Encoding").
For structural changes (adding imports, wrapping code):
- Use the editor tool on each file instead of regex
- Process files in a consistent order (alphabetical or by dependency)
### Step 4: Verify the Batch
```bash
# Confirm no missed instances (should return nothing)
grep -rl "oldPattern" src/ --include="*.ts"
# Confirm replacements are correct
grep -rn "newPattern" src/ --include="*.ts" | head -5
# Run tests and build to catch breakage
npm run test
npm run build
```
Report the commands you ran and their observed results. Never claim the batch is done without
that evidence.
## Splitting a Large Batch Across Subagents
Delegate only when the files split into **disjoint groups** (no file in two groups) and each
group needs judgment that a regex cannot provide. Otherwise run the batch yourself: one
mechanical pass is faster and easier to verify.
1. Run Step 1 and Step 2 yourself and list every affected file.
2. Partition the files into disjoint groups (by directory or domain). Never let two workers
edit the same file.
3. Give each worker the exact pattern, its file list, the exclusions and the verify command.
4. Wait for every worker, then run Step 4 yourself over the whole scope. You own the synthesis
and the final evidence.
{{#claude}}
Each group goes to a subagent through the Agent tool, one call per group, sent in the same
message so they run concurrently. Pick the persona that owns the domain, for example:
{{DELEGATE:frontend-specialist}}.
{{/claude}}
{{#codex}}
Each group goes to a subagent with `spawn_agent`, one per group, then wait for all of them
before verifying. Pick the persona that owns the domain, for example:
{{DELEGATE:frontend-specialist}}.
{{/codex}}
Subagents never ask the user: they return open questions to you, and you decide or ask.
## Common Batch Patterns
| Operation | Command pattern |
| --- | --- |
| **Rename import** | Find all `import { X }` → replace with `import { Y }` |
| **Update version** | Find `"version": "1.0"` → replace across all package.json |
| **Add export** | Append `export { X }` to all index files |
| **Remove deprecated** | Find `deprecatedFn()` → replace with `newFn()` |
| **Add header** | Prepend license header to all source files |
| **Type migration** | Find `interface X` → replace with `type X =` |
## Safety Rules
1. **Preview first** — always show affected files before modifying
2. **Git safety** — ensure a clean working tree (commit or stash first, with the user's consent)
3. **Exclude tests** — tests often need different treatment than source
4. **Verify after** — run build + tests after every batch operation
5. **Report changes** — list every file modified with a change summary
## Related Skills
| Need | Skill |
| --- | --- |
| Which files a change really affects (large repos, optional tool) | `{{SKILL:code-review-graph}}` |
| Multi-domain coordination | `{{SKILL:redevkit-orchestrate}}` |
Wersje
W bazie nie ma innych skilli o nazwie batch-operations.
Migawka bazy z 13.11.2026 · wersja paczki 567419ff1d48 (skrót SHA-256 całej paczki)
Pobrania w ostatnich 30 dniach: 0 · ranking
Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.
Podobne skille
- 100batch-scripting
Przekształca, migruje i generuje zmiany w wielu plikach naraz przez claude -p: zmiany nazw w całym kodzie, migracje 50+ plików, masowe testy i dokumentacja, z manifestem, dry-run i ponawianiem na podstawie logów. - 100backend-execute
Wprowadza zmiany w plikach i konfiguracji projektu bezpiecznie: podgląd różnic, kopie zapasowe, weryfikację i cofnięcie przy błędzie. - 90sweep-rewriter
Wprowadza jednolitą zmianę w wielu plikach, np. zmiany nazw lub migracje API, z narzędziami AST i skanem pozostałości. - 100processing-api-batches
Optymalizuje masowe żądania API przez batching, throttling i wykonanie równoległe, przy efektywnym przetwarzaniu operacji zbiorczych. - 100processing-api-batches
Optymalizuje masowe żądania API przez batching, throttling i wykonanie równoległe, przy efektywnym przetwarzaniu operacji zbiorczych. - 100batch-fix
Stosuje poprawki z przeglądu lub kilka drobnych korekt w ponad trzech plikach jednym przebiegiem, bez nowych kontraktów.