Greeting
Level: Beginner 15–30 minConcepts: Strings
Solutions: C# | TypeScript | Python
This kata is designed to start of simple and slowly become more complex as additional requirements are added that will require branching.
1. Greet a single Write a method greet(name) that uses name in a simple greeting. For example, when name is ‘Bob’, the method should return a string “Hello, Bob.”
2. Handle nulls by using a stand-in Handle nulls by introducing a stand-in. For example, when name is null, then the method should return the string “Hello, my friend.”
3. Handle shouting When a name is all uppercase, then the method should shout back to the user. For example, when name is “JERRY” then the method should return the string “HELLO JERRY!”
4. Handle two names Handle the input of two names. When name is an array of two names, then both names should be printed. For example, when name is [“Jill”, “Jane”], then the method should return the string “Hello, Jill and Jane”
5. Handle more than two names Handle the arbitrarily names of input. When name represents more than two names, separate them with commas and close with and Oxford comma “and”. For example, when name is [“Amy”, “Brian”, “Charlotte”], then the method should return the string “Hello, Amy, Brian, and Charlotte”
6. Handle mixing of normal and shouted names Allow for mixing of normal and shouted names by separating the responses into two greetings. For example, when name is [“Amy”, “BRIAN”, “Charlotte”], then the method should return the string “Hello, Amy and Charlotte. AND HELLO BRIAN!”
Bonus
1. Split names with commas into separate entries If any entries in name are a string containing a comma, split it as its own input. For example, when name is [“Bob”, “Charlie, Dianne”], then the method should return the string “Hello, Bob, Charlie, and Dianne.”
2. Allow commas in entries to be escaped Allow the input to escape intentional commas introduced by the previous requirement. These can be escaped in the same manner that CSV is, with double quotes surrounding the entry. For example, when name is [“Bob”, ""Charlie, Dianne""], then the method should return the string “Hello, Bob and Charlie, Dianne.”
Reference Walkthrough
Reference implementations in C#, TypeScript, and Python live at tddbuddy-reference-katas/greeting. This is an F1 kata — six progressive scenarios covering the single-name, null stand-in, shout, two-name, Oxford-comma, and mixed-split rules — shared across all three languages, each a single pure function greet(name).
- C# (.NET 8, xUnit, FluentAssertions 6.12.0) — walkthrough
- TypeScript (Node 20, Vitest 1.6, TS 5 strict) — walkthrough
- Python (3.11, pytest) — walkthrough
This kata ships in Agent Full-Bake mode at high gear: the six rules land as one commit per language, with a brief walkthrough noting there are no builders because the inputs and outputs are the domain. The two bonus tasks (splitting comma-containing entries, escaping commas with quoted entries) are intentionally out of scope in the reference — the six core scenarios are sufficient to demonstrate the F1 shape. See the repo’s Gears section for when high gear is the right call.