clankerguru/opsx/kotlin-dsl
Claude Code and agent skill by clankerguru/opsx
- community
Checking that the SKILL.md file is still in the repository.
Provides Gradle Kotlin DSL patterns for settings and project plugins, covering extension creation, convention wiring, Provider/Property lazy evaluation, Action callbacks, and configuration avoidance. Activates when writing Gradle plugins or build scripts using Kotlin DSL.
Install
npx vskill@latest install clankerguru/opsx/kotlin-dslSKILL.md
The same SKILL.md was published earlier as clankerguru/opsx/kotlin-dsl.
Gradle Kotlin DSL Patterns
Project-specific Gradle-Kotlin-DSL patterns (data object+SettingsExtension). For generic Gradle mechanisms see:-/gradle— lifecycle, Settings/Project model-/gradle-plugins-basics—plugins { },pluginManagement-/gradle-custom-plugins—Plugin<Project>/Plugin<Settings>, precompiled script plugins-/gradle-providers-properties—Property,Provider,convention,.map/.flatMap-/gradle-tasks— task registration, ordering, input/output annotations-/gradle-dependency-injection—@Injecton extensions,ObjectFactory,NamedDomainObjectContainer-/gradle-settings-plugin— companion pattern for settings-targeted plugins-/kotlin-dsl-builders— generic lambdas-with-receiver,@DslMarker
Rules
- Settings plugins use `Plugin<Settings>`, project plugins use `Plugin<Project>`. Settings plugins run during settings evaluation and can register extensions on
Settings, wirerootProjectcallbacks, and include builds. Project plugins run per-project.
- Register extensions with `settings.extensions.create()`. Pass the extension name constant and the class:
``kotlin val extension = settings.extensions.create(EXTENSION_NAME, SettingsExtension::class.java) ``
- Wire conventions on extension properties immediately after creation. Conventions set the default values that the DSL block can override:
``kotlin extension.outputDir.convention(OUTPUT_DIR) extension.autoGenerate.convention(false) extension.excludeDepScopes.convention(DEFAULT_EXCLUDED_DEP_SCOPES) ``
- Use `settings.gradle.rootProject(Action { })` to register tasks. This callback fires after settings evaluation but gives you access to the root project for task registration:
``kotlin settings.gradle.rootProject( Action { rootProject -> registerTasks(rootProject, extension) }, ) ``
- Use `settings.gradle.settingsEvaluated { }` for post-DSL work. When you need the DSL block to have finished before acting (e.g., including enabled composite builds):
``kotlin settings.gradle.settingsEvaluated { extension.includeEnabled() } ``
- Register tasks with `tasks.register()`, never `tasks.create()`. Configuration avoidance prevents creating task objects until they are needed:
``kotlin val contextTask = rootProject.tasks.register(TASK_CONTEXT, ContextTask::class.java) ``
- Wire extension properties to task properties with `.convention()`. Inside
configure { }, connect the extension values to the task's@Inputproperties:
``kotlin contextTask.configure { task -> task.outputDir.convention(extension.outputDir) task.excludeDepScopes.convention(extension.excludeDepScopes) } ``
- Use `Provider`/`Property` API for lazy evaluation. Wrap computed values in
provider { }so they resolve at execution time:
``kotlin task.subprojectPaths.set( rootProject.provider { rootProject.subprojects.map { it.path } }, ) ``
- Use `.map { }` on properties for transformations. Chain providers without eagerly evaluating:
``kotlin task.projectDeps.set( task.excludeDepScopes.map { excludes -> rootProject.allprojects.associate { proj -> proj.path to SymbolExtractor.extractDependenciesFromProject(proj, excludes) } }, ) ``
- Abstract properties are Gradle-managed. Declare properties as
abstract valon abstract classes annotated with@Inject. Gradle instantiates and wires them:
``kotlin abstract class SettingsExtension @Inject constructor() { abstract val outputDir: Property<String> abstract val autoGenerate: Property<Boolean> abstract val excludeDepScopes: SetProperty<String> } ``
- Use `Action<T>` for configuration lambdas in plugin APIs. Gradle's
Actioninterface is configuration-cache compatible:
``kotlin fun repos(action: Action<NamedDomainObjectContainer<WorkspaceRepository>>) { action.execute(repos) } ``
- String-based configuration names in convention plugins. In precompiled script plugins, use string-based dependency declarations:
``kotlin dependencies { "implementation"(gradleApi()) "testImplementation"("io.kotest:kotest-runner-junit5:5.9.1") } ``
Examples
Complete settings plugin structure
DSL accessor file
Convention plugin (precompiled script plugin)
NamedDomainObjectContainer usage
Anti-patterns
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingcli/src/main/resources/content/skills/kotlin-dsl/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/clankerguru/opsx/kotlin-dsl)