一键导入
review
// Review code for potential issues and improvements. Use when asked to review specific files, functions, or code sections.
// Review code for potential issues and improvements. Use when asked to review specific files, functions, or code sections.
| name | review |
| description | Review code for potential issues and improvements. Use when asked to review specific files, functions, or code sections. |
| disable-model-invocation | false |
| allowed-tools | Bash, Read, Glob, Grep, Edit, Write, WebSearch, Skill, Task |
Review the mentioned code for potential issues and improvements.
Review critically — don't assume correctness. Question every design choice and flag anything that would fail a production code review.
Always assume any prior git state and file contents you gathered is stale, especially if the user re-runs this skill, or asks to re-read.
Study these project standards and design docs:
node:sqlite compatibility requirementsFor N-API questions, consult ../node-addon-api/ and ../node-addon-examples/ (cloned siblings) before web search.
Only report verified bugs — things that are actually wrong. Do NOT report:
src/upstream/ — those files are auto-synced from Node.js and must not be modifiedFor EVERY potential issue, you MUST complete these steps before reporting:
src/, test/, and test/node-compat/src/upstream/node_sqlite.cc for behavior and error messages — we are a drop-in replacement and must match exactlyUse subagents when the user has explicitly authorized delegated agent work:
If you find zero real issues after thorough research, say "No issues found" — do not pad the list.
Drop-in compatibility with node:sqlite (HIGHEST PRIORITY)
src/upstream/node_sqlite.cccode, errcode, errstr, sqliteCode, sqliteExtendedCode, sqliteCodeName, sqliteErrorString) must all be present where Node.js sets themtest/node-compat/) must continue to passNative code correctness (C++ / N-API)
IsDataView() must be checked BEFORE IsBuffer() (CLAUDE.md documents this — IsBuffer matches all ArrayBufferView types)Napi::Error first, then std::exception, then .... Letting an exception propagate through a C function pointer SIGSEGVs on Alpine/musl. See src/sqlite_impl.cpp ApplyChangeset (~lines 1648–1750) for the canonical pattern.sqlite3_* allocation has a matching free; every Napi::Reference is released; finalizers don't dereference freed pointerssqlite3_aggregate_context; complex state via JSON serializationsrc/upstream/: ensure no edits there — that directory is auto-synced and must not be modifiedTypeScript layer
src/index.ts match the Node.js node:sqlite type signaturesESM vs CJS dual-build hazards (always check)
import and require consumers — verify in dist/cjs/ and dist/esm/ (or npm run test:all)await in code that ships to CJSimport.meta.url or __dirname assumptions that break in the other module system — use the existing dual-safe helpersrequire() of project files; prefer static imports so both bundles resolve correctly.cjs / .mjs extension mixing in test files is intentional — flag accidental changespackage.json exports map still routes import and require correctly for any new entry pointsWorker thread safety (always check)
Napi::ThreadSafeFunction (TSFN); the TSFN is acquired/released correctly and not leakednapi_env from one thread is valid on anotherCross-platform considerations
fsp.rm() with maxRetries/retryDelay (or useTempDir/useTempDirSuite test utilities)Testing
getTestTimeout() from test-timeout-config.cjs) instead of hard-coded valuesuseTempDir / useTempDirSuite rather than manual fs.rmSync cleanupsetTimeout to "fix" async cleanup, forced global.gc(), setImmediate in afterAll to silence Jest hang warnings — all mask real resource leaksREADY signaling) instead of timing assumptionstestMemoryBenchmark harness rather than naked timing assertionstest/node-compat/ still run with --test-concurrency=1test/node-compat/ coverage gaps (always check)
test/node-compat/test/upstream/ (reference-only) but is not yet ported to test/node-compat/, flag it — that's missing coveragenode:sqlite for parityCorrectness (general)
Build and release
package.json version is managed by the release GitHub Action — flag any manual version bumpbinding.gyp--no-verify, --no-gpg-sign, or skipped pre-commit hooks unless the user explicitly askedStep 1 — write up every issue as text first. For each issue use a short unique ID (e.g. #A, #B) and include:
src/sqlite_impl.cpp:1234)Step 2 — only after all issue blocks are written, use ask the user directly to collect accept/veto decisions. The question text is just the ID (e.g. Accept #A?) — it is NOT a substitute for the write-up above. Never jump straight to ask the user directly without the text write-up; the user can't evaluate #A if they've never seen what #A is.
Ask the user if it would be ok to git add just the impacted files and commit:
git add. If only a partial set of diffs are relevant for a given file, mention the line ranges you want to stage.<type>(<scope>): <summary> (under 50 chars on the first line; body explains the why) — and use ask the user directly to allow the user to edit it.package.json version manually — the release GitHub Action owns that.If you only need to stage certain chunks of a file, know that historically using interactive mode with git add has been problematic.
Review git staged changes for concrete bugs, regressions, and missing validation before committing.
Prepare a new release of @photostructure/sqlite. Syncs upstream Node.js + SQLite sources, updates npm deps, reviews commits since last release, decides semver bump (patch/minor/major), writes a CHANGELOG.md entry, and runs the full test+lint suite. Use when the user asks to "prep a release", "cut a release", "update everything and release", "sync upstream and release", or similar.
Update or create a TPP for engineer handoff when session context is running low. Use when ending a session, handing off work, or capturing progress on complex tasks.
Work on a Technical Project Plan - research, design, implement, or complete tasks based on current phase. Use when starting or continuing work on a TPP.