library-cleanup

Organizes SharePoint document libraries by detecting duplicates, renaming files, and restructuring folders.

128|50|Updated May 4, 2026
One-click install
npx skills add https://github.com/pnp/sharepoint-skills --skill library-cleanup-pnp
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: library-cleanup
Source: https://github.com/pnp/sharepoint-skills/tree/main/Skills/library-cleanup/library-cleanup
Command: npx skills add https://github.com/pnp/sharepoint-skills --skill library-cleanup-pnp

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? SharePoint document libraries accumulate duplicate files, empty folders, vague names, and deep nesting over time, making content hard to find for both people and AI. This Skill audits the library, proposes a clean structure with content-based renames, and executes the reorganization with user approval. ## Core Features & Use Cases - Library Audit & Scoring: Recursively scans all files and folders, summarizes duplicates, empty folders, bad names, and excessive nesting, then computes a 0-100 Organization Score. - Content-Based Renaming: Reads the actual content of badly named files to propose meaningful, descriptive new names instead of generic placeholders. - Guided Execution with TODO Checklist: Presents a before/after plan with visualizations, then executes moves, renames, and deletions in batches with a live progress checklist and failure tracking. - Impact Dashboard: Generates a self-contained HTML report comparing before/after metrics, with a Markdown fallback if file creation fails. - Use Case: A site owner inherits a messy project library with folders like "Stuff" and files like "doc1.docx". The Skill scans everything, proposes a clean structure with descriptive names derived from file content, and reorganizes the library after approval. ## Quick Start Open Copilot in SharePoint on the site and say "clean up file demo" to start the library scan and reorganization workflow.

Frequently Asked Questions about library-cleanup

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I clean up a messy SharePoint document library with Copilot?▼

Install the skill package into the Skills folder of your site's Agent Assets library, then open Copilot in SharePoint and say "clean up file demo". The skill scans the library, proposes a new structure with renames, and executes only after you approve the plan.

How does the skill rename files with vague names like doc1.docx?▼

The skill reads the actual content of every badly named file using cat_file and derives a new name from the document's title, subject, client, or project. It never uses generic placeholders like "Unnamed Document.pdf".

Does the skill delete or move files without my approval?▼

No. The skill never deletes, moves, or renames anything until you explicitly approve the full plan presented in Phase 2, which includes the proposed structure, rename table, and before/after comparison.

Can the skill handle large SharePoint libraries with thousands of files?▼

Yes. For libraries over 1000 items it falls back to per-folder scanning, reads content only for rename candidates, and batches move/rename operations in groups of about 50 with pauses between batches.

What happens if a file move or rename fails during cleanup?▼

The run does not abort. The failed item is retried once for transient errors, then marked with a failure indicator and reason in the checklist, and the impact report lists all items needing attention.

What permissions do I need to run a SharePoint library cleanup skill?▼

You need Edit permission on the SharePoint site to install the skill into the Agent Assets library, and an active Microsoft Copilot license with Copilot in SharePoint available on the site.