sixwhyo – A six-year-old code reviewer who'll ask "why?" for you

6yo.dev · 2026-08-03 · by Long Nguyen ·generic
sixwhyo is the 6-year-old code reviewer that will ask "why?" so you don't have to. Catches over-engineering before it ships.

sixwhyo – A six-year-old code reviewer who'll ask "why?" for you

sixwhyo logo

sixwhyo → six-why-o → 6 y.o.

---

INTRO

`sixwhyo` was created with the sole purpose to help (and remind) you to question your decisions when it comes to writing (potentially) overly complicated code.

Unlike the adults, who tend to overcomplicate things for no reason {p:40} 40% of the time, `sixwhyo` will spend {p:0} 0% of his time figuring out complicated solutions.

This means that your productivity will go {l:10,29,10,31,16,45,20,65,30,85,100} UP↑and your time wasted on trying to figure out the code will go {l:100,60,95,44,68,27,30,5} DOWN↓

SKILLS

`sixwhyo` comes with three skills for different purposes, but with the same goal.

| NAME | DESCRIPTION | | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------- | | sixwhyo | A six-year-old code reviewer who asks "why?" about everything. Catches over-engineering, confusing names, and unnecessary complexity. | | sixwhyo-summarize | Output is a 1-2 line summary of the request as a whole: how is the file? Is the class nice? Is the function correct? | | sixwhyo-simplify | corrects the code according to the language spec, but through kids eyes, maintaining simplicity and readability. |

INSTALLATION

pi install git:github.com/hxii/sixwhyo

For other harnesses (OpenCode, Oh My Pi, Codex), see README

USAGE

| TRIGGER | WHAT IT DOES | | ----------------- | ---------------------------------------------------- | | 6yo | Activates the kid. Stays on until you say stop. | | sixwhyo-simplify | One-shot: reviews and rewrites the code, then exits. | | sixwhyo-summarize | One-shot: 1–2 line file summary, then exits. |

EXAMPLES

BEFORE

# calculator.py
from abc import ABC, abstractmethod

class Operation(ABC): @abstractmethod def execute(self, a: float, b: float) -> float: pass class AdditionOperation(Operation): def execute(self, a: float, b: float) -> float: return a + b

class SubtractionOperation(Operation): def execute(self, a: float, b: float) -> float: return a - b

class MultiplicationOperation(Operation): def execute(self, a: float, b: float) -> float: return a * b

class DivisionOperation(Operation): def execute(self, a: float, b: float) -> float: if b == 0: raise ValueError("Cannot divide by zero") return a / b

class OperationFactory: @staticmethod def create_operation(op_type: str) -> Operation: if op_type == "add": return AdditionOperation() elif op_type == "subtract": return SubtractionOperation() elif op_type == "multiply": return MultiplicationOperation() elif op_type == "divide": return DivisionOperation() else: raise ValueError(f"Unknown operation: {op_type}")

class Calculator: def _init_(self): self.factory = OperationFactory()

def calculate(self, op_type: str, a: float, b: float) -> float: operation = self.factory.create_operation(op_type) return operation.execute(a, b)

def main(): calc = Calculator() result = calc.calculate("add", 5, 3) print(f"Result: {result}")

if _name_ == "_main_": main()

REASONING

This file is too big and I'm confused.

Why is it called test.py when it says calculator.py inside? The comment on line 1 says "calculator.py" but the file is test.py. That's like putting a "cat" label on a dog.

Why so many classes for adding numbers? You have:

  • One class to say "what an operation is" (Operation)
  • Four classes for adding, subtracting, multiplying, dividing
  • One class to make the operations (OperationFactory)
  • One class to use the operations (Calculator)

That's 7 classes to do `a + b`. I can do that with just `a + b`.

Why does the factory need to exist? The factory takes a string like "add" and returns an AdditionOperation. But why not just do the math right there? When I want to add 5 and 3, I don't need to build a machine first.

Why does Calculator need its own class? It just has one method that asks the factory for an operation and runs it. That's two lines of code, not a whole class.

What's good: You did check for dividing by zero. That's smart because dividing by zero makes numbers explode.

AFTER

def calculate(op, a, b):
    if op == "add": return a + b
    if op == "subtract": return a - b
    if op == "multiply": return a * b
    if op == "divide":
        if b == 0: raise ValueError("Cannot divide by zero")
        return a / b
    raise ValueError(f"Unknown operation: {op}")

Submit your Example

6yo.dev · 3 images · 5 links

Comments (0)

No comments yet