enforcing-typescript-standards▌
jgeurts/eslint-config-decent · updated Apr 8, 2026
MDX-style export adds YAML metadata + attribution linking explainx.ai and this canonical listing URL.
Enforces the project's core TypeScript standards including explicit typing, import organization, class member ordering, and code safety rules.
Enforcing TypeScript Standards
Enforces the project's core TypeScript standards including explicit typing, import organization, class member ordering, and code safety rules.
Triggers
Activate this skill when the user says or implies any of these:
- "write", "create", "implement", "add", "build" (new TypeScript code)
- "fix", "update", "change", "modify", "refactor" (existing TypeScript code)
- "review", "check", "improve", "clean up" (code quality)
- Any request involving
.tsor.tsxfiles
Specific triggers:
- Creating a new
.tsor.tsxfile - Modifying existing TypeScript code
- Reviewing TypeScript code for compliance
Core Standards
Type Safety
- Explicit return types: Prefer explicit return types when practical; omit when inference is obvious and adds no clarity
- Explicit member accessibility: Class members require
public,private, orprotected - Type-only imports: Use
import typefor types:import type { Foo } from './foo.js' - Sorted type constituents: Union/intersection types must be alphabetically sorted
- Only throw Error objects: Never throw strings or other primitives
- Avoid
anyand type assertions: Prefer proper typing overanyorascasts; use them only when truly necessary - Type JSON fields explicitly: Use
Record<string, unknown>or specific interfaces for JSON data, neverany - Use Number() for conversion: Prefer
Number(value)overparseInt(value, 10)orparseFloat(value) - Reuse existing types: Before defining a new interface, search for existing types that can be reused directly, extended, or derived using
Pick,Omit,Partial, or other utility types
Alternatives to Type Assertions
Before using as, try these approaches in order:
- Proper typing at the source
- Type guards (
typeof,instanceof) - Type narrowing through control flow
- Custom type predicate functions
- Discriminated unions
// Bad
const user = data as User;
// Good
function isUser(data: unknown): data is User {
return typeof data === 'object' && data !== null && 'id' in data;
}
if (isUser(data)) {
// data is now typed as User
}
Import Organization
- Import order: builtin → external → internal → parent → sibling → index (alphabetized within groups)
- No duplicate imports: Consolidate imports from the same module
- Newline after imports: Blank line required after import block
Class Member Ordering
- Signatures (call/construct)
- Fields: private → public → protected
- Constructors: public → protected → private
- Methods: public → protected → private
Code Style
- Simplicity over cleverness: Straightforward, readable code is better than clever one-liners
- Early returns: Use guard clauses to reduce nesting; return early for edge cases
- Nullish coalescing: Prefer
??over||for defaults (avoids false positives on0or'') - Optional chaining: Use
?.for safe property access - Match existing patterns: Follow conventions already established in the codebase
- Meaningful identifiers: Names must be descriptive (exceptions:
_,i,j,k,e,x,y) - Function declarations: Use
function foo()notconst foo = function() - Prefer const: Use
constunless reassignment is needed - No var: Always use
constorlet - Object shorthand: Use
{ foo }not{ foo: foo } - Template literals: Use
`Hello ${name}`not'Hello ' + name - Strict equality: Use
===except for null comparisons - One class per file: Maximum one class definition per file
- Avoid
reduce: Preferfor...ofloops or other array methods for clarity - Functions over classes: Prefer exported functions over classes with static methods (unless state is needed)
- No nested functions: Define helper functions at module level, not inside other functions
- Immutability: Create new objects/arrays instead of mutating existing ones
Naming Conventions
- Enum members: Use
PascalCase(e.g.,MyValue) - No trailing underscores: Identifiers cannot end with
_
Comments
- No redundant comments: Never comment what the code already expresses clearly
- No duplicate comments: Don't repeat information from function names, types, or nearby comments
- Meaningful only: Only add comments to explain why, not what — the code shows what it does
Boolean Expressions
- Prefer truthiness checks: Use implicit truthy/falsy checks over explicit comparisons
- Exception: Use explicit checks when distinguishing
0/''(valid values) fromnull/undefinedis semantically important
Testing
- Minimize mocking: Avoid mocking everything; use real implementations and data generators when available
- Test real behavior: Testing mocks provides little value — test actual code paths
- Don't be lazy: Write thorough tests that cover edge cases, not just happy paths
Error Handling
- Specific error types: Prefer specific error types over generic
Errorwhen meaningful - Avoid silent failures: Don't swallow errors with empty catch blocks
- Handle rejections: Always handle promise rejections
- Let errors propagate: Don't catch errors just to re-throw or log — let them bubble up to error handlers
Negative Knowledge
Avoid these anti-patterns:
console.log()statements in production codeeval()orFunction()constructor- Nested ternary operators
awaitinside loops whenPromise.allwould be simpler (sequential awaits are fine when order matters or parallelism adds complexity)- Empty interfaces
- Variable shadowing
- Functions defined inside loops
@ts-ignorewithout explanation (use@ts-expect-errorwith 10+ char description)- Comments that restate the code:
// increment counterabovecounter++ - Comments that duplicate type information:
// returns a stringwhen return type is: string - Commented-out code (delete it; use version control)
- Verbose boolean comparisons:
arr.length > 0,str !== '',obj !== null && obj !== undefined - Disabling lint rules via comments (fix the code instead)
- Overuse of
anytype orastype assertions - Over-mocking in tests instead of using real implementations or data generators
- Empty catch blocks that silently swallow errors
- Using
||for defaults when??is more appropriate - Deep nesting when early returns would simplify
- Catching errors just to re-throw or log them
- Nested function definitions inside other functions
- Mutating objects/arrays instead of creating new ones
- TOCTOU: Checking file/resource existence before operating (try and handle errors instead)
- Classes with only static methods (use plain functions instead)
- Duplicating existing interfaces instead of reusing or deriving with
Pick/Omit/Partial
Verification Workflow
- Analyze: Compare the code change against these TypeScript standards
- Generate/Refactor: Write or modify code to comply with all rules above
- Simplify: Review for opportunities to simplify — prefer clear, straightforward code over clever solutions
- Review naming: Verify variable and function names still make sense in context after changes
- Build: Verify types compile without errors (e.g.,
npm run buildornpx tsc --noEmit) - Lint: Run
npm run lintto confirm compliance before completing the task
Examples
Comments Examples
// Standard
// Retry with exponential backoff to handle transient network failures
async function fetchWithRetry(url: string, attempts = 3): Promise<Response> {
for (let i = 0; i < attempts; i++) {
try {
return await fetch(url);
} catch {
await sleep(2 ** i * 100);
}
}
throw new Error(`Failed after ${attempts} attempts`);
}
// Non-Standard
/**
* Fetches data from a URL with retry logic
* @param url - The URL to fetch from
* @param attempts - Number of attempts (default 3)
* @returns A Promise that resolves to a Response
*/
async function fetchWithRetry(url: string, attempts = 3): Promise<Response> {
// Loop through attempts
for (let i = 0; i < attempts; i++) {
try {
// Try to fetch the URL
return await fetch(url);
} catch {
// Wait before retrying
await sleep(2 ** i * 100);
}
}
// Throw error if all attempts fail
throw new Error(`Failed after ${attempts} attempts`);
}
Boolean Expressions Examples
// Standard
if (myArray.length) {
}
if (myString) {
}
if (myObject) {
}
if (!value) {
}
// Non-Standard
if (myArray.length !== 0) {
}
if (myArray.length > 0) {
}
if (myString !== '') {
}
if (myObject !== null && myObject !== undefined) {
}
if (value === null || value === undefined) {
}
Early Return Examples
// Standard
function processUser(user: User | null): Result {
if (!user) {
return { error: 'No user provided' };
}
if (!user.isActive) How to use enforcing-typescript-standards on Cursor
AI-first code editor with Composer
Prerequisites
Before installing skills in Cursor, ensure your development environment meets these requirements:
- ›Cursor installed and configured on your development machine
- ›Node.js version 16.0+ with npm package manager (verify with
node --version) - ›Active project directory or workspace where you want to add enforcing-typescript-standards
Execute installation command
Execute the skills CLI command in your project's root directory to begin installation:
The skills CLI fetches enforcing-typescript-standards from GitHub repository jgeurts/eslint-config-decent and configures it for Cursor.
Select Cursor when prompted
The CLI will show a list of available agents. Use arrow keys to navigate and space to select Cursor:
Verify installation
Confirm successful installation by checking the skill directory location:
Reload or restart Cursor to activate enforcing-typescript-standards. Access the skill through slash commands (e.g., /enforcing-typescript-standards) or your agent's skill management interface.
Security & Verification Notice
We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.
Skills execute code in your development environment. Always verify the publisher's identity, review recent commits, and test in isolated environments before production deployment.
List & Monetize Your Skill
Submit your Claude Code skill and start earning
Use Cases▌
Task Automation & Efficiency
Automate repetitive workflows and reduce manual effort
Example
Generate reports, summarize documents, draft communications
Save 3-5 hours per week on routine tasks
Knowledge Enhancement
Learn new skills, understand complex topics, get expert guidance
Example
Explain concepts, provide examples, suggest learning resources
Accelerate learning and skill development by 2x
Quality Improvement
Enhance output quality through reviews, suggestions, and refinements
Example
Review drafts, suggest improvements, catch errors
Improve work quality by 30-40% with less effort
Implementation Guide▌
Prerequisites
- ›Claude Desktop or compatible AI client with skill support
- ›Clear understanding of task or problem to solve
- ›Willingness to iterate and refine outputs
Time Estimate
15-45 minutes depending on use case complexity
Installation Steps
- 1.Install skill using provided installation command
- 2.Test with simple use case relevant to your work
- 3.Evaluate output quality and relevance
- 4.Iterate on prompts to improve results
- 5.Integrate into regular workflow if valuable
Common Pitfalls
- ⚠Expecting perfect results without iteration
- ⚠Not providing enough context in prompts
- ⚠Using skill for tasks outside its intended scope
- ⚠Accepting outputs without review and validation
Best Practices▌
✓ Do
- +Start with clear, specific prompts
- +Provide relevant context and constraints
- +Review and refine all outputs before using
- +Iterate to improve output quality
- +Document successful prompt patterns
✗ Don't
- −Don't use without understanding skill limitations
- −Don't skip validation of outputs
- −Don't share sensitive information in prompts
- −Don't expect skill to replace human judgment
💡 Pro Tips
- ★Be specific about desired format and style
- ★Ask for multiple options to choose from
- ★Request explanations to understand reasoning
- ★Combine AI efficiency with human expertise
When to Use This▌
✓ Use When
Use when skill capabilities match your task, clear ROI on time saved, and you can validate outputs. Best for repetitive tasks, learning, and quality improvement.
✗ Avoid When
Avoid when task requires deep expertise you can't validate, involves sensitive decisions, or when learning process is more valuable than speed of completion.
Learning Path▌
- 1Familiarize yourself with skill capabilities and limitations
- 2Start with low-risk, non-critical tasks
- 3Progress to more complex and valuable use cases
- 4Build expertise through regular use and experimentation
Discussion
Product Hunt–style comments (not star reviews)- No comments yet — start the thread.
Ratings
4.7★★★★★46 reviews- ★★★★★Jin Huang· Dec 24, 2024
Solid pick for teams standardizing on skills: enforcing-typescript-standards is focused, and the summary matches what you get after install.
- ★★★★★Ren Sanchez· Dec 20, 2024
enforcing-typescript-standards is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
- ★★★★★Shikha Mishra· Dec 8, 2024
I recommend enforcing-typescript-standards for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.
- ★★★★★Yash Thakker· Nov 27, 2024
enforcing-typescript-standards fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
- ★★★★★Sakshi Patil· Nov 19, 2024
Useful defaults in enforcing-typescript-standards — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.
- ★★★★★Min Gonzalez· Nov 15, 2024
enforcing-typescript-standards has been reliable in day-to-day use. Documentation quality is above average for community skills.
- ★★★★★Arjun Gupta· Nov 11, 2024
Keeps context tight: enforcing-typescript-standards is the kind of skill you can hand to a new teammate without a long onboarding doc.
- ★★★★★Dhruvi Jain· Oct 18, 2024
enforcing-typescript-standards has been reliable in day-to-day use. Documentation quality is above average for community skills.
- ★★★★★Chaitanya Patil· Oct 10, 2024
Registry listing for enforcing-typescript-standards matched our evaluation — installs cleanly and behaves as described in the markdown.
- ★★★★★Advait Chen· Oct 6, 2024
enforcing-typescript-standards fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
showing 1-10 of 46