From marsai-dev-team
Automated architectural code review against gold standard references. Compares diffs against the architecture template and reference examples, verifying structure, naming, architecture, events, duplication, responsibility, and ops.
npx claudepluginhub v4-company/marsai --plugin marsai-dev-teamThis skill uses the workspace's default tool permissions.
> **When to use**: before opening a PR or during code review. Invoke manually to receive rigorous architectural feedback.
architecture-template.mdgold-standard/README.mdgold-standard/app/di-symbols--types.tsgold-standard/app/dto-input--PaginatedInput.tsgold-standard/app/dto-input--SignInInput.tsgold-standard/app/event-handler--UserCreatedEventHandler.tsgold-standard/app/exception--pattern.mdgold-standard/app/response-mapper--UserResponseMapper.tsgold-standard/app/service--CreateUserMembershipService.tsgold-standard/app/usecase--SignUpUseCase.tsgold-standard/domain/aggregate--User.tsgold-standard/domain/entity--EmailAddress.tsgold-standard/domain/provider--TokenProvider.tsgold-standard/domain/repository--UserRepository.tsgold-standard/domain/value-object--AuthProviderVO.tsgold-standard/domain/value-object--MetadataVO.tsgold-standard/infra/controller--AuthController.tsgold-standard/infra/controller--PaginatedRoute.tsgold-standard/infra/di--container.tsgold-standard/infra/di--controllers.tsGenerates design tokens/docs from CSS/Tailwind/styled-components codebases, audits visual consistency across 10 dimensions, detects AI slop in UI.
Records polished WebM UI demo videos of web apps using Playwright with cursor overlay, natural pacing, and three-phase scripting. Activates for demo, walkthrough, screen recording, or tutorial requests.
Delivers idiomatic Kotlin patterns for null safety, immutability, sealed classes, coroutines, Flows, extensions, DSL builders, and Gradle DSL. Use when writing, reviewing, refactoring, or designing Kotlin code.
When to use: before opening a PR or during code review. Invoke manually to receive rigorous architectural feedback.
Goal: ensure code follows the architectural standard (Clean Architecture + DDD + Event-Driven) by comparing against the gold standard.
Before starting the review, ask:
"What is the ticket for this change? (paste the link or explain what is being done)"
Run git diff main...HEAD to capture everything changed in the current branch vs main.
If the branch is already main or there is no diff, warn: "No diff found against main. Are you on the correct branch?"
git diff main...HEAD --name-only to list changed files.git diff main...HEAD for the full diff.From the diff, decide what to investigate in the repo:
Golden rule of attention: think like a senior — "what can go wrong here? what else depends on this? does something that does this already exist?"
For each file in the diff, identify which architectural concept it represents and compare against the corresponding gold standard:
| If the file is a... | Compare against |
|---|---|
| Aggregate | gold-standard/domain/aggregate--User.ts |
| Entity | gold-standard/domain/entity--EmailAddress.ts |
| Value Object | gold-standard/domain/value-object--AuthProviderVO.ts |
| Repository interface | gold-standard/domain/repository--UserRepository.ts |
| Provider interface | gold-standard/domain/provider--TokenProvider.ts |
| UseCase | gold-standard/app/usecase--SignUpUseCase.ts |
| Service | gold-standard/app/service--CreateUserMembershipService.ts |
| Event Handler | gold-standard/app/event-handler--UserCreatedEventHandler.ts |
| DTO Input | gold-standard/app/dto-input--SignInInput.ts |
| DTO Input (paginated) | gold-standard/app/dto-input--PaginatedInput.ts |
| Response Mapper | gold-standard/app/response-mapper--UserResponseMapper.ts |
| Exception | gold-standard/app/exception--pattern.md |
| DI Symbols | gold-standard/app/di-symbols--types.ts |
| Controller | gold-standard/infra/controller--AuthController.ts |
| Kysely Repository | gold-standard/infra/kysely-repo--KyselyUserRepository.ts |
| Kysely Paginated Query | gold-standard/infra/kysely-repo--PaginatedQuery.ts |
| Controller (paginated route) | gold-standard/infra/controller--PaginatedRoute.ts |
| Persistence Mapper | gold-standard/infra/persistence-mapper--UserPersistenceMapper.ts |
| Provider impl | gold-standard/infra/provider--JoseTokenProvider.ts |
| DI config | gold-standard/infra/di--*.ts |
| Events setup | gold-standard/infra/events--index.ts |
| Server config | gold-standard/infra/server--index.ts |
| Prisma schema | gold-standard/infra/prisma--schema.prisma |
The gold standard is in: gold-standard/ (within this skill's folder)
The architecture template is in: architecture-template.md (within this skill's folder)
MUST read the corresponding gold standard AND the architecture template before making any judgment.
Verify ALL categories below, in order:
PascalCase with concept suffix (UseCase, Service, EventHandler, Repository, Controller, Mapper, Exception, etc.).PaginationParams as input and PaginatedResult<T> as output (both from @v4-company/mars-api/core). MUST NOT create custom pagination types (e.g., FindByXPaginatedOutput) — use library types.PaginationParams from @v4-company/mars-api/core as Querystring type (do not redefine page?: number; limit?: number inline).Paginated queries MUST follow this end-to-end pattern:
params: PaginationParams and returns Promise<PaginatedResult<T>>. Both imported from @v4-company/mars-api/core.KyselyDatabasePagination from @v4-company/mars-api/core. Instantiate with the repository's Kysely<DB>. Flow: getTotalCount(baseQuery) → addPagination(baseQuery, { ...params, total }) → query.execute() → return { success: true, data, pagination }.this.model! (non-null assertion). Store the Kysely instance in a private field private readonly db: Kysely<DatabaseSchema> in the constructor (already injected, save to own field with non-null type).SchemaOpenApi (with z.coerce.number() for page/limit query params), QuerySchema (for @ApiQueryParamsSchema), and Request extends RequestDto. Defaults: page = 1, limit = 10, max limit = 100.PaginatedResult<ResponseType>. Map domain objects to DTOs over result.data. Pass result.pagination directly.Querystmarsai: PaginationParams (from lib) in request type. @ApiQueryParamsSchema(QuerySchema) for OpenAPI. Defaults in controller: page: req.query.page ?? 1, limit: req.query.limit ?? 10.Reference: gold-standard/app/dto-input--PaginatedInput.ts, gold-standard/infra/controller--PaginatedRoute.ts
Violations that are BLOCK:
KyselyDatabasePaginationthis.model! (non-null assertion) to access Kysely instance{ items: T[], total: number }) instead of PaginatedResult<T>page?: number; limit?: number inline in controller instead of using PaginationParamsRoutes that receive organizationId as a parameter and access org-scoped data MUST:
@Auth(PERMISSIONS.RESOURCES.X, PERMISSIONS.ACTIONS.Y) — not just @Auth(). Define correct resource and action.OrganizationRepository.findById() — throw OrganizationNotFoundException if not.CheckUserOrganizationService — prevents a user with permission in org A from accessing data in org B.RequireSystemAdminService for routes that should be accessible by normal org users. System admin is for global administrative operations.Violations that are BLOCK:
@Auth() without resource/action on a route that requires specific permissionRequireSystemAdminService where CheckUserOrganizationService + permission would be correct.env.example.Follow output format below.
Everything that violates the architectural pattern. Includes:
KyselyDatabasePagination from libthis.model! (non-null assertion) in Kysely repository — store in private fieldPaginatedResult<T> / PaginationParamspage?: number; limit?: number in controller instead of PaginationParams from lib@Auth() without resource/action on route requiring permissionRequireSystemAdminService on route that should use CheckUserOrganizationService + permissionsImprovement suggestions that do not violate the pattern:
# Code Review — [branch-name]
**Ticket**: [Linear link or description]
**Files changed**: [N]
**Status**: [X BLOCKs | Y WARNINGs] or [APPROVED]
---
## Structure
[findings or "No issues"]
## Naming
[findings or "No issues"]
## Architecture
[findings or "No issues"]
## Events and Resilience
[findings or "No issues"]
## Duplication
[findings or "No issues"]
## Responsibility
[findings or "No issues"]
## Ops
[findings or "No issues"]
---
## Correction prompts
### By category
#### [Category with issues]
> Ready-to-paste prompt for fixing the issues in this category.
[repeat for each category with issues]
### General correction prompt
> Single prompt consolidating ALL issues found, ready to copy and paste.
---
## Verdict
[BLOCKED — X issues must be fixed before merge]
or
[APPROVED — code follows the architectural standard]
or
[APPROVED WITH NOTES — Y warnings to consider]
BLOCK file.ts:line — Description of the problem.
Reference: [gold standard or architecture template section X]
How to fix: [direct instruction]
WARNING file.ts:line — Improvement suggestion.
Reason: [why it would be better]
Each prompt must be self-contained — whoever pastes it does not need additional context:
Fix the following issues on branch [branch] following the architectural
standard (Clean Architecture + DDD + Event-Driven):
1. [file:line] — [problem]. Correct: [how it should be].
Reference: [template concept]
2. [file:line] — [problem]. Correct: [how it should be].
Rules:
- Do not create new folders
- Follow the pattern for [concept] as shown in: [template excerpt]
- Use Unit of Work for [context]