Skip to content
Back to skills

Sonar Rule

ASecurity

Use when the user asks about a SonarQube rule, wants to understand why code was flagged, or needs compliant/noncompliant examples. Also use when seeing rule IDs like "S3358" or "typescript:S1135". Triggers: "explain rule", "what is S3358", "sonar rule", "why was this flagged", "show rule", "rule details", "noncompliant example".

  • 3 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added May 26, 2026
developmenttypescriptpythonjava

Security analysis

A100/100

Scanned May 27, 2026

npx -y skills add denniscalazans/denniscalazans-plugins --skill sonar-rule --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Sonar Rule?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Sonar Rule
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/denniscalazans-sonar-rule/badge)](https://www.skillsdirectory.com/skills/denniscalazans-sonar-rule)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: sonar-rule
description: >
  Use when the user asks about a SonarQube rule, wants to understand why code was flagged, or needs compliant/noncompliant examples.
  Also use when seeing rule IDs like "S3358" or "typescript:S1135".
  Triggers: "explain rule", "what is S3358", "sonar rule", "why was this flagged", "show rule", "rule details", "noncompliant example".
---

# Sonar Rule

Look up any SonarQube rule and get the full explanation with code examples.

**Announce at start:** "Looking up SonarQube rule."

## Process

### Step 1: Identify rule key

Accept any of these formats:
- Full key: `typescript:S3358`
- Short number: `S3358`
- From issue context: extract the `rule` field from a previous `search_sonar_issues_in_projects` result

If only the number is given (e.g., `S3358`), determine the language prefix from context:
- Check the file extension of the flagged file (`.ts` → `typescript`, `.java` → `java`, `.py` → `python`)
- If no file context, ask the user which language

### Step 2: Fetch rule

Call `show_rule` with the full key:

```
show_rule { key: "typescript:S3358" }
```

The response includes the rule name, description, severity, tags, and code examples.

### Step 3: Present

Show the key information concisely — the rule response can be verbose:

1. **Rule name** — what the rule checks
2. **Why it matters** — the rationale behind the rule
3. **Noncompliant example** — code that triggers the violation
4. **Compliant example** — how to fix it
5. **Clean Code attribute** — e.g., CLEAR (Intentional), FOCUSED (Adaptable)

Keep the presentation focused — don't dump the entire raw response.

## Common Mistakes

| Don't | Do |
|-------|-----|
| Show the entire raw rule response | Extract key sections: why, noncompliant, compliant |
| Guess the language prefix blindly | Check the file extension or ask the user |
| Skip the compliant example | Always show both noncompliant and compliant code |

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.