Skip to main content

Codebase to Prompt Packager

Manually combine selected code snippets and file paths into a copyable XML prompt

Codebase to Prompt Packager

Up to 50 file entries, 100,000 characters per snippet, and 500,000 characters combined across the instruction, paths, and snippets. Drafts stay in this tab and clear on refresh.

Maximum 100,000 characters; included in the combined draft limit.

Codebase Files & Snippets

2 / 50 file entries · 262 / 500,000 combined characters

Maximum 4,096 characters.

74 / 100,000 characters

Maximum 4,096 characters.

57 / 100,000 characters

Packaged LLM Prompt (XML)

Was this Codebase to Prompt Packager helpful?

Help us keep tools reliable, fast, and bug-free.

What you can do with Codebase to Prompt Packager

  • Convert codebase into llm prompt
  • Bundle files for chatgpt

How this AI tool works

Create a well-formed, copyable XML prompt from a task instruction and manually entered file paths and code snippets; XML-reserved characters are escaped, original text is recovered by an XML parser, drafts stay in browser memory, and file/character limits bound local processing.

Example input

Instruction: Explain how this component reads a user name.
File: src/components/UserProfile.tsx
Code: export function UserProfile({ user }) { return <div>{user.name}</div>; }

Example output

<easyutils_prompt>
  <user_instruction>Explain how this component reads a user name.</user_instruction>

  <codebase>
    <file path="src/components/UserProfile.tsx">export function UserProfile({ user }) { return &lt;div&gt;{user.name}&lt;/div&gt;; }</file>
  </codebase>
</easyutils_prompt>

Practical workflow

  1. Write the task or question in the Global LLM Instruction / Prompt field.
  2. Edit the sample file paths and code snippets, or add and label another file entry.
  3. Review the XML-escaped prompt, then copy it; parsing the XML restores the original instruction, paths, and snippets.

Common use cases

  • Give an AI assistant a small set of related snippets when asking about how modules interact.
  • Prepare a bounded example for discussing a bug without uploading a repository archive.
  • Keep file paths beside manually selected code so an assistant can distinguish snippets in a prompt.

Important notes and limitations

  • The tool assembles XML locally in the browser; it does not read a local folder or send the instruction, paths, or snippets to an API.
  • The prompt has one `easyutils_prompt` root element. Reserved XML characters are escaped in the preview, so an XML parser recovers the original text without allowing snippet content to break the document structure.
  • XML 1.0 forbids several control characters; the preview and copy action are disabled until those characters are removed.
  • A draft can contain up to 50 file entries, 100,000 characters per code snippet, 4,096 per file path, 100,000 in the instruction, and 500,000 characters combined across the instruction, paths, and snippets. The fields enforce their individual limits; edits that exceed the combined limit are rejected with a message. Reduce or remove text to continue.
  • Clear All removes the current draft from page memory and leaves one blank file entry ready for another prompt.
  • Files must be added and pasted manually. The output format is fixed XML; there are no glob filters, Markdown or JSON modes, or file download.

CLI scripts to bundle code repositories for LLMs

git ls-files bundle to single text file

git ls-files | grep -vE '(package-lock|dist|test)' | while read f; do echo "=== File: $f ==="; cat "$f"; echo ""; done > codebase_prompt.txt

Gathers all git-tracked source files, skips lockfiles and build outputs, and outputs a formatted text prompt.

Count total lines & size of code files

git ls-files | grep -E '\.(ts|tsx|py|go|rs)$' | xargs wc -l

Quickly audits line counts of tracked source files before passing context into LLM prompts.

Repomix / Code2prompt CLI alternative

npx --yes repomix --style xml --output repomix-output.xml

Generates an XML-wrapped multi-file repository context file formatted for Claude 3.5 Sonnet and GPT-4o.

Repository Prompt Packaging Format Comparison

Output FormatLLM Parser SuitabilityPath DelimiterMetadata OverheadToken Efficiency
XML Tagging (<file path='...'>)Optimal for Claude 3.5 & GPT-4oExplicit XML attributeLow (~10 tokens per file wrapper)Very High (LLMs parse hierarchy and file boundaries cleanly)
Markdown Code Fences (```path)Standard across all LLMsHeader line before code fenceMinimal (~6 tokens per file)High (Standard readability, occasional fence escaping issues)
Plain Text Delimiters (=== FILE ===)Universal fallbackCustom separator lineMinimalMedium (Can blend with code comments if not distinctly framed)
JSON Wrapped File TreeSpecialized function callingJSON key-value mappingMedium (~20% overhead for string escaping)Lower (Escapes quotes, newlines, and brackets)

Codebase bundling & LLM prompt troubleshooting

Prompt exceeds LLM context window (context_length_exceeded)

Cause: Accidentally including lockfiles ('package-lock.json', 'yarn.lock'), build artifacts ('dist/', 'build/'), or large binary fixtures in prompt.

Solution: Filter out lockfiles, map files, and node_modules. Include only architectural files, schema definitions, and active source modules.

LLM hallucinates missing imports or functions

Cause: Selected files are too fragmented, omitting key type definitions, interfaces, or dependency configurations (e.g. tsconfig.json).

Solution: Include top-level types ('src/types/'), package.json dependencies, and main entry points alongside the target feature code.

Browser freezes or runs out of memory when dropping repository folder

Cause: Dropping an entire project folder containing 50,000+ files in 'node_modules/' or '.git/' into browser file picker.

Solution: Use the folder filter in EasyUtils to automatically skip 'node_modules' and '.git', or drag only the 'src/' directory.

Continue your workflow

  • LLM Token Counter — Measure exact BPE token usage and estimate API costs before sending code to LLMs.
  • System Prompt Builder — Structure persona rules, constraints, and instructions alongside your code bundle.
  • Diff Checker — Compare before and after versions of code suggestions produced by AI assistants.
  • JSON to TypeScript — Generate clean TypeScript interfaces from sample API JSON to guide LLM code generation.
  • LLM Response Cleaner — Clean and extract generated code blocks from AI model responses.
  • Git Utilities — Inspect Git branches, commit logs, and repository status.

Frequently asked questions

How should I provide context from more than one source file?

Add each relevant path and paste its code into a separate file entry. The XML keeps each path next to its snippet, but it does not inspect imports or verify that the files are complete.

Can I upload a folder or choose Markdown output?

No. Add file paths and snippets manually. The generated prompt uses a fixed XML structure and can be copied to the clipboard; folder upload, Markdown or JSON output, and file download are not available.

Why are angle brackets shown as XML entities in the preview?

The preview escapes reserved XML characters such as angle brackets and ampersands to keep the document well-formed. Parsing the XML restores those characters in the instruction and source snippets.

Are the snippets sent to an API?

No. Prompt assembly runs in the browser and the entered instruction, paths, and code are not sent to an EasyUtils API. Copying the result places it on your clipboard.