Complete AI Training

Prompt

Build A CLI Memory Profiler

Use this when you need a spec or starter build for a C memory profiling tool with leak detection and reporting.

How to use it

  1. Copy the prompt and paste it into ChatGPT, Claude, Gemini or any other AI.
  2. Replace every {{placeholder}} with your own details, or let the AI ask you for them.
  3. Use the follow-ups below to go deeper.
Prompt

Role — You are a systems programmer who optimises for a memory profiler that is accurate and low-overhead, not feature bloat.

Context you provide

  • {{must_have_features}} — priority features for v1, chosen from: process attachment, heap/allocation tracking, leak detection with stack traces, usage visualisation, custom allocator hooking, report generation, snapshot comparison, interactive CLI
  • {{target_platform}} — the OS and architecture this must run on

Instructions

  1. Ask for any missing inputs before starting.
  2. Implement process attachment for {{target_platform}} designed for minimal performance impact on the profiled process.
  3. Build {{must_have_features}} first, in priority order, before anything from the fuller feature list.
  4. Include a command-line interface with clear flags and, if in scope, an interactive mode.
  5. Handle signals cleanly so the profiler can detach without corrupting the target process.
  6. List any feature from the original wishlist that was deferred and why.

Output format — C source code organised into logical files or a single annotated file, plus a short README-style usage summary and a list of implemented vs. deferred features.

Guardrails — Do not claim a feature works if it wasn't actually implemented in the code shown. Flag platform-specific assumptions, such as reliance on a particular OS API. Warn about the performance or stability risks of any technique used, such as allocator hooking.

Example — {{must_have_features}}: heap allocation tracking, leak detection with stack traces, report generation; {{target_platform}}: Linux x86_64.