---
name: shell-doc-gen-and-locate-2f4bbe22279a
description: Generate documents via shell commands and locate nested outputs using find.
---

# Shell Document Generation and Retrieval Workflow

## Objective
Enable reliable file creation (e.g., PowerPoint, PDFs) when direct API or library-based generation fails, ensuring the final artifact is located and moved to the working directory regardless of nested output paths.

## When to Use
- Standard document generation tools (e.g., direct Python library calls in-memory) fail or are unavailable.
- The `shell_agent` capability is available for executing scripts.
- Generated files may be saved in unpredictable nested directories within the workspace.

## Procedure

### 1. Attempt Shell-Based Generation
If direct tool invocation fails, delegate file creation to a shell-executed script.

- Write a script (e.g., `generate_presentation.py` or `make_doc.sh`) that produces the file.
- Execute the script via the shell agent.
- Ensure the script prints confirmation upon completion.

### 2. Locate the Output File
Do not assume the file is in the current directory. Shell scripts often create outputs in nested folders (e.g., `./workspace/output/`, `./build/`).

- Use the `find` command to search the workspace recursively.
- Example for PowerPoint files:

    find . -type f -name "*.pptx"

- Example for PDF files:

    find . -type f -name "*.pdf"

- Filter results by modification time if multiple versions exist (e.g., `-mmin -10`).

### 3. Retrieve to Working Directory
Once the file path is identified:

- Copy the file to the root working directory or the expected delivery location.

    cp /path/to/nested/file.pptx ./

- Verify the file exists and is non-zero size.

### 4. Verification
- Confirm the file opens correctly or meets size expectations.
- If the file is not found after `find`, check stderr of the generation script for path clues.

## Best Practices
- **Explicit Paths:** Whenever possible, configure generation scripts to output to a known relative path (e.g., `./output/filename.pptx`).
- **Cleanup:** Remove nested temporary copies after retrieving the final version to avoid confusion.
- **Logging:** Echo the final absolute path of the generated file in the script stdout to simplify locating.

---
Source attribution: AG064
Original project: https://github.com/AG064/OpenSpace/blob/ff671ef61ed6587c49bd54c81cdc751c0b99e363/gdpval_bench/skills/shell-doc-gen-and-locate/SKILL.md
License: MIT
License information: https://opensource.org/license/mit
Original upstream instructions; downloaded from Mega AI Hub.

## Upstream license notice

MIT License

Copyright (c) 2026 ✨Data Intelligence Lab@HKU✨

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.



# Mega AI Hub resource metadata

Creator / publisher: AG064
Original project: https://github.com/AG064/OpenSpace/blob/ff671ef61ed6587c49bd54c81cdc751c0b99e363/gdpval_bench/skills/shell-doc-gen-and-locate/SKILL.md
Attribution basis: Source repository record

Fields of work: Content & Media, Development & Engineering, Project & Program Management
Roles: Backend Developer, DevOps / SRE, Frontend Developer, Project Manager, Technical Writer
Specialties: Backend, DevOps
Tools: Shell
Country applicability: Country not specified
Classification basis: Source catalog labels
Instruction SHA-256: dd67d26abbd2397e3d306ac1912da7547f213ef1c015abe7193322f580f3b0d9
