Skip to content
Back to skills

Code Quality

ASecurity

Run the Code Quality Advisor on demand against a specified file or all SQL files. Usage: $quality run [file-path] or $quality run (for all .sql files). Finds anti-patterns and writes a findings report.

  • 724 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 5, 2026
ai-agentssqlgit

Security analysis

A100/100

Pro scans all 4 files and shows the line behind each finding

Scanned September 5, 2026

npx -y skills add Snowflake-Labs/cocoplus --skill code-quality --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Code Quality?

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

Security grade badge for Code Quality
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/snowflake-labs-code-quality-7be72050/badge)](https://www.skillsdirectory.com/skills/snowflake-labs-code-quality-7be72050)

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: "quality-run"
description: "Run the Code Quality Advisor on demand against a specified file or all SQL files. Usage: $quality run [file-path] or $quality run (for all .sql files). Finds anti-patterns and writes a findings report."
version: "1.0.0"
author: "CocoPlus"
tags:
  - cocoplus
  - code-quality
---

Your objective is to run a code quality review.

Before proceeding, verify that `.cocoplus/` exists.
If not: output "CocoPlus not initialized in this directory. Run `$pod init` to begin." Then stop.

Parse argument: `$quality run [file-path]`
If no argument: find all `.sql` files in the current directory tree (excluding `.git/` and `.cocoplus/`).
If file-path provided: verify the file exists.

## SQL Anti-Pattern Detection

For each SQL file, check for these anti-patterns:

| ID | Pattern | Severity | Detection |
|----|---------|----------|-----------|
| QA-001 | SELECT * | medium | regex: `SELECT\s+\*` |
| QA-002 | Missing WHERE on UPDATE/DELETE | critical | regex: `(UPDATE\|DELETE FROM)\s+\S+\s*$` |
| QA-003 | Unbounded result (no LIMIT) | low | large SELECT without LIMIT |
| QA-004 | Cartesian product (implicit JOIN) | high | regex: `FROM\s+\w+\s*,\s*\w+` without WHERE |
| QA-005 | Deprecated OVER ROWS syntax | low | regex: `ROWS BETWEEN UNBOUNDED PRECEDING` |
| QA-006 | Hardcoded credentials | critical | regex: `password\s*=\s*['"][^'"]+['"]` |

## Write Findings Report

Generate timestamp.
Write `.cocoplus/quality-findings-[timestamp].md`:

```markdown
# Quality Findings Report

**Date:** [ISO 8601 timestamp]
**Files Analyzed:** [N]
**Findings:** [count by severity]

## Critical
[findings]

## High
[findings]

## Medium
[findings]

## Low
[findings]

## Summary
[overall assessment]
```

Output: "Quality review complete. [N] findings ([C] critical, [H] high, [M] medium, [L] low). Report: `.cocoplus/quality-findings-[timestamp].md`."

## Anti-Rationalization

| Shortcut / Temptation | Why It Fails |
|-----------------------|--------------|
| Report "no findings" without scanning the file (assuming clean code) | Anti-pattern detection requires actually running regex checks — assumptions produce false negatives |
| Skip writing the findings file if there are zero findings | An empty findings report is still a valid audit record; zero findings must be explicitly documented |
| Scan `.cocoplus/` SQL files along with project SQL files | CocoPlus internal files should never be analyzed — always exclude `.git/` and `.cocoplus/` from the scan |

## Exit Criteria

- [ ] `.cocoplus/quality-findings-[timestamp].md` exists with Date, Files Analyzed, and Findings summary header
- [ ] Each SQL file in scope was checked against all 6 anti-pattern rules (QA-001 through QA-006)
- [ ] Output shows finding counts by severity (critical, high, medium, low)

Files in this skill

  • quality-off.skill.md1.3 KB
  • quality-on.skill.md1.4 KB
  • quality-run.skill.md2.7 KB

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…