lint
Lint and format code. Auto-detects ESLint, Biome, Prettier, or language-native formatters and runs them with auto-fix. Reports remaining issues with actionable suggestions.
- License 许可
- MIT
- 所属仓库
- cmetech/otto-cli
- 最近更新
- 2026-06-17
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- lint
- description
- Lint and format code. Auto-detects ESLint, Biome, Prettier, or language-native formatters and runs them with auto-fix. Reports remaining issues with actionable suggestions.
03 SKILL.md 正文
<objective> Lint and format code in the current project. Auto-detect the project's linter and formatter toolchain, run them against the target files, and report results grouped by severity with actionable fix suggestions. </objective>
<working_directory_awareness>
Before running any git or build command: check whether your dispatch context specifies a working directory (look for "Working directory:" in your initial prompt). If it does and pwd does not match it, prefix every git invocation with -C <that path> (e.g. git -C /path/to/worktree diff --name-only) and run linters/formatters with the explicit path argument. Linting the wrong directory is a silent failure mode.
</working_directory_awareness>
<arguments>
This skill accepts optional arguments after /lint:
- No arguments: Lint only files changed in the current working tree (
git diff --name-onlyandgit diff --cached --name-only). - A file or directory path: Lint only that specific path (e.g.,
/lint src/utils). --fix: Automatically apply safe fixes. Can be combined with a path (e.g.,/lint src/ --fix).--fixwithout a path: Auto-fix changed files only.
Parse the arguments before proceeding. If --fix is present, set fix mode. If a non-flag argument is present, treat it as the target path.
</arguments>
<detection> Auto-detect the project's linter and formatter by checking configuration files in the project root. Check in this order and use the first match found for each category (linter vs. formatter). A project may have both a linter and a formatter.
JavaScript/TypeScript Linters:
-
Biome — Look for
biome.jsonorbiome.jsoncin the project root.- Lint command:
npx @biomejs/biome check .(or--applywith--fix) - Format command:
npx @biomejs/biome format .(or--writewith--fix) - Biome handles both linting and formatting. No need for a separate formatter if Biome is detected.
- Lint command:
-
ESLint — Look for
.eslintrc,.eslintrc.*(js, cjs, json, yml, yaml),eslint.config.*(js, mjs, cjs, ts, mts, cts), or an"eslintConfig"key inpackage.json.- Lint command:
npx eslint .(or--fixwith--fix) - Check
package.jsonfor the installed version. ESLint 9+ uses flat config (eslint.config.*).
- Lint command:
JavaScript/TypeScript Formatters (only if Biome was NOT detected):
- Prettier — Look for
.prettierrc,.prettierrc.*,prettier.config.*, or a"prettier"key inpackage.json.- Format check:
npx prettier --check . - Format fix:
npx prettier --write .
- Format check:
Rust:
- rustfmt — Look for
rustfmt.tomlor.rustfmt.toml, orCargo.tomlin the project root.- Format check:
cargo fmt -- --check - Format fix:
cargo fmt - Lint:
cargo clippy(if available)
- Format check:
Go:
- Go tools — Look for
go.modin the project root.- Format check:
gofmt -l . - Format fix:
gofmt -w . - Lint:
golangci-lint run(if installed), otherwisego vet ./...
- Format check:
Python:
-
Ruff — Look for
ruff.tomlor a[tool.ruff]section inpyproject.toml.- Lint command:
ruff check .(or--fixwith--fix) - Format command:
ruff format .(or--checkwithout--fix)
- Lint command:
-
Black — Look for a
[tool.black]section inpyproject.toml, orblackin requirements files.- Format check:
black --check . - Format fix:
black .
- Format check:
If no linter or formatter is detected, inform the user and suggest common options for their project type based on the files present. </detection>
<execution>
Step 1: Determine target files
- If a path argument was provided, use that path.
- If no path argument, get changed files:
Filter to files that still exist on disk. If no files are changed, inform the user and offer to lint the entire project instead.git diff --name-only git diff --cached --name-only
Step 2: Run the detected tools
Run the linter and/or formatter against the target files or directory.
- Without
--fix: Run in check/report mode only. Do NOT modify any files. - With
--fix: Run with auto-fix flags enabled.
When running formatters without --fix, show a preview of what would change:
- For Prettier: use
--checkand list files that would change. - For Biome: use
checkwithout--apply. - For Black: use
--check --diffto show the diff preview. - For Ruff: use
--difffor format and standard output for lint. - For rustfmt/gofmt: use
--checkor-lto list files, then show a diff for up to 5 files usingdiff <(command) file.
Step 3: Parse and organize output
Parse the tool output and organize issues:
## Lint Results
### Errors (X issues)
| File | Line | Rule | Message |
|------|------|------|---------|
| ... | ... | ... | ... |
### Warnings (X issues)
| File | Line | Rule | Message |
|------|------|------|---------|
| ... | ... | ... | ... |
### Formatting
- X files would be reformatted
- [list files]
### Summary
- Total issues: X errors, Y warnings, Z formatting
- Auto-fixable: N issues (run `/lint --fix` to apply)
Step 4: Suggest fixes for common issues
For the most frequent issues, provide brief actionable guidance:
- If the same rule appears 5+ times, suggest a bulk fix or config change.
- For unused imports/variables, list them for quick removal.
- For formatting-only issues, note that
--fixwill resolve them safely. - For issues that cannot be auto-fixed, provide a one-line explanation of how to resolve each unique rule violation.
</execution>
<critical_rules>
- Never modify files without
--fix: Default mode is report-only. Respect the user's working tree. - Use the project's own config: Do not invent lint rules. Use whatever config files exist in the project.
- Use the project's installed version: Always prefer
npx,cargo, or the project-local binary. Do not use globally installed tools unless no local version exists. - Handle missing tools gracefully: If a config file exists but the tool is not installed, inform the user and provide the install command (e.g.,
npm install --save-dev eslint). - Respect
.gitignoreand ignore patterns: Do not lintnode_modules,dist,build,target,.git, or other commonly ignored directories. Most tools handle this automatically; verify they do. - Limit output: If there are more than 50 issues, show the first 30 grouped by severity, then summarize the rest with counts per file. Do not flood the user with hundreds of lines.
- Exit cleanly: After presenting results, do not take further action. Let the user decide next steps.
</critical_rules>
04 同仓库更多 Skills
write-milestone-brief
Synthesize the current conversation into a milestone brief (PRD). Writes to `M###-CONTEXT.md` by default, or files a GitHub issue only with explicit user confirmation. Use when asked to "turn this into a PRD", "draft a milestone brief", "capture this context", "write it up", or when enough has been discussed to commit the plan to paper. Does not interview — it synthesizes what is already known.
write-docs
Collaborative document authoring workflow for proposals, technical specs, decision docs, README sections, ADRs, and long-form prose that must work for fresh readers. Use when asked to "write the docs", "draft a proposal", "write a spec", "write an RFC", "write the README", or when a document needs to be understandable by someone without this session's context. Three stages: gather context, iterate on structure, reader-test for a stranger.
web-quality-audit
Comprehensive web quality audit covering performance, accessibility, SEO, and best practices. Use when asked to "audit my site", "review web quality", "run lighthouse audit", "check page quality", or "optimize my website".
web-design-guidelines
Review UI code for Web Interface Guidelines compliance. Use when asked to "review my UI", "check accessibility", "audit design", "review UX", or "check my site against best practices".
verify-before-complete
Block completion claims until verification evidence has been produced in the current message. Use before marking a task/slice/milestone complete, before creating a commit or PR, before saying "it works" or "tests pass", and any time you are about to claim work is done. The rule is: evidence before claims, always — running the verification must happen now, not "earlier in the session". Fresh output or no claim.
userinterface-wiki
UI/UX best practices for web interfaces. Use when reviewing animations, CSS, audio, typography, UX patterns, prefetching, or icon implementations. Covers 11 categories from animation principles to typography. Outputs file:line findings.