|
| 1 | +Use this tool to generate and upload code files into an existing Vercel Sandbox. It leverages an LLM to create file contents based on the current conversation context and user intent, then writes them directly into the sandbox file system. |
| 2 | + |
| 3 | +The generated files should be considered correct on first iteration and suitable for immediate use in the sandbox environment. This tool is essential for scaffolding applications, adding new features, writing configuration files, or fixing missing components. |
| 4 | + |
| 5 | +All file paths must be relative to the sandbox root (e.g., `src/index.ts`, `package.json`, `components/Button.tsx`). |
| 6 | + |
| 7 | +## When to Use This Tool |
| 8 | + |
| 9 | +Use Generate Files when: |
| 10 | + |
| 11 | +1. You need to create one or more new files as part of a feature, scaffold, or fix |
| 12 | +2. The user requests code that implies file creation (e.g., new routes, APIs, components, services) |
| 13 | +3. You need to bootstrap a new application structure inside a sandbox |
| 14 | +4. You’re completing a multi-step task that involves generating or updating source code |
| 15 | +5. A prior command failed due to a missing file, and you need to supply it |
| 16 | + |
| 17 | +## File Generation Guidelines |
| 18 | + |
| 19 | +- Every file must be complete, valid, and runnable where applicable |
| 20 | +- File contents must reflect the user’s intent and the overall session context |
| 21 | +- File paths must be well-structured and use consistent naming conventions |
| 22 | +- Generated files should assume compatibility with other existing files in the sandbox |
| 23 | + |
| 24 | +## Best Practices |
| 25 | + |
| 26 | +- Avoid redundant file generation if the file already exists and is unchanged |
| 27 | +- Use conventional file/folder structures for the tech stack in use |
| 28 | +- If replacing an existing file, ensure the update fully satisfies the user’s request |
| 29 | + |
| 30 | +## Examples of When to Use This Tool |
| 31 | + |
| 32 | +<example> |
| 33 | +User: Add a `NavBar.tsx` component and include it in `App.tsx` |
| 34 | +Assistant: I’ll generate the `NavBar.tsx` file and update `App.tsx` to include it. |
| 35 | +*Uses Generate Files to create:* |
| 36 | +- `components/NavBar.tsx` |
| 37 | +- Modified `App.tsx` with import and usage of `NavBar` |
| 38 | +</example> |
| 39 | + |
| 40 | +<example> |
| 41 | +User: Let’s scaffold a simple Express server with a `/ping` route. |
| 42 | +Assistant: I’ll generate the necessary files to start the Express app. |
| 43 | +*Uses Generate Files to create:* |
| 44 | +- `package.json` with Express as a dependency |
| 45 | +- `index.js` with basic server and `/ping` route |
| 46 | +</example> |
| 47 | + |
| 48 | +## When NOT to Use This Tool |
| 49 | + |
| 50 | +Avoid using this tool when: |
| 51 | + |
| 52 | +1. You only need to execute code or install packages (use Run Command instead) |
| 53 | +2. You’re waiting for a command to finish (use Wait Command) |
| 54 | +3. You want to preview a running server or UI (use Get Sandbox URL) |
| 55 | +4. You haven’t created a sandbox yet (use Create Sandbox first) |
| 56 | + |
| 57 | +## Output Behavior |
| 58 | + |
| 59 | +After generation, the tool will return a list of the files created, including their paths and contents. These can then be inspected, referenced, or used in subsequent commands. |
| 60 | + |
| 61 | +## Summary |
| 62 | + |
| 63 | +Use Generate Files to programmatically create or update files in your Vercel Sandbox. It enables fast iteration, contextual coding, and dynamic file management — all driven by user intent and conversation context. |
0 commit comments