|
| 1 | +--- |
| 2 | +name: support-query-builder-sqlite-android-map |
| 3 | +description: Use when mapping SQLite query behavior, Room raw query integration, annotation processing flow, or KAPT-to-KSP migration decisions in support-query-builder. |
| 4 | +argument-hint: Describe the SQLite, Room, processor, or migration question you need to answer. |
| 5 | +--- |
| 6 | + |
| 7 | +# Support Query Builder SQLite Android Map |
| 8 | + |
| 9 | +## Overview |
| 10 | + |
| 11 | +This skill provides a fast, source-backed map for how SQL is built, translated into Android SQLite query objects, and connected to Room via raw queries. It also maps current KAPT behavior, KSP migration boundaries, and KotlinPoet code-generation ownership. |
| 12 | + |
| 13 | +Core principle: answer from module ownership and concrete file paths first, then use external docs to validate edge behavior. |
| 14 | + |
| 15 | +## When To Use |
| 16 | + |
| 17 | +- Onboarding an LLM or developer to this repository. |
| 18 | +- Explaining where SQL text and SQL parameters are produced. |
| 19 | +- Tracing `@EntitySchema` to generated schema object output. |
| 20 | +- Confirming whether a behavior belongs to `:core`, `:core:ext`, `:annotations`, or `:processor`. |
| 21 | +- Planning KAPT to KSP migration work without breaking module boundaries. |
| 22 | + |
| 23 | +Do not use this skill for general Gradle dependency editing. Use `support-query-builder-build-dependencies` for that. |
| 24 | + |
| 25 | +## Procedure |
| 26 | + |
| 27 | +1. Start with the package and ownership map in [sqlite-android-query-map.md](./references/sqlite-android-query-map.md). |
| 28 | +2. If the question involves generated schema constants, switch to [annotation-processing-map.md](./references/annotation-processing-map.md). |
| 29 | +3. Validate claimed behavior against the exact owner file before answering. |
| 30 | +4. When external behavior is unclear, consult the official references listed below and map findings back to local code. |
| 31 | + |
| 32 | +## Quick Reference |
| 33 | + |
| 34 | +| Question | Primary module | First file | |
| 35 | +| --- | --- | --- | |
| 36 | +| Where does SQL string building happen? | `:core` | `core/src/main/kotlin/co/anitrend/support/query/builder/core/QueryBuilder.kt` | |
| 37 | +| Where does `SupportSQLiteQuery` come from? | `:core:ext` | `core/ext/src/main/kotlin/co/anitrend/support/query/builder/core/ext/QueryBuilderExtension.kt` | |
| 38 | +| Where is `@EntitySchema` defined? | `:annotations` | `annotations/src/main/kotlin/co/anitrend/support/query/builder/annotation/EntitySchema.kt` | |
| 39 | +| Where is annotation processing entrypoint? | `:processor` | `processor/src/main/kotlin/co/anitrend/support/query/builder/processor/EntitySchemaProcessor.kt` | |
| 40 | +| Where is KotlinPoet emission committed? | `:processor` | `processor/src/main/kotlin/co/anitrend/support/query/builder/processor/factory/ClassFactory.kt` | |
| 41 | +| Where is KAPT wired into sample usage? | `:sample` | `sample/build.gradle.kts` | |
| 42 | +| How do I verify Android SQLite runtime capability? | `:sample` runtime diagnostics | `SELECT sqlite_version();` and `PRAGMA compile_options;` | |
| 43 | + |
| 44 | +## Example |
| 45 | + |
| 46 | +```kotlin |
| 47 | +import co.anitrend.support.query.builder.core.QueryBuilder |
| 48 | +import co.anitrend.support.query.builder.core.ext.asSupportSQLiteQuery |
| 49 | +import co.anitrend.support.query.builder.dsl.from |
| 50 | +import co.anitrend.support.query.builder.dsl.select |
| 51 | + |
| 52 | +val builder = QueryBuilder() |
| 53 | +builder select "*" from "person" |
| 54 | + |
| 55 | +// Bridge from pure query builder to Android Room raw-query input type |
| 56 | +val sqliteQuery = builder.asSupportSQLiteQuery() |
| 57 | +``` |
| 58 | + |
| 59 | +## Common Mistakes |
| 60 | + |
| 61 | +- Assuming `SupportSQLiteQuery` is created in `:core` instead of `:core:ext`. |
| 62 | +- Assuming KSP support exists because build output folders contain `ksp` artifacts. |
| 63 | +- Answering processor flow without checking `ClassFactory` for generated output options. |
| 64 | +- Ignoring package typos that are intentional and already in use (for example `from.extentions`). |
| 65 | +- Assuming a SQLite function from upstream docs is automatically available on all Android runtime versions. |
| 66 | + |
| 67 | +## Rationalization Table |
| 68 | + |
| 69 | +| Excuse | Reality | |
| 70 | +| --- | --- | |
| 71 | +| "KSP folders exist, so migration is done" | Folder artifacts are not build wiring truth. Confirm plugin and processor APIs in source/build files. | |
| 72 | +| "I can infer output path without reading processor code" | Output path is explicitly tied to `kapt.kotlin.generated` in `ClassFactory`. | |
| 73 | +| "Bridge code is obvious" | Verify owner module. This repo keeps SQL building and Android bridge in different modules. | |
| 74 | + |
| 75 | +## Red Flags |
| 76 | + |
| 77 | +- "I will answer from memory without file checks" |
| 78 | +- "I only need README for processor details" |
| 79 | +- "Build artifact folders are enough evidence for migration status" |
| 80 | + |
| 81 | +If any red flag appears, stop and reopen the reference maps. |
| 82 | + |
| 83 | +## External References |
| 84 | + |
| 85 | +- SQLite official docs: https://sqlite.org/docs.html |
| 86 | +- Android SQLite package summary: https://developer.android.com/reference/android/database/sqlite/package-summary |
| 87 | +- KAPT overview: https://kotlinlang.org/docs/kapt.html |
| 88 | +- KSP overview: https://kotlinlang.org/docs/ksp-overview.html |
| 89 | +- Android migration to KSP: https://developer.android.com/build/migrate-to-ksp |
| 90 | +- KotlinPoet docs: https://square.github.io/kotlinpoet/ |
| 91 | + |
| 92 | +## References |
| 93 | + |
| 94 | +- [SQLite and Android query map](./references/sqlite-android-query-map.md) |
| 95 | +- [Annotation processing map](./references/annotation-processing-map.md) |
0 commit comments