AGENT SKILL

x-lint-code

Analyzes source code with the appropriate linter for {{LANGUAGE}}. Second step in the pre-commit chain (RULE-007: format -> lint -> compile -> commit). Supports --fix, --changed-only, and --strict modes.

License 许可
MIT
最近更新
2026-10-27
Stars
★ 0
Forks
1

01 前言 Front Matter

name
x-lint-code
model
haiku
description
Analyzes source code with the appropriate linter for {{LANGUAGE}}. Second step in the pre-commit chain (RULE-007: format -> lint -> compile -> commit). Supports --fix, --changed-only, and --strict modes.
allowed-tools
Read, Write, Edit, Bash, Grep, Glob
argument-hint
[--fix | --changed-only | --strict]
context-budget
light
user-invocable
true
requires-capabilities
[]

02 资源文件 2

03 SKILL.md 正文

Global Output Policy

  • Language: English ONLY.
  • Tone: Technical, Direct, and Concise.
  • Efficiency: Remove all conversational fillers and greetings to save tokens.

Skill: Code Linting (slim — ADR-0012)

Runs static analysis on {{PROJECT_NAME}} source code using the appropriate linter for {{LANGUAGE}}. Second step of the pre-commit chain (RULE-007: format -> lint -> compile -> commit). Detects bugs, code smells, naming violations, and convention deviations before commit.

Triggers

  • /x-lint-code -- lint entire project, report errors and warnings
  • /x-lint-code --fix -- auto-fix violations where supported; re-stage corrected files
  • /x-lint-code --changed-only -- lint only modified files (staged + unstaged)
  • /x-lint-code --strict -- treat warnings as errors (exit 1 on any warning)
  • /x-lint-code --fix --changed-only -- auto-fix only changed files

Parameters

Parameter Type Default Description
--fix Flag off Auto-correct fixable violations; re-stage corrected files via git add
--changed-only Flag off Analyze only files from git diff --name-only + git diff --cached --name-only
--strict Flag off Treat warnings as errors; exit 1 if any warning exists

Output Contract

  • Mutation: none by default; with --fix, source files are corrected in place and re-staged.
  • Report to stdout: language, linter(s) used, scope (all / changed-only), mode (default/fix/strict), ERROR/WARNING/INFO counts, per-finding detail lines [{SEVERITY}] {file}:{line} -- {rule-id}: {description}, and final Result: {PASS | FAIL}.
  • Exit codes: see ## Error Envelope below.
  • Supported linters (summary): checkstyle+spotbugs+pmd (java), ktlint+detekt (kotlin), eslint (typescript), ruff+pylint (python), golangci-lint (go), clippy (rust). Per-language commands and secondary linter mapping: see references/full-protocol.md §1.

Error Envelope

Chain-wide error matrix. Canonical format -> lint -> compile -> commit rows live in _shared/error-handling-pre-commit.md. Rows below are x-lint-code-specific.

Scenario Exit Behavior
No findings (or INFO-only) 0 (PASS) Proceed to next chain step
WARNING-only findings without --strict 0 (PASS) Proceed; warnings listed in report
WARNING findings with --strict 1 (FAIL) Block chain; exit with warning count
Any ERROR findings 1 (FAIL) Block chain; exit with error list
Linter not installed 1 Suggest installation command
No source files found (empty scope) 0 Report "No files to analyze"
Linter config missing 0 (with WARN) Use linter defaults; warn about missing config
Linter command fails (internal error) 1 Report stderr details
--changed-only with no changed files 0 Report "No modified files"
--fix leaves unfixable errors 1 Report remaining errors after fix attempt

Full Protocol

Minimum viable contract above. The 7-step workflow (detect → scope → primary lint → secondary lint → fix → categorize → report), full language/linter mapping with --fix commands, severity-classification rules, and per-language notes (Java checkstyle/spotbugs/pmd details, Kotlin ktlint/detekt, TypeScript eslint, Python ruff/pylint, Go golangci-lint, Rust clippy) live in references/full-protocol.md per ADR-0012 (skill body slim-by-default). Happy-path invocation from the pre-commit chain reads only this SKILL.md.

Integration Notes

Skill Relationship Context
x-format-code precedes Format runs before lint in pre-commit chain
x-commit-changes orchestrator Invokes this skill as step 3b of its chain
x-review-codebase complementary Review provides deeper analysis; lint catches basics
x-audit-code complementary Audit runs lint as part of full codebase check

Template Variables

Variable Description Example
{{LANGUAGE}} Project language java
{{BUILD_TOOL}} Project build tool maven
{{BUILD_TOOL_CMD}} CLI prefix for build tool mvn / ./gradlew / npx
{{PROJECT_NAME}} Project name my-java-cli

04 同仓库更多 Skills

review-bench
review-bench/edercnj_ia-dev-environment

x-parallel-eval

Detects and classifies file-collision risks between work units (tasks, stories, or epic phases) before parallel execution. Reads ## File Footprint blocks produced by x-task-plan / x-story-plan, applies the parallelism-heuristics knowledge pack (hard / regen / soft categories + hotspot overrides), and emits a collision matrix + serialization recommendation in Markdown (default) or JSON.

★ 0
review-bench
review-bench/edercnj_ia-dev-environment

parallelism-heuristics

Canonical catalog of file-collision heuristics for parallel task, story, and epic execution. Defines the File Footprint block format, the three Conflict Categories (hard / regen / soft), a hotspot list of high-contention paths, and the degrade-with-warning policy. Consumed by x-task-plan, x-story-plan, x-epic-map, x-parallel-eval, and x-dev-*-implement.

★ 0
review-bench
review-bench/edercnj_ia-dev-environment

x-watch-pr-ci

Polls a PR's CI checks and Copilot review status, blocking until checks complete or timeout. Returns one of 8 stable exit codes (SUCCESS=0, CI_PENDING_PROCEED=10, CI_FAILED=20, TIMEOUT=30, PR_ALREADY_MERGED=40, NO_CI_CONFIGURED=50, PR_CLOSED=60, PR_NOT_FOUND=70). Writes a versioned state-file for session resume.

★ 0
review-bench
review-bench/edercnj_ia-dev-environment

x-validate-docs

Documentation freshness gate: validates 6 dimensions (readme, api-specs, grpc-proto, adr, skill-docs, system-architecture) against code changes in a PR. Stack-aware — only validates targets declared/auto-detected from ProjectConfig.documentation.targets. Returns exit non-zero on staleness; produces structured report.

★ 0
review-bench
review-bench/edercnj_ia-dev-environment

x-update-system-architecture

Incrementally updates docs/architecture/system.md after an epic completes. Appends new entries to the Decision Log (§11) using x-internal-write-report --append (dedup by ## ID: marker) and surgically inserts component/integration changes into sections 1-10 via Edit. Idempotent: re-running with the same epic produces a byte-identical system.md.

★ 0
review-bench
review-bench/edercnj_ia-dev-environment

x-update-architecture

Incrementally updates the service architecture document with changes from architecture plans. Adds new components, integrations, flows, and ADR references without rewriting existing content. Use after implementation to keep architecture documentation current.

★ 0