agentleFS
JetBrainsKnown publisherJetBrains/klibs-io/AGENTS.md

klibs-io

AGENTS.md108 starsChanged 4 months agoApache-2.0View on GitHub

klibs.io — a service that indexes, catalogs, and provides search for Kotlin Multiplatform libraries from Maven Central and GitHub, with AI-powered metadata generation. Note: avoid introducing new dependencies unless absolutely necessary. Module structure follows "module by feature". Each core module has its own entity, repository, service, and controller layers. Docker must be running for Testcontainers-based tests. Key config files in app/src/main/resources/: - application.yml — base config - application-local.yml — local dev - application-prod.yml — production template - PostgreSQL with Liquibase…

  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.

    Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

  • In this repository3 other files it gives its agents.

The file

Show its rules and text

We split this AGENTS.md into the rules it gives an agent

14 rules. About 0 are common, 13 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈13

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    use only for end-to-end tests, otherwise avoid

    line 78
  2. Distinctive:

    Avoid using JDBC in new code.

    line 100
  3. Very specific:

    Test method names use backtick syntax: descriptive test name

    line 116
  4. Distinctive:

    Don't delete branches either.

    line 122
  5. Distinctive:

    If some functionality is not natively supported by Kotlin Toolchain's declarative YAML configuration, you can use local plugins to extend …

    line 148
  6. Distinctive:

    If Kotlin Toolchain does not provide some functionality out of the box, but an equivalent Gradle plugin exists, do not try to reuse or …

    line 149
  7. Distinctive:

    STOP and wait for approval: before editing files.

    line 168
  8. Distinctive:

    Keep changes minimal and localized.

    line 172
  9. Distinctive:

    Avoid excessive comments. Keep code self-documenting.

    line 181
  10. Distinctive:

    Keep comments clear and concise.

    line 182
  11. Distinctive:

    Do not rename/move packages broadly.

    line 184
  12. Distinctive:

    Do not change public APIs unless requested.

    line 185
  13. Distinctive:

    Avoid dependency upgrades unless requested.

    line 186
  14. Distinctive:

    Avoid mocking unless absolutely necessary.

    line 189

≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

AGENTS.md

Project Overview

klibs.io — a service that indexes, catalogs, and provides search for Kotlin Multiplatform libraries from Maven Central and GitHub, with AI-powered metadata generation.

Tech Stack

  • Language: Kotlin 2.0+, JVM target: Java 21+
  • Framework: Spring Boot
  • Database: PostgreSQL 15+ (Liquibase migrations, JPA + raw JDBC)
  • Build: Kotlin Toolchain (module manifests in module.yaml, shared templates under build-logic/templates/, version catalog at gradle/libs.versions.toml referenced via $libs.*)
  • Docker: PostgreSQL, localstack, Testcontainers

Note: avoid introducing new dependencies unless absolutely necessary.

Project Structure

app/                        # Main Spring Boot module (runnable). Configs, scheduled jobs, indexing services.
core/
  package/                  # Maven packages/artifacts
  project/                  # High-level project entity (aggregates packages + SCM repo)
  readme/                   # README fetch & processing (minimize, link rewrite, androidx providers)
  scm-owner/                # GitHub org/user owners
  scm-repository/           # Git repositories, SCM metadata
  search/                   # Full-text search (PostgreSQL FTS, materialized views)
  storage/                  # S3 storage abstraction
integrations/
  ai/                       # OpenAI integration (descriptions, tags)
  github/                   # GitHub API integration
  maven/                    # Maven Central scanning and indexing
build-logic/
  templates/                # Shared Kotlin Toolchain module templates (base, kotlin-jvm, spring-*, persistence, mock)
  plugins/                  # Local Kotlin Toolchain plugins (git-properties, jib)
project.yaml                # Kotlin Toolchain project root (module list + plugin registrations)
frontend/                   # Frontend app (React)

Module structure follows "module by feature". Each core module has its own entity, repository, service, and controller layers.

Build & Run

# Build without tests
./kotlin build

# Run tests (see Testing section for scoping flags)
./kotlin test

# Package the runnable JAR
./kotlin package
# Output: build/tasks/_app_executableJarJvm/app-jvm-executable.jar

# Run locally with Spring profile (requires Docker for PostgreSQL and localstack via docker-compose)
./kotlin run -m app

# Or run the main function by ./kotlin run -m app --main-class <class>

Testing

# Run all tests
./kotlin test

# Run tests for a specific module
./kotlin test -m app
./kotlin test -m package

# Run a specific test (fully qualified name)
./kotlin test --include-test=io.klibs.app.example.SimpleExampleTest
  • Framework: JUnit 5, Spring Boot Test, MockMvc, Testcontainers (PostgreSQL), Mockito Kotlin
  • Base test classes:
    • BaseUnitWithDbLayerTest — database integration tests
    • SmokeTestBase — web/API endpoint tests
      • use only for end-to-end tests, otherwise avoid
  • Test locations: <module>/src/test/kotlin/

Docker must be running for Testcontainers-based tests.

Spring Profiles

  • local — local development (uses docker-compose for DB)
  • prod — production (restricts debug utilities)

Configuration

Key config files in app/src/main/resources/:

  • application.yml — base config
  • application-local.yml — local dev
  • application-prod.yml — production template

Database

  • PostgreSQL with Liquibase migrations in app/src/main/resources/db/migration/ (organized by quarter: 2024-Q4, 2025-Q1, etc.)
  • Mix of Spring Data JPA (packages) and custom JDBC (projects, search)
    • Note: this project is JPA-first, even if this costs some performance. Avoid using JDBC in new code.
  • Materialized views project_index and package_index for full-text search
  • ShedLock table for distributed scheduling locks

Key Architecture Decisions

(Rationale only — module layout is under Project Structure, FTS details under Database.)

  • PostgreSQL FTS — chosen for simpler deployment; acknowledged tech debt, contained in core/search
  • S3 — cold cache only (readme, GMaven package metadata)
  • Scheduled jobs — drive the data-processing pipelines

Coding Conventions

  • Package namespace: io.klibs.*
  • Naming: *Entity, *Repository, *RepositoryJdbc, *Controller, *Service, *DTO, *Response, *Configuration, *Properties
  • Test method names use backtick syntax: `descriptive test name`
  • 4-space indentation, 120-char max line length
  • Kotlin coding conventions (camelCase functions/vars, PascalCase classes)

Branching & Workflow

Important: DONT PUSH! PUSH IS PROHIBITED! Don't delete branches either.

  • master — production (auto-deployed)
  • release* — current release branch, deployed to test environment
  • feature/KTL-<id>-<desc> — feature branches from release
  • hotfix/KTL-<id>-<desc> — hotfix branches from master
  • Release tags: release-yyyy.mm.dd

API Documentation

Swagger UI available at /api-docs/swagger-ui.html. Actuator at /actuator/health and /actuator/info.

Updating JVM Version

Two places to update:

  1. build-logic/templates/kotlin-jvm.module-template.yaml — settings.jvm.jdk.version. All JVM modules inherit from this template, so this is the build-time source of truth.
  2. app/module.yaml — plugins.jib.baseImage.fullName. The container runtime must match the build JDK.

Updating Kotlin Toolchain version

./kotlin update, if it's a dev version then ./kotlin update --dev

JVM runtime which Kotlin Toolchain runs on is tied to Kotlin Toolchain distribution, hence updating Kotlin Toolchain updates the JVM runtime under the hood.

Build Plugins

If some functionality is not natively supported by Kotlin Toolchain's declarative YAML configuration, you can use local plugins to extend the build. This is the escape hatch for custom build logic — feel free to use it when needed. If Kotlin Toolchain does not provide some functionality out of the box, but an equivalent Gradle plugin exists, do not try to reuse or adapt the Gradle plugin inside this project. Reimplement the needed behavior using Kotlin Toolchain's local plugin system instead.

When a library's standard workflow includes a build-time processing step (code generation from declarative files, schema compilation, resource transformation, etc.), that step must be implemented as a Kotlin Toolchain local plugin. Do not bypass or skip the processing step by manually writing code that the tool is designed to generate, or by using the library in a degraded/runtime-only mode. Preserve the library's full intended workflow.

Build Tool Policy

Treat Kotlin Toolchain as a fixed project requirement. Do not ask to switch to Gradle or re-open the Kotlin Toolchain/Gradle tradeoff just because some library or tool commonly uses Gradle-oriented workflows. When build-time processing is needed, implement it within the Kotlin Toolchain workflow and keep the discussion focused on the chosen repository approach rather than on alternative build systems or plugin-name specifics, unless the user explicitly asks for that detail.

Codex Working Agreement (Milestone Gating)

Objective

Reduce context switching and rework. Prefer small, reviewable diffs and explicit stop points.

Default interaction pattern

Step 1 — Align (no code changes yet):

  • Restate the goal in 1–2 sentences.
  • List assumptions + constraints (and note uncertainty explicitly).
  • Propose a plan with 2–4 milestones.
    • For each milestone: exact modules/files to touch, and how to validate (tests/commands).
  • STOP and wait for approval before editing files.

Step 2 — Execute (one milestone at a time):

  • Implement only the next approved milestone.
  • Keep changes minimal and localized.
  • STOP after the milestone and provide:
    • per-file change summary
    • validation commands
    • risks / follow-ups

Change constraints (hard defaults)

  • IMPORTANT: prefer minimal diff — avoid large reformats.
  • Methods should fit on one screen (50 lines max).
  • Avoid excessive comments. Keep code self-documenting.
  • Keep comments clear and concise. 3 lines max.
  • IMPORTANT: no refactors unless explicitly requested or required for correctness; if required, propose as a separate milestone first.
  • Do not rename/move packages broadly.
  • Do not change public APIs unless requested.
  • Avoid dependency upgrades unless requested.
  • Tests:
    • Make tests check business logic, not implementation details or method call sequence.
    • Avoid mocking unless absolutely necessary.
    • Main thing: check that post-condition corresponds to expected behavior. Don't check implementation details.

Output format

Use concise headings:

  • Goal
  • Assumptions / Constraints
  • Plan (Milestones)
  • Milestone N Results
  • Validation
  • Risks / Next Steps

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.