[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6X02WR2JWBP48QHA20PH4P2":3,"skill-same:01M6X02WR2JWBP48QHA20PH4P2":72},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":23,"publishedAt":44,"linkOnly":45,"markdownContent":46,"markdownBody":47,"frontMatter":48,"refName":49,"commitSha":50,"skillDirectory":51,"forksCount":52,"repositoryHtmlUrl":53,"repositoryHomepageUrl":6,"ownerHtmlUrl":54,"ownerBlogUrl":55,"ownerDescription":56,"updatedAt":57,"install":58,"resources":71},"01M6X02WR2JWBP48QHA20PH4P2","data-access-abstraction",null,"Data access abstraction patterns for apps that need to swap between local databases (SQLite) and cloud databases (Cosmos DB, PostgreSQL) without changing application code. Covers Node.js\u002FTypeScript, Python\u002FFastAPI, and .NET. Use when building apps that run locally with SQLite and deploy to Azure with Cosmos DB or PostgreSQL.","microsoft\u002Fagentic-journeys","microsoft","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F6154722?v=4","01M698VYDXZ6JW5WH3CRV650R8","Microsoft","01M6X02N4YDMMXKRMQMRA26956",6,"MIT","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fagentic-journeys\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fdata-access-abstraction\u002FSKILL.md",[18],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000033","数据分析师","PROFESSION","适用职业",[24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43],"data access abstraction","data","access","fastapi","when","for","apps","cosmos","db","local","patterns","databases","typescript","node","sqlite","postgresql","code","run","azure","python","2026-11-10 10:12:30",false,"---\nname: data-access-abstraction\ndescription: Data access abstraction patterns for apps that need to swap between local databases (SQLite) and cloud databases (Cosmos DB, PostgreSQL) without changing application code. Covers Node.js\u002FTypeScript, Python\u002FFastAPI, and .NET. Use when building apps that run locally with SQLite and deploy to Azure with Cosmos DB or PostgreSQL.\n---\n\n# Data Access Abstraction\n\nBuild APIs with swappable data layers using the repository pattern. Develop locally with SQLite, deploy to Azure with Cosmos DB or PostgreSQL — same route code, different backend. Works in any language.\n\n## When to Use This Skill\n\n- Building an API that needs to run locally (SQLite) and in Azure (Cosmos DB or PostgreSQL)\n- Adding a new data provider to an existing app without changing routes or business logic\n- Migrating from one database to another incrementally\n- Any project following the AIMarket journey pattern (local dev → cloud deploy)\n\n## Pattern Overview\n\nThe pattern is the same regardless of language:\n\n```\nRoutes\u002FControllers → Repository Interfaces → Factory → Implementations\n                                                │\n                                                ├── SQLite (local dev)\n                                                ├── Cosmos DB (Azure deploy)\n                                                ├── PostgreSQL (Azure deploy)\n                                                └── In-memory (testing)\n```\n\n**Three rules:**\n1. Define repository interfaces (or abstract classes \u002F protocols) per entity\n2. Routes depend only on the interfaces — never import a database client directly\n3. A factory reads a config value (`DATA_PROVIDER`) and returns the right implementation\n\nAdding a new database means writing a new implementation file. Zero changes to routes.\n\n## Environment Variable\n\nAll languages use the same convention:\n\n```\nDATA_PROVIDER=sqlite     # Local development (default)\nDATA_PROVIDER=cosmos     # Azure Cosmos DB\nDATA_PROVIDER=postgres   # Azure PostgreSQL\n```\n\n---\n\n## Node.js \u002F TypeScript\n\n### Repository Interfaces\n\n```typescript\n\u002F\u002F data\u002Finterfaces.ts\n\nexport interface IProductRepository {\n  getAll(params: {\n    page: number; pageSize: number;\n    category?: string; minPrice?: number; maxPrice?: number;\n  }): Promise\u003C{ data: Product[]; totalCount: number }>;\n\n  getById(id: string): Promise\u003CProduct | null>;\n  create(input: CreateProductInput): Promise\u003CProduct>;\n  update(id: string, fields: Partial\u003CProduct>): Promise\u003CProduct | null>;\n}\n\nexport interface IOrderRepository {\n  create(input: CreateOrderInput): Promise\u003COrder>;\n  getById(id: string): Promise\u003COrder | null>;\n  getByUserId(userId: string, page: number, pageSize: number): Promise\u003C{ data: Order[]; totalCount: number }>;\n}\n\nexport interface IUserRepository {\n  create(input: CreateUserInput): Promise\u003CUser>;\n  getById(id: string): Promise\u003CUser | null>;\n  getByEmail(email: string): Promise\u003CUser | null>;\n}\n\nexport interface DataStore {\n  products: IProductRepository;\n  orders: IOrderRepository;\n  users: IUserRepository;\n  close?(): void;\n}\n```\n\n### Factory\n\n```typescript\n\u002F\u002F data\u002Fstore.ts\n\nexport async function createStore(): Promise\u003CDataStore> {\n  const provider = process.env.DATA_PROVIDER || 'sqlite';\n  switch (provider) {\n    case 'sqlite':\n      return (await import('.\u002Fsqlite.js')).createSqliteStore();\n    case 'cosmos':\n      return (await import('.\u002Fcosmos.js')).createCosmosStore();\n    case 'postgres':\n      return (await import('.\u002Fpostgres.js')).createPostgresStore();\n    default:\n      throw new Error(`Unknown DATA_PROVIDER: ${provider}`);\n  }\n}\n```\n\n### SQLite Implementation\n\nUse `better-sqlite3` (synchronous API, fast). Wrap sync calls in `Promise.resolve()` or make routes `await` — sync values resolve immediately.\n\n```typescript\n\u002F\u002F data\u002Fsqlite.ts\n\nimport Database from 'better-sqlite3';\n\nexport function createSqliteStore(dbPath = 'app.db'): DataStore {\n  const db = new Database(dbPath);\n  db.pragma('journal_mode = WAL');\n  db.pragma('foreign_keys = ON');\n  \u002F\u002F Create tables, seed if empty...\n\n  return {\n    products: {\n      async getAll({ page, pageSize, category, minPrice, maxPrice }) {\n        let where = 'WHERE status = ?';\n        const params: any[] = ['active'];\n        if (category) { where += ' AND category = ?'; params.push(category); }\n        if (minPrice != null) { where += ' AND price >= ?'; params.push(minPrice); }\n        if (maxPrice != null) { where += ' AND price \u003C= ?'; params.push(maxPrice); }\n\n        const { c: totalCount } = db.prepare(`SELECT COUNT(*) as c FROM products ${where}`).get(...params);\n        const rows = db.prepare(`SELECT * FROM products ${where} LIMIT ? OFFSET ?`)\n          .all(...params, pageSize, (page - 1) * pageSize);\n        return { data: rows.map(parseRow), totalCount };\n      },\n      \u002F\u002F ...\n    },\n    close: () => db.close(),\n  };\n}\n```\n\n**SQLite-specific:** Store arrays as JSON strings (`JSON.stringify(tags)`), parse on read. Use a junction table for order items.\n\n### Cosmos DB Implementation\n\n```typescript\n\u002F\u002F data\u002Fcosmos.ts\n\nimport { CosmosClient } from '@azure\u002Fcosmos';\n\nexport function createCosmosStore(): DataStore {\n  const client = new CosmosClient({ endpoint: process.env.COSMOS_ENDPOINT!, key: process.env.COSMOS_KEY! });\n  const db = client.database(process.env.COSMOS_DATABASE || 'aimarket');\n\n  return {\n    products: {\n      async getAll({ page, pageSize, category, minPrice, maxPrice }) {\n        let query = 'SELECT * FROM c WHERE c.status = @status';\n        const parameters = [{ name: '@status', value: 'active' }];\n        if (category) { query += ' AND c.category = @cat'; parameters.push({ name: '@cat', value: category }); }\n        \u002F\u002F ... build query\n        const { resources } = await db.container('products').items.query({ query, parameters }).fetchAll();\n        return { data: resources.slice((page-1)*pageSize, page*pageSize), totalCount: resources.length };\n      },\n      \u002F\u002F ...\n    },\n  };\n}\n```\n\n**Cosmos-specific:** Arrays and objects are native JSON — no serialization. Embed order items in the order document.\n\n### PostgreSQL Implementation\n\nUse `pg` (node-postgres). PostgreSQL supports native arrays and JSONB, so it sits between SQLite and Cosmos in terms of data handling.\n\n```typescript\n\u002F\u002F data\u002Fpostgres.ts\n\nimport pg from 'pg';\n\nexport function createPostgresStore(): DataStore {\n  const pool = new pg.Pool({\n    connectionString: process.env.POSTGRES_CONNECTION_STRING,\n    ssl: process.env.POSTGRES_SSL === 'true' ? { rejectUnauthorized: false } : undefined,\n  });\n\n  return {\n    products: {\n      async getAll({ page, pageSize, category, minPrice, maxPrice }) {\n        let where = 'WHERE status = $1';\n        const params: any[] = ['active'];\n        let idx = 2;\n\n        if (category) { where += ` AND category = $${idx++}`; params.push(category); }\n        if (minPrice != null) { where += ` AND price >= $${idx++}`; params.push(minPrice); }\n        if (maxPrice != null) { where += ` AND price \u003C= $${idx++}`; params.push(maxPrice); }\n\n        const countRes = await pool.query(`SELECT COUNT(*) FROM products ${where}`, params);\n        const totalCount = parseInt(countRes.rows[0].count);\n        const dataRes = await pool.query(\n          `SELECT * FROM products ${where} LIMIT $${idx++} OFFSET $${idx}`,\n          [...params, pageSize, (page - 1) * pageSize]\n        );\n        return { data: dataRes.rows, totalCount };\n      },\n      \u002F\u002F ...\n    },\n    close: () => pool.end(),\n  };\n}\n```\n\n**PostgreSQL-specific:** Use `TEXT[]` for arrays (native), `JSONB` for nested objects, and `$1` parameterized queries. Azure PostgreSQL requires `ssl: { rejectUnauthorized: false }`.\n\n### Routes\n\n```typescript\n\u002F\u002F routes\u002Fproducts.ts — depends only on DataStore interface\n\nexport function productRoutes(store: DataStore): Router {\n  const router = Router();\n  router.get('\u002F', async (req, res) => {\n    const result = await store.products.getAll({ page: 1, pageSize: 20 });\n    res.json(result);\n  });\n  return router;\n}\n```\n\n---\n\n## Python \u002F FastAPI\n\n### Repository Interfaces\n\nUse `Protocol` (structural typing) or `ABC` (nominal typing). Protocol is more Pythonic.\n\n```python\n# data\u002Finterfaces.py\n\nfrom typing import Protocol\nfrom models import Product, Order, User\n\nclass ProductRepository(Protocol):\n    def get_all(self, *, page: int = 1, page_size: int = 20,\n                category: str | None = None, min_price: float | None = None,\n                max_price: float | None = None) -> dict:\n        \"\"\"Returns { 'data': list[Product], 'total_count': int }\"\"\"\n        ...\n\n    def get_by_id(self, id: str) -> Product | None: ...\n    def create(self, data: dict) -> Product: ...\n    def update(self, id: str, fields: dict) -> Product | None: ...\n\nclass OrderRepository(Protocol):\n    def create(self, data: dict) -> Order: ...\n    def get_by_id(self, id: str) -> Order | None: ...\n    def get_by_user_id(self, user_id: str, page: int, page_size: int) -> dict: ...\n\nclass UserRepository(Protocol):\n    def create(self, data: dict) -> User: ...\n    def get_by_id(self, id: str) -> User | None: ...\n    def get_by_email(self, email: str) -> User | None: ...\n\nclass DataStore(Protocol):\n    products: ProductRepository\n    orders: OrderRepository\n    users: UserRepository\n```\n\n### Factory\n\n```python\n# data\u002Fstore.py\n\nimport os\n\ndef create_store() -> DataStore:\n    provider = os.getenv(\"DATA_PROVIDER\", \"sqlite\")\n    if provider == \"sqlite\":\n        from data.sqlite import create_sqlite_store\n        return create_sqlite_store()\n    elif provider == \"cosmos\":\n        from data.cosmos import create_cosmos_store\n        return create_cosmos_store()\n    elif provider == \"postgres\":\n        from data.postgres import create_postgres_store\n        return create_postgres_store()\n    else:\n        raise ValueError(f\"Unknown DATA_PROVIDER: {provider}\")\n```\n\n### SQLite Implementation\n\n```python\n# data\u002Fsqlite.py\n\nimport sqlite3, json, uuid\nfrom models import Product\n\nclass SqliteProductRepository:\n    def __init__(self, db: sqlite3.Connection):\n        self.db = db\n\n    def get_all(self, *, page=1, page_size=20, category=None, min_price=None, max_price=None):\n        where, params = \"WHERE status = ?\", [\"active\"]\n        if category:\n            where += \" AND category = ?\"; params.append(category)\n        if min_price is not None:\n            where += \" AND price >= ?\"; params.append(min_price)\n        if max_price is not None:\n            where += \" AND price \u003C= ?\"; params.append(max_price)\n\n        total = self.db.execute(f\"SELECT COUNT(*) FROM products {where}\", params).fetchone()[0]\n        rows = self.db.execute(\n            f\"SELECT * FROM products {where} LIMIT ? OFFSET ?\",\n            params + [page_size, (page - 1) * page_size]\n        ).fetchall()\n\n        return {\"data\": [self._parse(r) for r in rows], \"total_count\": total}\n\n    def _parse(self, row) -> Product:\n        d = dict(row)\n        d[\"tags\"] = json.loads(d[\"tags\"])  # JSON string → list\n        return Product(**d)\n\ndef create_sqlite_store(db_path=\"app.db\"):\n    db = sqlite3.connect(db_path)\n    db.row_factory = sqlite3.Row\n    db.execute(\"PRAGMA journal_mode=WAL\")\n    db.execute(\"PRAGMA foreign_keys=ON\")\n    # Create tables, seed if empty...\n    return SqliteDataStore(\n        products=SqliteProductRepository(db),\n        orders=SqliteOrderRepository(db),\n        users=SqliteUserRepository(db),\n    )\n```\n\n### Cosmos DB Implementation\n\n```python\n# data\u002Fcosmos.py\n\nfrom azure.cosmos import CosmosClient\nimport os\n\nclass CosmosProductRepository:\n    def __init__(self, container):\n        self.container = container\n\n    def get_all(self, *, page=1, page_size=20, category=None, min_price=None, max_price=None):\n        query = \"SELECT * FROM c WHERE c.status = @status\"\n        params = [{\"name\": \"@status\", \"value\": \"active\"}]\n        if category:\n            query += \" AND c.category = @cat\"\n            params.append({\"name\": \"@cat\", \"value\": category})\n        # ... build query\n        items = list(self.container.query_items(query=query, parameters=params, enable_cross_partition_query=True))\n        start = (page - 1) * page_size\n        return {\"data\": items[start:start+page_size], \"total_count\": len(items)}\n\ndef create_cosmos_store():\n    client = CosmosClient(os.environ[\"COSMOS_ENDPOINT\"], os.environ[\"COSMOS_KEY\"])\n    db = client.get_database_client(os.getenv(\"COSMOS_DATABASE\", \"aimarket\"))\n    return CosmosDataStore(\n        products=CosmosProductRepository(db.get_container_client(\"products\")),\n        orders=CosmosOrderRepository(db.get_container_client(\"orders\")),\n        users=CosmosUserRepository(db.get_container_client(\"users\")),\n    )\n```\n\n### FastAPI Routes\n\n```python\n# routes\u002Fproducts.py — depends only on DataStore protocol\n\nfrom fastapi import APIRouter, Depends\nfrom data.store import create_store\n\nrouter = APIRouter(prefix=\"\u002Fapi\u002Fproducts\")\n\n@router.get(\"\u002F\")\ndef list_products(page: int = 1, page_size: int = 20, category: str | None = None,\n                  store: DataStore = Depends(create_store)):\n    result = store.products.get_all(page=page, page_size=page_size, category=category)\n    return {**result, \"page\": page, \"page_size\": page_size}\n```\n\n---\n\n## .NET \u002F C# (Minimal APIs or Controllers)\n\n### Repository Interfaces\n\n```csharp\n\u002F\u002F Data\u002FInterfaces.cs\n\npublic interface IProductRepository\n{\n    Task\u003C(List\u003CProduct> Data, int TotalCount)> GetAllAsync(\n        int page = 1, int pageSize = 20,\n        string? category = null, decimal? minPrice = null, decimal? maxPrice = null);\n    Task\u003CProduct?> GetByIdAsync(string id);\n    Task\u003CProduct> CreateAsync(CreateProductInput input);\n    Task\u003CProduct?> UpdateAsync(string id, UpdateProductInput input);\n}\n\npublic interface IOrderRepository\n{\n    Task\u003COrder> CreateAsync(CreateOrderInput input);\n    Task\u003COrder?> GetByIdAsync(string id);\n    Task\u003C(List\u003COrder> Data, int TotalCount)> GetByUserIdAsync(string userId, int page, int pageSize);\n}\n\npublic interface IUserRepository\n{\n    Task\u003CUser> CreateAsync(CreateUserInput input);\n    Task\u003CUser?> GetByIdAsync(string id);\n    Task\u003CUser?> GetByEmailAsync(string email);\n}\n```\n\n### Dependency Injection (Factory)\n\n```csharp\n\u002F\u002F Program.cs\n\nvar provider = builder.Configuration[\"DATA_PROVIDER\"] ?? \"sqlite\";\n\nif (provider == \"sqlite\")\n{\n    builder.Services.AddSingleton\u003CIProductRepository, SqliteProductRepository>();\n    builder.Services.AddSingleton\u003CIOrderRepository, SqliteOrderRepository>();\n    builder.Services.AddSingleton\u003CIUserRepository, SqliteUserRepository>();\n}\nelse if (provider == \"cosmos\")\n{\n    builder.Services.AddSingleton\u003CIProductRepository, CosmosProductRepository>();\n    builder.Services.AddSingleton\u003CIOrderRepository, CosmosOrderRepository>();\n    builder.Services.AddSingleton\u003CIUserRepository, CosmosUserRepository>();\n}\nelse if (provider == \"postgres\")\n{\n    builder.Services.AddSingleton\u003CIProductRepository, PostgresProductRepository>();\n    builder.Services.AddSingleton\u003CIOrderRepository, PostgresOrderRepository>();\n    builder.Services.AddSingleton\u003CIUserRepository, PostgresUserRepository>();\n}\n```\n\n.NET uses built-in DI instead of a manual factory. The pattern is the same: register implementations based on config, inject interfaces into routes.\n\n### SQLite Implementation\n\n```csharp\n\u002F\u002F Data\u002FSqliteProductRepository.cs\n\nusing Microsoft.Data.Sqlite;\nusing System.Text.Json;\n\npublic class SqliteProductRepository : IProductRepository\n{\n    private readonly SqliteConnection _db;\n\n    public SqliteProductRepository(IConfiguration config)\n    {\n        _db = new SqliteConnection(config.GetConnectionString(\"Sqlite\") ?? \"Data Source=app.db\");\n        _db.Open();\n        \u002F\u002F Create tables, seed if empty...\n    }\n\n    public async Task\u003C(List\u003CProduct> Data, int TotalCount)> GetAllAsync(\n        int page = 1, int pageSize = 20,\n        string? category = null, decimal? minPrice = null, decimal? maxPrice = null)\n    {\n        var where = \"WHERE status = 'active'\";\n        if (category != null) where += $\" AND category = @category\";\n        if (minPrice != null) where += $\" AND price >= @minPrice\";\n        if (maxPrice != null) where += $\" AND price \u003C= @maxPrice\";\n\n        \u002F\u002F Execute count + select queries...\n        \u002F\u002F Parse tags from JSON string: JsonSerializer.Deserialize\u003Cstring[]>(row[\"tags\"])\n    }\n}\n```\n\n### Cosmos DB Implementation\n\n```csharp\n\u002F\u002F Data\u002FCosmosProductRepository.cs\n\nusing Microsoft.Azure.Cosmos;\n\npublic class CosmosProductRepository : IProductRepository\n{\n    private readonly Container _container;\n\n    public CosmosProductRepository(CosmosClient client, IConfiguration config)\n    {\n        var db = client.GetDatabase(config[\"COSMOS_DATABASE\"] ?? \"aimarket\");\n        _container = db.GetContainer(\"products\");\n    }\n\n    public async Task\u003C(List\u003CProduct> Data, int TotalCount)> GetAllAsync(\n        int page = 1, int pageSize = 20,\n        string? category = null, decimal? minPrice = null, decimal? maxPrice = null)\n    {\n        var query = new QueryDefinition(\"SELECT * FROM c WHERE c.status = @status\")\n            .WithParameter(\"@status\", \"active\");\n        \u002F\u002F Add filters, execute, paginate...\n    }\n}\n```\n\n### Minimal API Routes\n\n```csharp\n\u002F\u002F Routes depend only on interfaces — injected via DI\n\napp.MapGet(\"\u002Fapi\u002Fproducts\", async (IProductRepository repo,\n    int page = 1, int pageSize = 20, string? category = null) =>\n{\n    var (data, total) = await repo.GetAllAsync(page, pageSize, category);\n    return Results.Ok(new { data, page, pageSize, totalCount = total });\n});\n```\n\n---\n\n## Java \u002F Spring Boot\n\n### Repository Interfaces\n\n```java\n\u002F\u002F data\u002FProductRepository.java\n\npublic interface ProductRepository {\n    PaginatedResult\u003CProduct> getAll(int page, int pageSize,\n        String category, Double minPrice, Double maxPrice);\n    Optional\u003CProduct> getById(String id);\n    Product create(CreateProductInput input);\n    Optional\u003CProduct> update(String id, UpdateProductInput input);\n}\n\n\u002F\u002F data\u002FOrderRepository.java\n\npublic interface OrderRepository {\n    Order create(CreateOrderInput input);\n    Optional\u003COrder> getById(String id);\n    PaginatedResult\u003COrder> getByUserId(String userId, int page, int pageSize);\n}\n\n\u002F\u002F data\u002FUserRepository.java\n\npublic interface UserRepository {\n    User create(CreateUserInput input);\n    Optional\u003CUser> getById(String id);\n    Optional\u003CUser> getByEmail(String email);\n}\n```\n\n### Factory via Spring Profiles\n\nSpring profiles replace the manual factory. Set `DATA_PROVIDER` as the active profile:\n\n```yaml\n# application.yml\nspring:\n  profiles:\n    active: ${DATA_PROVIDER:sqlite}\n```\n\n```java\n\u002F\u002F data\u002Fsqlite\u002FSqliteProductRepository.java\n\n@Repository\n@Profile(\"sqlite\")\npublic class SqliteProductRepository implements ProductRepository {\n    private final JdbcTemplate jdbc;\n\n    public SqliteProductRepository(DataSource dataSource) {\n        this.jdbc = new JdbcTemplate(dataSource);\n    }\n\n    @Override\n    public PaginatedResult\u003CProduct> getAll(int page, int pageSize,\n            String category, Double minPrice, Double maxPrice) {\n        var where = new StringBuilder(\"WHERE status = 'active'\");\n        var params = new ArrayList\u003C>();\n\n        if (category != null) { where.append(\" AND category = ?\"); params.add(category); }\n        if (minPrice != null) { where.append(\" AND price >= ?\"); params.add(minPrice); }\n        if (maxPrice != null) { where.append(\" AND price \u003C= ?\"); params.add(maxPrice); }\n\n        int total = jdbc.queryForObject(\n            \"SELECT COUNT(*) FROM products \" + where, Integer.class, params.toArray());\n        var rows = jdbc.query(\n            \"SELECT * FROM products \" + where + \" LIMIT ? OFFSET ?\",\n            this::mapRow,\n            Stream.concat(params.stream(), Stream.of(pageSize, (page - 1) * pageSize)).toArray());\n\n        return new PaginatedResult\u003C>(rows, total);\n    }\n\n    private Product mapRow(ResultSet rs, int rowNum) throws SQLException {\n        return new Product(\n            rs.getString(\"id\"),\n            rs.getString(\"name\"),\n            \u002F\u002F ...\n            objectMapper.readValue(rs.getString(\"tags\"), new TypeReference\u003CList\u003CString>>() {}),  \u002F\u002F JSON → List\n            \u002F\u002F ...\n        );\n    }\n}\n```\n\n```java\n\u002F\u002F data\u002Fcosmos\u002FCosmosProductRepository.java\n\n@Repository\n@Profile(\"cosmos\")\npublic class CosmosProductRepository implements ProductRepository {\n    private final CosmosContainer container;\n\n    public CosmosProductRepository(CosmosClient client,\n            @Value(\"${cosmos.database:aimarket}\") String dbName) {\n        this.container = client.getDatabase(dbName).getContainer(\"products\");\n    }\n\n    @Override\n    public PaginatedResult\u003CProduct> getAll(int page, int pageSize,\n            String category, Double minPrice, Double maxPrice) {\n        var query = new StringBuilder(\"SELECT * FROM c WHERE c.status = @status\");\n        var params = new ArrayList\u003CSqlParameter>();\n        params.add(new SqlParameter(\"@status\", \"active\"));\n\n        if (category != null) {\n            query.append(\" AND c.category = @cat\");\n            params.add(new SqlParameter(\"@cat\", category));\n        }\n        \u002F\u002F ... build query\n\n        var options = new CosmosQueryRequestOptions();\n        var items = container.queryItems(\n            new SqlQuerySpec(query.toString(), params), options, Product.class);\n\n        var all = items.stream().collect(Collectors.toList());\n        int start = (page - 1) * pageSize;\n        return new PaginatedResult\u003C>(\n            all.subList(start, Math.min(start + pageSize, all.size())), all.size());\n    }\n}\n```\n\n### SQLite DataSource Config\n\n```java\n\u002F\u002F config\u002FSqliteConfig.java\n\n@Configuration\n@Profile(\"sqlite\")\npublic class SqliteConfig {\n    @Bean\n    public DataSource dataSource() {\n        var ds = new SQLiteDataSource();\n        ds.setUrl(\"jdbc:sqlite:app.db\");\n        return ds;\n    }\n\n    @Bean\n    public CommandLineRunner initDb(DataSource dataSource) {\n        return args -> {\n            var jdbc = new JdbcTemplate(dataSource);\n            jdbc.execute(\"PRAGMA journal_mode=WAL\");\n            jdbc.execute(\"PRAGMA foreign_keys=ON\");\n            \u002F\u002F Create tables, seed if empty...\n        };\n    }\n}\n```\n\n### Controller Routes\n\n```java\n\u002F\u002F controller\u002FProductController.java — depends only on ProductRepository interface\n\n@RestController\n@RequestMapping(\"\u002Fapi\u002Fproducts\")\npublic class ProductController {\n    private final ProductRepository repo;\n\n    public ProductController(ProductRepository repo) {  \u002F\u002F Spring injects the active profile's impl\n        this.repo = repo;\n    }\n\n    @GetMapping\n    public ResponseEntity\u003C?> list(\n            @RequestParam(defaultValue = \"1\") int page,\n            @RequestParam(defaultValue = \"20\") int pageSize,\n            @RequestParam(required = false) String category) {\n        var result = repo.getAll(page, pageSize, category, null, null);\n        return ResponseEntity.ok(Map.of(\n            \"data\", result.data(), \"page\", page, \"pageSize\", pageSize,\n            \"totalCount\", result.totalCount(),\n            \"totalPages\", (int) Math.ceil((double) result.totalCount() \u002F pageSize)\n        ));\n    }\n}\n```\n\n**Key:** Spring's `@Profile` + DI eliminates the manual factory. Set `DATA_PROVIDER=postgres` or `DATA_PROVIDER=cosmos` as the active profile and Spring wires the matching implementations automatically. Add `@Profile(\"postgres\")` to a `PostgresProductRepository` that uses `JdbcTemplate` with a PostgreSQL `DataSource` — same `JdbcTemplate` API as SQLite, different driver and SQL dialect.\n\n---\n\n## SQLite Patterns (All Languages)\n\nSQLite doesn't support arrays or nested objects. These patterns apply regardless of language:\n\n| Data Type | SQLite Storage | Read Pattern |\n|-----------|---------------|-------------|\n| `string[]` (tags) | JSON string column: `'[\"tag1\",\"tag2\"]'` | Parse with `JSON.parse()` \u002F `json.loads()` \u002F `JsonSerializer.Deserialize` \u002F `ObjectMapper.readValue()` |\n| Nested object (address) | JSON string column: `'{\"street\":\"...\"}'` | Parse on read |\n| One-to-many (order items) | Junction table: `order_items(orderId, productId, quantity, price)` | JOIN on read |\n| UUID primary keys | TEXT column | Generate with `uuid` \u002F `uuid4()` \u002F `Guid.NewGuid()` \u002F `UUID.randomUUID()` |\n\n**Pragmas to always set:**\n```sql\nPRAGMA journal_mode = WAL;    -- Better concurrent read performance\nPRAGMA foreign_keys = ON;     -- Enforce referential integrity\n```\n\n## Cosmos DB Patterns (All Languages)\n\n| Data Type | Cosmos DB Storage | Notes |\n|-----------|------------------|-------|\n| `string[]` (tags) | Native JSON array | No serialization needed |\n| Nested object (address) | Native JSON object | No serialization needed |\n| One-to-many (order items) | Embedded array in document | No junction table needed |\n| Queries | SQL-like with `@param` | Use parameterized queries for safety |\n\n**Partition key strategy:** Choose a field that distributes data evenly. Common choices: `\u002Fid` (default), `\u002Fcategory` (products), `\u002FuserId` (orders).\n\n## PostgreSQL Patterns (All Languages)\n\nPostgreSQL supports native arrays and JSONB, so it handles complex types better than SQLite but uses SQL instead of Cosmos DB's document model.\n\n| Data Type | PostgreSQL Storage | Notes |\n|-----------|-------------------|-------|\n| `string[]` (tags) | `TEXT[]` (native array) | Use `= ANY($1)` for filtering, no serialization needed |\n| Nested object (address) | `JSONB` column | Query with `->` \u002F `->>` operators |\n| One-to-many (order items) | Junction table (same as SQLite) or `JSONB` array | Junction table is cleaner for queries |\n| UUID primary keys | `UUID` type or `TEXT` | Use `gen_random_uuid()` for server-side generation |\n| Parameterized queries | `$1, $2, $3` (Node pg) or `%s` (Python psycopg2) or `@param` (.NET Npgsql) | Never concatenate user input |\n\n**Azure PostgreSQL requirements:**\n```\n# Connection string must include sslmode\nPOSTGRES_CONNECTION_STRING=postgresql:\u002F\u002Fuser:pass@host.postgres.database.azure.com:5432\u002Faimarket?sslmode=require\n\n# For Azure Flexible Server, also set\nPOSTGRES_SSL=true\n```\n\n**Libraries by language:**\n\n| Language | Library | Notes |\n|----------|---------|-------|\n| Node.js | `pg` (node-postgres) | Use `Pool` for connection pooling |\n| Python | `psycopg2` or `asyncpg` | `psycopg2-binary` for easy install, `asyncpg` for async FastAPI |\n| .NET | `Npgsql` + `Npgsql.EntityFrameworkCore.PostgreSQL` | Or raw `NpgsqlConnection` |\n| Java | Spring `JdbcTemplate` + `postgresql` driver | Same `JdbcTemplate` API as SQLite, different DataSource |\n\n## Anti-Patterns\n\n| Don't | Do Instead |\n|-------|------------|\n| Import database clients in route files | Import only interfaces\u002Fprotocols |\n| Put SQL\u002Fquery strings in routes | Encapsulate in the implementation |\n| Hardcode connection strings | Use environment variables |\n| Create one repository for all entities | One interface per entity |\n| Skip `async\u002Fawait` because SQLite is sync | Always use async — it's free for sync implementations |\n| Test against a real database | Create an in-memory implementation for unit tests |\n\n## Checklist\n\n- [ ] Repository interfaces defined per entity (typed, no database-specific imports)\n- [ ] Factory\u002FDI reads `DATA_PROVIDER` and returns the correct implementation\n- [ ] Routes depend only on interfaces, never on implementation files\n- [ ] SQLite implementation handles JSON serialization for arrays and objects\n- [ ] PostgreSQL implementation uses native `TEXT[]` for arrays and `JSONB` for objects\n- [ ] Cosmos DB implementation uses native JSON types (no serialization)\n- [ ] `DATA_PROVIDER=sqlite` works locally\n- [ ] `DATA_PROVIDER=postgres` works with Azure PostgreSQL (SSL enabled)\n- [ ] `DATA_PROVIDER=cosmos` works with Azure Cosmos DB\n- [ ] `.env.example` documents all providers and their required variables\n- [ ] An in-memory implementation exists for unit tests\n","# Data Access Abstraction\n\nBuild APIs with swappable data layers using the repository pattern. Develop locally with SQLite, deploy to Azure with Cosmos DB or PostgreSQL — same route code, different backend. Works in any language.\n\n## When to Use This Skill\n\n- Building an API that needs to run locally (SQLite) and in Azure (Cosmos DB or PostgreSQL)\n- Adding a new data provider to an existing app without changing routes or business logic\n- Migrating from one database to another incrementally\n- Any project following the AIMarket journey pattern (local dev → cloud deploy)\n\n## Pattern Overview\n\nThe pattern is the same regardless of language:\n\n```\nRoutes\u002FControllers → Repository Interfaces → Factory → Implementations\n                                                │\n                                                ├── SQLite (local dev)\n                                                ├── Cosmos DB (Azure deploy)\n                                                ├── PostgreSQL (Azure deploy)\n                                                └── In-memory (testing)\n```\n\n**Three rules:**\n1. Define repository interfaces (or abstract classes \u002F protocols) per entity\n2. Routes depend only on the interfaces — never import a database client directly\n3. A factory reads a config value (`DATA_PROVIDER`) and returns the right implementation\n\nAdding a new database means writing a new implementation file. Zero changes to routes.\n\n## Environment Variable\n\nAll languages use the same convention:\n\n```\nDATA_PROVIDER=sqlite     # Local development (default)\nDATA_PROVIDER=cosmos     # Azure Cosmos DB\nDATA_PROVIDER=postgres   # Azure PostgreSQL\n```\n\n---\n\n## Node.js \u002F TypeScript\n\n### Repository Interfaces\n\n```typescript\n\u002F\u002F data\u002Finterfaces.ts\n\nexport interface IProductRepository {\n  getAll(params: {\n    page: number; pageSize: number;\n    category?: string; minPrice?: number; maxPrice?: number;\n  }): Promise\u003C{ data: Product[]; totalCount: number }>;\n\n  getById(id: string): Promise\u003CProduct | null>;\n  create(input: CreateProductInput): Promise\u003CProduct>;\n  update(id: string, fields: Partial\u003CProduct>): Promise\u003CProduct | null>;\n}\n\nexport interface IOrderRepository {\n  create(input: CreateOrderInput): Promise\u003COrder>;\n  getById(id: string): Promise\u003COrder | null>;\n  getByUserId(userId: string, page: number, pageSize: number): Promise\u003C{ data: Order[]; totalCount: number }>;\n}\n\nexport interface IUserRepository {\n  create(input: CreateUserInput): Promise\u003CUser>;\n  getById(id: string): Promise\u003CUser | null>;\n  getByEmail(email: string): Promise\u003CUser | null>;\n}\n\nexport interface DataStore {\n  products: IProductRepository;\n  orders: IOrderRepository;\n  users: IUserRepository;\n  close?(): void;\n}\n```\n\n### Factory\n\n```typescript\n\u002F\u002F data\u002Fstore.ts\n\nexport async function createStore(): Promise\u003CDataStore> {\n  const provider = process.env.DATA_PROVIDER || 'sqlite';\n  switch (provider) {\n    case 'sqlite':\n      return (await import('.\u002Fsqlite.js')).createSqliteStore();\n    case 'cosmos':\n      return (await import('.\u002Fcosmos.js')).createCosmosStore();\n    case 'postgres':\n      return (await import('.\u002Fpostgres.js')).createPostgresStore();\n    default:\n      throw new Error(`Unknown DATA_PROVIDER: ${provider}`);\n  }\n}\n```\n\n### SQLite Implementation\n\nUse `better-sqlite3` (synchronous API, fast). Wrap sync calls in `Promise.resolve()` or make routes `await` — sync values resolve immediately.\n\n```typescript\n\u002F\u002F data\u002Fsqlite.ts\n\nimport Database from 'better-sqlite3';\n\nexport function createSqliteStore(dbPath = 'app.db'): DataStore {\n  const db = new Database(dbPath);\n  db.pragma('journal_mode = WAL');\n  db.pragma('foreign_keys = ON');\n  \u002F\u002F Create tables, seed if empty...\n\n  return {\n    products: {\n      async getAll({ page, pageSize, category, minPrice, maxPrice }) {\n        let where = 'WHERE status = ?';\n        const params: any[] = ['active'];\n        if (category) { where += ' AND category = ?'; params.push(category); }\n        if (minPrice != null) { where += ' AND price >= ?'; params.push(minPrice); }\n        if (maxPrice != null) { where += ' AND price \u003C= ?'; params.push(maxPrice); }\n\n        const { c: totalCount } = db.prepare(`SELECT COUNT(*) as c FROM products ${where}`).get(...params);\n        const rows = db.prepare(`SELECT * FROM products ${where} LIMIT ? OFFSET ?`)\n          .all(...params, pageSize, (page - 1) * pageSize);\n        return { data: rows.map(parseRow), totalCount };\n      },\n      \u002F\u002F ...\n    },\n    close: () => db.close(),\n  };\n}\n```\n\n**SQLite-specific:** Store arrays as JSON strings (`JSON.stringify(tags)`), parse on read. Use a junction table for order items.\n\n### Cosmos DB Implementation\n\n```typescript\n\u002F\u002F data\u002Fcosmos.ts\n\nimport { CosmosClient } from '@azure\u002Fcosmos';\n\nexport function createCosmosStore(): DataStore {\n  const client = new CosmosClient({ endpoint: process.env.COSMOS_ENDPOINT!, key: process.env.COSMOS_KEY! });\n  const db = client.database(process.env.COSMOS_DATABASE || 'aimarket');\n\n  return {\n    products: {\n      async getAll({ page, pageSize, category, minPrice, maxPrice }) {\n        let query = 'SELECT * FROM c WHERE c.status = @status';\n        const parameters = [{ name: '@status', value: 'active' }];\n        if (category) { query += ' AND c.category = @cat'; parameters.push({ name: '@cat', value: category }); }\n        \u002F\u002F ... build query\n        const { resources } = await db.container('products').items.query({ query, parameters }).fetchAll();\n        return { data: resources.slice((page-1)*pageSize, page*pageSize), totalCount: resources.length };\n      },\n      \u002F\u002F ...\n    },\n  };\n}\n```\n\n**Cosmos-specific:** Arrays and objects are native JSON — no serialization. Embed order items in the order document.\n\n### PostgreSQL Implementation\n\nUse `pg` (node-postgres). PostgreSQL supports native arrays and JSONB, so it sits between SQLite and Cosmos in terms of data handling.\n\n```typescript\n\u002F\u002F data\u002Fpostgres.ts\n\nimport pg from 'pg';\n\nexport function createPostgresStore(): DataStore {\n  const pool = new pg.Pool({\n    connectionString: process.env.POSTGRES_CONNECTION_STRING,\n    ssl: process.env.POSTGRES_SSL === 'true' ? { rejectUnauthorized: false } : undefined,\n  });\n\n  return {\n    products: {\n      async getAll({ page, pageSize, category, minPrice, maxPrice }) {\n        let where = 'WHERE status = $1';\n        const params: any[] = ['active'];\n        let idx = 2;\n\n        if (category) { where += ` AND category = $${idx++}`; params.push(category); }\n        if (minPrice != null) { where += ` AND price >= $${idx++}`; params.push(minPrice); }\n        if (maxPrice != null) { where += ` AND price \u003C= $${idx++}`; params.push(maxPrice); }\n\n        const countRes = await pool.query(`SELECT COUNT(*) FROM products ${where}`, params);\n        const totalCount = parseInt(countRes.rows[0].count);\n        const dataRes = await pool.query(\n          `SELECT * FROM products ${where} LIMIT $${idx++} OFFSET $${idx}`,\n          [...params, pageSize, (page - 1) * pageSize]\n        );\n        return { data: dataRes.rows, totalCount };\n      },\n      \u002F\u002F ...\n    },\n    close: () => pool.end(),\n  };\n}\n```\n\n**PostgreSQL-specific:** Use `TEXT[]` for arrays (native), `JSONB` for nested objects, and `$1` parameterized queries. Azure PostgreSQL requires `ssl: { rejectUnauthorized: false }`.\n\n### Routes\n\n```typescript\n\u002F\u002F routes\u002Fproducts.ts — depends only on DataStore interface\n\nexport function productRoutes(store: DataStore): Router {\n  const router = Router();\n  router.get('\u002F', async (req, res) => {\n    const result = await store.products.getAll({ page: 1, pageSize: 20 });\n    res.json(result);\n  });\n  return router;\n}\n```\n\n---\n\n## Python \u002F FastAPI\n\n### Repository Interfaces\n\nUse `Protocol` (structural typing) or `ABC` (nominal typing). Protocol is more Pythonic.\n\n```python\n# data\u002Finterfaces.py\n\nfrom typing import Protocol\nfrom models import Product, Order, User\n\nclass ProductRepository(Protocol):\n    def get_all(self, *, page: int = 1, page_size: int = 20,\n                category: str | None = None, min_price: float | None = None,\n                max_price: float | None = None) -> dict:\n        \"\"\"Returns { 'data': list[Product], 'total_count': int }\"\"\"\n        ...\n\n    def get_by_id(self, id: str) -> Product | None: ...\n    def create(self, data: dict) -> Product: ...\n    def update(self, id: str, fields: dict) -> Product | None: ...\n\nclass OrderRepository(Protocol):\n    def create(self, data: dict) -> Order: ...\n    def get_by_id(self, id: str) -> Order | None: ...\n    def get_by_user_id(self, user_id: str, page: int, page_size: int) -> dict: ...\n\nclass UserRepository(Protocol):\n    def create(self, data: dict) -> User: ...\n    def get_by_id(self, id: str) -> User | None: ...\n    def get_by_email(self, email: str) -> User | None: ...\n\nclass DataStore(Protocol):\n    products: ProductRepository\n    orders: OrderRepository\n    users: UserRepository\n```\n\n### Factory\n\n```python\n# data\u002Fstore.py\n\nimport os\n\ndef create_store() -> DataStore:\n    provider = os.getenv(\"DATA_PROVIDER\", \"sqlite\")\n    if provider == \"sqlite\":\n        from data.sqlite import create_sqlite_store\n        return create_sqlite_store()\n    elif provider == \"cosmos\":\n        from data.cosmos import create_cosmos_store\n        return create_cosmos_store()\n    elif provider == \"postgres\":\n        from data.postgres import create_postgres_store\n        return create_postgres_store()\n    else:\n        raise ValueError(f\"Unknown DATA_PROVIDER: {provider}\")\n```\n\n### SQLite Implementation\n\n```python\n# data\u002Fsqlite.py\n\nimport sqlite3, json, uuid\nfrom models import Product\n\nclass SqliteProductRepository:\n    def __init__(self, db: sqlite3.Connection):\n        self.db = db\n\n    def get_all(self, *, page=1, page_size=20, category=None, min_price=None, max_price=None):\n        where, params = \"WHERE status = ?\", [\"active\"]\n        if category:\n            where += \" AND category = ?\"; params.append(category)\n        if min_price is not None:\n            where += \" AND price >= ?\"; params.append(min_price)\n        if max_price is not None:\n            where += \" AND price \u003C= ?\"; params.append(max_price)\n\n        total = self.db.execute(f\"SELECT COUNT(*) FROM products {where}\", params).fetchone()[0]\n        rows = self.db.execute(\n            f\"SELECT * FROM products {where} LIMIT ? OFFSET ?\",\n            params + [page_size, (page - 1) * page_size]\n        ).fetchall()\n\n        return {\"data\": [self._parse(r) for r in rows], \"total_count\": total}\n\n    def _parse(self, row) -> Product:\n        d = dict(row)\n        d[\"tags\"] = json.loads(d[\"tags\"])  # JSON string → list\n        return Product(**d)\n\ndef create_sqlite_store(db_path=\"app.db\"):\n    db = sqlite3.connect(db_path)\n    db.row_factory = sqlite3.Row\n    db.execute(\"PRAGMA journal_mode=WAL\")\n    db.execute(\"PRAGMA foreign_keys=ON\")\n    # Create tables, seed if empty...\n    return SqliteDataStore(\n        products=SqliteProductRepository(db),\n        orders=SqliteOrderRepository(db),\n        users=SqliteUserRepository(db),\n    )\n```\n\n### Cosmos DB Implementation\n\n```python\n# data\u002Fcosmos.py\n\nfrom azure.cosmos import CosmosClient\nimport os\n\nclass CosmosProductRepository:\n    def __init__(self, container):\n        self.container = container\n\n    def get_all(self, *, page=1, page_size=20, category=None, min_price=None, max_price=None):\n        query = \"SELECT * FROM c WHERE c.status = @status\"\n        params = [{\"name\": \"@status\", \"value\": \"active\"}]\n        if category:\n            query += \" AND c.category = @cat\"\n            params.append({\"name\": \"@cat\", \"value\": category})\n        # ... build query\n        items = list(self.container.query_items(query=query, parameters=params, enable_cross_partition_query=True))\n        start = (page - 1) * page_size\n        return {\"data\": items[start:start+page_size], \"total_count\": len(items)}\n\ndef create_cosmos_store():\n    client = CosmosClient(os.environ[\"COSMOS_ENDPOINT\"], os.environ[\"COSMOS_KEY\"])\n    db = client.get_database_client(os.getenv(\"COSMOS_DATABASE\", \"aimarket\"))\n    return CosmosDataStore(\n        products=CosmosProductRepository(db.get_container_client(\"products\")),\n        orders=CosmosOrderRepository(db.get_container_client(\"orders\")),\n        users=CosmosUserRepository(db.get_container_client(\"users\")),\n    )\n```\n\n### FastAPI Routes\n\n```python\n# routes\u002Fproducts.py — depends only on DataStore protocol\n\nfrom fastapi import APIRouter, Depends\nfrom data.store import create_store\n\nrouter = APIRouter(prefix=\"\u002Fapi\u002Fproducts\")\n\n@router.get(\"\u002F\")\ndef list_products(page: int = 1, page_size: int = 20, category: str | None = None,\n                  store: DataStore = Depends(create_store)):\n    result = store.products.get_all(page=page, page_size=page_size, category=category)\n    return {**result, \"page\": page, \"page_size\": page_size}\n```\n\n---\n\n## .NET \u002F C# (Minimal APIs or Controllers)\n\n### Repository Interfaces\n\n```csharp\n\u002F\u002F Data\u002FInterfaces.cs\n\npublic interface IProductRepository\n{\n    Task\u003C(List\u003CProduct> Data, int TotalCount)> GetAllAsync(\n        int page = 1, int pageSize = 20,\n        string? category = null, decimal? minPrice = null, decimal? maxPrice = null);\n    Task\u003CProduct?> GetByIdAsync(string id);\n    Task\u003CProduct> CreateAsync(CreateProductInput input);\n    Task\u003CProduct?> UpdateAsync(string id, UpdateProductInput input);\n}\n\npublic interface IOrderRepository\n{\n    Task\u003COrder> CreateAsync(CreateOrderInput input);\n    Task\u003COrder?> GetByIdAsync(string id);\n    Task\u003C(List\u003COrder> Data, int TotalCount)> GetByUserIdAsync(string userId, int page, int pageSize);\n}\n\npublic interface IUserRepository\n{\n    Task\u003CUser> CreateAsync(CreateUserInput input);\n    Task\u003CUser?> GetByIdAsync(string id);\n    Task\u003CUser?> GetByEmailAsync(string email);\n}\n```\n\n### Dependency Injection (Factory)\n\n```csharp\n\u002F\u002F Program.cs\n\nvar provider = builder.Configuration[\"DATA_PROVIDER\"] ?? \"sqlite\";\n\nif (provider == \"sqlite\")\n{\n    builder.Services.AddSingleton\u003CIProductRepository, SqliteProductRepository>();\n    builder.Services.AddSingleton\u003CIOrderRepository, SqliteOrderRepository>();\n    builder.Services.AddSingleton\u003CIUserRepository, SqliteUserRepository>();\n}\nelse if (provider == \"cosmos\")\n{\n    builder.Services.AddSingleton\u003CIProductRepository, CosmosProductRepository>();\n    builder.Services.AddSingleton\u003CIOrderRepository, CosmosOrderRepository>();\n    builder.Services.AddSingleton\u003CIUserRepository, CosmosUserRepository>();\n}\nelse if (provider == \"postgres\")\n{\n    builder.Services.AddSingleton\u003CIProductRepository, PostgresProductRepository>();\n    builder.Services.AddSingleton\u003CIOrderRepository, PostgresOrderRepository>();\n    builder.Services.AddSingleton\u003CIUserRepository, PostgresUserRepository>();\n}\n```\n\n.NET uses built-in DI instead of a manual factory. The pattern is the same: register implementations based on config, inject interfaces into routes.\n\n### SQLite Implementation\n\n```csharp\n\u002F\u002F Data\u002FSqliteProductRepository.cs\n\nusing Microsoft.Data.Sqlite;\nusing System.Text.Json;\n\npublic class SqliteProductRepository : IProductRepository\n{\n    private readonly SqliteConnection _db;\n\n    public SqliteProductRepository(IConfiguration config)\n    {\n        _db = new SqliteConnection(config.GetConnectionString(\"Sqlite\") ?? \"Data Source=app.db\");\n        _db.Open();\n        \u002F\u002F Create tables, seed if empty...\n    }\n\n    public async Task\u003C(List\u003CProduct> Data, int TotalCount)> GetAllAsync(\n        int page = 1, int pageSize = 20,\n        string? category = null, decimal? minPrice = null, decimal? maxPrice = null)\n    {\n        var where = \"WHERE status = 'active'\";\n        if (category != null) where += $\" AND category = @category\";\n        if (minPrice != null) where += $\" AND price >= @minPrice\";\n        if (maxPrice != null) where += $\" AND price \u003C= @maxPrice\";\n\n        \u002F\u002F Execute count + select queries...\n        \u002F\u002F Parse tags from JSON string: JsonSerializer.Deserialize\u003Cstring[]>(row[\"tags\"])\n    }\n}\n```\n\n### Cosmos DB Implementation\n\n```csharp\n\u002F\u002F Data\u002FCosmosProductRepository.cs\n\nusing Microsoft.Azure.Cosmos;\n\npublic class CosmosProductRepository : IProductRepository\n{\n    private readonly Container _container;\n\n    public CosmosProductRepository(CosmosClient client, IConfiguration config)\n    {\n        var db = client.GetDatabase(config[\"COSMOS_DATABASE\"] ?? \"aimarket\");\n        _container = db.GetContainer(\"products\");\n    }\n\n    public async Task\u003C(List\u003CProduct> Data, int TotalCount)> GetAllAsync(\n        int page = 1, int pageSize = 20,\n        string? category = null, decimal? minPrice = null, decimal? maxPrice = null)\n    {\n        var query = new QueryDefinition(\"SELECT * FROM c WHERE c.status = @status\")\n            .WithParameter(\"@status\", \"active\");\n        \u002F\u002F Add filters, execute, paginate...\n    }\n}\n```\n\n### Minimal API Routes\n\n```csharp\n\u002F\u002F Routes depend only on interfaces — injected via DI\n\napp.MapGet(\"\u002Fapi\u002Fproducts\", async (IProductRepository repo,\n    int page = 1, int pageSize = 20, string? category = null) =>\n{\n    var (data, total) = await repo.GetAllAsync(page, pageSize, category);\n    return Results.Ok(new { data, page, pageSize, totalCount = total });\n});\n```\n\n---\n\n## Java \u002F Spring Boot\n\n### Repository Interfaces\n\n```java\n\u002F\u002F data\u002FProductRepository.java\n\npublic interface ProductRepository {\n    PaginatedResult\u003CProduct> getAll(int page, int pageSize,\n        String category, Double minPrice, Double maxPrice);\n    Optional\u003CProduct> getById(String id);\n    Product create(CreateProductInput input);\n    Optional\u003CProduct> update(String id, UpdateProductInput input);\n}\n\n\u002F\u002F data\u002FOrderRepository.java\n\npublic interface OrderRepository {\n    Order create(CreateOrderInput input);\n    Optional\u003COrder> getById(String id);\n    PaginatedResult\u003COrder> getByUserId(String userId, int page, int pageSize);\n}\n\n\u002F\u002F data\u002FUserRepository.java\n\npublic interface UserRepository {\n    User create(CreateUserInput input);\n    Optional\u003CUser> getById(String id);\n    Optional\u003CUser> getByEmail(String email);\n}\n```\n\n### Factory via Spring Profiles\n\nSpring profiles replace the manual factory. Set `DATA_PROVIDER` as the active profile:\n\n```yaml\n# application.yml\nspring:\n  profiles:\n    active: ${DATA_PROVIDER:sqlite}\n```\n\n```java\n\u002F\u002F data\u002Fsqlite\u002FSqliteProductRepository.java\n\n@Repository\n@Profile(\"sqlite\")\npublic class SqliteProductRepository implements ProductRepository {\n    private final JdbcTemplate jdbc;\n\n    public SqliteProductRepository(DataSource dataSource) {\n        this.jdbc = new JdbcTemplate(dataSource);\n    }\n\n    @Override\n    public PaginatedResult\u003CProduct> getAll(int page, int pageSize,\n            String category, Double minPrice, Double maxPrice) {\n        var where = new StringBuilder(\"WHERE status = 'active'\");\n        var params = new ArrayList\u003C>();\n\n        if (category != null) { where.append(\" AND category = ?\"); params.add(category); }\n        if (minPrice != null) { where.append(\" AND price >= ?\"); params.add(minPrice); }\n        if (maxPrice != null) { where.append(\" AND price \u003C= ?\"); params.add(maxPrice); }\n\n        int total = jdbc.queryForObject(\n            \"SELECT COUNT(*) FROM products \" + where, Integer.class, params.toArray());\n        var rows = jdbc.query(\n            \"SELECT * FROM products \" + where + \" LIMIT ? OFFSET ?\",\n            this::mapRow,\n            Stream.concat(params.stream(), Stream.of(pageSize, (page - 1) * pageSize)).toArray());\n\n        return new PaginatedResult\u003C>(rows, total);\n    }\n\n    private Product mapRow(ResultSet rs, int rowNum) throws SQLException {\n        return new Product(\n            rs.getString(\"id\"),\n            rs.getString(\"name\"),\n            \u002F\u002F ...\n            objectMapper.readValue(rs.getString(\"tags\"), new TypeReference\u003CList\u003CString>>() {}),  \u002F\u002F JSON → List\n            \u002F\u002F ...\n        );\n    }\n}\n```\n\n```java\n\u002F\u002F data\u002Fcosmos\u002FCosmosProductRepository.java\n\n@Repository\n@Profile(\"cosmos\")\npublic class CosmosProductRepository implements ProductRepository {\n    private final CosmosContainer container;\n\n    public CosmosProductRepository(CosmosClient client,\n            @Value(\"${cosmos.database:aimarket}\") String dbName) {\n        this.container = client.getDatabase(dbName).getContainer(\"products\");\n    }\n\n    @Override\n    public PaginatedResult\u003CProduct> getAll(int page, int pageSize,\n            String category, Double minPrice, Double maxPrice) {\n        var query = new StringBuilder(\"SELECT * FROM c WHERE c.status = @status\");\n        var params = new ArrayList\u003CSqlParameter>();\n        params.add(new SqlParameter(\"@status\", \"active\"));\n\n        if (category != null) {\n            query.append(\" AND c.category = @cat\");\n            params.add(new SqlParameter(\"@cat\", category));\n        }\n        \u002F\u002F ... build query\n\n        var options = new CosmosQueryRequestOptions();\n        var items = container.queryItems(\n            new SqlQuerySpec(query.toString(), params), options, Product.class);\n\n        var all = items.stream().collect(Collectors.toList());\n        int start = (page - 1) * pageSize;\n        return new PaginatedResult\u003C>(\n            all.subList(start, Math.min(start + pageSize, all.size())), all.size());\n    }\n}\n```\n\n### SQLite DataSource Config\n\n```java\n\u002F\u002F config\u002FSqliteConfig.java\n\n@Configuration\n@Profile(\"sqlite\")\npublic class SqliteConfig {\n    @Bean\n    public DataSource dataSource() {\n        var ds = new SQLiteDataSource();\n        ds.setUrl(\"jdbc:sqlite:app.db\");\n        return ds;\n    }\n\n    @Bean\n    public CommandLineRunner initDb(DataSource dataSource) {\n        return args -> {\n            var jdbc = new JdbcTemplate(dataSource);\n            jdbc.execute(\"PRAGMA journal_mode=WAL\");\n            jdbc.execute(\"PRAGMA foreign_keys=ON\");\n            \u002F\u002F Create tables, seed if empty...\n        };\n    }\n}\n```\n\n### Controller Routes\n\n```java\n\u002F\u002F controller\u002FProductController.java — depends only on ProductRepository interface\n\n@RestController\n@RequestMapping(\"\u002Fapi\u002Fproducts\")\npublic class ProductController {\n    private final ProductRepository repo;\n\n    public ProductController(ProductRepository repo) {  \u002F\u002F Spring injects the active profile's impl\n        this.repo = repo;\n    }\n\n    @GetMapping\n    public ResponseEntity\u003C?> list(\n            @RequestParam(defaultValue = \"1\") int page,\n            @RequestParam(defaultValue = \"20\") int pageSize,\n            @RequestParam(required = false) String category) {\n        var result = repo.getAll(page, pageSize, category, null, null);\n        return ResponseEntity.ok(Map.of(\n            \"data\", result.data(), \"page\", page, \"pageSize\", pageSize,\n            \"totalCount\", result.totalCount(),\n            \"totalPages\", (int) Math.ceil((double) result.totalCount() \u002F pageSize)\n        ));\n    }\n}\n```\n\n**Key:** Spring's `@Profile` + DI eliminates the manual factory. Set `DATA_PROVIDER=postgres` or `DATA_PROVIDER=cosmos` as the active profile and Spring wires the matching implementations automatically. Add `@Profile(\"postgres\")` to a `PostgresProductRepository` that uses `JdbcTemplate` with a PostgreSQL `DataSource` — same `JdbcTemplate` API as SQLite, different driver and SQL dialect.\n\n---\n\n## SQLite Patterns (All Languages)\n\nSQLite doesn't support arrays or nested objects. These patterns apply regardless of language:\n\n| Data Type | SQLite Storage | Read Pattern |\n|-----------|---------------|-------------|\n| `string[]` (tags) | JSON string column: `'[\"tag1\",\"tag2\"]'` | Parse with `JSON.parse()` \u002F `json.loads()` \u002F `JsonSerializer.Deserialize` \u002F `ObjectMapper.readValue()` |\n| Nested object (address) | JSON string column: `'{\"street\":\"...\"}'` | Parse on read |\n| One-to-many (order items) | Junction table: `order_items(orderId, productId, quantity, price)` | JOIN on read |\n| UUID primary keys | TEXT column | Generate with `uuid` \u002F `uuid4()` \u002F `Guid.NewGuid()` \u002F `UUID.randomUUID()` |\n\n**Pragmas to always set:**\n```sql\nPRAGMA journal_mode = WAL;    -- Better concurrent read performance\nPRAGMA foreign_keys = ON;     -- Enforce referential integrity\n```\n\n## Cosmos DB Patterns (All Languages)\n\n| Data Type | Cosmos DB Storage | Notes |\n|-----------|------------------|-------|\n| `string[]` (tags) | Native JSON array | No serialization needed |\n| Nested object (address) | Native JSON object | No serialization needed |\n| One-to-many (order items) | Embedded array in document | No junction table needed |\n| Queries | SQL-like with `@param` | Use parameterized queries for safety |\n\n**Partition key strategy:** Choose a field that distributes data evenly. Common choices: `\u002Fid` (default), `\u002Fcategory` (products), `\u002FuserId` (orders).\n\n## PostgreSQL Patterns (All Languages)\n\nPostgreSQL supports native arrays and JSONB, so it handles complex types better than SQLite but uses SQL instead of Cosmos DB's document model.\n\n| Data Type | PostgreSQL Storage | Notes |\n|-----------|-------------------|-------|\n| `string[]` (tags) | `TEXT[]` (native array) | Use `= ANY($1)` for filtering, no serialization needed |\n| Nested object (address) | `JSONB` column | Query with `->` \u002F `->>` operators |\n| One-to-many (order items) | Junction table (same as SQLite) or `JSONB` array | Junction table is cleaner for queries |\n| UUID primary keys | `UUID` type or `TEXT` | Use `gen_random_uuid()` for server-side generation |\n| Parameterized queries | `$1, $2, $3` (Node pg) or `%s` (Python psycopg2) or `@param` (.NET Npgsql) | Never concatenate user input |\n\n**Azure PostgreSQL requirements:**\n```\n# Connection string must include sslmode\nPOSTGRES_CONNECTION_STRING=postgresql:\u002F\u002Fuser:pass@host.postgres.database.azure.com:5432\u002Faimarket?sslmode=require\n\n# For Azure Flexible Server, also set\nPOSTGRES_SSL=true\n```\n\n**Libraries by language:**\n\n| Language | Library | Notes |\n|----------|---------|-------|\n| Node.js | `pg` (node-postgres) | Use `Pool` for connection pooling |\n| Python | `psycopg2` or `asyncpg` | `psycopg2-binary` for easy install, `asyncpg` for async FastAPI |\n| .NET | `Npgsql` + `Npgsql.EntityFrameworkCore.PostgreSQL` | Or raw `NpgsqlConnection` |\n| Java | Spring `JdbcTemplate` + `postgresql` driver | Same `JdbcTemplate` API as SQLite, different DataSource |\n\n## Anti-Patterns\n\n| Don't | Do Instead |\n|-------|------------|\n| Import database clients in route files | Import only interfaces\u002Fprotocols |\n| Put SQL\u002Fquery strings in routes | Encapsulate in the implementation |\n| Hardcode connection strings | Use environment variables |\n| Create one repository for all entities | One interface per entity |\n| Skip `async\u002Fawait` because SQLite is sync | Always use async — it's free for sync implementations |\n| Test against a real database | Create an in-memory implementation for unit tests |\n\n## Checklist\n\n- [ ] Repository interfaces defined per entity (typed, no database-specific imports)\n- [ ] Factory\u002FDI reads `DATA_PROVIDER` and returns the correct implementation\n- [ ] Routes depend only on interfaces, never on implementation files\n- [ ] SQLite implementation handles JSON serialization for arrays and objects\n- [ ] PostgreSQL implementation uses native `TEXT[]` for arrays and `JSONB` for objects\n- [ ] Cosmos DB implementation uses native JSON types (no serialization)\n- [ ] `DATA_PROVIDER=sqlite` works locally\n- [ ] `DATA_PROVIDER=postgres` works with Azure PostgreSQL (SSL enabled)\n- [ ] `DATA_PROVIDER=cosmos` works with Azure Cosmos DB\n- [ ] `.env.example` documents all providers and their required variables\n- [ ] An in-memory implementation exists for unit tests\n",{"name":5,"description":7},"main","08df0f20395080660d032202390dae6fe94caccb",".github\u002Fskills\u002Fdata-access-abstraction",7,"https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fagentic-journeys","https:\u002F\u002Fgithub.com\u002Fmicrosoft","https:\u002F\u002Fopensource.microsoft.com","Open source projects and samples from Microsoft","2026-10-25 18:55:43",{"source":8,"skillName":5,"commands":59,"prompt":69,"zipAvailable":70},[60,63,66],{"tool":61,"command":62},"npx","npx skills add microsoft\u002Fagentic-journeys --skill data-access-abstraction",{"tool":64,"command":65},"bunx","bunx skills add microsoft\u002Fagentic-journeys --skill data-access-abstraction",{"tool":67,"command":68},"pnpm","pnpm dlx skills add microsoft\u002Fagentic-journeys --skill data-access-abstraction","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fagentic-journeys\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fdata-access-abstraction\u002FSKILL.md",true,[],[73,102,122,141,170,195],{"skillNo":74,"name":75,"nameZh":6,"description":76,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":77,"categories":78,"keywords":85,"publishedAt":44},"01M6X04HH8G0N7M63NR4AJ0A1W","flex-functions-sql-foundry","Scaffold and deploy an Azure Functions Flex Consumption API with Azure SQL through managed identity and Microsoft Foundry.\nUSE FOR: serverless APIs that need Flex Consumption, managed-identity Azure SQL access, Microsoft Foundry models, and deterministic azd\u002FBicep infrastructure.\nDO NOT USE FOR: Container Apps, AKS, SQL password authentication, non-HTTP workloads that need independent scaling, or projects that cannot use Azure CLI and azd.","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fagentic-journeys\u002Fblob\u002Fmain\u002Fjourneys\u002Fsmart-todo\u002Fcheckpoints\u002Fphase-3\u002Frepo\u002F.github\u002Fskills\u002Fflex-functions-sql-foundry\u002FSKILL.md",[79,84],{"categoryNo":80,"categoryName":81,"taxonomyType":82,"taxonomyTypeDesc":83},"01JBSEEDCAT000000000000010","后端与接口","SCENARIO","使用场景",{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},[86,87,88,89,90,42,91,92,26,93,94,95,96,97,98,99,100,30,29,101],"foundry","sql","functions","flex functions sql foundry","foundry models","http","authentication","projects","password","use","container","azure cli","do","deterministic","scaling","managed",{"skillNo":103,"name":104,"nameZh":6,"description":105,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":106,"categories":107,"keywords":111,"publishedAt":44},"01M6X04BC3XM0FXCTQZQVA0F81","superset-azure","Deploy Apache Superset on Azure. Use when deploying Superset for BI\u002Fdata visualization with PostgreSQL backend.","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fagentic-journeys\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fsuperset-azure\u002FSKILL.md",[108],{"categoryNo":109,"categoryName":110,"taxonomyType":82,"taxonomyTypeDesc":83},"01JBSEEDCAT000000000000011","运维与部署",[42,112,113,114,115,116,39,117,118,25,95,119,120,121,29,28],"superset","superset azure","deploy","data visualization","visualization","apache","apache superset","backend","bi","with",{"skillNo":123,"name":124,"nameZh":6,"description":125,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":126,"categories":127,"keywords":131,"publishedAt":44},"01M6X045XFPWKZZNKXBM2WRA43","n8n-azure","n8n workflow automation configuration for Azure. Use when deploying n8n specifically to Azure Container Apps.","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fagentic-journeys\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fn8n-azure\u002FSKILL.md",[128],{"categoryNo":129,"categoryName":130,"taxonomyType":82,"taxonomyTypeDesc":83},"01JBSEEDCAT000000000000023","Skill与智能体开发",[42,132,133,134,135,136,95,96,137,138,139,30,140,29,28],"n8n","n8n azure","workflow","automation","Workflow Automation","configuration","n8n workflow automation","azure container apps","n8n workflow",{"skillNo":142,"name":143,"nameZh":6,"description":144,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":145,"categories":146,"keywords":150,"publishedAt":44},"01M6X03Z3NQVK79R1A9GR97VS4","journey-test-harness","Run multiple journeys as a cross-platform test suite. Discover journeys, invoke journey-runner in isolated workspaces, deploy, verify, capture screenshots, clean up only owned Azure resources, and produce a consolidated report.\nUSE FOR: test all journeys, regression test, CI journey validation, nightly journey test, end-to-end journey suite, validate journeys deploy correctly.\nDO NOT USE FOR: running one journey interactively (use journey-runner), creating journeys (use journey-template), or reviewing content (use content-reviewer).","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fagentic-journeys\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fjourney-test-harness\u002FSKILL.md",[147],{"categoryNo":148,"categoryName":149,"taxonomyType":82,"taxonomyTypeDesc":83},"01JBSEEDCAT000000000000008","测试与质量",[151,152,153,154,155,41,156,157,158,159,160,161,162,163,164,165,166,167,168,169],"test","harness","journey","test harness","journey test harness","ci","template","regression","reviewer","only","up","test all","workspaces","clean","runner","discover","end","resources","invoke",{"skillNo":171,"name":172,"nameZh":6,"description":173,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":174,"categories":175,"keywords":179,"publishedAt":44},"01M6X03S1407VWGHND8SDYRK0T","journey-template","Create new agentic journeys from app ideas. Generates README.md (learner walkthrough), PLAN.md (AI-readable spec), and app-specific skills for OSS deployments. Supports any stack (Node.js, Python, .NET, Java, Swift, Kotlin) and Azure service (Container Apps, AKS, Functions, App Service).\nUSE FOR: new journey, scaffold journey, create learning experience, generate journey template, add journey to repo, build and deploy app to Azure, create journey README, generate PLAN.md spec, new OSS deployment, new full-stack journey, journey from idea.\nDO NOT USE FOR: modifying existing journeys (use coder), reviewing journey content (use content-reviewer), deploying apps (use oss-to-azure-deployer agent).","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fagentic-journeys\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fjourney-template\u002FSKILL.md",[176],{"categoryNo":177,"categoryName":178,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000036","内容创作者",[157,153,180,181,182,183,184,185,186,187,188,189,159,37,190,191,192,193,30,194],"journey template","swift","agentic","deploy app to azure","create","generate","aks","walkthrough","plan","stack","deploy app","idea","full","app","add",{"skillNo":196,"name":197,"nameZh":6,"description":198,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":199,"categories":200,"keywords":201,"publishedAt":44},"01M6X03GAF7B5764RD7KP7EK0S","journey-runner","Run an agentic journey end-to-end: preflight the host, extract prompts, execute them in an isolated workspace, build, deploy to Azure, verify with real requests and screenshots, and clean up only owned resources.\nUSE FOR: test a journey, run a journey end-to-end, validate journey prompts, deploy a journey to Azure, walk through a journey, execute journey steps, CI journey test.\nDO NOT USE FOR: creating new journeys (use journey-template), reviewing journey content (use content-reviewer), or modifying unrelated code.","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fagentic-journeys\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fjourney-runner\u002FSKILL.md",[],[165,153,202,203,182,41,40,156,204,157,159,160,161,205,164,98,167,206,168,29],"journey runner","screenshots","preflight","unrelated","host"]