Review

code-quality

A quality method for plan, code and review work, with numbers from open tools and a report.

Why this skill exists

"Review this code" gives an opinion. The opinion changes from one run to the next, and it talks about old code that the change did not touch. A team cannot track an opinion. This skill gives each metric an ID and a threshold, and it applies them to new and changed code only. The numbers come from tools that you can run without skillsaw.

When to use it

Use it when you plan, write or review code, and before a pull request. It has three roles:

The Review role, step by step:

  1. Find the tools. quality doctor shows each tool as present or missing, with its install command. A missing tool is not a failure: its metrics show as "not measured".
  2. Measure. quality measure runs lizard, the linter of the language and a dependency tool on the changed files, and joins their output.
  3. Read the diff. The agent looks for what tools cannot see: an implicit state machine, a string comparison where an enum is necessary, a query in a loop, a change of behaviour with no test.
  4. Write the findings. Each finding has a metric ID, a level (Important, Nit or Good), a file, evidence and a fix.
  5. Build the report. quality report writes the page, adds one point to the history, and writes the index.
IDMetricDefault limitMeasured by
CQ-HEALTHHealth of the change, 0 to 100Does not go downskillsaw, from the lizard values
CQ-CCCyclomatic complexity of a function10lizard
CQ-FLOCCode lines of a function50lizard
CQ-PARAMParameters of a function5lizard
CQ-NESTNested control structures5lizard
CQ-LOCCode lines of a fileA file does not grow past 400lizard
CQ-BRANCH, CQ-SIMPBranches and simplification smells0 new findingsThe linter of the language
CQ-COUPCoupling of a moduleInstability goes up by 0.05 or lessThe dependency tool of the language
SM-RULE, CQ-ENUM, CQ-N1, CQ-COV, CQ-LCOM4State machines, enums, query counts, tests, cohesion0 newThe agent, by review

Some languages have other defaults. For example, a Ruby function has a limit of 25 code lines, and Go has a complexity limit of 15.

Hints after each edit

npx @skillsaw/cli hints <file> gives hints on the lines that the agent just changed: a function above a limit, a file that grows too long. The Claude Code plugin runs it as a hook after an edit. A hint is advice. It never stops the agent.

The limits of the measurement

The interview from a real run

The request named the role and the base, so the agent asked only about the missing tools and about where to keep the report. The third question is the livery question: it was asked one time, in the planning chain.

The request

Review the quality of this branch against main.

The agent found these answers in the repo. It did not ask these questions.

  • Which role do you want: plan, code or review?

    Review.

    Source The request names the role ("Review the quality of this branch").

  • Which base do you want for the comparison?

    origin/main (28deb79). The head is feat/design-skill at 6929aff.

    Source The request ("against main"), git rev-parse origin/main, and the base that quality measure found.

  • Does the change go through a state machine or a domain value?

    Yes. The diff adds two Machine classes (docs-app/designs/order/machine.ts, docs-app/designs/text-editor/machine.ts), a status field of a design, and comparisons of state types with string literals. The review read the full diff for SM-RULE and CQ-ENUM.

    Source git diff origin/main...HEAD

  • Which name, accent colour and logo do the pages of this repo get? (the name and the logo)

    Name: Switchyard. Logo: docs/logo.svg (the same file as docs/site/logo.svg).

    Source README.md title, docs/logo.svg. livery show gave exit code 1, so the procedure of skillsaw-interviews.md section 6 ran.

A skip rule of the question bank removed these questions.

  • Which thresholds does the team want different from the defaults?

    Skip when the role is Review of one change. The repo had no .skillsaw/config.json; the defaults apply.

  • A changed function breaks a threshold. What do you want to do with it?

    Skip when the role is Review.

  • Who is the owner of the report?

    Always skip, unless the user asks for a name on the report. The owner is the git user (Joe Gaudet).

The maintainer saw these questions. The first option is the recommended one.

Question 1 of 3

skillsaw quality doctor shows that lizard and dependency-cruiser are missing for switchyard. Which tools do you want to install for the quality review of the design-skill change?

  • lizard only Recommended Chosen

    lizard gives the health score and all function metrics; without it, quality measure shows 'not measured' for each of the 24 files of this change.

  • All missing tools

    lizard and dependency-cruiser: the report then also has the coupling graph; dependency-cruiser becomes a dev dependency of the repo.

  • None

    Nothing is installed; the report has only the eslint findings and the findings of the reviewer, with no health score.

Question 2 of 3

Do you want the skillsaw quality report of the design-skill change in the switchyard repo?

  • Yes, in the repo Recommended Chosen

    docs/quality/ and .skillsaw/quality-history.json are ready to commit, so the trend of the branch works; the agent does not commit them.

  • Keep them local

    The agent adds the quality folder and the history file to .gitignore, and the report stays on this machine.

  • Summary only

    The agent prints the summary and keeps no page.

Question 3 of 3

The switchyard repo has no skillsaw livery. Which accent colour do you want for the skillsaw pages of switchyard (project name: Switchyard)?

  • Indigo #4f46e5 Recommended Chosen

    It is --brand-indigo, the primary colour of the Switchyard site (docs/site/site.css:5), so the pages agree with the site.

  • Amber #f59e0b

    It is --brand-amber, the second brand colour of the site; it gives less contrast for links and tags.

  • Slate #475569

    It is the default of skillsaw; the pages then do not look like Switchyard.

Note. Asked one time, in the feature-one-pager interview of the planning chain. This clone had no livery, so the code-quality skill did the livery procedure and used that answer.

The agent recorded these assumptions. Nobody answered them.

  • Folders (skillsaw-interviews.md section 7): docs/ of switchyard has a different use (docs/site is the published site, docs/api is generated). The maintainer was not asked the folder question. The recommended option applies: a folder that the site does not publish. The workflow .github/workflows/pages.yml publishes only docs/site and docs/api, so the default folders (docs/quality and the four others) are such folders. The agent wrote them with skillsaw docs set.
  • Format check (section 7, step 6): the repo has a Prettier gate (pnpm format:check). The agent added the five artifact folders to .prettierignore.
  • lizard: quality doctor gave the install command pipx install lizard. This machine has no pipx. The agent made a virtualenv outside the clone (python3 -m venv, then pip install lizard) and put its bin folder first on PATH.
  • The answer "Yes, in the repo" lets the report, the index and .skillsaw/quality-history.json stay in the tree as files that are not ignored. The code-quality skill itself made no commit; the pr skill committed them in its step 4.
  • Each run writes a new folder: 2026-12-02-feat-design-skill for the review, then 2026-12-02-feat-design-skill-02 and -03 for the two polish rounds. The output also has them as review/, round-1/ and round-2/.

The artifact from that run

The change is the branch feat/design-skill of switchyard: 52 files and 7,467 added lines. There are three reports, one for each point: the review, and the two polish rounds. Each report has its own folder, and the history table of a report links the other two. Use the filters by level and by file in the findings.

PointHeadHealthDirectionImportantNitGoodAccepted
Review6929aff64UP241550
After round 1debe71e69UP251496
After round 238a5b0f74UP512916

The broken limits were 29 at the review, 37 after round 1 and 26 after round 2. The report of round 1 is a page too.

These scores were computed again. The first run showed 63, then 68, then 74, and the direction of the report changed from DOWN to UP between two runs with the same base. This was a defect in the base score: the set of functions for the score before changed with each head, so the base was 70, 70 and 48. After the fix, the base score is 63 at each point, and the scores are 64, 69 and 74. The findings and the fixes are from the first rounds.

The report of the review, liveOpen the full page · The index
The report after polish round 2, liveOpen the full page · The index
The quality report in the light theme at 1280 px
Light, 1280 px
The quality report in the dark theme at 1280 px
Dark, 1280 px
The quality report on a phone at 390 px
Phone, 390 px

The commands

dependency-cruiser was missing and the maintainer chose "lizard only", so the coupling metric shows as "not measured" in this run.

skillsaw quality doctor   # before the install: lizard and depcruise missing
python3 -m venv <S>/examples/venv && <S>/examples/venv/bin/pip install -q lizard
export PATH=<S>/examples/venv/bin:$PATH
skillsaw quality doctor   # lizard present, depcruise missing
git status --short && git branch --show-current
git diff --stat origin/main...HEAD
skillsaw quality measure --base origin/main
skillsaw quality measure --base origin/main --json
skillsaw livery show   # exit code 1: no livery
skillsaw livery set --name "Switchyard" --accent '#4f46e5' --logo docs/logo.svg
skillsaw docs show
skillsaw docs set --adr docs/adr --prd docs/prd --one-pager docs/one-pagers --walkthrough docs/walkthroughs --quality docs/quality
git diff origin/main...HEAD   # read in full for each TypeScript source file; the tests, ui.html, player.html, the Markdown files and pnpm-lock.yaml were skimmed
node packages/cli/dist/cli.js design new|check <a probe design>   # to make sure that two findings are real; the probe folder was removed
printf ... >> .prettierignore   # the five artifact folders
skillsaw quality report --base origin/main --findings <S>/examples/tmp/review-findings.json
skillsaw quality check docs/quality/2026-12-02-feat-design-skill/index.html   # correct
node <S>/examples/tmp/shots.mjs <report> <index> <out>/screens review   # headless Chromium: no console errors, filters used

<S> and <out> are the scratch folders of the run.

What we learned from this run

The review took 20 minutes of agent time. Most of that was the read of 4,600 lines of TypeScript. The quality runs found 23 problems.

Still open: the linter step for Go, Java, Kotlin and C# is not verified against a real tool run, and a finding of the level Good can replace a measured limit in the report.

Config keys

All keys are optional. The livery keys apply to the report.

KeyDefaultMeaningWho reads it
docs.qualitydocs/qualityThe folder of the quality reports.CLI
quality.baseThe base of the pull request, then origin/main, origin/master, main, masterThe git ref that quality measure and quality report compare with. --base wins.CLI: src/quality/measure.ts
quality.thresholds.<key>cc 10, floc 50, param 5, nest 5, loc 400, coupDelta 0.05, coupImporters 10, with other defaults for some languagesA threshold for all languages.CLI: src/quality/spec.ts, for quality and hints
quality.thresholds.<language>.<key>NoneA threshold for one language: typescript, python, ruby, go, java, kotlin, csharp, rust.CLI: src/quality/spec.ts
rules.libraries.<language>.stateMachineThe table in state-machines.mdThe state machine library of one language.Agent: the rule state-machines.md
rules.libraries.<language>.enumThe table in enum-comparisons.mdThe enum library or feature of one language.Agent: the rule enum-comparisons.md