

Also from Kynth Studios


Also from Kynth Studios


Also from Kynth Studios
1# Agent Guidelines (Ktor)23This file is the primary playbook for agentic coding tools working in this repository.45## Critical Workflow Rule67**NEVER return control to the user without ensuring:**81. Tests pass: `./gradlew :module-name:jvmTest` (and other platforms if touched)92. Code compiles: `./gradlew :module-name:assemble`103. Code is formatted and linting passes: run `./gradlew :module-name:formatKotlin`, then `./gradlew :module-name:lintKotlin`114. ABI validated: `./gradlew :module-name:updateKotlinAbi` (if public/protected API changed)1213Prefer this order to fail fast.14Always prefer **module-specific** commands (`:module-name:task`) over project-wide commands.1516## Project Requirements1718- JDK 21 is required.19- Kotlin Multiplatform: JVM, JS, Native.20- Apple targets require Xcode + command line tools.21- Android targets are optional and enabled when Android SDK is available (`ANDROID_HOME` or `local.properties` `sdk.dir`).2223## Project Layout2425### Gradle module structure (flattened)26The project uses a **flattened Gradle structure** (see `settings.gradle.kts`). Nested directory paths do NOT translate to nested Gradle project names.27Example: `ktor-client/ktor-client-curl` → `:ktor-client-curl` (not `:ktor-client:ktor-client-curl`).2829### Source set layout (platform-centric)30Kotlin Multiplatform sources use a flattened, platform-centric layout (do not re-introduce `src/<platform>Main/...`).3132```text33common/src34jvm/src35jvm/resources36jvm/test37jvm/test-resources38...39```4041Build logic enforces "no surprise source sets": manually registering extra source sets is rejected.42To add a new target/source set, add the directory or enable the target via `gradle.properties` (`target.<name>=true`).4344## Build Commands4546**Important**: Always prefer running tasks on the specific module you touched, not the entire project.4748### Common tasks49```bash50./gradlew :module-name:assemble # Build the module51```5253Run tests:54```bash55./gradlew :module-name:jvmTest # Run JVM tests for the module56./gradlew :module-name:allTests # Run tests across all platforms for the module57./gradlew :module-name:jvmTest --tests "fully.qualified.TestClassName" # Run a specific test58./gradlew :module-name:jvmTest --tests "fully.qualified.TestClassName.methodName" # Run a specific test method59```6061Linting:62```bash63./gradlew :module-name:formatKotlin # Format the module64./gradlew :module-name:lintKotlin # Lint the module65```6667## Code Style Guidelines6869### Formatting (EditorConfig is authoritative)70- Kotlin style: IntelliJ + `KOTLIN_OFFICIAL` (`.editorconfig`).71- Indent: 4 spaces (JSON/YAML: 2); max line length: 120; end of line: LF.72- Use `./gradlew :module-name:formatKotlin` rather than manual formatting.7374### Imports75- Star imports are preferred for `io.ktor.*` (configured in `.editorconfig`).7677### Naming78- Follow Kotlin conventions unless the surrounding package has a strong established pattern.79- Tests: prefer descriptive test names in backticks: `describe what is being tested`.8081### Types and API design82- Prefer `internal` by default; keep the public surface intentional.83- Public API requires KDoc (parameters, return, and notable exceptions).84- Public-but-not-for-users APIs that cannot be `internal` should use `@InternalAPI`.85- Keep `@OptIn(...)` scope minimal.86- All types used as receivers in DSL should be annotated with `@KtorDsl` (for example, all plugin configs).8788### Error handling89- `require(...)` for argument validation, `check(...)` for state validation, `error("...")` for unreachable states.90- Throw specific exceptions appropriate to the layer (IO parsing: `IOException`/`EOFException`; validation: Ktor exceptions like `BadRequestException`).91- Make error messages actionable; include the problematic value/context.9293### Logging94- Prefer Ktor log helpers where present.95- Avoid noisy logs in hot paths.9697### Documentation and comments98- Avoid redundant comments; add them only for tricky invariants or platform-specific behavior.99- Keep KDoc correct when behavior/signatures change.100- New source files must include the repository copyright header.101102## Development Practices103104- Prefer TDD where feasible: add/adjust tests, then implement.105- For multiplatform changes: start JVM-first unless the task requires another platform.106- Keep local-only build knobs (for example, developer `gradle.properties` overrides) out of commits.107- If asked to create commits: use imperative mood and include `KTOR-<NUM>` when there is a related YouTrack issue.108109### Adding or removing modules110111- Module names must start with `ktor-`.112- The project uses a flattened Gradle structure with custom DSL in `settings.gradle.kts` (see Project Layout section).113- When modules are added/removed or new targets enabled, run `./update-artifact-dumps.sh` to update published artifact lists in `gradle/artifacts`.114 Publishing will fail if these dumps are stale.115116## Binary Compatibility and ABI Validation117118Binary compatibility is **enforced** using Kotlin Gradle Plugin ABI validation.119All public API changes must be tracked in `/api/` directories within modules.120121### Release branches and API policy122123- Patch releases are maintained in `release/<major>.x` (for example, v3 uses `release/3.x`, v4 uses `release/4.x`).124- The next minor release is developed on `main`.125- Public API changes are allowed only for minor/major releases (typically on `main`), not for patch releases (on `release/<major>.x`).126- Breaking changes are **only allowed in major version releases**.127- The repo includes an interactive helper `./switch-base-branch.sh` for switching a feature branch base between `main` and `release/<major>.x`.128 For agents: use `--dry-run` to print the git commands, then run them after user approval.129130### Validation commands131```bash132./gradlew :module-name:checkKotlinAbi # Validate ABI compatibility133./gradlew :module-name:updateKotlinAbi # Update ABI signature files after changes134```135136### Rules137- **All** `public`/`protected` API changes require updating `api/*.api` dumps.138- API changes must be **intentional and well-documented**.139
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| vllm-project/vllmAGENTS.md · 89k | AGENTS.md | setuptestlint-formatstyle+5 | 100/100 | 14 days ago | |
| duckduckgo/content-scope-scriptsspecial-pages/AGENTS.md · 70 | AGENTS.md | buildteststylearch+3 | 100/100 | 14 days ago | |
| TryGhost/Ghoste2e/AGENTS.md · 55k | AGENTS.md | setupteststylearch+2 | 100/100 | today | |
| deepseek-ai/deepseek-harnessnative/landlock-run/AGENTS.md · 104k | AGENTS.md | setupteststylearch+3 | 100/100 | today | |
| aaif-goose/gooseAGENTS.md · 53k | AGENTS.md | setupbuildtestlint-format+7 | 100/100 | 8 days ago | |
| n8n-io/n8npackages/@n8n/agents/AGENTS.md · 201k | AGENTS.md | buildteststylearch+3 | 100/100 | 14 days ago | |
| code-yeongyu/oh-my-openagentpackages/web/AGENTS.md · 68k | AGENTS.md | setupbuildtestlint-format+6 | 100/100 | 13 days ago | |
| mui/material-uiAGENTS.md · 99k | AGENTS.md | setupbuildtestlint-format+9 | 100/100 | 14 days ago |
A badge carrying the measured quality of the strongest agent config file in this repository, out of 100. It reads from this index every time somebody loads your page, so it changes when the measurement changes and there is nothing to keep up to date. Free, no account, and the value is not something you or we can set by hand.
[](https://rulestack.kynth.studio/configs/ktorio-ktor-agents)Would rather not hotlink us? Every badge is also served in shields.io’s endpoint schema, so shields renders the image and your readers never talk to our domain:
Published by Toolproof, the masthead over this index and eight others. The method behind the number is at toolproof.kynth.studio/methodology, and the whole thing is readable as JSON with no key at /api.