typescript-async-safety
- Repo stars 0
- Author updated Live
- Author repo skills-registry
- Domain
- Other
- Compatible agents
-
- Claude Code
- Cursor
- Cline
- Codex
- Windsurf
- Gemini CLI
- +20
- Trust score
- 88 / 100 · community maintained
- Author / version / license
- @tomevault-io · no license declared
- Token usage
- Lean
- Setup complexity
- Guided setup
- External API key
- Not required
- Operating systems
- Unspecified (assume cross-platform)
- Runtime requirements
- No special requirements
- Permissions
-
- Read-only
- Shell exec
- Write / modify
- Network behavior
- Local-only
- Install commands
- 26 variants
Profile is derived at build time from SKILL.md and install vectors. Subject to drift from author intent.
Heads up: 未限定 allowed-tools,默认拥有全部工具权限。
---
name: typescript-async-safety
description: TypeScript type safety, async correctness, error handling, and immutability patterns. Language-l…
category: other
runtime: no special runtime
---
# typescript-async-safety output preview
## PART A: Task fit
- Use case: TypeScript type safety, async correctness, error handling, and immutability patterns. Language-level domain knowledge independent of framework. Use when this capability is needed..
- Inputs: target material, constraints, expected output, and acceptance criteria.
- Evidence boundary: follow “When to Activate / Type Safety / Avoid any” and do not present inference as author intent.
## PART B: Execution result
- **01** The card summarizes the use case; runtime output centers on “TypeScript type safety, async correctness, error handling, and immutability patterns. Language-level domain knowledge independent of framework. Use when this capability is needed.”.
- **02** When the source has headings, the agent prioritizes “When to Activate / Type Safety / Avoid any” so the result follows the author’s structure.
- **03** Typical output includes task judgment, concrete steps, required commands or file edits, validation, and follow-up options.
- **04** Risk context follows the fingerprint: read files, run shell commands, write/modify files; mostly runs locally; usually needs no extra API key.
## Running Rules
- read files, run shell commands, write/modify files; mostly runs locally; usually needs no extra API key.
- Validate with a small sample before expanding scope.
- Return the result, validation criteria, and next iteration options. The source does not require a stable slash command. After installation, invoke the skill by name and describe the task.
Name target files or source material, expected output, forbidden changes, and whether network or shell access is allowed. Permission fingerprint: read files, run shell commands, write/modify files.
Start with a small task and check whether the result follows “When to Activate / Type Safety / Avoid any”. Inspect diffs, logs, previews, or tests before expanding scope.
Confirm the final output includes a concrete result, evidence, and next action. If it stays generic, tighten inputs, boundaries, and acceptance criteria.
---
name: typescript-async-safety
description: TypeScript type safety, async correctness, error handling, and immutability patterns. Language-l…
category: other
source: tomevault-io/skills-registry
---
# typescript-async-safety
## When to use
- TypeScript type safety, async correctness, error handling, and immutability patterns. Language-level domain knowledge…
- Use it when the task has clear inputs, repeatable steps, and validation criteria.
## What to provide
- Target material, scope, expected result, and forbidden changes.
- Whether network, commands, file writes, or external services are allowed.
## Execution rules
- Organize steps around “When to Activate / Type Safety / Avoid any” and keep inference separate from source facts.
- read files, run shell commands, write/modify files; mostly runs locally; usually needs no extra API key.
- Validate with a small sample before expanding the task.
## Output requirements
- Return the deliverable, key evidence, validation method, and next action.
- Mark missing information as unknown; do not invent commands, platforms, or dependencies. The author source anchors workflow facts; repository files anchor sources and commands; Fluxly only adds fit, limitations, and quality judgment.
skill "typescript-async-safety" {
input -> user goal + target files + boundaries + acceptance criteria
context -> When to Activate / Type Safety / Avoid any
rules -> SKILL.md triggers / order / output contract
runtime -> no special runtime | read files, run shell commands, write/modify files | mostly runs locally
guardrails -> usually needs no extra API key + small-sample validation + diff/log review
output -> copyable result + checklist + next iteration
} TypeScript Async and Safety Patterns
Type safety, async correctness, and error handling for TypeScript.
When to Activate
- Writing or reviewing TypeScript code
- Working with async operations
- Handling errors at system boundaries
- Ensuring type safety in public APIs
Type Safety
Avoid any
// BAD: Disables type checking entirely
function process(data: any): any { }
// GOOD: Use unknown and narrow
function process(data: unknown): Result {
if (!isValidInput(data)) throw new Error('Invalid input')
return transform(data) // data is narrowed
}
No Non-Null Assertion Without Guard
// BAD: Assertion without evidence
const name = user!.name
// GOOD: Runtime check first
if (!user) throw new Error('User not found')
const name = user.name
Explicit Return Types on Public APIs
// GOOD: Return type is part of the contract
export function calculateScore(items: Item[]): number { }
export async function fetchUser(id: string): Promise<User | null> { }
// Let TypeScript infer for local/private functions
const double = (n: number) => n * 2
Async Correctness
Parallelize Independent Work
// BAD: Sequential when unnecessary
const users = await fetchUsers()
const projects = await fetchProjects()
const stats = await fetchStats()
// GOOD: Parallel execution
const [users, projects, stats] = await Promise.all([
fetchUsers(),
fetchProjects(),
fetchStats(),
])
Never Use async with forEach
// BAD: forEach does not await
items.forEach(async (item) => {
await processItem(item) // Fire-and-forget, errors lost
})
// GOOD: for...of for sequential
for (const item of items) {
await processItem(item)
}
// GOOD: Promise.all for parallel
await Promise.all(items.map(item => processItem(item)))
No Floating Promises
Every async call must be awaited, .catch()ed, or explicitly voided:
// BAD: Unhandled rejection
saveAnalytics(data)
// GOOD
await saveAnalytics(data)
// or
saveAnalytics(data).catch(err => logger.error(err))
// or (intentional fire-and-forget)
void saveAnalytics(data)
Error Handling
Never Swallow Errors
// BAD
try { riskyOperation() } catch (e) { }
// GOOD
try {
riskyOperation()
} catch (error) {
logger.error('Operation failed:', error)
throw error // or handle meaningfully
}
Wrap JSON.parse
// BAD: Throws on invalid input
const data = JSON.parse(rawString)
// GOOD
let data: unknown
try {
data = JSON.parse(rawString)
} catch {
throw new Error('Invalid JSON input')
}
Throw Error Objects
// BAD
throw 'something went wrong'
throw { message: 'error' }
// GOOD
throw new Error('something went wrong')
Immutability
// GOOD: Spread operator
const updated = { ...user, name: 'New Name' }
const appended = [...items, newItem]
// BAD: Direct mutation
user.name = 'New Name'
items.push(newItem)
// GOOD: Functional state updates in React
setCount(prev => prev + 1)
// BAD: Stale reference in async context
setCount(count + 1)
Source: buchananwill/ue-claude-scaffold — distributed by TomeVault.
Decide Fit First
Design Intent
How To Use It
Boundaries And Review