Skip to content
Skills Library
Programming · Review & audit

reviewing-typescript-code

/reviewing-typescript-code

Reviews TypeScript code for project-specific quality patterns. Use when writing entities, services, repositories, comparators, formatters, bootstrap methods, deployment stages, diff support, or reviewing PRs with functional patterns. Do NOT use for general TypeScript tutorials or non-Configurator projects.

Licence
BSD-3-Clause
Last repository change
17.08.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
3
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 17.08.2026, without references to retired models or APIs.

Licence

BSD-3-Clause, otwarta.

What it does and when to use it

Reviews TypeScript code for project-specific quality patterns. Use when writing entities, services, repositories, comparators, formatters, bootstrap methods, deployment stages, diff support, or reviewing PRs with functional patterns. Do NOT use for general TypeScript tutorials or non-Configurator projects.

Original author description

Reviews TypeScript code for project-specific quality patterns. Use when writing entities, services, repositories, comparators, formatters, bootstrap methods, deployment stages, diff support, or reviewing PRs with functional patterns. Do NOT use for general TypeScript tutorials or non-Configurator projects.

How it works

  1. Overview
  2. When to Use
  3. Quick Reference
  4. Quality Checklist
  5. Review Output Format
  6. Project-Specific Conventions
  7. Common Mistakes
  8. References
  9. Related Skills
  10. Quick Reference Rule
Original SKILL.md headings · 118 lines, 603 words
SKILL.md preview
---
name: reviewing-typescript-code
description: "Reviews TypeScript code for project-specific quality patterns. Use when writing entities, services, repositories, comparators, formatters, bootstrap methods, deployment stages, diff support, or reviewing PRs with functional patterns. Do NOT use for general TypeScript tutorials or non-Configurator projects."
allowed-tools: "Read, Grep, Glob"
metadata:
  author: Ollie Shop
  version: 1.0.0
compatibility: "Claude Code with Node.js >=20, pnpm, TypeScript 5.5+"
---

# TypeScript Code Quality Patterns

## Overview

Project-specific code quality checklist for the Saleor Configurator codebase. Covers type safety conventions, error handling patterns, and architectural standards unique to this project.

## When to Use

- Adding entity types, services, repositories, comparators, formatters
- Implementing deployment stages or bootstrap methods
- Creating Zod schemas or error classes
- Reviewing code before commit or PR merge

## Quick Reference

| Convention | Rule |
|-----------|------|
| No `any` | Production code only; allowed in test mocks |
| Branded types | Use `EntitySlug`, `EntityName` for domain values |
| Error classes | Extend `BaseError` with error code |
| GraphQL errors | Wrap with `GraphQLError.fromCombinedError()` |
| Zod errors | Wrap with `ZodValidationError.fromZodError()` |
| Functions | 10-50 lines ideal, ~100 max |
| Style | Functional (`map`/`filter`/`flatMap`) over loops |

## Quality Checklist

### Type Safety

- [ ] No `any` types in production code
- [ ] No unsafe assertions (`as unknown as T`)
- [ ] No non-null assertions (`!`) without justification
- [ ] Branded types for domain values (`EntitySlug`, `EntityName`)
- [ ] Discriminated unions over inheritance
- [ ] `satisfies` for type validation with literal preservation
- [ ] `readonly` for immutable data

### Clean Code

- [ ] Single responsibility per function
- [ ] Functions under 50 lines (ideally)
- [ ] Meaningful, declarative names
- [ ] Boolean names use `is`/`has`/`should`/`can` prefix
- [ ] Named constants instead of magic numbers
- [ ] Registry/strategy pattern for long conditional chains
- [ ] Arrow functions for consistency

### Functional Patterns

- [ ] No direct mutation of arrays/objects
- [ ] `map`/`filter`/`flatMap` over `for`/`forEach` loops
- [ ] No accumulating spreads in `reduce` (use `Map`)

### Error Handling

- [ ] Custom errors extend `BaseError` with error code
- [ ] GraphQL errors: `GraphQLError.fromCombinedError()`
- [ ] Zod errors: `ZodValidationError.fromZodError()`
- [ ] Error messages are actionable with recovery suggestions
- [ ] Error includes relevant context

## Review Output Format

Structure findings as:

### Critical Issues
Items that must be fixed before merge.

### Important Improvements
Items that should be addressed but are not blocking.

### Suggestions
Nice-to-have improvements for future consideration.

### Positive Observations
Well-implemented patterns worth highlighting.

## Project-Specific Conventions

- **Entity identification**: Slug-based (categories, products) vs Name-based (productTypes, pageTypes)
- **Service pattern**: Constructor DI with validator, repository, logger
- **Repository pattern**: GraphQL operations encapsulated, responses mapped to domain models
- **Test pattern**: `vi.fn()` mocks with schema-generated test data
- **Zod-first**: Define schemas before implementing logic; use `z.infer<>` for types

## Common Mistakes

| Mistake | Fix |
|---------|-----|
| Using `any` in production code | Use `unknown` + type guards |
| Exposing GraphQL types to services | Map to domain types in repository |
| Missing error context in GraphQL calls | Include operation name in error |
| Long `if-else` chains | Refactor to registry/strategy pattern |
| Accumulating spreads in `reduce` | Use `Map` or `Object.fromEntries` |
| Mutation in loops (`push`) | Use `map`/`filter`/`flatMap` |

## References

### Skill Reference Files
- **[Anti-Patterns](references/anti-patterns.md)** - Code examples of common anti-patterns with corrections
- **[Type Safety Examples](references/type-safety-examples.md)** - Branded types, type guards, discriminated unions

### Project Resources
- `docs/CODE_QUALITY.md` - Complete coding standards
- `docs/ARCHITECTURE.md` - Service patterns
- `biome.json` - Linting rules

## Related Skills

- **Complete entity workflow**: See `adding-entity-types` for architectural patterns
- **Zod standards**: See `designing-zod-schemas` for schema review criteria
- **Pre-commit checks**: See `validating-pre-commit` for quality gate commands

## Quick Reference Rule

For a condensed quick reference, see `.claude/rules/code-quality.md` (automatically loaded when editing `src/**/*.ts` files).
Files in this package (3)
  • SKILL.md 5 KB
  • references/anti-patterns.md 5 KB
  • references/type-safety-examples.md 7 KB

Versions

The database has no other skills named reviewing-typescript-code.

Database snapshot: 13.11.2026 · package version aff2369423b8 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100typescript-best-practices
    TypeScript coding guidelines with dos and don'ts for type design and patterns. Use when writing, reviewing, or refactoring TypeScript code in projects with tsconfig.json or .ts/.tsx files. Trigger when the user asks to "review TypeScript code", "check my TS code", "write…
  • 90code-review
    Use when reviewing AI-generated code for architectural quality, design patterns, and engineering practices
  • 100typescript
    This skill should be used when writing or reviewing TypeScript or TSX code, or when the project uses "TypeScript", "React", "tsx", "SWR", "Vite", "Next.js", or TypeScript type patterns. Provides TypeScript coding conventions, React patterns, and best practices. Project-specific…
  • 100typescript-security
    TypeScript and JavaScript application security across frontend and backend code. USE WHEN: securing TypeScript/JavaScript applications, reviewing frontend/backend code for vulnerabilities DO NOT USE FOR: code quality issues (use `typescript-quality`), general TypeScript patterns, styling
  • 91typescript-best-practices
    This skill should be used when writing, reading, or reviewing TypeScript code and choosing type safety or validation patterns.
  • 100typescript-patterns
    TypeScript type system patterns, generics, utility types, and strict mode best practices. Use when writing or reviewing TypeScript code.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.