✳ IskraAI

Code from description: how to get useful code from a text request

The "Code from description" tool helps you quickly get a small program from a textual description. Its key feature -- no automatic execution: you get the source code, usage instructions and explicitly stated assumptions, and you run everything manually. This reduces risks and allows you to check the logic first. In this article we will examine how the form is set up, how to formulate queries and what to look for when checking. All examples are fabricated and provided only for illustration.

Ouvrir l'outil: Générateur de code ↗

How the form is set up and what is entered as input

The form consists of three fields: "Your text or idea", "Platform or application" and "Goal or desired result". In the first field is inserted a natural language description of the task, in the second -- the language or environment (for example, Python 3.11, JavaScript in the browser, Bash), in the third -- what is considered success: console output, return value, file creation. The input field accepts up to 8000 characters, additional details -- up to 1000 characters. This allows you to describe not only a function, but also constraints: prohibition of external libraries, error handling, output format.

The tool returns a single result in a separate panel. It can be copied or downloaded as a plain text TXT file. There is no automatic execution, saving or integration with repositories. You decide yourself where to insert the code and how to run it. This is important for security: the generated code is not executed on the server and has no access to your data.

The model can make mistakes, and queue and availability vary. Therefore, the result should always be checked: read the assumptions, run on test data and compare with the expected behavior. The tool does not guarantee correctness and does not replace review.

Example query: "Write a Python function that takes a list of numbers and returns a new list without duplicates, preserving order. No external libraries. Add an instruction to run and state assumptions."

Scenario 1: data cleaning utility

Suppose you are an analyst and often receive CSV exports with extra spaces and empty lines. You need a small program that reads a file, removes empty lines, trims spaces in each field and saves the result to a new file. This is a typical task where the generator saves time on template code.

The query should contain the input data format, delimiter, encoding and what to do with the header. The more specific the description, the fewer assumptions you will have to correct. Specify that the program must not overwrite the original file and must output the number of processed lines.

A useful result is not only code, but also an instruction: how to run it, what arguments to pass, what happens if the file is missing. Check that error handling does not silently swallow exceptions and that the encoding is explicitly set.

Query: "Python script: reads CSV with delimiter ; in utf-8 encoding, removes fully empty lines, trims spaces at the beginning and end of each field, saves to a new file with _clean suffix. Outputs the number of deleted lines. No pandas. Add an instruction to run and assumptions."

Scenario 2: function for a web page

The second scenario is a small JavaScript function for a web page. For example, you need to highlight rows in a table where the value in a column exceeds a given threshold. This can be done without frameworks, using the pure DOM API. The generator will help you quickly get a working skeleton.

In the query specify the HTML structure, classes or element identifiers, threshold and highlight color. It is important to agree that the function must not break existing handlers and must work after the DOM is loaded. If you do not want to use external libraries, write it explicitly.

Result check: open the page in a browser, make sure the highlighting is applied only to the required rows, and that it is not duplicated on repeated calls. Check if there is protection against missing elements -- otherwise the function will crash.

Query: "JavaScript function highlightAbove(threshold, color): finds a table with id results, iterates over tbody rows, compares the number in the third column with threshold, if exceeded adds a background color to the row. No libraries. Do not execute automatically. Add an instruction for connecting and assumptions."

Scenario 3: script for automating routine

The third scenario is a Bash script for backing up a folder with reports. It should create an archive with the date in the name, check for the existence of the source folder and not delete old archives without confirmation. This is an example where assumptions about paths and access rights are important.

Describe where the source data is located, where to save the archives, whether a log is needed. Specify that the script must not be run automatically on a schedule -- only manually. This corresponds to the tool policy: no automatic execution.

A useful result contains commands with explanations, return code checks and clear error messages. Test on a test folder: is the archive created, is the date format correct, is an existing file overwritten.

Query: "Bash script: takes a path to a folder, creates a tar.gz archive in ~/backups with name reports_YYYY-MM-DD.tar.gz, checks for the existence of the folder, outputs a success or error message. Does not delete old archives. Add an instruction to run and assumptions."

How to formulate a query to get useful code

Main rule: describe not only what to do, but also what not to do. Prohibition of external libraries, network requests, file modification -- all this reduces the number of edits. If the task allows several interpretations, choose one and state it explicitly.

Add examples of input and expected output data. This helps the model understand the format. For example: "input [1,2,2,3], output [1,2,3]". Do not be afraid to indicate edge cases: empty list, missing file, negative number.

Ask to include an instruction for use and a list of assumptions. This is not decoration, it is part of the result: from the assumptions you quickly understand where the code may differ from your environment. If an assumption is incorrect, correct the query and generate again.

Good query: "Python function unique(seq) returns a list without duplicates preserving order. Input: any iterable. Output: list. Example: [1,2,2,3] -> [1,2,3]. No external libraries. Add a docstring, run instruction and assumptions."

Checking the result and tool limitations

After generation read the code in full. Check that it does not contain unfamiliar calls, does not access the network and does not delete data without warning. Run on a test set, compare with the expected result. If there are tests -- add them manually, the tool does not create them automatically.

Limitations: no automatic execution, saving, integrations and batch processing. Cannot upload documents, no DOCX or PDF export, no change highlighting and comparison modes. Result -- only text that can be copied or downloaded as TXT. The model can make mistakes, and availability of the queue changes.

The tool is not intended for generating photorealistic images, audio or video. It works with text code. If the task goes beyond these limits, the result will be useless. Always check the code before using it in real projects.

Check: run the function on an empty list, a list with one element and a list with repeating values. Make sure the order is preserved and the original list is not modified.

"Code from description" is an assistant for quickly creating small programs from textual descriptions. It does not execute code and does not guarantee correctness, but it saves time on template tasks, if the query is specific. Use the three form fields, specify the platform, goal and limitations, ask for instructions and assumptions. Check the result on test data and remember the limitations: text only, no automation and no integrations. Examples in the article are fabricated and provided only for illustration.

Ouvrir l'outil: Générateur de code ↗

Les traductions de l'interface sont assistées par machine et peuvent nécessiter des améliorations.