All authors

Claude Skills by HoangNguyen0403
github.com/HoangNguyen04031,435 skills147 installs5,833 views
- Swift TestingMark an XCTest method `async throws` and call the asynchronous API with `try await` directly: ```swift final class APIClientTests: XCTestCase { func testFetchUser() async throws { let client = APIClient(transport: StubTransport()) let user = try await client.fetchUser() XCTAssertEqual(user.id, 42) } } ``` Use structured async APIs rather than `Thread.sleep`. If the code is callback-based, bridge or test it with an `XCTestExpectation` and a reasonable timeout.Votes: 0GitHub stars: 584
- Swift TestingCreate an expectation before starting callback-based work, fulfill it in the completion handler, then wait with a finite timeout: ```swift func testCompletionIsCalled() { let expectation = expectation(description: "completion called") client.fetch { result in XCTAssertEqual(try? result.get().id, 42) expectation.fulfill() } wait(for: [expectation], timeout: 2.0) } ``` Use `async throws` tests with `try await` for async APIs instead of blocking. Every expectation needs a reasonable timeout so a...Votes: 0GitHub stars: 584
- Swift TestingDepend on a protocol and inject a stub or mock through the initializer: ```swift protocol UserStore { func user() throws -> User } final class StubUserStore: UserStore { let value: User init(value: User) { self.value = value } func user() throws -> User { value } } final class ProfileViewModel { private let store: UserStore init(store: UserStore) { self.store = store } } ``` Tests can now supply deterministic success and failure stores without networking or global state. Keep mocks focused on...Votes: 0GitHub stars: 584
- Swift ToolingFor a Swift package, add the dependency in `Package.swift` and declare it on the target that imports it: ```swift let package = Package( name: "MyApp", products: [.library(name: "MyApp", targets: ["MyApp"])], dependencies: [ .package(url: "https://github.com/example/Logging.git", from: "1.2.0") ], targets: [ .target( name: "MyApp", dependencies: [.product(name: "Logging", package: "Logging")] ) ] ) ``` Use semantic version requirements, keep products and targets explicit, and run `swift packa...Votes: 0GitHub stars: 584
- Swift ToolingAdd a `.swiftlint.yml` file at the project root and configure the rules intentionally: ```yaml disabled_rules: - line_length opt_in_rules: - empty_count ``` Run SwiftLint locally and in CI, and treat compiler warnings as errors in CI. Prefer fixing the underlying violation over scattering `// swiftlint:disable` comments. Keep configuration versioned with the project so every developer and build uses the same quality rules.Votes: 0GitHub stars: 584
- Swift ToolingWrap development-only code in `#if DEBUG` and close it with `#endif`: ```swift let endpoint: URL guard let debugEndpoint = URL(string: "http://localhost:8080") else { fatalError("Invalid debug endpoint") } endpoint = debugEndpoint guard let productionEndpoint = URL(string: "https://api.example.com") else { fatalError("Invalid production endpoint") } endpoint = productionEndpoint ``` Use build configurations or `.xcconfig` files for environment-specific values rather than hardcoding secrets. K...Votes: 0GitHub stars: 584
- Swift ToolingWrite public API documentation with triple-slash comments so DocC can use it: ```swift /// Loads a user from the configured service. /// /// - Returns: The decoded user. /// - Throws: `NetworkError` when the request or response is invalid. public func loadUser() async throws -> User { ... } ``` Use clear summaries, parameter and return descriptions, and typed `- Throws:` documentation. DocC-compatible comments belong on public declarations, and the generated documentation should be built as p...Votes: 0GitHub stars: 584
- Typescript Best PracticesUse ES modules and named exports consistently. Replace each `require()` with a static import, use `import type` for type-only dependencies, and give exported functions explicit return types: ```ts // user-service.ts import type { UserRepository } from "./user-repository.js"; export interface User { readonly id: string; } export function getUser(repository: UserRepository, id: string): User { return repository.getById(id); } ``` ```ts // consumer.ts import { getUser } from "./user-service.js";...Votes: 0GitHub stars: 584
- Typescript Best PracticesUse a top-level async function with an explicit return type and `Promise.all()` so independent requests run concurrently. Check HTTP failures and narrow caught errors as `unknown`: ```ts interface User { readonly id: string; } interface Report { readonly total: number; } async function fetchJson<T>(url: string): Promise<T> { const response = await fetch(url); if (!response.ok) { throw new Error(`Request failed: ${response.status} ${url}`); } return (await response.json()) as T; } export async...Votes: 0GitHub stars: 584
- Typescript Best PracticesPrefer composition and constructor injection when the base class is becoming large. Split each capability behind a small interface and make collaborators explicit: ```ts export interface UserRepository { findById(id: string): Promise<User | null>; } export interface AuditLogger { record(event: string): Promise<void>; } export interface User { readonly id: string; } export class UserService { public constructor( private readonly repository: UserRepository, private readonly auditLogger: AuditLo...Votes: 0GitHub stars: 584
- Typescript LanguagePrefer a literal union or a const object for application roles instead of a runtime `enum`. This keeps the allowed values available to TypeScript without emitting enum JavaScript: ```ts export const USER_ROLES = ["admin", "editor", "viewer"] as const; export type UserRole = (typeof USER_ROLES)[number]; export interface User { readonly role: UserRole; } export function canManageUsers(role: UserRole): boolean { return role === "admin"; } ``` If roles arrive from a request or database, validate ...Votes: 0GitHub stars: 584
- Typescript LanguageModel the event catalog as a map from event names to payloads, then derive both the event name and payload types from that map. A discriminant or distinct key prevents mismatched payloads: ```ts type EventMap = { userCreated: { readonly userId: string }; invoicePaid: { readonly invoiceId: string; readonly amountCents: number }; }; type EventName = keyof EventMap; type Listener<K extends EventName> = (payload: EventMap[K]) => void; export class EventBus { private readonly listeners: { [K in Ev...Votes: 0GitHub stars: 584
- Typescript LanguageUse a branded type so a validated ID is not interchangeable with an arbitrary string: ```ts export type UserId = string & { readonly __brand: "UserId" }; export function parseUserId(value: string): UserId { if (!/^usr_[a-zA-Z0-9]+$/.test(value)) { throw new Error("Invalid user ID"); } return value as UserId; } export function loadUser(id: UserId): Promise<User> { return repository.findById(id); } ``` Only the parser (or a schema validator at the input boundary) should create the brand. The `l...Votes: 0GitHub stars: 584
- Typescript SecurityValidate the request at the Express boundary with a Zod schema and return structured errors before using the data: ```ts import { z } from "zod"; import type { RequestHandler } from "express"; const registrationSchema = z.object({ email: z.string().email(), password: z.string().min(12).max(128), }); type RegistrationInput = z.infer<typeof registrationSchema>; export const register: RequestHandler = async (req, res, next) => { const result = registrationSchema.safeParse(req.body); if (!result....Votes: 0GitHub stars: 584
- Typescript SecurityStore the JWT signing secret outside source control: use the deployment platform's secret manager in production, and an uncommitted `.env` file supplied through the environment for local development. Never put it in frontend code, a checked-in config file, or a JWT payload. ```ts const jwtSecret = process.env.JWT_SECRET; if (!jwtSecret) { throw new Error("JWT_SECRET is not configured"); } ``` Load it once during startup, restrict access to the service, rotate it through the secret manager, an...Votes: 0GitHub stars: 584
- Typescript SecurityString concatenation with user input is SQL injection-prone. Validate the input at the request boundary and pass values separately through a parameterized query or a type-safe ORM: ```ts const query = z.object({ email: z.string().email() }); const parsed = query.safeParse(req.query); if (!parsed.success) { res.status(400).json({ error: "invalid_request" }); return; } const result = await pool.query<UserRow>( "SELECT id, email FROM users WHERE email = $1", [parsed.data.email], ); ``` Do not in...Votes: 0GitHub stars: 584
- Typescript SecurityThe original `execSync` call is vulnerable because an environment value is interpolated into a shell command. Treat the value as untrusted, validate it against the refs permitted by CI, and use `execFileSync` with an argument array and no shell: ```ts import { execFileSync } from "node:child_process"; const baseRef = process.env.GITHUB_BASE_REF; if (!baseRef || !/^[A-Za-z0-9._/-]+$/.test(baseRef) || baseRef.includes("..")) { throw new Error("Invalid GITHUB_BASE_REF"); } const output = execFil...Votes: 0GitHub stars: 584
- Typescript SecurityDo not fetch `process.env.API_URL` until it has been parsed and checked against an explicit allow-list. Environment configuration is not automatically trusted, and unrestricted URLs create an SSRF risk: ```ts const rawApiUrl = process.env.API_URL; if (!rawApiUrl) { throw new Error("API_URL is required"); } const apiUrl = new URL(rawApiUrl); const allowedOrigins = new Set(["https://api.example.com"]); if (apiUrl.protocol !== "https:" || !allowedOrigins.has(apiUrl.origin)) { throw new Error("AP...Votes: 0GitHub stars: 584
- Typescript ToolingFor a new project, enable strict checking and the additional options that catch unsafe indexing, optional-property mistakes, unused code, and module inconsistencies: ```json { "compilerOptions": { "target": "ES2022", "module": "NodeNext", "moduleResolution": "NodeNext", "strict": true, "noUncheckedIndexedAccess": true, "exactOptionalPropertyTypes": true, "noImplicitOverride": true, "noPropertyAccessFromIndexSignature": true, "noUnusedLocals": true, "noUnusedParameters": true, "forceConsistent...Votes: 0GitHub stars: 584
- Typescript ToolingUse ESLint with the TypeScript parser and recommended type-aware rules, and keep compiler checking as a separate CI step. With flat config: ```js // eslint.config.mjs import eslint from "@eslint/js"; import tseslint from "typescript-eslint"; export default tseslint.config( eslint.configs.recommended, ...tseslint.configs.recommendedTypeChecked, { files: ["**/*.ts", "**/*.tsx"], languageOptions: { parserOptions: { projectService: true, tsconfigRootDir: import.meta.dirname, }, }, rules: { "@type...Votes: 0GitHub stars: 584
- Typescript ToolingDo not use `@ts-ignore`: it hides an error unconditionally and does not fail when the underlying error disappears. First inspect the diagnostic and fix the type, narrowing, generic constraint, or API declaration causing it. For example: ```ts function formatId(value: string | undefined): string { if (value === undefined) { throw new Error("id is required"); } return value; } ``` If a genuine, unavoidable third-party typing defect remains, use `@ts-expect-error` on the smallest line with a com...Votes: 0GitHub stars: 584
- Database HanaApply SAP HANA database standards for SQL parameterization, in-memory engine optimization, dynamic IN query chunking, column aliasing on joins, and datatype casting. Use when writing SQL for SAP HANA, optimizing HANA queries, or diagnosing HANA driver errors.Votes: 0GitHub stars: 584
- Database MigrationsPlan additive, zero-downtime schema migrations with rollout, backfill, and rollback awareness. Use when renaming columns, backfilling data, or shipping risky database changes.Votes: 0GitHub stars: 584
- Database Query PerformanceDiagnose database latency with explain plans, index ownership, and query amplification review. Use when a query is slow, an index is missing, or scans, loops, and N+1 patterns appear.Votes: 0GitHub stars: 584
- Database Schema DesignDesign relational or document schemas from access patterns, cardinality, and lifecycle. Use when modeling entities, choosing embed vs normalize, or shaping schema boundaries before implementation.Votes: 0GitHub stars: 584
- Database TransactionsDefine transaction boundaries, locking, and consistency guarantees for multi-step writes. Use when designing atomic operations, retries, idempotency, or concurrent write behavior.Votes: 0GitHub stars: 584
- Flutter NavigationImplement route configuration, go_router/deep linking, and named routes in Flutter. Use for route declarations, route guards, and URL-to-screen mapping; defer transition-only animation, state-transfer/BLoC questions, auto_route-specific setup, and generic app-bar controls.Votes: 0GitHub stars: 584
- Python ArchitectureStructure Python backends with explicit dependency direction, ports/adapters, and runtime boundaries. Use when shaping project layout, clean architecture, service boundaries, dependency injection, report rendering boundaries, or transport separation in Python.Votes: 0GitHub stars: 584
- Python Async RuntimeWrite correct async Python runtime code with explicit blocking-I/O boundaries, cancellation, and timeout handling. Use when editing `asyncio` workflows, background loops, async services, or mixed sync/async integrations.Votes: 0GitHub stars: 584
- Python Best PracticesWrite maintainable Python with small functions, explicit boundaries, guard clauses, and readable state flow. Use when refactoring Python services, helpers, modules, or async logic for clarity—not generic test writing, tooling setup, or database transaction implementation.Votes: 0GitHub stars: 584
- Python DatabaseImplement Python database access with parameterized SQL, transaction scope, connection helpers, and repository seams. Use when editing Postgres queries, repositories, transactions, pooling, or persistence boundaries in Python.Votes: 0GitHub stars: 584
- Python Error HandlingDesign Python error paths with narrow exceptions, rollback, contextual logs, and preserved blocker truth. Use when handling retries, verifier outcomes, parser failures, or exception flow in Python services.Votes: 0GitHub stars: 584
- Python LanguageCore Python 3.11+ language standards for typing, dataclasses, imports, pathlib, and stdlib-first code. Use for idiomatic language constructs in Python modules or stubs; defer pytest fixtures, database/client configuration, subprocess security, and other specialized concerns.Votes: 0GitHub stars: 584
- Python SecuritySecure Python services against secret leakage, injection, unsafe subprocess calls, and dependency drift. Use when handling env vars, tokens, SQL, file paths, shell commands, auth flows, or Python security gates.Votes: 0GitHub stars: 584
- Python TestingTest Python services with pytest, async coverage, monkeypatch, and boundary-focused fakes. Use when writing Python tests, fixtures, async tests, regression tests, or dependency-isolated verification.Votes: 0GitHub stars: 584
- Python ToolingConfigure Python tooling, dependency surfaces, static analysis, and verification gates. Use when editing `pyproject.toml`, `requirements.txt`, `pytest.ini`, `ruff`, `pyright`, CI, or Python release checks.Votes: 0GitHub stars: 584
- Specialist System ArchitectRuns one bounded deep dive on a single risky component of a system design and returns a justified recommendation (with options only where genuinely considered), failure modes, and verification hooks. Use during a design session when a component needs expert depth beyond the main thread's budget.Votes: 0GitHub stars: 584
- Common Task Complexity RoutingScores a task on Spread, Novelty, Centrality (0-6), routes the tier to autonomy, verification, review and model tier, and gives provider-neutral capability/effort guidance that preserves configured profiles. Use for sizing, model routing, LLM model selection, thinking level or model tier.Votes: 0GitHub stars: 584
- Quality Engineering Automation HealthMeasures whether an automation suite builds release confidence via feedback-loop length, suite reliability, release cadence, and production escape rate, and emits a release_confidence verdict. Use when judging suite value, ROI, or pre-release trust; not for writing or healing tests.Votes: 0GitHub stars: 584
- Quality Engineering Flaky TriageQuarantines an intermittently failing test behind a ticket with an owner and expiry, assigns a root-cause bucket from isolated reruns, and defines when the test leaves quarantine. Use when a test is a QUARANTINE_CANDIDATE or fails without a code change; not for deterministic failures.Votes: 0GitHub stars: 584
- Quality Engineering Playwright Pom GenerationGenerates Playwright page objects from an executable test plan, one class per screen with ladder-compliant locators and no assertions, wired into a shared fixture. Use when a web scenario needs a page object that does not exist yet, or when locators drift and the page object must be rebuilt.Votes: 0GitHub stars: 584
- Quality Engineering Selector StabilityCross-stack selector and test-id policy for web and mobile automation. Use when writing or reviewing E2E/UI test locators, or adding data-testid/accessibility identifiers to components.Votes: 0GitHub stars: 584
- Quality Engineering Test HealingFailure taxonomy and allowed/forbidden repairs for a failing E2E test. Use when a Playwright/Maestro/Detox/XCUITest/Espresso/Appium test fails and you must decide whether to repair the test or route to a real bug.Votes: 0GitHub stars: 584
- Quality Engineering Test Plan AuthoringTurn acceptance criteria into an executable test plan (scenarios, seed, selector gaps) before generating E2E code. Use when ACs exist but no runnable test plan does yet.Votes: 0GitHub stars: 584
- Quality Engineering Visual BaselineCaptures, masks, compares, and updates screenshot baselines for web and mobile suites, with per-region thresholds and a reviewed-diff rule for every baseline change. Use when a screenshot assertion fails, a baseline needs updating, or visual checks are being added; not for deciding what to verify.Votes: 0GitHub stars: 584
- System Design Interview CoachingFacilitate timed system-design interview practice across backend, mobile/client, SDK/library, and full-stack surfaces. Use risk-driven probes, an adverse timeline, mechanism revision, one changed constraint, and the existing six-criterion evidence-based debrief.Votes: 0GitHub stars: 584
- Test LoopPlan, generate, and heal an executable E2E test suite from approved acceptance criteria (web and mobile).Votes: 0GitHub stars: 584
- Specialist Solution DiagrammerDraws one evidence-grounded architecture diagram as an editable draw.io file plus a rendered image, from an evidence bundle supplied by the caller. Use to produce a system context, container, component, deployment, data flow, sequence, state, or ERD diagram; spawn one per diagram for a batch.Votes: 0GitHub stars: 584
- Specialist Test HealerClassifies one failing E2E test from its artifacts, applies at most one allowed repair from the test-healing catalog, proves it with three sequential reruns and an unchanged assertion set, and returns a verdict with a route. Use per failure inside test-loop; never for production code changes.Votes: 0GitHub stars: 584
- Specialist Test PlannerTurns approved AC/SRS into an executable test plan (scenarios, seed, selector gaps) for the test-loop workflow. Use for independent test-plan generation from stable requirements.Votes: 0GitHub stars: 584