/openlogos:code-reviewerfrom openlogos
Reviews code for compliance with OpenLogos methodology, validating against API YAML specs, sequence diagrams, and DB DDL. Includes YAML validity checks and structured review reports.
Ships in openlogos. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Review AI-generated code by performing systematic validation against the full OpenLogos specification chain (API YAML, sequence diagram EX cases, DB DDL), ensuring code is fully consistent with design documents, covers all exception paths, and meets security requirements.
logos/resources/api/ contains API YAML specificationslogos/resources/prd/3-technical-plan/2-scenario-implementation/ contains scenario sequence diagrams (with EX cases)logos/resources/database/ contains DB DDLFor projects without APIs (pure CLI / libraries), API consistency checks can be skipped; focus on sequence diagram coverage and exception handling instead.
Pre-check — YAML Validity (before anything else):
Before loading API specs, validate that all logos/resources/api/*.yaml files are syntactically valid YAML and conform to the OpenAPI 3.x schema. If any file fails parsing (e.g., unquoted special characters in description fields), report it as a Critical blocker immediately — do not proceed with the rest of the review until YAML errors are fixed.
Then read the following files to establish a "reference baseline" for the code review:
logos/resources/api/*.yaml): Extract endpoint inventory, record each endpoint's path, method, request body schema, response schema, and status codeslogos/resources/prd/3-technical-plan/2-scenario-implementation/): Extract all EX exception case IDs and expected behaviorslogos/resources/database/): Extract table structures, column types, constraints, and indexeslogos-project.yaml: Read tech_stack to confirm the technology stack, external_dependencies to confirm external dependenciesSummarize into a review checklist:
Review scope: S01-related code
- API endpoints: 4 (auth.yaml)
- EX exception cases: 7 (EX-2.1 ~ EX-5.2)
- DB tables: 2 (users, profiles)
- Security policies: 2 RLS rules
Compare code implementation against API YAML specification endpoint by endpoint:
Checklist:
| Check Item | Description | Severity |
|---|---|---|
| Path Match | Whether route paths in code exactly match paths in YAML | Critical |
| HTTP Method | Whether GET/POST/PUT/DELETE matches | Critical |
| Request Body Fields | Whether code reads all required fields defined in YAML requestBody.schema | Critical |
| Request Body Validation | Whether field type, format (email/uuid), minLength and other constraints are validated in code | Warning |
| Response Fields | Whether JSON field names and types returned by code match YAML responses.schema | Critical |
| Status Codes | Whether HTTP status codes returned in normal and error cases match YAML definitions | Critical |
| Error Response Format | Whether error responses follow the unified { code, message, details? } format | Warning |
| YAML Validity | All logos/resources/api/*.yaml files parse as valid YAML and valid OpenAPI 3.x — unquoted special characters (:, →, #) in description/summary values are a common failure mode | Critical |
Output format:
### API Consistency
| Endpoint | Check Item | Status | Notes |
|----------|------------|--------|-------|
| POST /api/auth/register | Request body fields | ✅ | email, password both read |
| POST /api/auth/register | Response status code | ❌ Critical | Registration success returns 200, YAML defines 201 |
| POST /api/auth/register | Error code | ❌ Warning | Duplicate email returns generic 400, YAML defines 409 |
Map all EX exception cases from sequence diagrams to error handling in code one by one:
Key checks:
Output format:
### Exception Handling Coverage
| EX ID | Exception Description | Code Coverage | Notes |
|-------|----------------------|---------------|-------|
| EX-2.1 | Email already registered | ✅ | Returns 409, format correct |
| EX-2.2 | Auth service unavailable | ❌ Critical | No try/catch wrapping the supabase.auth.signUp call |
| EX-4.1 | profiles write failure | ❌ Critical | auth.users record not rolled back after INSERT failure |
Check whether database operations in code conform to DDL design:
Checklist:
INTEGER amount field in DDL, whether code passes cents instead of dollars)Check the security implementation of the code:
| Check Item | Description | Severity |
|---|---|---|
| Authentication Check | Whether endpoints requiring authentication verify token/session before processing logic | Critical |
| Authorization Check | Whether users can only access their own data (owner check) | Critical |
| Input Validation | Whether user input has type validation and length limits (prevent injection, prevent XSS) | Critical |
| Sensitive Data | Whether responses leak password hashes, internal IDs, or stack traces | Critical |
| RLS Dependency | If relying on PostgreSQL RLS, whether code correctly sets the auth.uid() context | Warning |
| SQL Injection | Whether parameterized queries are used (string-concatenated SQL is prohibited) | Critical |
| Rate Limiting | Whether critical endpoints (login, registration) have rate limiting against brute force | Warning |
Summarize all findings by severity and generate a structured report:
# Code Review Report: S01 User Registration
## Review Scope
- Scenario: S01
- Endpoints: 4
- EX cases: 7
- Code files: src/api/auth/register.ts, src/api/auth/login.ts
## Review Summary
| Severity | Count |
|----------|-------|
| 🔴 Critical | 2 |
| 🟡 Warning | 3 |
| 🔵 Info | 1 |
## Critical Findings
### [C1] POST /api/auth/register status code mismatch
- **Spec source**: auth.yaml → register → responses.201
- **Issue**: Code returns 200, spec defines 201
- **Fix suggestion**: Change `res.status(200)` to `res.status(201)`
### [C2] EX-2.2 unhandled: Auth service unavailable
- **Spec source**: S01 sequence diagram → EX-2.2
- **Issue**: `supabase.auth.signUp()` call is not wrapped in try/catch
- **Fix suggestion**: Add try/catch, return 503 on timeout or 5xx
## Warning Findings
...
## Info Findings
...
Report principles:
The following prompts can be copied directly for use with AI:
Help me do a code reviewHelp me check if this code conforms to the API YAML specReview the code implementation related to S01Help me check if exception handling is completeHelp me check if security policies are in place审查前读取 spec/authority-closure.md、项目 Authority Registry、场景和测试追溯。本段只定义 reviewer 行为,不维护 owner/writer 的第二份清单。
逐 fact_id 验证:canonical state 只有 sole writer;所有写入经过 mutation entry;消费者调用 authority decision/共享 evaluator;projection 只读且校验 freshness;response lost/restart 从 authority/receipt 恢复;旧 writer、旧 parser 和 fallback scan 已删除或不可达;cutover 有 exit evidence。
以下均为 Critical:旁路写权威;复制完成谓词/状态机;从 marker、mtime、目录或 stale cache 反推决定;projection 覆盖 authority;feature flag 永久保留两个 writer;测试未制造冲突副本/新进程恢复。只加注释或声称“最终一致”不能关闭问题。
报告按 fact_id 给出证据、代码位置、违反的 AC、所需删除/收口动作和对应 UT/ST。AC-01~AC-07 任一 Critical 未清零即不得批准交付。
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
16 skills in this plugin
/api-designerDesign OpenAPI specifications derived from scenario sequence diagrams. Use when scenarios exist in 2-scenario-implementation/ but logos/resources/api/ is empty. All description and summary values in YAML must be double-quoted./architecture-designerDesign technical architecture and select technology stack. Use when product design exists in logos/resources/prd/2-product-design/ but logos/resources/prd/3-technical-plan/1-architecture/ is empty./change-writerWrite change proposals with impact analysis following OpenLogos delta workflow. Use when the project lifecycle is active and source code or methodology documents need modification./code-implementorGenerate business code and test code based on the full specification chain (sequence diagrams, API YAML, DB DDL, test case specs). Use when test cases exist in logos/resources/test/ but logos/resources/implementation/ is empty./db-designerDesign database schema based on API and scenario requirements. Use when scenarios exist but logos/resources/database/ is empty./deployment-designerDesign the deployment plan (topology, environments, release commands, migrations, rollback, post-deploy smoke) and the environment registry deploy configuration for openlogos deploy. Use when API/DB design is complete but logos/resources/prd/3-technical-plan/3-deployment/ is empty, or when a change affects deployment.npx claudepluginhub miniidealab/openlogos --plugin openlogosOther plugins' skills for the same job