code-review
Skill0 starsChanged 7 months agoMITView on GitHub
Thorough code review for the Platform healthcare SaaS backend. Checks for logical flaws, inconsistencies, missing pieces, security issues, and adherence to project patterns. USE FOR: code review, review code, review my changes, review this PR, review pull request, check my code, find bugs, find issues, audit code, review implementation, sanity check, look for problems, what did I miss, review diff, review branch. DO NOT USE FOR: writing new code from scratch, generating features, creating mockups (use mockup-guidelines skill).
194 other projects use a version of this.
Adopted by
Most recently taken up by
- dzhng/skillstheir own version, first seen Nov 15, 2026
- mdiri-ai/SoduWorktheir own version, first seen Nov 15, 2026
- sirkirby/unifi-mcptheir own version, first seen Nov 13, 2026
- microsoft/vscodetheir own version, first seen Nov 12, 2026
- oceanbase/seekdbtheir own version, first seen Nov 12, 2026
- dzhng/jevgreptheir own version, first seen Nov 11, 2026
Used with
Projects with it also use close-spec, design-with-images and 10 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
dzhngSkillclose-spec
When a spec under specs/<feature>/ is done shipping (a write-spec build, or any planned task that produced a spec), archive it to specs/done/ and rewrite it from a build-plan into a durable rationale — the why, the principles, the invariants — pointing back to the real code for the how. Use when implementation has landed and the plan no longer matches what shipped, or the user says a feature/spec is finished. Pairs with [write-spec](../write-spec/SKILL.md) (the plan this closes) and [review](../review/SKILL.md) (run before closing).
Also in 5 projects that use this
dzhngSkilldesign-with-images
Explore UI and visual design with image generation, then iterate the real implementation against the user-selected concept. Use when brainstorming visual directions, offering mockup variants, or implementing an approved generated design; do not stop at the mockups or the first code approximation.
Also in 5 projects that use this
PydanticSkilladd-new-model
Add support for a newly-released language or image generation model in pydantic-ai (e.g. openai:gpt-5.6, anthropic:claude-sonnet-5, openai:gpt-image-2). Use when a provider ships a new model id and you need to wire literals, profile flags, adapters, and tests to recognize it. Handles SDK-lag, gateway list conventions, capability probing, and direct image-model geometry.
Also in 9 projects that use this
transitive-bullshitSkillcompare-screenshots
Compare screenshots against the intended design, distinguishing approved references from historical baselines. Use for iterative implementation matching, before/after visual review, objective image telemetry, or checking a lone capture for flat, empty, or badly framed content.
Also in 5 projects that use this
Microsoft AzureSkillazsdk-common-apiview-feedback-resolution
Analyze and resolve APIView review feedback on Azure SDK PRs. **UTILITY SKILL**. USE FOR: APIView comments, API review feedback, SDK API surface changes. DO NOT USE FOR: general code review, non-APIView feedback. INVOKES: azure-sdk-mcp:azsdk_apiview_get_comments, azure-sdk-mcp:azsdk_customized_code_update, azure-sdk-mcp:azsdk_typespec_delegate_apiview_feedback, azure-sdk-mcp:azsdk_run_typespec_validation, azure-sdk-mcp:azsdk_package_generate_code.
Also in 6 projects that use this
Microsoft AzureSkillazsdk-common-generate-sdk-locally
Generate and finalize Azure SDKs locally from TypeSpec, including build, checks, tests, changelog, metadata, and version updates by default. WHEN: "generate SDK locally", "build SDK", "run SDK tests", "run CI checks", "validate package", "run checks", "update changelog", "fix SDK build errors", "resolve SDK generation errors", "customize TypeSpec", "rename SDK client", "rename SDK model", "hide operation from SDK", "fix analyzer errors", "resolve customization drift", "create subclient", "update metadata", "update version". INVOKES: azsdk_verify_setup, azsdk_package_generate_code, azsdk_package_build_code, azsdk_package_run_check, azsdk_package_run_tests, azsdk_customized_code_update, azsdk_package_update_changelog_content, azsdk_package_update_metadata, azsdk_package_update_version.
Also in 6 projects that use this
- +4 more from dzhng
- +2 more from Azure
Other versions194 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 194
- mattpocock/skills★ 325ksame name
- TheAlgorithms/Python★ 226ksame name
- microsoft/vscode★ 195ksame name
- github/spec-kit★ 150ksame name
- ggml-org/llama.cpp★ 135ksame name
- supabase/supabase★ 115ksame name
- storybookjs/storybook★ 92ksame name
- shareAI-lab/learn-claude-code★ 80ksame name
- shareAI-lab/analysis_claude_code★ 80ksame name
- vectorize-io/hindsight★ 61ksame name
184 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository8 other files it gives its agents.
- .github/copilot-instructions.mdCopilot instructions
- ai-service-repo-task-generatorSkill
- api-patternsSkill
- frontend-repo-task-generatorSkill
- migrationsSkill
- mockup-guidelinesSkill
- new-moduleSkill
- update-knowledgeSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
18 rules. 0 are common, 9 are distinctive, and 9 are very specific to this project.
0
Common
Most of the 183 edited versions we read keep these.
9
Distinctive
This author's own choices. Worth a look.
9
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 24
If the user says "review my changes," use get_changed_files or ask which files to look at.
- Distinctive: line 34
Read the files being reviewed in full — do not skim.
- Distinctive: line 36
Look at how similar features are implemented elsewhere in the codebase.
- Distinctive: line 70
Do loops terminate correctly?
- Very specific: line 75
Check against the established patterns in copilot-instructions.md:
- Very specific: line 82
Schemas: Do they inherit from BaseSchema (NOT pydantic.BaseModel)?
- Very specific: line 83
Models: Do tenant models have __table_args__ = {"schema": None}?
- Very specific: line 99
Do tenant models have __table_args__ = {"schema": None}?
- Very specific: line 100
If a new tenant table was added, was app/tenant/tables.py updated too?
- Very specific: line 101
If a migration adds a tenant table, does it use {schema_name} placeholder?
- Very specific: line 113
FK ordering: When creating multiple tables with FK dependencies, are parent tables created before child tables?
- Distinctive: line 142
Look for things that contradict each other or break expectations:
- Very specific: line 159
Participant removal flows: If removing/disabling a VBC CE payer or AccessIQ participant, are the corresponding OrganizationTenantAppAccess …
- Distinctive: line 167
Do error paths clean up resources (rollback transactions)?
- Distinctive: line 188
Don't rubber-stamp: If you find nothing wrong, say so explicitly, but also explain what you checked.
- Distinctive: line 189
Don't guess: If you're unsure whether something is a bug, read the related code to confirm.
- Distinctive: line 190
Don't only find problems: If something is done well or cleverly, call it out briefly.
- Distinctive: line 192
Don't suggest changes you can't justify: Every finding needs a "why it matters."
“Common” is measured: kept by at least 6 in 10 of the 183 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Code Review — Platform Backend
Purpose: Perform a thorough, critical code review. Your job is to find problems, not to approve code. Be constructive but direct.
0. Before You Start — Clarifying Questions
Always ask clarifying questions before diving in. At minimum, confirm:
- What is the scope? A specific file, a module, recent changes, or the full codebase?
- What changed and why? Feature, bugfix, refactor, or migration?
- Which module/app? (ValueIQ, RebateIQ, AccessIQ, or platform-level?)
- Any areas of concern? Performance, security, correctness, or general review?
If the user says "review my changes," use get_changed_files or ask which files to look at. Do not review blindly.
Recent-change reviews: Always use
git logandgit diffto identify actual commits and diffs. Never guess what changed from current code alone.
1. Review Process
Step 1: Understand the Context
- Read the files being reviewed in full — do not skim.
- Identify which module the code belongs to and check related files (controller, crud_service, models, schema, constants).
- Look at how similar features are implemented elsewhere in the codebase. Search for patterns before flagging something as wrong.
Step 2: Check Each Category
Work through every category in Section 2 below. Do not skip categories even if the change seems small — small changes can have large ripple effects.
Step 3: Report Findings
Organize findings by severity:
| Severity | Meaning |
| CRITICAL | Will cause bugs, data corruption, security vulnerabilities, or production failures. Must fix. |
| MAJOR | Significant logic issues, missing error handling, pattern violations that will cause problems. Should fix. |
| MINOR | Style inconsistencies, minor improvements, redundant code. Nice to fix. |
| NOTE | Observations, suggestions, or questions for the author. Not necessarily wrong. |
For each finding, provide:
- File and line (with link)
- What's wrong (be specific)
- Why it matters
- Suggested fix (show the corrected code when possible)
2. Review Categories
2.1 Logical Correctness
- Does the code do what it claims to do?
- Are there off-by-one errors, wrong comparisons, or inverted conditions?
- Are edge cases handled? (empty lists, None values, zero, negative numbers)
- Are return values used correctly by callers?
- Do loops terminate correctly? Are break/continue used properly?
- Are there race conditions in multi-step operations?
2.2 Project Pattern Adherence
Check against the established patterns in copilot-instructions.md:
- Request context: Is
get_context_vars()/get_current_user()/get_current_user_organization_id()called directly, or is context incorrectly passed as function parameters? - Module structure: Does the code follow
controller.py/crud_service.py/models.py/schema.py/constants.pysplit? - DB access isolation: Are all database queries (
db.query,db.add,db.delete,get_context_vars()for DB session) confined tocrud_service.py? Service files (service.py,*_service.py) must NOT access the DB directly — they should call CRUD functions. Exception:get_context_vars()is allowed in service files that manage transaction boundaries (e.g., background task wrappers withdb.begin_nested()). - Route decorators: Correct order?
dependencies=[Depends(authenticated)]on route,@version(1),@has_permissions(BuiltInPermissions.X.value)(is.valueused?), then optionally@is_app([PlatformApps.X]), then@limiter.limit(...). Are all decorators in this order? - Authentication import: Is
authenticatedimported fromcommon.authentication(NOTcommon.security)? - Schemas: Do they inherit from
BaseSchema(NOTpydantic.BaseModel)? - Models: Do tenant models have
__table_args__ = {"schema": None}? - Transaction pattern: Is
flush()used beforecommit()? Isin_transactionparameter respected? - Background task atomicity: Do background tasks that write multiple related records (e.g., data + status) wrap them in
db.begin_nested()? The SUCCESS status must usein_transaction=Trueso it commits with the data. On failure,db.rollback()undoes everything, then ERROR status is recorded in a separate commit. Ask: "if any step after commit fails, is the DB consistent?" Reference:app/vbc/health_plan/health_plan_bulk_upload_service.py. - Nested savepoint trap (SQLAlchemy 2.0): If a
begin_nested()block calls a function that itself doesbegin_nested()+session.commit(), the inner commit releases ALL savepoints and commits the outermost transaction. Verify: does every function called inside abegin_nested()either (a) acceptin_transactionand skip its own commit whenTrue, or (b) never callsession.commit()? Also check that deferred side effects (AAD, email) are returned, not executed, whenin_transaction=True. - Behavior over rules: When reviewing code modeled on an existing reference, understand why the reference does something before flagging it as a pattern violation. Trace the full behavior (transaction boundaries, commit/rollback paths, error flows). A structural rule like "no DB access in service files" does not override the need for transaction control.
- Enum comparisons: Since
BaseSchemahasuse_enum_values=True, are enum fields compared with.valuestrings, not enum instances? - Three-user authorization: For routes that handle participant-scoped data, does the controller branch on caller type (
current_user.is_admin_user,is_customer_user(), payer ownership check)? Is payer ownership validated by comparingparticipant.organization_idagainstget_current_user_organization_id()? Does Admin bypass ownership checks? Are manufacturer-only routes blocked for payer users (and vice versa)? - FastAPI route ordering: Are literal routes (e.g.,
/gaps,/detect) registered before parameterized routes (e.g.,/{request_id}) on the same HTTP method? Parameterized routes act as catch-alls and cause 422 errors if they shadow literal ones. - Imports at module top: Are all imports at the top of the file? Inline/lazy imports inside functions make dependencies hard to trace. Only acceptable for genuine circular-import issues (and must be documented).
- Azure SQL case-insensitivity: Are there unnecessary
func.lower()calls in SQLAlchemy string filters? Azure SQL default collation is case-insensitive —func.lower()is harmless but redundant. - Header/body tenant_app_id validation: For POST/PATCH routes with
tenant_app_idin the request body, isbody.tenant_app_id == x_tenant_app_idvalidated (raise 400 on mismatch)? GET routes should filter byx_tenant_app_idfrom the header. - Module-level mutable globals: Are there module-level dicts/lists used for cross-request state? With multi-worker deployment, each uvicorn worker has its own memory — module-level mutable state won't be shared. Use DB or
TenantSchemaMappattern instead.
2.3 Multi-Tenancy
- Are new tables tenant-scoped or platform-scoped? Is the choice correct?
- Do tenant models have
__table_args__ = {"schema": None}? - If a new tenant table was added, was
app/tenant/tables.pyupdated too? - If a migration adds a tenant table, does it use
{schema_name}placeholder? - Are there any cross-tenant data leaks? (queries without proper schema isolation)
2.4 Migrations
- Is the migration file named correctly? (
YYYY_N_SEQ_REV.sql) - Is the sequence number correct? (check
_migrations/for the highest current SEQ) - Does it use
PLATFORM.TABLE_NAMEfor platform tables? - Does it use
{schema_name}for tenant tables? - Is
app/tenant/tables.pyin sync with the migration? - Are there
IF NOT EXISTSguards where appropriate? - New permissions: inserted into
ROLE_PERMISSIONwith correct role IDs? - FK ordering: When creating multiple tables with FK dependencies, are parent tables created before child tables? Does the same order hold in
tables.py?
2.5 Missing Pieces
This is where most bugs hide. Actively look for things that should exist but don't:
- Missing error handling — what if the DB query returns None?
- Missing validation — are inputs validated before use?
- Missing permissions — should this endpoint have
@has_permissions? - Missing audit logging — should this state-changing action be logged? If audit logging is present, does it use
create_audit_log()fromaudit_log.audit_servicewith enum-backed entity names and actions fromaudit_log.constants? - Missing AI feature gating — do AI-related endpoints check
is_ai_enabled_for_app()before proceeding? AI features must be gated per tenant app config. - Missing
@is_appdecorator — should this route be restricted to a specific app? - Missing rate limiting on sensitive endpoints?
- Incorrect rate limit values? (guideline:
"60/minute"for reads,"30/minute"default,"10/minute"for expensive/bulk,"120/minute"for lightweight) - Missing
db.commit()ordb.rollback()in error paths? - Missing atomicity — are multiple writes in a background task wrapped in
db.begin_nested()? If the data commits but the status record doesn't, the system is inconsistent. - Nested savepoint violations — does a
begin_nested()block call any function that itself callssession.commit()without anin_transactionguard? (SQLAlchemy 2.0 trap: inner commit releases all savepoints) - Boolean parsing in file uploads — are boolean-like values from spreadsheet columns parsed with a positive allowlist (
in ("yes", "true", "1", "y")) so unknowns default to False? Negative allowlists cause blanks/typos to default to True. - Variable scoping in try/except — are variables referenced in
exceptblocks initialized before thetrystatement? Common withinvites,errors, or similar lists in background tasks. - Exception differentiation in background tasks — do background tasks catch
HTTPExceptionseparately from genericException? Business validation errors should preserve structured detail; generic exceptions should store a safe message, neverstr(e). - String truncation before DB insert — are user-generated or error-derived strings truncated to the VARCHAR column limit before inserting? Without truncation, joined errors or raw exception strings can exceed the limit and cause a secondary DB failure.
- File upload row limits — when a file upload path constructs an API body schema with
max_lengthon a list field, does the upload service check row count before constructing the body? Otherwise users get opaque Pydantic validation errors. - New enum values not added to
constants.py? - New permissions not added to
BuiltInPermissionsinapp/role/constants.py? - Schema fields that exist in the model but not in the response schema (or vice versa)?
- Missing tests — does this change have corresponding test coverage in
tests/? Are new functions, edge cases, and error paths tested?
2.6 Inconsistencies
Look for things that contradict each other or break expectations:
- Model field names vs. schema field names — do they match?
- Column types in migration vs. SQLAlchemy model types — do they align?
- Business logic that contradicts what the route name/docstring promises
- Inconsistent naming (e.g.,
user_idin one place,userIdin another) - Inconsistent error response formats compared to other endpoints
- Constants defined but not used, or magic strings instead of constants
2.7 Security
- Are there any SQL injection risks? (raw SQL without parameterization)
- Is user input sanitized before use in queries or file paths?
- Are permissions checks present on all endpoints that need them?
- Is sensitive data (passwords, tokens, PII) being logged?
- Are there any IDOR (Insecure Direct Object Reference) risks — can a user access another user's/org's data by manipulating IDs?
- Is the
current_userororg_idused to scope data access? - Participant removal flows: If removing/disabling a VBC CE payer or AccessIQ participant, are the corresponding
OrganizationTenantAppAccessrecords also deleted? (2 per payer — ADMIN + APP_ADMIN groups). Stale records grant tenant access via middleware. Reference: delegate cleanup inapp/vbc/health_plan/invite_delegate_service.py
2.8 Error Handling
- Are exceptions caught at the right level?
- Are error messages helpful without leaking internal details?
- Are HTTP status codes correct? (400 for client errors, 404 for not found, 403 for forbidden, 500 should be rare)
- Are there bare
except:orexcept Exception:blocks that swallow errors silently? - Do error paths clean up resources (rollback transactions)?
2.9 Performance
- Are there N+1 query patterns? (querying in a loop)
- Are there missing DB indexes for frequently-queried columns?
- Are large result sets loaded entirely into memory when they could be paginated?
- Are there unnecessary
db.commit()calls inside loops?
2.10 Code Quality
- Dead code, unused imports, commented-out blocks
- Functions that are too long (>50 lines) or do too many things
- Duplicated logic that should be extracted
- Naming: are variables and functions clearly named for their purpose?
- Type hints: are they present and correct?
3. Don'ts
- Don't rubber-stamp. If you find nothing wrong, say so explicitly, but also explain what you checked. An empty review is not a good review.
- Don't guess. If you're unsure whether something is a bug, read the related code to confirm. Use search tools to find how similar code works elsewhere.
- Don't only find problems. If something is done well or cleverly, call it out briefly.
- Don't flag things that are documented exceptions. For instance,
allow_origins=["*"]in CORS is intentional (enforced at infra level). JWTverify_signature: Falseis by design. Checkcopilot-instructions.mdbefore flagging. - Don't suggest changes you can't justify. Every finding needs a "why it matters."
4. Review Summary Template
End every review with a summary:
## Review Summary
**Scope:** [what was reviewed]
**Verdict:** [CRITICAL issues found / Looks good with minor items / Clean]
### Findings
| # | Severity | File | Issue |
|---|----------|------|-------|
| 1 | CRITICAL | file.py:L42 | Description |
| 2 | MAJOR | file.py:L88 | Description |
| ...| ... | ... | ... |
### What Looks Good
- [Positive observations]
### Recommendations
- [Optional broader suggestions]Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

