Install
$ agentstack add skill-andregusman-raiz-a-gusman-claude-ag-referencia-typescript ✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.
Security review
✓ PassedNo 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.
Verified badge
Passed review? Show it. Paste this badge into your README, it links to the public security report.
Reliability & compatibility
Declared compatibility
Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.
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 →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.
- Author: andregusman-raiz
- Source: andregusman-raiz/a-gusman-claude
- License: MIT
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet, be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.