AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified MIT Self-run

Ag Referencia Typescript

skill-andregusman-raiz-a-gusman-claude-ag-referencia-typescript · by andregusman-raiz

Patterns TypeScript strict mode, generics, utility types, e error handling

No reviews yet
0 installs
20 views
0.0% view→install

Install

$ agentstack add skill-andregusman-raiz-a-gusman-claude-ag-referencia-typescript

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-andregusman-raiz-a-gusman-claude-ag-referencia-typescript)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
1mo ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Ag Referencia Typescript? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Skill: TypeScript Patterns

Referencia de patterns para TypeScript em modo strict.

Quando Ativar

  • Definindo tipos complexos
  • Usando generics
  • Implementando error handling tipado
  • Trabalhando com Zod e inferencia

Strict Mode (tsconfig recomendado)

{
  "compilerOptions": {
    "target": "ES2022",
    "module": "ESNext",
    "moduleResolution": "bundler",
    "strict": true,
    "noUncheckedIndexedAccess": true,
    "noImplicitReturns": true,
    "forceConsistentCasingInFileNames": true,
    "skipLibCheck": true
  }
}

Utility Types

type UpdateUser = Partial;
type RequiredUser = Required;
type UserPreview = Pick;
type PublicUser = Omit;
type RolePermissions = Record;
type Config = Readonly;
type ServiceResult = ReturnType;
type Users = Awaited>;

Generics

function first(arr: T[]): T | undefined {
  return arr[0];
}

function getProperty(obj: T, key: K): T[K] {
  return obj[key];
}

interface ApiResponse {
  data: T;
  error: string | null;
  status: number;
}

interface Repository {
  findById(id: string): Promise;
  findAll(): Promise;
  create(input: CreateInput): Promise;
  update(id: string, input: UpdateInput): Promise;
  delete(id: string): Promise;
}

Discriminated Unions

type Result =
  | { success: true; data: T }
  | { success: false; error: E };

function divide(a: number, b: number): Result {
  if (b === 0) return { success: false, error: 'Divisao por zero' };
  return { success: true, data: a / b };
}

const result = divide(10, 2);
if (result.success) {
  console.log(result.data); // TypeScript sabe que e number
}

Zod + TypeScript

import { z } from 'zod';

const userSchema = z.object({
  id: z.string().uuid(),
  email: z.string().email(),
  name: z.string().min(1),
  role: z.enum(['admin', 'user', 'guest']),
});

type User = z.infer;

// Validacao segura
const result = userSchema.safeParse(rawData);
if (result.success) {
  const user = result.data; // Tipado corretamente
}

Error Handling

class AppError extends Error {
  constructor(
    message: string,
    public code: string,
    public statusCode: number = 500,
  ) {
    super(message);
    this.name = 'AppError';
  }
}

class NotFoundError extends AppError {
  constructor(resource: string, id: string) {
    super(`${resource} com id ${id} nao encontrado`, 'NOT_FOUND', 404);
  }
}

class ValidationError extends AppError {
  constructor(details: z.ZodError) {
    super('Dados invalidos', 'VALIDATION_ERROR', 400);
  }
}

Type Guards

function isUser(obj: unknown): obj is User {
  return typeof obj === 'object' && obj !== null && 'id' in obj && 'email' in obj;
}

function assertDefined(val: T | null | undefined, name: string): asserts val is T {
  if (val == null) throw new AppError(`${name} e obrigatorio`, 'ASSERTION_FAILED');
}

Async Patterns

// Promise.allSettled para operacoes independentes
const results = await Promise.allSettled([fetchUsers(), fetchPosts()]);
const users = results[0].status === 'fulfilled' ? results[0].value : [];

// Retry com backoff
async function withRetry(fn: () => Promise, maxRetries = 3, delay = 1000): Promise {
  for (let attempt = 0; attempt  setTimeout(r, delay * Math.pow(2, attempt)));
    }
  }
  throw new Error('Unreachable');
}

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.