AdvancedCoding~15 min
Explain Then Improve
Write a prompt that makes the AI explain code in plain English first, then suggest improvements — in that exact order.
Skills Tested
Phase separationCode explanationTypeScript refactoring
Challenge Prompt
This is the example prompt structure. Write your own variation below.
Analyse this code in two strictly separate phases:
PHASE 1 — EXPLAIN (plain English, no code):
Explain what this function does to a non-programmer in 3 sentences.
PHASE 2 — IMPROVE (code only, no prose):
Rewrite the function with: (1) better variable names, (2) early return pattern, (3) TypeScript strict types.
```javascript
function p(d) {
let r = [];
for(let i=0;i<d.length;i++) {
if(d[i] % 2 == 0) r.push(d[i]);
}
return r;
}
```
Output Phase 1 first, then Phase 2. Do not mix them.Your Prompt
Write your own version. Every word matters — be specific.
🪙
Reward
+200 GeraCoins
Earn GeraCoins for completing this challenge. Redeem across all Gera products.
Hints (3)
- 1The "do not mix them" instruction is critical — without it the AI interleaves explanation and code.
- 2Phase 1 restricted to "no code" and Phase 2 to "no prose" enforces clean separation.
- 3The original function filters even numbers — a simple case that reveals whether the explanation is accurate.
Related Topics
code explanationrefactoringTypeScriptplain Englishtwo-phase output
More Coding challenges
View all Coding →Intermediate
Armenian Phone Validator
Generate a regex that correctly validates Armenian mobile phone numbers — covering all network prefixes and the +374 country code.
IntermediateSQL From Schema
Write a prompt that produces a correct, optimised SQL query from a given schema — without any hallucinated column names.
AdvancedFind the Bug
Write a prompt that makes the AI identify ALL bugs in a given broken Python function — without fixing them first.