Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

static-analysis

БесплатноБез исполняемых скриптовНе проверен

Use when setting up or improving static analysis tooling — type checking, linting, security scanning (SAST), and code formatting. Covers cross-platform tools…

onfire7777от onfire7777★ 17 звёзд на GitHub

Об этом скилле

Static Analysis — Catching Bugs at Write Time

Overview

Static analysis catches bugs before code runs by examining source code for type errors, style violations, security vulnerabilities, and formatting issues. It sits at the base of the Test Trophy because it provides free confidence — zero runtime cost, instant feedback, and it prevents entire classes of bugs from ever reaching tests.

Categories of Static Analysis

Category What It Catches When It Runs
Type Checking Type mismatches, null safety, API contract violations IDE + CI
Linting Code smells, anti-patterns, complexity, unused code IDE + CI
Security Scanning (SAST) Injection, hardcoded secrets, insecure patterns CI + pre-commit
Formatting Inconsistent style, indentation, line length IDE + pre-commit

Type Checking

TypeScript

TypeScript provides compile-time type safety for JavaScript codebases.

// tsconfig.json — strict configuration
{
  "compilerOptions": {
    "strict": true,                    // Enable all strict checks
    "noUncheckedIndexedAccess": true,  // Array/object index returns T | undefined
    "noImplicitOverride": true,        // Require 'override' keyword
    "exactOptionalPropertyTypes": true,// Distinguish undefined from missing
    "noFallthroughCasesInSwitch": true,
    "forceConsistentCasingInFileNames": true,
    "target": "ES2022",
    "module": "NodeNext",
    "moduleResolution": "NodeNext",
    "declaration": true,
    "sourceMap": true,
    "outDir": "./dist"
  },
  "include": ["src/**/*"],
  "exclude": ["node_modules", "dist"]
}

Run type checking:

# Check without emitting files
npx tsc --noEmit

# Watch mode during development
npx tsc --noEmit --watch

mypy (Python)

# mypy.ini
[mypy]
python_version = 3.12
strict = True
warn_return_any = True
warn_unused_configs = True
disallow_untyped_defs = True
disallow_incomplete_defs = True
check_untyped_defs = True
no_implicit_optional = True
warn_redundant_casts = True
warn_unused_ignores = True

[mypy-tests.*]
disallow_untyped_defs = False
# Run mypy
mypy src/
mypy src/ --html-report reports/mypy

Pyright (Python)

// pyrightconfig.json
{
  "include": ["src"],
  "exclude": ["**/node_modules", "**/__pycache__"],
  "typeCheckingMode": "strict",
  "reportMissingImports": true,
  "reportMissingTypeStubs": false,
  "pythonVersion": "3.12"
}
# Run Pyright
npx pyright
pyright src/

C# Strong Typing

C# provides strong typing out of the box. Enable nullable reference types and treat warnings as errors for maximum safety.

<!-- In .csproj -->
<PropertyGroup>
  <Nullable>enable</Nullable>
  <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
  <WarningLevel>9999</WarningLevel>
  <EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
  <AnalysisLevel>latest-recommended</AnalysisLevel>
</PropertyGroup>

Linting

ESLint (JavaScript / TypeScript)

// eslint.config.mjs (flat config — ESLint v9+)
import js from "@eslint/js";
import tseslint from "typescript-eslint";

export default tseslint.config(
  js.configs.recommended,
  ...tseslint.configs.strictTypeChecked,
  ...tseslint.configs.stylisticTypeChecked,
  {
    languageOptions: {
      parserOptions: {
        projectService: true,
        tsconfigRootDir: import.meta.dirname,
      },
    },
    rules: {
      "@typescript-eslint/no-unused-vars": ["error", {
        argsIgnorePattern: "^_",
        varsIgnorePattern: "^_",
      }],
      "@typescript-eslint/no-explicit-any": "error",
      "@typescript-eslint/explicit-function-return-type": "warn",
      "no-console": ["warn", { allow: ["warn", "error"] }],
      "prefer-const": "error",
      eqeqeq: ["error", "always"],
    },
  },
  {
    ignores: ["dist/", "node_modules/", "coverage/"],
  }
);
# Run ESLint
npx eslint .
npx eslint . --fix          # Auto-fix fixable issues
npx eslint . --format json  # Machine-readable output

Biome (JavaScript / TypeScript — fast alternative to ESLint + Prettier)

// biome.json
{
  "$schema": "https://biomejs.dev/schemas/1.9.0/schema.json",
  "organizeImports": { "enabled": true },
  "linter": {
    "enabled": true,
    "rules": {
      "recommended": true,
      "complexity": { "noExcessiveCognitiveComplexity": "warn" },
      "suspicious": { "noExplicitAny": "error" },
      "style": { "useConst": "error" }
    }
  },
  "formatter": {
    "enabled": true,
    "indentStyle": "space",
    "indentWidth": 2
  }
}
npx @biomejs/biome check .
npx @biomejs/biome check . --fix

Ruff (Python — fast linter + formatter)

# pyproject.toml
[tool.ruff]
target-version = "py312"
line-length = 88

[tool.ruff.lint]
select = [
  "E",   # pycodestyle errors
  "W",   # pycodestyle warnings
  "F",   # pyflakes
  "I",   # isort
  "N",   # pep8-naming
  "UP",  # pyupgrad
Полный SKILL.md на GitHub

Установить static-analysis в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

AGENTS.mdREADME.mdmetadata.jsonrules/_sections.mdrules/_template.mdrules/static-analysis-enable-strict-mode-in-type-checkers-strict.mdrules/static-analysis-layer-tools.mdrules/static-analysis-pin-tool-versions-in-ci-to-avoid-surprise-breakages-from.mdrules/static-analysis-prefer-biome-or-ruff-when-speed-matters.mdrules/static-analysis-run-security-scanning-semgrep-codeql-on-every-pr-not.mdrules/static-analysis-run-static-analysis-on-every-keystroke-ide-integration.mdrules/static-analysis-separate-formatting-from-linting.mdrules/static-analysis-start-with-recommended-strict-rulesets-then-customize.mdrules/static-analysis-store-all-configuration-in-the-repository-so-every.mdrules/static-analysis-treat-warnings-as-errors-in-ci-to-prevent-gradual-quality.mdrules/static-analysis-use-editorconfig-to-enforce-consistent-formatting-across.mdrules/static-analysis-use-pre-commit-hooks-to-catch-issues-before-they-reach-ci.md

FAQ

Что делает скилл static-analysis?

Use when setting up or improving static analysis tooling — type checking, linting, security scanning (SAST), and code formatting. Covers cross-platform tools including TypeScript, mypy, ESLint, Biome, Ruff, Semgrep, CodeQL, Roslyn analyzers, Prettier, Black, and dotnet format with configuration examples and CI integration patterns. USE FOR: linting, type checking, SAST, code formatting, Semgrep rules, ESLint configuration, Roslyn analyzers DO NOT USE FOR: runtime testing (use unit-testing or integration-testing), E2E tests (use e2e-testing), performance profiling (use performance-testing)

Как установить скилл static-analysis?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл static-analysis запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить static-analysis с