Skip to content

heymegabyte/agent-skills / 07-quality-and-verification

quality-and-verification

Unverified

5-level verification pyramid: static→unit→Playwright E2E (homepage-first, 6bp)→AI visual→post-deploy. 8-check quality gate. Multi-agent testing (functional/security/a11y/performance). Playwright v1.56+ AI agents (Planner/Generator/Healer, v1.63 current). WCAG 2.2 AA via axe-core v4.13. Percy+Chromatic visual regression. ADA Title II 2027/2028 deadlines.

FileKindSize
SKILL.mdskill md5.5 KB
accessibility-gate.mdmarkdown5.8 KB
adversarial-testing.mdmarkdown5.5 KB
agentic-security.mdmarkdown3.4 KB
audio-video-sync.mdmarkdown1.7 KB
build-breaking-rules.mdmarkdown17.0 KB
chrome-and-browser-workflows.mdmarkdown5.5 KB
completeness-verification.mdmarkdown5.3 KB
computer-use-automation.mdmarkdown6.0 KB
contract-testing.mdmarkdown4.3 KB
e2e-accumulation.mdmarkdown1.6 KB
eval-driven-development.mdmarkdown6.3 KB
evidence-collection.mdmarkdown3.7 KB
llm-evals.mdmarkdown15.7 KB
performance-optimization.mdmarkdown4.8 KB
picovoice-eagle-biometric.mdmarkdown1.6 KB
security-hardening.mdmarkdown8.7 KB
semgrep-codebase-rules.mdmarkdown4.2 KB
slop-detection.mdmarkdown4.3 KB
spec-driven-development.mdmarkdown5.0 KB
stagehand-ai-fallback.mdmarkdown1.6 KB
stagehand-ai-testing.mdmarkdown7.7 KB
tdd-verification.mdmarkdown6.7 KB
testing-matrices.mdmarkdown5.3 KB
ui-completeness-sweep.mdmarkdown6.3 KB
visual-inspection-loop.mdmarkdown14.0 KB
visual-regression.mdmarkdown7.0 KB
wcag-2-2-2026.mdmarkdown3.2 KB

semgrep-codebase-rules.md

View on GitHub
---
name: "Semgrep Codebase Rules"
version: "2.0.0"
updated: "2026-04-23"
description: "Custom Semgrep YAML rules per-project. Architecture, style, OWASP 2025 security, anti-patterns. Rules evolve as AI learns codebase. Deterministic enforcement via hooks+CI."
---

# Semgrep Codebase Rules

ESLint rules require JS authoring. Semgrep rules are YAML — AI writes in seconds, AST-matched (not text), fewer false positives. Per-project in `.semgrep/rules/`, versioned in git.

**Setup:** `brew install semgrep` → `mkdir -p .semgrep/rules/`.

## Core Rule Set (every Emdash project)

```yaml
rules:
  # Architecture (A01/A07 Broken Access Control)
  - id: no-direct-d1
    pattern: c.env.DB.prepare(...)
    message: "Use repository fns from src/db/. Direct D1 breaks data layer."
    severity: ERROR
    paths: { exclude: ["src/db/**"] }
  - id: missing-auth-middleware
    patterns:
      - pattern: app.get($PATH, async ($C) => { ... })
      - pattern-not: app.get($PATH, requireAuth(), ...)
    message: "API route missing requireAuth(). Add or document why public."
    severity: WARNING
    paths: { include: ["src/routes/**"], exclude: ["src/routes/webhooks/**","src/routes/health.ts"] }

  # Style
  - id: no-any-type
    pattern: "$X: any"
    message: "Use unknown. See code-style rule."
    severity: ERROR
    languages: [typescript]
  - id: no-console-log
    pattern: console.log(...)
    message: "Use Sentry breadcrumb or PostHog event."
    severity: WARNING
    paths: { exclude: ["**/*.test.*","**/*.spec.*","scripts/**"] }
  - id: error-envelope
    pattern: "c.json({ error: $MSG }, $STATUS)"
    fix: "c.json({ error: $MSG, code: 'UNKNOWN', details: null }, $STATUS)"
    message: "Use full error envelope: {error, code, details}."
    severity: WARNING

  # OWASP 2025 Security
  - id: hardcoded-secret  # A04 Cryptographic Failures
    patterns:
      - pattern: $KEY = "sk_..."
      - pattern: $KEY = "Bearer ..."
    message: "Hardcoded secret. Use get-secret or wrangler secret."
    severity: ERROR
  - id: missing-zod-validation  # A05 Injection
    patterns:
      - pattern: app.post($PATH, async ($C) => { const body = await $C.req.json(); ... })
      - pattern-not: app.post($PATH, zValidator(...), ...)
    message: "POST/PUT routes require @hono/zod-validator. No raw req.json()."
    severity: ERROR
  - id: cors-wildcard  # A01 Broken Access Control
    pattern-regex: "origin.*['\"]\\*['\"]"
    message: "Never CORS '*' in production. Use exact origins."
    severity: ERROR
    paths: { exclude: ["**/*.test.*"] }
  - id: no-eval  # A05 Injection
    patterns:
      - pattern: eval(...)
      - pattern: document.write(...)
      - pattern: innerHTML = $X
    message: "Use textContent. eval/innerHTML = XSS vector (OWASP A05:2025)."
    severity: ERROR
  - id: no-todo
    pattern-regex: "(TODO|FIXME|HACK|XXX|TEMP)"
    message: "Resolve before committing."
    severity: WARNING
    paths: { exclude: ["**/*.md"] }
```

## OWASP 2025 Coverage

- **A01** → `cors-wildcard` + `missing-auth`
- **A03 Supply Chain** → `npm audit` in CI
- **A04** → `hardcoded-secret`
- **A05** → `missing-zod` + `no-eval`
- **A07** → `missing-auth-middleware`
- **A09** → `no-console-log`
- **A10 Exceptional Conditions** → try/catch enforcement (add rule when pattern found 3x)

## AI Rule Evolution

Same pattern fixed 3+ times → create rule. Architecture decision → enforce immediately.

```bash
cat > .semgrep/rules/new-rule.yaml << 'EOF'
rules:
  - id: descriptive-name
    pattern: the-pattern
    message: "Why wrong + what to do."
    severity: WARNING|ERROR
    languages: [typescript]
EOF
semgrep --config .semgrep/rules/new-rule.yaml src/  # test, refine if noisy
```

**Lifecycle:** Create → Test → Refine → Enforce → Evolve → Retire (0 hits in 30 days).

## Integration

### Pre-commit

```yaml
- repo: https://github.com/semgrep/semgrep
  rev: v1.95.0
  hooks: [{id: semgrep, args: ['--config','.semgrep/rules/','--error']}]
```

### CI

```bash
semgrep --config .semgrep/rules/ --error src/
```

### PostToolUse (`format-on-save.sh`)

```bash
semgrep --config .semgrep/rules/ --quiet "$FILE" 2>/dev/null
```

Each session adds 1-3 rules. After 10 sessions: 30+ rules = codebase fingerprint. New agents read rules, instantly understand constraints without full conversation history.
rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first.Stars: 194kUpdated Claude CodeCodexVerifiedInstall