ワンクリックで
kotlin-app-config
Sealed class-konfigurasjon for Kotlin-applikasjoner med miljøspesifikke innstillinger
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Sealed class-konfigurasjon for Kotlin-applikasjoner med miljøspesifikke innstillinger
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Generer conventional commit-meldinger med Nav-relevante scopes og breaking change-format
Expert builder for the Aksel design system (Nav / @navikt) React components, design tokens, layout primitives, theming (light/dark), icons, CSS, the Tailwind preset, version migrations, and Figma-to-code. Trigger on any frontend UI task that mentions Aksel, Nav/Navikt, "designsystemet", or @navikt/ds-* / @navikt/aksel-* packages — or that asks to add, create, build, or refactor a component (button, input, modal, table, alert, card, form) or layout, or to implement a design from Figma (a pasted figma.com/design/...?node-id link, "implement this design", "build this from Figma", design-to-code). Strong signals "using/with aksel", "@navikt/ds-react", "design system", a pasted figma.com link. If the work is frontend UI and there is any Aksel signal, invoke this skill unless the user explicitly opts out.
Integrer og konfigurer Nav Dekoratøren – felles header og footer for nav.no-applikasjoner. Bruk når et team skal ta i bruk Dekoratøren, oppdatere konfigurasjon, legge til breadcrumbs/språkvelger/analytics, håndtere samtykke (ekomloven), CSP eller feilsøke integrasjon mot dekoratøren.
Lag responsive layouts med Aksel Design System (v8+) - spacing tokens, layout primitives (Box, HStack, VStack, HGrid, Page, Bleed) og ResponsiveProp
Generer og kjør Playwright E2E-tester for webapplikasjoner med page objects, auth fixtures og tilgjengelighetstester
Kompakt output-stil som kutter fyllord og beholder teknisk substans — spar output-tokens uten å miste nøyaktighet.
| name | kotlin-app-config |
| description | Sealed class-konfigurasjon for Kotlin-applikasjoner med miljøspesifikke innstillinger |
| license | MIT |
| compatibility | Kotlin application |
| metadata | {"domain":"backend","tags":"kotlin configuration sealed-class environment"} |
This skill provides patterns for type-safe environment configuration using Kotlin sealed classes.
sealed class Environment(
val name: String,
val databaseUrl: String,
val kafkaBrokers: String,
val azureAdIssuer: String
) {
data object Local : Environment(
name = "local",
databaseUrl = "jdbc:postgresql://localhost:5432/myapp",
kafkaBrokers = "localhost:9092",
azureAdIssuer = "http://localhost:8080/azuread"
)
data class Dev(
private val env: Map<String, String>
) : Environment(
name = "dev",
databaseUrl = env.getValue("DATABASE_URL"),
kafkaBrokers = env.getValue("KAFKA_BROKERS"),
azureAdIssuer = env.getValue("AZURE_OPENID_CONFIG_ISSUER")
)
data class Prod(
private val env: Map<String, String>
) : Environment(
name = "prod",
databaseUrl = env.getValue("DATABASE_URL"),
kafkaBrokers = env.getValue("KAFKA_BROKERS"),
azureAdIssuer = env.getValue("AZURE_OPENID_CONFIG_ISSUER")
)
companion object {
fun from(env: Map<String, String>): Environment {
return when (env["NAIS_CLUSTER_NAME"]) {
"dev-gcp" -> Dev(env)
"prod-gcp" -> Prod(env)
else -> Local
}
}
}
}
fun main() {
val env = Environment.from(System.getenv())
val dataSource = createDataSource(env.databaseUrl)
val kafkaProducer = createKafkaProducer(env.kafkaBrokers)
logger.info("Starting application in ${env.name} environment")
}
import com.natpryce.konfig.*
data class AppConfig(
val database: DatabaseConfig,
val kafka: KafkaConfig,
val azure: AzureConfig
)
data class DatabaseConfig(
val url: String
)
data class KafkaConfig(
val brokers: String
)
data class AzureConfig(
val issuer: String
)
val config = EnvironmentVariables()
val appConfig = AppConfig(
database = DatabaseConfig(
url = config.getOrNull(Key("DATABASE_URL", stringType))
?: "jdbc:postgresql://localhost:5432/myapp"
),
kafka = KafkaConfig(
brokers = config.getOrNull(Key("KAFKA_BROKERS", stringType))
?: "localhost:9092"
),
azure = AzureConfig(
issuer = config.getOrNull(Key("AZURE_OPENID_CONFIG_ISSUER", stringType))
?: "http://localhost:8080/azuread"
)
)
Production pattern from navikt/hotlibs supporting multiple cluster types:
sealed interface Environment {
val cluster: String
val tier: Tier
enum class Tier { TEST, LOCAL, DEV, PROD }
companion object {
private val all: List<Environment> = listOf(
TestEnvironment,
LocalEnvironment,
GcpEnvironment.DEV,
GcpEnvironment.PROD
)
val current: Environment by lazy {
val cluster = System.getenv("NAIS_CLUSTER_NAME")
all.find { it.cluster == cluster } ?: LocalEnvironment
}
}
}
sealed class DefaultEnvironment(
override val cluster: String,
override val tier: Environment.Tier
) : Environment
object TestEnvironment : DefaultEnvironment("test", Environment.Tier.TEST)
object LocalEnvironment : DefaultEnvironment("local", Environment.Tier.LOCAL)
enum class GcpEnvironment(
override val cluster: String,
override val tier: Environment.Tier
) : Environment {
DEV("dev-gcp", Environment.Tier.DEV),
PROD("prod-gcp", Environment.Tier.PROD)
}
data class DatabaseConfig(
val url: String,
val username: String,
val password: String
)
data class KafkaConfig(
val brokers: String,
val topic: String
)
data class AzureConfig(
val clientId: String,
val issuer: String,
val jwksUri: String
)
fun loadConfig(): AppConfig {
val config = ConfigurationProperties.systemProperties() overriding
EnvironmentVariables()
return AppConfig(
database = DatabaseConfig(
url = config[Key("database.url", stringType)],
username = config[Key("database.username", stringType)],
password = config[Key("database.password", stringType)]
),
kafka = KafkaConfig(
brokers = config[Key("kafka.brokers", stringType)],
topic = config[Key("kafka.topic", stringType)]
),
azure = AzureConfig(
clientId = config[Key("azure.client.id", stringType)],
issuer = config[Key("azure.issuer", stringType)],
jwksUri = config[Key("azure.jwks.uri", stringType)]
)
)
}