phase-8-review
๐ฏSkillfrom popup-studio-ai/bkit-claude-code
Verifies overall codebase quality through comprehensive architecture, convention, and implementation gap analysis before deployment.
Part of
popup-studio-ai/bkit-claude-code(17 items)
Installation
/plugin marketplace add popup-studio-ai/bkit-claude-code/plugin install bkitSkill Details
|
Overview
# Phase 8: Architecture/Convention Review
> Overall codebase quality verification
Purpose
Review the entire codebase before deployment. Identify architecture consistency, convention compliance, and potential issues.
What to Do in This Phase
- Architecture Review: Review structural consistency
- Convention Review: Verify rule compliance
- Code Quality Review: Duplication, complexity, potential bugs
- Refactoring: Fix discovered issues
Deliverables
```
docs/03-analysis/
โโโ architecture-review.md # Architecture review
โโโ convention-review.md # Convention review
โโโ refactoring-plan.md # Refactoring plan
```
PDCA Application
- Plan: Define review scope/criteria
- Design: Design checklist
- Do: Execute code review
- Check: Analyze issues
- Act: Refactor and proceed to Phase 9
Level-wise Application
| Level | Application Method |
|-------|-------------------|
| Starter | Can be skipped (simple projects) |
| Dynamic | Required |
| Enterprise | Required + security review |
---
Full Phase Verification Matrix
Cross-Phase Consistency Verification
Phase 8 verifies that all Phase outputs and rules are consistently applied.
```
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Cross-Phase Dependency Flow โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ Phase 1 (Schema/Terminology) โ
โ โ Glossary, entity definitions โ
โ Phase 2 (Coding Convention) โ
โ โ Naming rules, environment variable conventions โ
โ Phase 3 (Mockup) โ
โ โ Component structure, Props design โ
โ Phase 4 (API) โ
โ โ RESTful principles, response format, error codes โ
โ Phase 5 (Design System) โ
โ โ Design tokens, component variants โ
โ Phase 6 (UI Implementation) โ
โ โ API client, type sharing, error handling โ
โ Phase 7 (SEO/Security) โ
โ โ Security rules, metadata โ
โ Phase 8 (Review) โ Current stage: Full verification โ
โ โ โ
โ Phase 9 (Deployment) โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
```
Phase-specific Verification Checklist
#### Phase 1 โ Verify: Terminology/Schema Consistency
```
โก Are glossary.md terms consistently used in code?
- Business terms โ Code naming matching
- Global standard terms โ API response field names matching
โก Do entity definitions match actual types?
โก Do relationship definitions match actual implementation?
```
#### Phase 2 โ Verify: Convention Compliance
```
โก Naming rule compliance (PascalCase, camelCase, UPPER_SNAKE_CASE)
โก Folder structure rule compliance
โก Environment variable naming rule compliance (NEXT_PUBLIC_, DB_, API_*, etc.)
โก .env.example template completion
โก Environment variable validation logic (lib/env.ts) exists
```
#### Phase 4 โ Verify: API Consistency
```
โก RESTful principle compliance
- Resource-based URLs (nouns, plural)
- Correct HTTP method usage
- Status code consistency
โก Response format consistency
- Success: { data, meta? }
- Error: { error: { code, message, details? } }
- Pagination: { data, pagination }
โก Error code standardization (matches ERROR_CODES constant)
```
#### Phase 5 โ Verify: Design System Consistency
```
โก Are design tokens defined? (CSS Variables / ThemeData)
โก Do components use tokens? (no hardcoded colors)
โก Are component variants consistent?
โก Dark mode support (if defined)
```
#### Phase 6 โ Verify: UI-API Integration Consistency
```
โก API client layer structure compliance
- Components โ hooks โ services โ apiClient
- No direct fetch calls
โก Type consistency
- Phase 4 API spec types = Phase 6 client types
โก Error handling consistency
- Global error handler usage
- Error code-specific handling logic
โก State management pattern consistency
```
#### Phase 7 โ Verify: Security/SEO Application
```
โก Authentication/authorization middleware applied
โก Input validation (server-side)
โก XSS, CSRF defense
โก No sensitive info exposed to client
โก SEO meta tags applied
```
#### Phase 9 โ Verify: Deployment Readiness
```
โก Environment variable Secrets registered (based on Phase 2 list)
โก Environment separation (dev/staging/prod)
โก Build successful
โก Environment variable validation script passes
```
---
Clean Architecture Verification
Layer Separation Principles
```
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Presentation Layer โ
โ (pages, components, hooks - UI concerns) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Application Layer โ
โ (services, use-cases - business logic) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Domain Layer โ
โ (entities, types - core domain models) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Infrastructure Layer โ
โ (api client, db, external services) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Dependency direction: Outside โ Inside (Presentation โ Domain)
Inner layers must not know about outer layers
```
Layer-specific Verification Checklist
#### Presentation Layer (UI)
```
โก Is there business logic in components?
โก Are there direct API calls? (should go through hooks)
โก Is state management properly separated?
โก Do components have single responsibility?
```
#### Application Layer (Services)
```
โก Are domain logic and infrastructure logic separated?
โก Are external dependencies abstracted?
โก Is the structure testable?
โก Are use cases clearly defined?
```
#### Domain Layer (Types/Entities)
```
โก Are there no external library dependencies?
โก Does it contain only pure business rules?
โก Do types match Phase 1 schema?
```
#### Infrastructure Layer (API Client)
```
โก Are external service calls abstracted?
โก Is error handling consistent?
โก Is configuration managed via environment variables?
```
---
Architecture Review Checklist
Structure
- [ ] Does folder structure match conventions
- [ ] Is separation of concerns well done
- [ ] Is dependency direction correct (outside โ inside)
Patterns
- [ ] Are consistent patterns used
- [ ] Is there unnecessary abstraction
- [ ] Is proper encapsulation done
Convention Review Checklist
Naming
- [ ] Does it follow Phase 2 defined rules
- [ ] Are meaningful names used
- [ ] Is there consistency
Code Style
- [ ] Unified indentation, quotes, etc.
- [ ] Is file length appropriate
- [ ] Is function length appropriate
Code Quality Checklist
- [ ] Is there duplicate code
- [ ] Are there highly complex functions
- [ ] Is error handling appropriate
- [ ] Is type safety ensured
AI-Assisted Review
```
Request code review from Claude:
"Review this project's code.
- Does it follow CONVENTIONS.md rules
- Is there architecture consistency
- Are there potential bugs or improvements"
```
Template
See templates/pipeline/phase-8-review.template.md
Next Phase
Phase 9: Deployment โ After review completion, deploy to production
---
6. In-Depth Code Quality Review
6.1 Duplicate Code Detection
#### Detection Methods
```bash
# 1. Search for similar function names
grep -r "function.*format" src/
grep -r "function.*calculate" src/
grep -r "function.get.By" src/
# 2. Search for similar patterns
grep -rn "reduce.*sum" src/
grep -rn "filter.*map" src/
grep -rn "useState.*useEffect" src/
```
#### Handling by Duplication Type
| Type | Example | Solution |
|------|---------|----------|
| Exact duplicate | Same code copy-paste | Extract to function |
| Structural similarity | Same logic, different data | Parameterize |
| Conceptual similarity | Different implementations for similar purpose | Integrate or interface |
#### Duplicate Code Checklist
```
โก Is the same logic in 2+ places?
โก Are there multiple functions with similar names?
โก Is the same data transformation repeated?
โก Are similar UI patterns repeated?
โก Is the same API call pattern repeated?
โก Is similar error handling repeated?
```
6.2 Reusability Assessment
#### Assessment Criteria
| Score | Criteria | Description |
|-------|----------|-------------|
| โญโญโญ | High | Can be used in other projects |
| โญโญ | Medium | Can be used in multiple places within same project |
| โญ | Low | Used only for specific feature |
#### Reusability Checklist
```
Check for each function/component:
โก Is it tied to a specific domain?
โก Does it depend on external state?
โก Are parameters generic?
โก Is the return value predictable?
โก Are there side effects?
```
6.3 Extensibility Assessment
#### Extensibility Check
```
When new requirements come:
โก Can it be added without modifying existing code?
โก Can behavior be changed by configuration only?
โก Is adding new types/cases easy?
โก Can it be extended without adding conditionals?
```
#### Extensibility Anti-patterns
```typescript
// โ Requires modification for each extension
function process(type: string) {
if (type === 'a') { / ... / }
else if (type === 'b') { / ... / }
// Add else if for each new type...
}
// โ Hardcoded list
const ALLOWED_TYPES = ['a', 'b', 'c']
// โ Enumerated switch statements
switch (action.type) {
case 'ADD': // ...
case 'REMOVE': // ...
// Add case for each new action...
}
```
#### Good Extensibility Patterns
```typescript
// โ Registry pattern
const handlers: Record
function register(type: string, handler: Handler) {
handlers[type] = handler
}
function process(type: string, data: unknown) {
return handlers[type]?.(data)
}
// โ Configuration-based
const CONFIG = {
types: ['a', 'b', 'c'],
handlers: { ... }
}
// โ Plugin structure
interface Plugin { execute(data): Result }
const plugins: Plugin[] = []
```
6.4 Object-Oriented Principles Check
#### SOLID Principles Checklist
S - Single Responsibility (SRP)
```
โก Does the class/function change for only one reason?
โก Does the name clearly explain the role?
โก Is "and" in the name? โ Needs separation
```
O - Open/Closed (OCP)
```
โก Is it open for extension? (new features can be added)
โก Is it closed for modification? (no existing code changes needed)
โก Are interfaces/abstractions used?
```
L - Liskov Substitution (LSP)
```
โก Can subtypes replace parent types?
โก Do overridden methods keep the contract?
```
I - Interface Segregation (ISP)
```
โก Is the interface too large?
โก Must unused methods be implemented?
โก Can the interface be split smaller?
```
D - Dependency Inversion (DIP)
```
โก Does it depend on abstractions instead of concrete classes?
โก Are dependencies injected? (DI)
โก Is the structure testable?
```
6.5 Refactoring Priority
```
Urgent (Required before deployment):
- Duplication that can cause bugs
- Security vulnerabilities
- Performance bottlenecks
High (As soon as possible):
- Same logic duplicated in 3+ places
- Files over 200 lines
- Nesting deeper than 5 levels
Medium (Next sprint):
- Structure lacking extensibility
- Naming inconsistencies
- Structure difficult to test
Low (Backlog):
- Style inconsistencies
- Excessive comments
- Unused code
```
---
7. AI Code Review Request Template
```markdown
Please review the code from these perspectives:
- Duplicate Code
- Are there similar functions/components?
- Is there common logic that can be extracted?
- Reusability
- Can it be used generically?
- Is it tied to a specific domain?
- Extensibility
- Can it flexibly respond to new requirements?
- Are there hardcoded parts?
- SOLID Principles
- Does it follow single responsibility?
- Is it open for extension and closed for modification?
- Convention Compliance
- Does it follow CONVENTIONS.md rules?
- Is naming consistent?
Please identify parts that need refactoring and their priority.
```
---
8. Gap Analysis (Design vs Implementation)
Gap Analysis Report Template
```markdown
# Gap Analysis Report
Analysis Target
- Design document: docs/02-design/{feature}.design.md
- Implementation path: src/features/{feature}/
Results by Category
API Endpoints
| Design | Implementation | Status |
|--------|----------------|--------|
| POST /api/users | POST /api/users | โ Match |
| GET /api/users/:id | - | โ Not implemented |
| - | DELETE /api/users/:id | โ ๏ธ Missing from design |
Data Model
| Design Entity | Implementation | Status |
|---------------|----------------|--------|
| User | types/user.ts | โ Match |
| UserRole | - | โ Not implemented |
Match Rate
- Total items: 10
- Matches: 7
- Not implemented: 2
- Missing from design: 1
- Match Rate: 70%
```
Gap Types and Actions
| Gap Type | Meaning | Action |
|----------|---------|--------|
| โ Match | Design = Implementation | None |
| โ Not implemented | In design, not in code | Implement or update design |
| โ ๏ธ Missing from design | In code, not in design | Add to design document |
| ๐ Different | Exists but different | Align (code is truth) |
When to Run Gap Analysis
- After completing feature implementation
- Before deployment
- When design document is updated
- During code review
More from this repository10
Rapidly create trendy, interactive UI mockups using HTML/CSS/JS, designed for easy Next.js component conversion without requiring a designer.
Builds platform-independent design systems with consistent UI components across multiple frameworks and technologies.
Develops cross-platform desktop applications using web technologies with Electron or Tauri frameworks, targeting Windows, macOS, and Linux.
Implements frontend UI screens, integrates with backend APIs, and manages application state using design system components and centralized API architecture.
Skill
Optimizes web application's search visibility and security by implementing meta tags, semantic HTML, and conducting vulnerability checks.
Skill
Skill
Deploys applications to production environments using CI/CD strategies, configuring infrastructure across various platforms like Vercel, Kubernetes, and Docker.
Enforces AI-native development rules using PDCA methodology, automatically detecting project complexity and applying consistent code quality standards.