This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is a ReadingBat content repository — it defines Java and Kotlin programming challenges served by the readingbat-core platform. It is not a standalone application; it provides challenge content that the ReadingBat server renders as interactive coding exercises.
./gradlew build -x test # Compile without tests
./gradlew --rerun-tasks check # Run all tests
./gradlew run # Start the content server locally (port 8080)
make tests # Shortcut for running tests
make build # Shortcut for compile
make cc # Continuous compilation (watches for changes)
make versioncheck # Check for dependency updatesThe project uses JVM toolchain 17 and Kotest with JUnit Platform.
src/main/kotlin/Content.kt is the central file. It uses the readingBatContent DSL to declare all challenges organized by language, groups, and individual challenges. The DSL references:
- A
reposource —GitHubRepoin production,FileSystemSource("./")for local dev (controlled byisProduction()) java { }andkotlin { }blocks that define language sectionsgroup()blocks withpackageName,description, and challenge declarations- Challenges can be added individually via
challenge("ClassName")or in bulk viaincludeFiles/includeFilesWithTypeglob patterns
Each challenge is a standalone source file with a main() method that prints expected outputs. The main() output lines become the expected answers for the challenge. The class/file name must match what's declared in Content.kt.
- Java challenges (
src/main/java/<package>/): A public class with a static method and amain()that calls it with test inputs viaSystem.out.println(). The@desccomment (supports markdown) provides the challenge description. - Kotlin challenges (
src/main/kotlin/<package>/): Top-level functions with amain()that calls them viaprintln(). Kotlin challenges require an explicitreturnType(e.g.,IntType,StringType,IntListType) when declared inContent.kt, either per-challenge or viaincludeFilesWithType.
src/main/resources/application.conf uses HOCON format to configure the ReadingBat server. The readingbat.content block points to the content file and variable name. The readingbat.site block controls production mode, DBMS, caching, and OAuth settings. Ktor deployment settings (port, watch paths) are also configured here.
ContentServer.kt is a top-level main function that starts ReadingBatServer — all server logic lives in the readingbat-core dependency.
src/test/kotlin/ContentTests.kt uses Kotest StringSpec with Ktor's testApplication to validate all challenges: verifying empty answers are NOT_ANSWERED, wrong answers are INCORRECT, and correct answers are CORRECT. Tests use helpers from readingbat-core's TestSupport.
Managed via gradle/libs.versions.toml. Key dependencies:
readingbat-core— the ReadingBat platform (from JitPack)common-utils— shared utilities (providesFileSystemSource,GitHubRepo)kotest+ktor-server-test— testing