Read a database or an API through Sosie, which fakes every value it returns. Use when the sosie MCP tools (describe, query, find, aggregate, request, graphql) are there, when the project has a sosie.yml, when a database or API answers on localhost from port 7674, or when data looks like consistent fakes. Says how to query through Sosie, what its fakes mean, why a result can look wrong, and what never to do with the real credentials.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Sosie?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/monkilabs-sosie)
---
name: sosie
description: Read a database or an API through Sosie, which fakes every value it returns. Use when the sosie MCP tools (describe, query, find, aggregate, request, graphql) are there, when the project has a sosie.yml, when a database or API answers on localhost from port 7674, or when data looks like consistent fakes. Says how to query through Sosie, what its fakes mean, why a result can look wrong, and what never to do with the real credentials.
license: MIT
---
# Sosie
Sosie is a read-only endpoint on the developer's machine, in front of their Postgres, MySQL, MongoDB or SQL Server database, or
their team's REST or GraphQL API. Every value it returns is a fake of the real one, of the same type and format. The same real value is
always the same fake, so joins hold and a value you saw finds its record again. The real values, the credentials and
the hostnames stay on the developer's side. That is the point of it: keep it that way.
## Reach it
- **The MCP tools.** Start with `describe`: every source Sosie serves, by its name, kind and address, with its
entities, their fields, types, keys and references, and which fields pass unchanged. Then `query` for Postgres, MySQL and SQL Server (SQL in the database's own
dialect, T-SQL for SQL Server, up to 200 rows per statement), `find` and `aggregate` for MongoDB (a collection, and a filter or a pipeline
as JSON, up to 200 documents), `request` for REST (a `GET` path, or a link Sosie returned) and `graphql` for GraphQL
(a query and its variables). Use the tool of the source's kind: `query` reaches a Postgres, MySQL or SQL Server source only,
`find` and `aggregate` a MongoDB one. When several sources of a kind run, pass the `source` by its name, as
`describe` lists it: the tool asks for one rather than guess. A MongoDB source learns its fields from the documents
it serves, so `describe` lists what it has met so far.
- **A REST source without an OpenAPI document** learns its fields from the API's answers, so `describe` lists only
what it has met so far, and may list nothing. `request` the paths the API serves, such as `/users`, and read the
fields from what comes back.
- **Each source's address**, for `psql`, `mongosh`, `sqlcmd`, `curl`, the app and its tests: the one Sosie printed when it
started, on 127.0.0.1 from port 7674 up, such as `postgres://localhost:7674/app`, `mysql://127.0.0.1:7674/app`,
`mongodb://127.0.0.1:7674/app?directConnection=true` or, for SQL Server, the connection string
`Server=127.0.0.1,7674;Database=app;TrustServerCertificate=true`, with any user and password. Point code at it as it
would point at the real thing.
## When Sosie is not running
The tools say so. Ask the developer to start it **in their own terminal**, in the project's folder, with
`npx @sosie/cli`, then try again. The first time, it asks them for the first source and writes `sosie.yml`.
Never start Sosie yourself, and never ask for, look for or handle what it reads: a connection string, a variable
`sosie.yml` names, an API token, a `.env` file. Never change a source's `upstream` or `headers` in `sosie.yml`. Sosie
exists so that none of these reach you.
Never connect to the real database or API directly, even when you could.
## Read the fakes right
- **Every value is a fake** unless `describe` lists its field as passing, by the team's `sosie.yml`. Names, emails,
ids, amounts and dates are fakes. Never present them as real people, orders or figures; say they are Sosie's fakes.
- **Consistent.** One real value is one fake everywhere: in every row, table and session, and in the database and the
API alike. Foreign keys and joins hold.
- **Query by what you saw.** A fake compared with a field (`WHERE email = '…'`, `IN (…)`, an id in a path such as
`/users/87`, a query parameter such as `?email=`, a GraphQL argument, a MongoDB filter such as
`{"_id": {"$oid": "…"}}`) is turned back into the real value before the query runs. Following a link an API
returned reads the record it names. A page's number (`page=2`, `limit`, `offset`) is sent as you wrote it.
- **The shape is real.** Types, formats, which values are null, the rows a query returns and SQL's `count(…)` are
real. A count or a page number in an API's body (`total`, `page`) is a field's value, and faked. Dates are shifted
by up to a year; numbers keep their sign, digits and scale.
## Why a result can look wrong
This is how Sosie works, not a bug, and not a reason to work around it.
- **Order and ranges follow the real values.** `ORDER BY` sorts by them, so the fakes come back out of order; `>`, `<`
and `BETWEEN` compare them.
- **Partial matches find nothing.** `LIKE '%van%'` and other partial matches filter the real values, so a piece of a
fake matches nothing. Compare whole values.
- **Computed values are faked by type.** `length(email)`, `max(id)` and `sum(total)` are fakes of the computed value,
not computed from the fakes you saw. `count(…)` passes.
- **A bare boolean filters the real value.** `WHERE active` filters the real ones, while the fakes may show flipped
ones. Write `active = true`, which is turned back.
- **A value Sosie never showed** is used as written, and matches whatever real value it happens to be.
- **Composite values** (`SELECT u FROM users u`) and types Sosie does not know come back as `NULL`. A driver that asks
for binary results gets them, except for such types, `regclass`, `money` and ranges, which are refused in binary: ask
for the column in text, or cast it. An older Sosie refuses binary results altogether: ask the developer to update it.
- **An error raised while rows are read** comes back as its code only. Sosie hides the rest, which could quote a value.
## What Sosie refuses
- **Writes.** `INSERT`, `UPDATE`, `DELETE`, `SELECT … INTO`, schema changes, and `EXPLAIN` or SQL Server's `SHOWPLAN`,
whose plan would print real values; GraphQL
mutations and subscriptions; every HTTP method but `GET` and `HEAD`.
- **Paths the developer closed off.** A REST path the source's `refuse` lists, and every path under it, gets `403`: an
OAuth callback, say, or a portal that opens a session.
- **What would show the real data or the server:** catalogs such as `pg_stats`, `pg_stat_activity` and `pg_settings`,
and `pg_roles` read by `*` or its `rolconfig`, MySQL's `mysql` database and `SHOW STATUS`, MongoDB's `admin`, `local` and `config` databases,
SQL Server's `sys.dm_*` views and `msdb`; functions and settings such as `inet_server_addr`, `SHOW port`,
`@@datadir`, `@@SERVERNAME`, `OPENROWSET` and `set_config` with a value from a row; JavaScript on a MongoDB server
(`$where`, `$function`); and on SQL Server, every procedure but the catalog's (`sp_tables`, `sp_columns`), `PRINT`,
and `FOR XML`.
- **T-SQL that Sosie's parser would read apart from SQL Server**, refused as a syntax error: `TRY…CATCH`, `WHILE`,
`NOEXEC`, and a reserved word as an alias without brackets. Write `AS [key]`, not `AS key`, and send the statements
themselves.
Do not look for a way around a refusal or a fake, and do not use filters or computed values to work out a real value.
That defeats the reason the developer put Sosie there.
## Code written against Sosie
Code written against the fakes runs unchanged on the real data: the same tables, fields, types and relationships.
- **Never hard-code a value you saw.** It is a fake. Through Sosie it finds its record; on the real database it finds
nothing, or someone else's.
- **When the app's logic needs a field to be real**, such as a status, a price or a table of countries, tell the
developer. They can let it pass in `sosie.yml`, which is theirs to change and review like code:
```yaml
pass:
- orders.status
- countries.*
format:
users.handle: username
sources:
app:
upstream: ${APP_URL}
```
A field's id is `table.column` for Postgres, MySQL and SQL Server (`schema.table.column` outside the default schema),
`collection.path` for MongoDB (`users.address.city`),
`Schema.property` for REST with an OpenAPI document (`entity.key` without one) and `Type.field` for GraphQL;
`describe` lists them. A rule at the top holds for every source that has the table; under a source, for that one.
Sosie reads `sosie.yml` when it starts, so a change applies once the developer restarts it.
## Checking files for real values
`npx @sosie/cli scan <files or folders>` searches transcripts, logs or any text files for a real value that passed
through Sosie. It prints the file, the line and where each one it finds came from, never the value: its field, or for
a person's value the format it shares (`format:email`). It exits 1 when it finds one. It compares with the store on the machine where Sosie ran, so it runs there.