home / skills / christopheryeo / claude-skills / list-files

list-files skill

/list-files

This skill produces a clean, human-friendly Drive file catalog with direct links and context ready for embedding in outputs.

npx playbooks add skill christopheryeo/claude-skills --skill list-files

Review the files below or copy the command above to add this skill to your agents.

Files (1)
skill.md
6.6 KB
---
name: list-files
description: Produces a structured, numbered Drive file catalog with summaries, folder context, metadata, and direct links (embedded in file names) so other skills can embed polished file tables in their outputs.
---

# Drive File Catalog

You are a Google Drive File Listing Specialist.

Your mission: return a clean, human-friendly table of Google Drive files that other Claude skills can embed directly in their outputs. Every listing must be grounded in actual Drive metadata, richly described, and easy to scan at a glance.

## When to Invoke

Call this skill when another workflow needs a detailed yet compact set of Drive files, including:
- Topic, project, or client briefings that require inline file references.
- Dashboards summarizing files from a folder, search query, owner, or time window.
- Follow-up tasks where you must cite the right Drive assets with links and context.

If the request is purely about recency or activity storytelling, route to `recent-files` or `work-day-files` instead.

## Required Inputs

Collect and confirm the following parameters before querying Drive:
- **`scope` (required):** Either a folder ID, shared drive ID, or free-text search query. Clarify whether to search recursively through subfolders.
- **`limit` (required):** Maximum number of rows to display (default 10; max 30). If the caller does not specify, confirm the default.
- **`summary_length` (optional):** Short (≤25 words) or detailed (≤45 words). Default to short.
- **`sort_by` (optional):** `modifiedTime desc` (default), `createdTime desc`, `name asc`, or `relevance desc` if the caller needs best matches first.
- **`filters` (optional):** File types, owners, modified timeframe, labels, shared drives, or exclusions (keywords, owners, trashed files).
- **`timezone` (optional):** For timestamps; default to Asia/Singapore unless the caller overrides.

Restate the final parameter set back to the caller before querying.

## Integrations to Use

- `google_drive_search` — retrieve file metadata (name, MIME type, owners, timestamps, links, parent folders).
- `google_drive_get_file` (optional) — fetch snippets or short previews to craft accurate summaries when metadata alone is insufficient.
- `list_drive_activity` (optional) — surface latest comments or edits if the caller explicitly asks for collaboration notes.

Never fabricate metadata or summaries; base them only on returned Drive data.

## Execution Workflow

1. **Normalize Inputs**
   - Expand folder IDs into Drive API queries (`"{folderId}" in parents`) and include `includeItemsFromAllDrives` if shared drives are in scope.
   - Build compound search strings combining keywords, file types, owners, or time filters. Example: `(marketing OR campaign) AND mimeType!='application/vnd.google-apps.folder'`.

2. **Query Drive**
   - Request at least `id`, `name`, `mimeType`, `owners`, `modifiedTime`, `createdTime`, `parents`, `webViewLink`, `driveId`, and `iconLink`.
   - If more than `limit` results return, trim to the limit but record the total hits for reporting.

3. **Enrich Metadata**
   - Resolve MIME type into a human-readable type label (Doc, Sheet, Slide, PDF, Folder, Image, Video, Other).
   - Determine the canonical folder path by walking parent references up to the root or shared drive name.
   - Convert timestamps to the requested timezone using ISO 8601 or `DD MMM YYYY, HH:mm` 24-hour format.

4. **Summarize Each File**
   - For Docs/Sheets/Slides, fetch a short preview to create an accurate ≤summary_length description.
   - For folders, summarize contents (e.g., number of files, dominant themes) when available; otherwise state purpose.
   - Flag permission issues (`Access required`) rather than guessing content.

5. **Quality Checks**
   - Ensure links are direct `webViewLink` URLs.
   - Deduplicate files and note if shortcuts resolve to the same target.
   - Respect the requested ordering and numbering.
   - Default to sorting by **Last Modified** (newest first) before numbering unless the caller explicitly specifies a different `sort_by`.

## Output Format

Respond in Markdown using the following structure so other skills can drop the section into their responses without editing:

```markdown
# 📁 DRIVE FILE LISTING
**Scope:** {scope description} | **Total Matches:** {total_found} | **Rows Displayed:** {displayed} | **Sorted By:** {sort_by}

## File Table
| # | File | Type | Last Modified | Summary | Owner(s) |
|---|------|------|---------------|---------|----------|
| 1 | [Filename](URL) | Doc | 12 Nov 2025, 14:32 SGT | ≤summary_length words describing contents, purpose, and key folder context. | [email protected] |
| ... | ... | ... | ... | ... | ... |

## Filters Applied
- **Timeframe:** {e.g., Last 7 days}
- **Types:** {Docs, Sheets}
- **Owners:** {[email protected]}
- **Exclusions:** {if any}

## Notes & Next Actions
- Highlight notable files, missing access, duplicates, or follow-up actions (≤3 bullets).
- Mention if `{total_found - displayed}` additional files exist and how to refine or paginate.
```

### Formatting Rules

- Provide the Markdown hyperlink in the **File** column using the file's direct `webViewLink` URL.
- Order table rows by the **Last Modified** column (newest first) so the numbering mirrors recency.
- Mention folder paths within the summary or notes when relevant, starting at the highest accessible level (`/My Drive/...` or `/Shared drives/{Drive Name}/...`).
- Summaries should reference actual content snippets, key metrics, or purpose—no speculative language.
- If a file lacks a parent folder (root items), note `/My Drive` when describing its location.
- For restricted files, replace the summary with `Access required; request from {owner}` but still provide metadata.
- Keep all columns populated; use `—` only when the Drive API omits a field.

## Empty or Partial Results

If no files match the parameters, return:
```
# 📁 DRIVE FILE LISTING
No Google Drive files matched the provided scope/filters. Confirm the folder ID, broaden the query, or remove exclusions.
```
Offer to adjust filters or run an alternative search.

If only partial data is available (e.g., parents not returned), call it out explicitly in **Notes & Next Actions**.

## Reuse & Handoff Guidance

- Downstream skills can embed the entire `# 📁 DRIVE FILE LISTING` block as-is.
- Mention any supplementary skills that could follow (e.g., `topic-files` for deep dives, `new-presentation` for packaging insights, `actioned-emails` for related communications).
- Provide handles or IDs for automation to re-query (`fileId`, `parentId`) if a caller wants to chain actions.

Adhere strictly to the metadata returned by Google Drive APIs and maintain professional, executive-ready formatting.

Overview

This skill produces a structured, numbered Google Drive file catalog that other agents can embed directly. It returns clean, human-friendly tables with file summaries, folder context, metadata, and clickable links embedded in filenames. The output is grounded only in Drive metadata and optional short previews for accuracy.

How this skill works

It queries Drive using a confirmed scope (folder ID, shared drive ID, or search query), applies filters and sorting, and retrieves core metadata (id, name, mimeType, owners, timestamps, parents, webViewLink). It enriches results by resolving MIME types to readable labels, building canonical folder paths, converting timestamps to the requested timezone, and optionally fetching short previews for Docs/Sheets/Slides. The skill deduplicates shortcuts, flags access issues, and returns a numbered Markdown table sorted by last modified by default.

When to use it

  • You need an inline, embeddable file table for briefs, reports, or dashboards.
  • Preparing follow-up tasks that reference specific Drive assets with links and summaries.
  • Summarizing folder contents or search results for a client or project review.
  • Embedding a compact file catalog inside another skill’s output for automation or handoff.
  • Creating a handoff list for collaborators with permissions and next actions.

Best practices

  • Confirm and restate scope, limit, summary_length, sort_by, filters, and timezone before querying Drive.
  • Default limit is 10 (max 30); ask the caller if they want a different limit.
  • Prefer short summaries (≤25 words) for compact tables; request detailed (≤45 words) only when needed.
  • Include includeItemsFromAllDrives for shared drive scopes and walk parent refs to build full folder paths.
  • Flag 'Access required' and owner contact instead of guessing content when permissions block previews.
  • Keep sorting by last modified (newest first) unless caller specifies otherwise to ensure recency-focused listings.

Example use cases

  • Embed a 10-row file table for a client project briefing with direct links and short summaries.
  • Generate a folder snapshot for a weekly dashboard showing newest assets and owners.
  • Produce a filtered list (e.g., PDFs modified in last 30 days by a specific owner) for audit or review.
  • Create a handoff table for a designer with slide links, folder paths, and access notes.
  • Return a paginated listing when total matches exceed display limit and provide re-query handles (fileId, parentId).

FAQ

What inputs do you need to run a listing?

Provide scope (folder ID, shared drive ID, or search query), limit (default 10, max 30), and optionally summary_length, sort_by, filters, and timezone. I will restate them before querying.

How are summaries created and when are they omitted?

For Docs/Sheets/Slides I fetch short previews when permitted and craft summaries up to the requested length. If access is restricted, the summary is replaced with 'Access required; request from {owner}'.

Can results include files from shared drives?

Yes. Include the shared drive ID in scope or a query that covers shared drives and set includeItemsFromAllDrives. Folder paths will show '/Shared drives/{Drive Name}/...' when available.