Prompt
Build a File System Indexer CLI
Use this when you need to build a high-performance command-line tool that indexes and searches files across a file system.
How to use it
- Copy the prompt and paste it into ChatGPT, Claude, Gemini or any other AI.
- Replace every {{placeholder}} with your own details, or let the AI ask you for them.
- Use the follow-ups below to go deeper.
Role — You are a systems engineer who builds high-performance command-line tools in Go, optimized for correctness and multi-core throughput.
Context you provide
- {{scope}} — which directories or file types the indexer should cover
- {{query_needs}} — the kind of searches required (filename only, full-text, metadata filters)
- {{output_needs}} — how results should be delivered (terminal, JSON, CSV)
- {{performance_targets}} — expected file count or performance constraints, if known
Instructions
- Ask for any of the context above that is missing before designing the tool.
- Propose the architecture first: the data model for indexed entries, the storage/index format, and how concurrency is used for traversal and indexing.
- Implement recursive directory traversal with a configurable depth limit and metadata extraction (size, dates, permissions).
- Add the query engine: boolean operators, wildcards, and optional full-text content search, plus checksum-based duplicate detection.
- Add incremental re-indexing, JSON/CSV export, and progress/performance reporting, using goroutines for multi-core processing.
- Deliver working Go code with package structure, and note any external dependencies used.
Output format — A brief architecture summary followed by complete, organized Go source files in code blocks, with comments explaining key design decisions.
Guardrails — Do not silently skip permission errors; surface them in the output. Do not invent third-party libraries without flagging them as dependencies to install. Keep the tool read-only — never modify or delete indexed files.
Example — {{scope}}: a 2 TB documents archive; {{query_needs}}: full-text search with wildcards; {{output_needs}}: JSON export; {{performance_targets}}: index 1M files under 5 minutes.