This skill provides advanced insights for code review, debugging issues, and best practices in Deno. It is ideal for developers seeking to enhance their Deno skills and project setups.
$ npx skills add https://github.com/denoland/skills --skill deno-expertThe deno-expert skill equips AI coding assistants with code review and debugging expertise for Deno applications. It provides structured guidance on identifying code issues, evaluating code quality, and applying Deno best practices during the development process. This skill works alongside other Deno skills to ensure your AI assistant can review code comprehensively, debug problems systematically, and recommend improvements aligned with modern Deno conventions. Developers benefit from automated code analysis that catches issues early and provides actionable feedback without manual review overhead.
Install using the command `npx skills add https://github.com/denoland/skills --skill deno-expert`
Reviewing Deno/Fresh code for best practices
Debugging Deno runtime issues
Answering advanced Deno questions
Evaluating package choices
$ npx skills add https://github.com/denoland/skills --skill deno-expertgit clone https://github.com/denoland/skillsCopy the install command above and run it in your terminal.
Launch Claude Code, Cursor, or your preferred AI coding agent.
Use the prompt template or examples below to test the skill.
Adapt the skill to your specific use case and workflow.
Act as a Deno expert. Review the following [CODE_SNIPPET] in a [PROJECT_NAME] project, identify potential issues, suggest optimizations, and recommend best practices for [SPECIFIC_TASK]. Focus on performance, security, and maintainability. Here's the code: ```[CODE_SNIPPET]```
# Deno Code Review for `auth-service` Project
## Overview
Reviewed the `auth-service` module, focusing on the `validateJWT` function in `src/auth.ts`. The code handles JWT validation but has several areas for improvement.
## Issues Found
- **Security**: The function uses `Deno.readTextFile` without verifying file permissions. A malicious user could replace the JWT secret file.
- **Performance**: The secret is read from disk on every validation call. Cache it in memory using `Deno.cache` or environment variables.
- **Error Handling**: Missing proper error handling for malformed JWTs. Currently throws raw errors that could leak stack traces.
## Optimizations
- **Cache the Secret**:
```typescript
let cachedSecret: string | null = null;
async function getSecret(): Promise<string> {
if (cachedSecret) return cachedSecret;
cachedSecret = await Deno.readTextFile('./secrets/jwt.key');
return cachedSecret;
}
```
- **Add Validation Middleware**:
```typescript
import { validate } from 'https://deno.land/x/validasaur/mod.ts';
const [passes, errors] = await validate(jwtPayload, {
userId: { required: true, type: 'string' }
});
```
## Best Practices
1. Use `Deno.env.get('JWT_SECRET')` for secrets in production.
2. Add rate limiting to prevent brute-force attacks.
3. Log validation failures (without sensitive data) for debugging.
## Next Steps
Would you like me to draft a PR with these changes? Or focus on another part of the codebase?Take a free 3-minute scan and get personalized AI skill recommendations.
Take free scan