AI Skill Report Card

Generating TypeScript Definitions

B+78·May 6, 2026·Source: Web
15 / 15
TypeScript
/* eslint-disable */ declare namespace Namespace.Module.Entity { interface Entity { id: number; field: string; created_at: string; updated_at: string; } type CreateEntityParams = Pick<Entity, 'field'>; type UpdateEntityParams = Partial<Pick<Entity, 'field'>>; type EntityQueryStringParams = { page: number; page_size: number; } & Partial<{ search: string; order_by: string; field: string; id: number | number[]; }>; }
Recommendation
Remove the progress checklist from workflow - it's redundant and adds clutter
13 / 15

Progress:

  • Collect namespace information
  • Get interface name and fields
  • Analyze model for nullable fields
  • Generate create/update types
  • Create query string parameters
  • Format final output

Step 1: Gather Information Ask user for:

  • Namespace (e.g., "Planejamento.Cadastro.Area")
  • Interface name (e.g., "Area")
  • Serializer code or field list
  • Model code (for nullable field detection)
  • Filter configuration (for query params)

Step 2: Parse Serializer Fields From DRF serializer fields tuple, map to TypeScript types:

  • idnumber
  • String fields → string
  • Boolean fields → boolean
  • DateTime fields → string
  • ForeignKey fields → number
  • Related labels (field__label) → string

Step 3: Detect Nullable Fields From model definition:

  • Fields with null=True → add ? optional modifier
  • Fields with blank=True → add ? optional modifier
  • read_only_fields → add ? optional modifier

Step 4: Generate CRUD Types

TypeScript
type CreateEntityParams = Pick<Entity, 'writable_field1' | 'writable_field2'>; type UpdateEntityParams = Partial<Pick<Entity, 'writable_field1' | 'writable_field2'>>;

Exclude read_only_fields from create/update types.

Step 5: Build Query String Type Base structure:

TypeScript
type EntityQueryStringParams = { page: number; page_size: number; } & Partial<{ search: string; order_by: string; // ... filter fields }>;
Recommendation
Consolidate the field mapping information scattered across steps into a single reference table
18 / 20

Example 1: Basic Entity Input:

Python
class CargoSerializer(serializers.ModelSerializer): class Meta: model = Cargo fields = ("id", "nome", "codigo", "created_at", "updated_at") read_only_fields = ("id", "created_at", "updated_at")

Output:

TypeScript
/* eslint-disable */ declare namespace System.Module.Cargo { interface Cargo { id: number; nome: string; codigo: string; created_at: string; updated_at: string; } type CreateCargoParams = Pick<Cargo, 'nome' | 'codigo'>; type UpdateCargoParams = Partial<Pick<Cargo, 'nome' | 'codigo'>>; }

Example 2: With Nullable Fields and Relations Input:

Python
# Model class ReceitaCanalFlash(models.Model): canal = models.ForeignKey(Canal, null=True, blank=True) codigo = models.CharField(max_length=10) # Serializer class CanalFlashSerializer(serializers.ModelSerializer): canal__label = serializers.CharField(source="canal.nome", read_only=True) class Meta: fields = ("id", "canal", "codigo", "canal__label", "created_at") read_only_fields = ("id", "canal__label", "created_at")

Output:

TypeScript
interface CanalFlash { id: number; canal?: number; canal__label?: string; codigo: string; created_at: string; } type CreateCanalFlashParams = Pick<CanalFlash, 'codigo' | 'canal'>; type UpdateCanalFlashParams = Partial<Pick<CanalFlash, 'codigo' | 'canal'>>;

Example 3: With Filters Input:

Python
class CanalFlashFilter(DefaultFilter): search_fields = ["codigo", "descricao"] codigo = filters.CharFilter(lookup_expr="icontains") canal = filters.NumberFilter(method="filter_canal")

Output:

TypeScript
type CanalFlashQueryStringParams = { page: number; page_size: number; } & Partial<{ search: string; order_by: string; codigo: string; canal: number | number[]; id: number | number[]; }>;
Recommendation
Add a complete end-to-end example showing the full input (model + serializer + filter) and complete output
  • Always start with /* eslint-disable */
  • Use namespace structure: Module.SubModule.Entity
  • Make ForeignKey fields optional if null=True in model
  • Include __label fields for related data
  • Map array filters to number | number[] or string | string[]
  • Always include id, page, page_size, search, order_by in query params
  • Don't forget optional modifiers (?) for nullable model fields
  • Don't include read_only_fields in create/update types
  • Don't map Django field types incorrectly (DateTimeField → string, not Date)
  • Don't miss array filter syntax for getlist() methods
  • Don't forget to ask for complete filter configuration
0
Grade B+AI Skill Framework
Scorecard
Criteria Breakdown
Quick Start
15/15
Workflow
13/15
Examples
18/20
Completeness
15/20
Format
15/15
Conciseness
12/15