file-management
Organize, back up, compress, split, and merge files/folders using rule-driven plans; use when you need safe previews, conflict handling, and verification before executing file operations.
Best use case
file-management is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Organize, back up, compress, split, and merge files/folders using rule-driven plans; use when you need safe previews, conflict handling, and verification before executing file operations.
Teams using file-management should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/file-management/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How file-management Compares
| Feature / Agent | file-management | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Organize, back up, compress, split, and merge files/folders using rule-driven plans; use when you need safe previews, conflict handling, and verification before executing file operations.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
> **Source**: [https://github.com/aipoch/medical-research-skills](https://github.com/aipoch/medical-research-skills)
# File Management
## When to Use
- You need to **reorganize a directory** (move/copy/rename) based on include/exclude patterns and a target folder structure.
- You want a **repeatable backup workflow** (copy or archive) with optional retention rules and verification manifests.
- You need to **compress** a folder or a set of files to reduce size or package deliverables.
- You must **split very large files** into fixed-size parts for transfer/storage limits (binary-safe).
- You need to **merge previously split parts** back into the original file reliably (binary-safe).
## Key Features
- **Safety-first planning**: generate a preview/manifest of intended actions before writing changes.
- **Rule-driven scope control**: root path + include/exclude patterns + thresholds + target structure (see `references/rule-schema.md`).
- **Conflict handling**: default to skip/rename on collisions; overwrite only with explicit confirmation.
- **Non-destructive defaults**: avoid deletion unless explicitly requested.
- **Verification support**: compare counts/sizes and optionally generate hashes for critical backups.
- **Binary-safe split/merge**: split by fixed size and merge parts without corrupting binary data (`scripts/`).
## Dependencies
- PowerShell 5.1+ (Windows PowerShell) or PowerShell 7+
- Cmdlets used: `Get-ChildItem`, `Copy-Item`, `Move-Item`, `Compress-Archive`, `Get-FileHash`
- Python 3.8+ (for split/merge scripts)
- `scripts/split_file.py`
- `scripts/merge_parts.py`
## Example Usage
### 1) Organize files with a preview plan (PowerShell)
```powershell
# Inputs (adjust to your case)
$Root = "D:\Inbox"
$Target = "D:\Organized"
$Include = @("*.pdf","*.docx")
$ExcludeDirs = @("node_modules",".git")
$WhatIf = $true # set to $false to execute
# Build a manifest (preview plan)
$files = Get-ChildItem -Path $Root -Recurse -File |
Where-Object {
($Include | ForEach-Object { $_ }) -contains $_.Extension -eq $false
}
# Practical include filter (simple example)
$files = Get-ChildItem -Path $Root -Recurse -File -Include $Include
# Exclude directories by path segment
$files = $files | Where-Object {
$p = $_.FullName
-not ($ExcludeDirs | Where-Object { $p -match [regex]::Escape("\$_\") })
}
$plan = foreach ($f in $files) {
# Example target structure: by extension
$ext = $f.Extension.TrimStart(".").ToLower()
$destDir = Join-Path $Target $ext
$destPath = Join-Path $destDir $f.Name
[pscustomobject]@{
Source = $f.FullName
Destination = $destPath
Action = "Copy" # start with Copy; switch to Move after verification
}
}
# Preview
$plan | Format-Table -AutoSize
# Execute (safe defaults: create dirs; do not overwrite unless you decide to)
foreach ($item in $plan) {
$destDir = Split-Path $item.Destination -Parent
if (-not (Test-Path $destDir)) { New-Item -ItemType Directory -Path $destDir | Out-Null }
if (Test-Path $item.Destination) {
# Default conflict strategy: rename
$base = [IO.Path]::GetFileNameWithoutExtension($item.Destination)
$ext = [IO.Path]::GetExtension($item.Destination)
$dir = Split-Path $item.Destination -Parent
$item.Destination = Join-Path $dir ("{0}_{1}{2}" -f $base, (Get-Date -Format "yyyyMMddHHmmss"), $ext)
}
if ($item.Action -eq "Copy") {
Copy-Item -LiteralPath $item.Source -Destination $item.Destination -WhatIf:$WhatIf
} else {
Move-Item -LiteralPath $item.Source -Destination $item.Destination -WhatIf:$WhatIf
}
}
```
### 2) Backup + hash manifest (PowerShell)
```powershell
$Source = "D:\Project"
$BackupRoot = "E:\Backups"
$Stamp = Get-Date -Format "yyyyMMdd_HHmmss"
$BackupDir = Join-Path $BackupRoot ("Project_{0}" -f $Stamp)
# Copy backup
Copy-Item -Path $Source -Destination $BackupDir -Recurse
# Create a hash manifest for verification
$manifestPath = Join-Path $BackupDir "hash-manifest.sha256.txt"
Get-ChildItem -Path $BackupDir -Recurse -File |
ForEach-Object {
$h = Get-FileHash -Algorithm SHA256 -LiteralPath $_.FullName
"{0} {1}" -f $h.Hash, ($_.FullName.Substring($BackupDir.Length + 1))
} | Set-Content -Encoding UTF8 $manifestPath
```
### 3) Compress a folder (PowerShell)
```powershell
$SourceDir = "D:\Project"
$ZipPath = "E:\Archives\Project.zip"
Compress-Archive -Path (Join-Path $SourceDir "*") -DestinationPath $ZipPath -Force
```
### 4) Split and merge a large file (Python)
```bash
# Split into 100MB parts (binary-safe)
python scripts/split_file.py --input "E:\ISO\big.iso" --part-size 100MB --output-dir "E:\ISO\parts"
# Merge parts back (binary-safe)
python scripts/merge_parts.py --input-dir "E:\ISO\parts" --output "E:\ISO\big.iso"
```
> Note: CLI flags may vary depending on the scripts’ implementation. If the scripts do not expose flags, adapt the commands to match their actual parameters.
## Implementation Details
- **Rule schema and planning**
- Prefer structured rules to define:
- `rootPath`
- include/exclude patterns (glob-like)
- optional size thresholds (e.g., split if `> N MB`)
- target structure mapping (e.g., by extension/date/project)
- conflict strategy (`skip`, `rename`, `overwrite`)
- Use `references/rule-schema.md` as the canonical format for describing these rules.
- **Preview-first execution**
- Generate a **manifest/plan** listing `(source, destination, action)` before any write operation.
- Use PowerShell `-WhatIf` (or an explicit “dry run” mode) to validate the plan.
- **Conflict handling**
- Default behavior should be **non-destructive**:
- If destination exists: **rename** (append timestamp or counter) or **skip**
- Only **overwrite** after explicit user confirmation
- **Verification**
- Basic checks: file counts and total sizes before/after.
- Strong checks for critical backups: `SHA256` via `Get-FileHash`, stored as a manifest for later validation.
- **Binary-safe splitting/merging**
- Splitting should read/write raw bytes in fixed-size chunks (no text encoding).
- Merging should concatenate parts in deterministic order (e.g., numeric suffix ordering) to reproduce the original byte stream exactly.Related Skills
schedule-management
Local schedule management for adding events, tracking deadlines, generating reminders, and detecting time conflicts when users need offline scheduling with optional popup notifications.
literature-management
Import local literature into a managed library; trigger when you need offline deduplication, tagging, and a searchable index.
file-security-toolkit
Encrypt/decrypt local files, redact sensitive information in documents, and validate password strength when handling private data or preparing files for sharing.
file-search
Perform fast file name and content searches with ripgrep (rg); use it when you need to locate files by glob/regex, find keywords across directories, or replace common find/grep workflows.
citation-management
Comprehensive citation management for academic research; use when you need to discover papers (Google Scholar/PubMed), extract/verify metadata (DOI/PMID/arXiv/URL), and produce validated, clean BibTeX for manuscripts.
single-drug-faers-safety-profile
Generates complete FAERS pharmacovigilance study designs for one-drug whole-profile safety mapping using signal detection, subgroup analysis, onset/seriousness characterization, and conservative label-gap interpretation.
skill-auditor
A comprehensive auditor for any agent skill — including Manus, OpenClaw/ClawHub, Claude, LobeHub, or custom SKILL.md-based skills. Use this skill whenever a user wants to evaluate, audit, review, score, or quality-check an agent skill before publishing, updating, or deploying. Covers two hard veto gates (structural redlines + research integrity redlines), static quality scoring across 25 criteria (ISO 25010 + OpenSSF + Agent), dynamic test input generation, multi-mode execution testing, multi-layer output evaluation with five specialized category rubrics (Evidence Insight / Protocol Design / Data Analysis / Academic Writing / Other), a Research Veto that applies to all four research categories, human eval viewer generation, actionable P0/P1/P2 optimization recommendations, and automatic skill improvement that outputs a polished, production-ready SKILL.md. Also use whenever a user says "audit my skill", "evaluate my skill", "improve my skill", or wants a corrected version after evaluation.
two-sample-mr-research-planner
Generates complete two-sample Mendelian randomization (MR) research designs from a user-provided research direction. Use when users want to design, plan, or build a study using two-sample MR to test causal relationships. Triggers:"design a two-sample MR study", "build a publishable MR paper", "test whether this biomarker causally affects this disease", "generate Lite/Standard/Advanced MR plans", "screen multiple exposures with MR", "bidirectional MR design", "causal inference using GWAS summary statistics", or "I want to study X and Y using MR". Always outputs four workload configurations (Lite / Standard / Advanced / Publication+) with a recommended primary plan, step-by-step workflow, figure plan, validation strategy, minimal executable version, and publication upgrade path.
research-proposal-generator
Generates a comprehensive research proposal design based on input literature, including hypothesis, mechanism verification, and budget. Use when the user wants to design a research project from a paper.
research-grants
Write competitive research proposals for NSF, NIH, DOE, DARPA, and Taiwan's NSTC when you need agency-compliant narratives, budgets, and review-criteria alignment for a specific solicitation/FOA/BAA.
protocol-standardization
Standardize fragmented experimental steps into reproducible protocol documents when you need method organization, lab SOP drafting, or cross-operator reproducibility; missing parameters must be explicitly marked as "To be supplemented/Not provided".
prospero-registration-helper
Assists researchers in generating PROSPERO registration content for meta-analyses from a title and optional protocol. Use when the user wants to draft a PROSPERO registration form.