konsistent-fix-violations
БесплатноБез исполняемых скриптовНе проверенRun the konsistent CLI, review all reported violations, and fix them in the codebase. Use when the user wants to "fix konsistent violations", "resolve…
от vercel-labs★ 204 звезды на GitHubОб этом скилле
konsistent — Fix Violations
Run konsistent, surface what is broken, and resolve violations. The hard part is not the mechanical fix — it is deciding whether the rule or the code is wrong when a single rule has many violations, and which non-trivial violations are worth attempting versus deferring.
The canonical workflow and per-predicate triage rubric are documented in node_modules/konsistent/docs/guides/fixing-violations.md. Read it before classifying violations. This skill layers strict gating, user confirmation, and AskUserQuestion interactions on top of that workflow.
Workflow (strict order)
- Run the CLI and collect all violations as JSON.
- Group violations by rule and identify rules with high violation counts.
- For each high-count rule, ask the user whether to keep, change, or remove the rule.
- Update
konsistent.jsonvia thekonsistent-configskill if any rules need changes. - Re-run the CLI to refresh the violation list, then stop and ask for explicit confirmation before modifying any code.
- Triage remaining violations into trivial vs. non-trivial.
- Surface non-trivial violations to the user and let them decide how to handle each.
- Fix the approved violations and re-run the CLI to verify.
Do not skip steps. Do not collapse them. The asks for user input at steps 3, 5, and 7 are non-negotiable.
1. Run the CLI
Determine the invocation in this order:
- If
package.jsonhas akonsistentscript → use the project's package manager:pnpm konsistent,npm run konsistent, oryarn konsistent(match the lockfile /packageManagerfield). - Else, if
konsistentis indevDependencies→ run via the package runner:pnpm exec konsistent,npx konsistent, etc. - Else, fall back to
npx konsistent.
Run the check command with JSON output and a high diagnostic cap so nothing is truncated:
<runner> konsistent check --format=json --max-diagnostics=1000
Note: when invoking via an npm/pnpm script that already wraps konsistent, you may need -- to forward flags:
pnpm konsistent check --format=json --max-diagnostics=1000
# OR if the script runs konsistent without args:
pnpm konsistent -- check --format=json --max-diagnostics=1000
The JSON output is an array of { severity, conventionName, filePath, predicateName, message }. Exit code is non-zero when errors are present; that is expected — read the JSON regardless. See node_modules/konsistent/docs/reference/cli.md for the full output schema.
If the command fails for reasons other than violations (config not found, invalid config, missing dependency), stop and resolve the underlying issue first. Do not proceed.
2. Group violations by rule
Aggregate the violations by conventionName (and optionally predicateName). Compute a count per group. Report the totals to the user briefly:
Found N violations across M conventions. Rule
Xhas K violations; ruleYhas J violations; …
A rule is "high-count" when it has roughly 5+ violations OR represents more than half of the violating files for that rule's path pattern. Use judgment — a rule with 4 violations across 4 files where the path pattern only matches 5 files is also high-count.
Why this matters: a rule with 1–2 violations almost always means the code is the outlier. A rule with many violations often means the rule itself encodes a convention the codebase has not actually adopted — fixing the code without questioning the rule produces churn and may overwrite the team's real convention.
3. Ask the user: rule vs. code
For each high-count rule, explicitly ask the user to choose. Use the AskUserQuestion tool with concrete options. Do not infer — the user owns this decision.
Frame the question with:
- The rule's name / description / what it enforces.
- The codebase distribution — count how many of the matched files conform vs. violate, and report the split (e.g. "12 of 25 matched packages use pattern A; 13 use pattern B — codebase is roughly 50/50"). This framing dramatically improves the user's ability to decide.
- A short summary of what convention the violating files actually follow (read 2–3 of them — what naming/structure pattern do they share?).
- A few representative examples (file paths or symbol names from each pattern).
Offer at minimum these options:
- Keep the rule, fix the code — code is the outlier; proceed to fix violations.
- Change the rule to match what the code does — the violating pattern is the real convention; update
konsistent.json. - Remove the rule — the convention isn't worth enforcing.
- Other (free-text — e.g. relax to
severity: warning, narrow the path pattern
Установить konsistent-fix-violations в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл konsistent-fix-violations?
Run the konsistent CLI, review all reported violations, and fix them in the codebase. Use when the user wants to "fix konsistent violations", "resolve konsistent errors", "clean up konsistent diagnostics", "make konsistent pass", "address structural convention violations", or asks to run konsistent and act on the results. The skill is interactive: it requires explicit user decisions when many violations stem from the same rule (rule vs. code question), explicit user confirmation before modifying any code, and a triage step for non-trivial violations. For editing `konsistent.json`, this skill defers to the `konsistent-config` skill.
Как установить скилл konsistent-fix-violations?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл konsistent-fix-violations запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic