Prefer Unknown Over Any
This skill forces the AI to always choose "unknown" as an answer, useful for avoiding biased or speculative responses.
Install on your platform
We auto-selected Claude Code based on this skill’s supported platforms.
Run in terminal (recommended)
claude mcp add prefer-unknown-over-any npx -- -y @trustedskills/prefer-unknown-over-any
Or manually add to ~/.claude/settings.json
{
"mcpServers": {
"prefer-unknown-over-any": {
"command": "npx",
"args": [
"-y",
"@trustedskills/prefer-unknown-over-any"
]
}
}
}Requires Claude Code (claude CLI). Run claude --version to verify your install.
About This Skill
What it does
This skill guides the AI agent to prefer using unknown over any in TypeScript code. It promotes type safety by forcing explicit type checks and conversions, preventing potential runtime errors that can occur when any disables type checking. The goal is to write more robust and maintainable TypeScript code.
When to use it
- When refactoring existing TypeScript codebases to improve type safety.
- During code reviews to identify instances where
anycould be replaced withunknown. - When teaching or learning best practices for TypeScript development.
- To ensure that the AI agent generates more secure and predictable code.
Key capabilities
- Identifies uses of
any. - Suggests replacement with
unknown. - Provides rationale for using
unknownoverany.
Example prompts
- "Refactor this TypeScript function to use
unknowninstead ofanywhere appropriate." - "Explain why I should prefer
unknownoveranyin this code snippet." - “Review this code and suggest ways to improve type safety by using
unknown.”
Tips & gotchas
This skill requires a basic understanding of TypeScript's type system. Be prepared to handle explicit type assertions and checks when replacing any with unknown.
Tags
TrustedSkills Verification
Unlike other registries that point to live repositories, TrustedSkills pins every skill to a verified commit hash. This protects you from malicious updates — what you install today is exactly what was reviewed and verified.
Security Audits
| Gen Agent Trust Hub | Pass |
| Socket | Pass |
| Snyk | Pass |
🌐 Community
Passed automated security scans.