"think twice, code once" as they say. I would encourage to create a process that helps your child to first become a better thinker and in turn to be a better coder. Developing his/her ability to be a good thinker and creating the enthusiasm to code the process/program that your Child thought of would go a long way I believe.
Have you taught your child the usage of flowcharts as a simple method to visualize the input and output of code. There are a multitude of online flowcharting software programs that allow you to quickly and easily visualize your programs. These come with built in shapes that demonstrate areas in coding such as input, output, connectors, decision, terminal and so forth. Have your child give it a try.
The practice of effectively planning and detailing out a process before development allows for more robust programs. Flowcharting is key to developing a broader way of thinking, and it allows you to account for more of the “big picture” stuff.