| name | code-guardian | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| description | Performs quality control at the end of every task. Checks for security vulnerabilities, errors, and code quality using ESLint. Detects buffer overflow errors and validates input for validity and size. Use this skill at the end of every task for code analysis. | ||||||||||
| license | MIT | ||||||||||
| metadata |
|
- ESLint Analysis - Static code analysis for errors and best practices
- Security Scanning - Detection of security vulnerabilities (SQL Injection, XSS, etc.)
- Buffer Overflow Detection - Validate input sizes and validity checks
- Input Validation - Checks for missing length, type, and range validations
- At the end of every task for quality control
- When security vulnerabilities need to be checked
- For buffer-related operations
- Before committing code
npx eslint --config .eslint.code-guardian.json --ext .ts,.js,.tsx,.jsx .npx eslint --config .eslint.code-guardian.json --fix .npx tsc --noEmitThe skill expects .eslint.code-guardian.json in your project root:
{
"root": true,
"env": {
"browser": true,
"es2021": true,
"node": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:security/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": ["@typescript-eslint", "security"],
"rules": {
"no-console": "warn",
"no-debugger": "warn",
"security/detect-object-injection": "off"
}
}npm install --save-dev eslint @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint-plugin-securityOptional for Prettier formatting:
npm install --save-dev eslint-plugin-prettier prettierThe skill detects the following security vulnerabilities:
| Rule | Description | Severity |
|---|---|---|
security/detect-eval-with-expression |
eval() with dynamic expressions | High |
security/detect-non-literal-fs-filename |
File system access without path validation | High |
security/detect-non-literal-regexp |
Regex from user input | Medium |
security/detect-object-injection |
Object injection vulnerabilities | Medium |
security/detect-possible-timing-attacks |
Timing attacks | Medium |
security/detect-pseudoRandomBytes |
Weak random number generators | Medium |
The skill detects potential buffer overflow errors:
| Rule | Description | Severity |
|---|---|---|
no-buffer-constructor |
Use of unsafe Buffer constructors | High |
no-new-native-buffer |
Unsafe Buffer creation | High |
security/detect-non-literal-fs-filename |
File system access without path validation | High |
The skill checks for missing or insufficient input validation:
| Check | Description |
|---|---|
| Length validation | Warning for missing length limits on strings |
| Type validation | Missing type validation for function parameters |
| Range validation | Numeric values without range validation |
| Null check | Missing Null/Undefined checks |
Copy the code-guardian folder to:
- Project:
.opencode/skills/code-guardian/ - Global:
~/.config/opencode/skills/code-guardian/
The skill can be configured as a Post-Task-Hook:
// oh-my-opencode.json
{
"hooks": {
"PostTaskExecute": {
"agent": "code-guardian",
"enabled": true
}
}
}| Code | Meaning | Action |
|---|---|---|
| 0 | No problems found | Continue |
| 1 | ESLint errors present | Try automatic fix |
| 2 | Configuration error | Check configuration |
- Add
node_modules/anddist/to.eslintignore - Adapt the rules to your project
- Use
--fixfor automatic corrections