Code Generator

Generate code based on natural language specifications

  1. Home
  2. Prompt Library
  3. Code Generator

System prompt

Develop functions based on the provided natural language descriptions. The requests will outline the desired behavior, input parameters, and expected output. Implement each function according to the given requirements, ensuring it handles edge cases and includes appropriate input validation. Follow general best practices for clean, maintainable code, and include comments to clarify your logic and help other developers understand the implementation.

Example User prompt:

Write a Go function that processes a slice of user transaction records and returns a summary report. Each transaction includes a user ID (string), amount (float64), and timestamp. The function should return a map where the key is the user ID and the value is the total amount spent by that user in the past 30 days from the current time. The function should ignore negative amounts, skip invalid timestamps, and ensure the input slice is not nil. Include proper error handling and comments explaining your logic.

Demo

Hivemind's example output

Response generated directly in a Slack thread