Safe/Not Safe is a client-side web application that evaluates PostgreSQL migration SQL for safety risks without sending data to external servers. When a user inputs a migration statement, the tool uses libpg_query compiled to WebAssembly to parse the SQL in the browser, then applies a catalog of TypeScript rules to determine whether the migration should be classified as SAFE, NOT SAFE, or requiring NEEDS CONTEXT for further review. This architecture ensures that sensitive database schema information remains local to the user's machine during analysis.

The tool's rule set specifically targets migration patterns known to cause production problems. It identifies operations that create blocking indexes (distinguishing between standard CREATE INDEX and the safer CREATE INDEX CONCURRENTLY), detects table rewrites that can occur during certain ALTER COLUMN TYPE operations, flags constraint validations that require exclusive access locks, warns about transaction-wrapped DDL that complicates error recovery, and catches rollout-incompatible renames that could break applications during gradual deployment schemes. Additional checks include direct unique constraint builds, TRUNCATE, and table rewrite commands such as VACUUM FULL and CLUSTER, as listed in its rule coverage.

However, the tool's analysis is inherently limited to the SQL statement alone without visibility into the actual database state. As the documentation explains, certain operations like altering a column type may be safe in some contexts (requiring only a metadata change) but unsafe in others (necessitating a full table rewrite) depending on factors such as the original data type and existing table contents. The NEEDS CONTEXT verdict is designed to flag these situations where the tool cannot determine safety definitively without additional information about the schema or data, meaning the tool serves best as an initial screening mechanism rather than a comprehensive safety guarantee.