validate-code

v2026.09.24

Run the full code quality validation suite for this codebase. Use this skill when you have finished implementing code changes and want to verify they are clean before committing, when told to "validate", "check quality", or "run linting", or before invoking the submit-changes skill. Runs lint-code (format, lint, typecheck, knip, spell-check) using the write configuration to auto-fix what it can, then checks that nothing remains.

GitHub
安装命令
npx skhub add jimmypaolini/validate-code
Markdown
SKILL.md

Validate Code

Run the codebase's full automated quality suite against your changes before committing. This prevents pre-commit hook failures, failed CI jobs, and wasted triage cycles.

When to Use This Skill

  • After finishing implementation of any task — TypeScript, Python, Markdown, YAML, JSON
  • Before invoking the submit-changes skill
  • When asked to "validate", "check code quality", "run linting", or "verify changes are clean"
  • Anytime you add new dependencies, exports, or files (Knip detects unused ones)

What lint-code Covers

The lint-code Nx target hangs every quality tool off dependsOn, so one invocation builds one task graph:

ToolPurposeConfiguration
oxfmt + prettierCode formattingconfiguration/oxfmt.config.ts, configuration/prettier.config.ts
eslint + oxlintLinting (TS/JS)project eslint.config.ts, configuration/oxlint.config.ts
ruffFormat + lint (Python)pyproject.toml
tsc --noEmitTypeScript type checkingproject tsconfig.json → configuration/tsconfig.base.json
pyright + tyPython type checkingpyproject.toml
knipUnused TS files, exports, depsconfiguration/knip.config.ts
fallow dead-codeThe same, workspace-wide in one passconfiguration/fallow.config.jsonc
vultureUnused Python codeconfiguration/vulture_whitelist.py
cspellSpell checkingconfiguration/cspell.config.yaml
markdownlintMarkdown lintingconfiguration/.markdownlint-cli2.jsonc
yamllintYAML lintingconfiguration/yamllint.yaml

Validation Workflow

Step 1 — Auto-fix

Run lint-code in write mode to automatically fix all auto-fixable issues (formatting, linting, unused-code whitelist entries, sync checks):

pnpm exec nx affected --target=typecheck-code,lint-code,format-code,deprecate-code,guard-code --configuration=write --base=main

For new/untracked files that nx affected won't detect, target the relevant project(s) directly:

pnpm exec nx run <project>:typecheck-code,lint-code,format-code,deprecate-code,guard-code --configuration=write

Review the changes made. If any files were modified, inspect them to ensure the auto-fixes are correct.

Step 2 — Verify

Run lint-code in check mode to confirm no issues remain:

pnpm exec nx affected --target=typecheck-code,lint-code,format-code,deprecate-code,guard-code --configuration=check --base=main

All checks must pass before proceeding. If any fail, triage each failure:

  • Format/lint: Fix the reported violations manually, then re-run.
  • Typecheck: Fix type errors — see write-typescript skill for patterns.
  • Spell-check: Either fix the typo, or add the word to the appropriate dictionary in configuration/.cspell/.
  • Knip (unused code): Remove the unused export/file/dependency, or add an exception in configuration/knip.config.ts.
  • Fallow dead-code (unused code): The same finding from the other direction — knip runs once per workspace, fallow once over all of them. The two configurations are kept in step, so fix the code and both pass; if an exception is genuinely warranted, add it to configuration/fallow.config.jsonc and its counterpart in configuration/knip.config.ts, or the next run of the other tool reports what you just excused. Prefer overrides to ignorePatterns when suppressing a file: ignorePatterns also drops what that file imports out of the module graph, which makes reachable files read as dead.
  • Sync checks: Run the failing synchronization's own write configuration (e.g., nx run synchronization:conventional-config:write), or nx run-many --targets=conformetry-generators,conventional-config,devcontainer-configuration,pull-request-template,skill-exclusions --configuration=write for every derivation at once.
  • Check skill exclusions: Add the exclusion lines the failure names to configuration/.prettierignore, configuration/.codometerignore, and .gitattributes. This leaf has no write variant.

See triage-integration for detailed per-tool fix instructions.

Step 3 — Done

Once both write and check pass cleanly, code quality is confirmed. Proceed to commit or hand off.

Step 4 — Coverage Gate (when required)

lint-code does not enforce Vitest coverage thresholds. If the task, project, or CI requires a coverage target, run the coverage configuration explicitly after Step 3:

pnpm exec nx run <project>:vitest --configuration=coverage

If the threshold fails by a small margin, prioritize adding targeted tests for uncovered guard branches (if (!value), fallback paths, sparse/undefined handling) instead of broad test rewrites.

Step 5 — Type Coverage Gate (TypeScript projects with target)

If a touched TypeScript project defines a type-coverage target, treat it as a required gate and run it explicitly after Step 3.

pnpm exec nx run <project>:typecheck
pnpm exec nx run <project>:type-coverage

✅ Best practice: Run typecheck and type-coverage back-to-back for the same project while stabilizing changes to avoid late iteration loops.

Common Patterns

New TypeScript files added

# Target the specific project since affected may not pick up new files
pnpm exec nx run <project>:typecheck-code,lint-code,format-code,deprecate-code,guard-code --configuration=write
pnpm exec nx run <project>:typecheck-code,lint-code,format-code,deprecate-code,guard-code --configuration=check

Refactor-heavy test changes

# 1) Auto-fix + quality checks
pnpm exec nx run <project>:typecheck-code,lint-code,format-code,deprecate-code,guard-code --configuration=write
pnpm exec nx run <project>:typecheck-code,lint-code,format-code,deprecate-code,guard-code --configuration=check

# 2) Re-verify coverage gates explicitly
pnpm exec nx run <project>:vitest --configuration=coverage

# 3) If available, enforce type coverage gate too
pnpm exec nx run <project>:typecheck
pnpm exec nx run <project>:type-coverage

New skill added

A skill is one directory, .agents/skills/<skill-name>/SKILL.md. .claude/skills and .github/skills are symlinks to .agents/skills, so that one copy already serves both harnesses — there is no second copy to create and no table of contents to regenerate. AGENTS.md deliberately does not list the skills; agents are handed the installed set directly.

The only extra command applies to a skill installed from another repository, which skills update records in skills-lock.json:

# Regenerate the exclusion blocks that keep locked skills out of prettier,
# codometer, Linguist, cspell, and markdownlint
pnpm exec nx run synchronization:skill-exclusions:write

AGENTS.md edited

The types and scopes tables in AGENTS.md are generated between marker comments from configuration/conventional.config.cjs. Edit the config, never the table, then regenerate:

pnpm exec nx run synchronization:conventional-config:write
pnpm exec nx run synchronization:conventional-config:check

Everything outside those markers is hand-written and needs no synchronization run.

Resources

发现
标签

此技能尚未发布标签。

版本
最新版本元数据

版本

v2026.09.24

发布时间

Sep 24, 2026

分类

未分类

许可证

MIT

源路径

.agents/skills/validate-code

默认分支

main

最新提交

5ac136d

Tree SHA

9af071d