# Your Design System Is a Contract. Enforce It with Konsist and Android Lint

DevFeed: [Your Design System Is a Contract. Enforce It with Konsist and Android Lint](<https://devfeed.tech/articles/your-design-system-is-a-contract-enforce-it-with-konsist-and-android-lint-91135.md>)

Original publisher: [Read original article](<https://proandroiddev.com/konsist-design-system-validator-jetpack-compose-d5c3814fe462?source=rss----c72404660798---4>)

Author: Ravi Rawal

Published: 2026-10-20T16:36:52Z

Content type: tutorial

Language: en

Sources: [ProAndroidDev](<https://devfeed.tech/sources/proandroiddev-medium.md>)

Topics: [Design system](<https://devfeed.tech/topics/design-system.md>), [lint](<https://devfeed.tech/topics/lint.md>), [User interface design](<https://devfeed.tech/topics/ui-design.md>), [Android](<https://devfeed.tech/topics/android.md>), [Jetpack](<https://devfeed.tech/topics/jetpack.md>), [Android Testing](<https://devfeed.tech/topics/android-testing.md>), [Gradle](<https://devfeed.tech/topics/gradle.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [android-development](<https://devfeed.tech/tags/android-development.md>), [automated](<https://devfeed.tech/tags/automated.md>), [color](<https://devfeed.tech/tags/color.md>), [colors](<https://devfeed.tech/tags/colors.md>), [component](<https://devfeed.tech/tags/component.md>), [components](<https://devfeed.tech/tags/components.md>), [compose](<https://devfeed.tech/tags/compose.md>), [compose-ui](<https://devfeed.tech/tags/compose-ui.md>), [consistency](<https://devfeed.tech/tags/consistency.md>), [custom](<https://devfeed.tech/tags/custom.md>), [design-system](<https://devfeed.tech/tags/design-system.md>), [design-systems](<https://devfeed.tech/tags/design-systems.md>), [dimensions](<https://devfeed.tech/tags/dimensions.md>), [documentation](<https://devfeed.tech/tags/documentation.md>), [engineering](<https://devfeed.tech/tags/engineering.md>), [feature](<https://devfeed.tech/tags/feature.md>), [jetpack-compose](<https://devfeed.tech/tags/jetpack-compose.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [lint](<https://devfeed.tech/tags/lint.md>), [padding](<https://devfeed.tech/tags/padding.md>), [patterns](<https://devfeed.tech/tags/patterns.md>), [rules](<https://devfeed.tech/tags/rules.md>), [screen](<https://devfeed.tech/tags/screen.md>), [software-engineering](<https://devfeed.tech/tags/software-engineering.md>)

## AI overview

Treat the design system as an enforceable engineering contract: centralize approved tokens and reusable components, then place each rule in the layer suited to check it. Konsist can test package structure and architectural boundaries; custom Android Lint detectors can flag prohibited source patterns, such as numeric Compose Color literals outside approved packages; Compose UI tests can check rendered behavior like accessibility, font scaling, touch targets, and state transitions. The sample Lint rule is deliberately limited: it may miss colors expressed through constants, helpers, resources, aliases, or other forms, and it cannot judge whether a named token is semantically appropriate. The article recommends testing both violations and allowed exceptions, keeping rules narrow to reduce false positives, verifying APIs against the project's pinned versions, and rolling checks out gradually before making them blocking in CI.

## Source excerpt

A practical guide to enforcing colors, spacing, typography, shapes, and component conventions in Jetpack Compose -- with a custom Android Lint rule. A design system is only as reliable as the rules that prevent teams from bypassing it. Most Android teams have a design system. They define typography, colors, spacing, shapes, dimensions, and reusable Compose components. They document usage guidelines, publish component libraries, and ask developers to follow the established conventions. Yet a few months into development, the same problems start appearing. One screen uses 16.dp for horizontal padding; another uses 18.dp. A developer creates a custom TextStyle because the existing typography does not look quite right. A feature introduces a hardcoded hex color. A button uses a different corner radius from the rest of the application. Someone builds another card component because the existing one seems inconvenient to reuse. None of these decisions looks particularly dangerous in isolation. Together, they undermine the consistency the design system was supposed to provide. Code reviews can catch some of these violations, but they are not a reliable enforcement mechanism. Reviewers have limited time, conventions are easy to overlook, and the same feedback gets repeated across pull requests. The better approach is to treat the design system as an engineering contract and enforce that contract through automated checks. For Android teams using Jetpack Compose, Konsist and custom Android Lint rules solve complementary parts of this problem. Konsist can enforce architectural and structural conventions. Android Lint can inspect source code for prohibited patterns. Compose UI tests can verify how the resulting interface behaves at runtime. Together, they turn design-system conventions from documentation into executable rules. Start by defining what the contract actually means Before writing a test or a lint detector, identify the rules your team expects every feature to follow. N