Skip to content
cccskills

Test log of code-review

For each task: the request, the rubric and the score for each item, time and tokens for every run, Claude Code’s full logs, and the files it produced. The raw data is here too, so the score can be recomputed if the weighting changes.

Run on Nov 11, 2026 (runs: claude-sonnet-5-5 / judge: claude-opus-5-5). Figures are medians. The tasks were written by AI from SKILL.md, so they may lean toward situations where the skill helps.

Raw data (JSON)Tasks, per-run measurements, judgments and the summary as stored.

Measurements per run

RunResultTimeTokensCostTurnsSkill usedLog
Task 1 Run 1 Without skillDone17s52,023$0.0536-Full log
Task 1 Run 1 With skillDone15s51,104$0.0457YesFull log
Task 1 Run 1 With skill (not named)Done18s51,320$0.0477YesFull log
Task 1 Run 2 With skillDone16s51,307$0.0247YesFull log
Task 1 Run 2 Without skillDone15s51,784$0.0316-Full log
Task 1 Run 2 With skill (not named)Done15s51,051$0.0227YesFull log
Task 1 Run 3 Without skillDone15s51,781$0.0306-Full log
Task 1 Run 3 With skillDone13s50,932$0.0207YesFull log
Task 1 Run 3 With skill (not named)Done13s50,837$0.0277YesFull log
Task 2 Run 1 Without skillDone14s51,215$0.0413-Full log
Task 2 Run 1 With skillDone19s88,211$0.0586YesFull log
Task 2 Run 1 With skill (not named)Done16s68,418$0.0465YesFull log
Task 2 Run 2 With skillDone19s88,261$0.0426YesFull log
Task 2 Run 2 Without skillDone16s52,118$0.0324-Full log
Task 2 Run 2 With skill (not named)Done16s68,187$0.0315YesFull log

“With skill (not named)” runs only measure the pick-up rate and are not judged.

Task 1: Review a PR adding a new CLI command against design docs and tests

Request

Can you review the pull request in PR.md before I approve it? It adds a new `specify lint-names` command. Our design docs are in design/ and the glossary is in docs/glossary.md. Please don't change any code. Just give me review findings ordered by severity, and say whether it's ready to merge.

Rubric

  1. Points out that the command module does its own filesystem access (os.listdir/os.path.isdir) instead of calling a service, and cites design/cli.md section 1 (Command boundaries)
  2. Points out that with --json, stdout also gets "Checking stories..." (and possibly other text), so it is not a single JSON document, citing design/cli.md section 2
  3. Points out that a missing directory exits with 1 when it should exit with 2 (usage error), citing design/cli.md section 3
  4. Notes that the tests only cover the success path and that tests for invalid names, a missing directory, and --json output are missing
  5. Notes that the user-facing text uses "story/stories" where docs/glossary.md calls these "feature spec"
  6. Leaves the code unchanged, orders the findings by severity, and clearly says the PR is not ready to merge

Score per rubric item (1 = met, 0.5 = partly, 0 = not met)

#Run 1
Without skill / With skill
Run 2
Without skill / With skill
Run 3
Without skill / With skill
11 / 11 / 11 / 1
21 / 11 / 11 / 1
31 / 11 / 11 / 1
41 / 11 / 11 / 1
51 / 11 / 11 / 1
61 / 0.51 / 11 / 0.5
Starting files(4)

design/cli.md

# CLI Design

## 1. Command boundaries
Command modules in `src/specify_cli/commands/` only parse arguments, call a service in `src/specify_cli/services/`, and render the result. Command modules must not read or write project files directly; all filesystem access lives in services.

## 2. Output
Human-readable output goes through `ui.render()`. When `--json` is passed, stdout must contain exactly one JSON document and nothing else; progress messages and diagnostics go to stderr.

## 3. Exit codes
- 0: success, no problems found
- 1: the command ran and found validation problems
- 2: usage error (bad arguments, missing paths)

Services must never call `sys.exit`; only the command layer maps results to exit codes.

## 4. Testing
Every command needs tests for the success path and for its failure paths (validation failure and usage error), including `--json` output.

design/workflow-step.md

# Workflow Step Types

Step types are declared in `workflow/steps.py`. Each step has `name`, `inputs`, and `run()`. Not relevant to CLI command additions unless a step is added.

docs/glossary.md

# Glossary

- **feature spec**: a `spec.md` file under `specs/<NNN-name>/`. Do not call these "stories" or "tickets".
- **agent**: a supported AI coding agent (Claude, Copilot, ...). Do not use "assistant" or "bot".
- **project**: the user's repository initialised with `specify init`.

PR.md

# PR #412: Add `specify lint-names` command

Adds a command that checks story directory names follow the `NNN-kebab-name` pattern.

```diff
diff --git a/src/specify_cli/commands/lint_names.py b/src/specify_cli/commands/lint_names.py
new file mode 100644
--- /dev/null
+++ b/src/specify_cli/commands/lint_names.py
@@ -0,0 +1,34 @@
+import json
+import os
+import re
+import sys
+
+import typer
+
+PATTERN = re.compile(r"^\d{3}-[a-z0-9-]+$")
+
+
+def lint_names(path: str = "specs", as_json: bool = typer.Option(False, "--json")):
+    """Check that every story folder is named correctly."""
+    print("Checking stories...")
+    if not os.path.isdir(path):
+        print(f"No such directory: {path}")
+        sys.exit(1)
+
+    bad = []
+    for entry in sorted(os.listdir(path)):
+        if not PATTERN.match(entry):
+            bad.append(entry)
+
+    if as_json:
+        print(json.dumps({"invalid": bad}))
+    else:
+        for name in bad:
+            print(f"Invalid story name: {name}")
+
+    if bad:
+        sys.exit(1)
+    print("All stories look good!")
+
diff --git a/src/specify_cli/__init__.py b/src/specify_cli/__init__.py
--- a/src/specify_cli/__init__.py
+++ b/src/specify_cli/__init__.py
@@ -10,6 +10,8 @@ from .commands.init import init
 from .commands.check import check
+from .commands.lint_names import lint_names
 
 app.command()(init)
 app.command()(check)
+app.command("lint-names")(lint_names)
diff --git a/tests/test_lint_names.py b/tests/test_lint_names.py
new file mode 100644
--- /dev/null
+++ b/tests/test_lint_names.py
@@ -0,0 +1,12 @@
+from typer.testing import CliRunner
+
+from specify_cli import app
+
+
+def test_lint_names_ok(tmp_path):
+    (tmp_path / "001-login").mkdir()
+    (tmp_path / "002-user-profile").mkdir()
+    result = CliRunner().invoke(app, ["lint-names", "--path", str(tmp_path)])
+    assert result.exit_code == 0
+    assert "All stories look good!" in result.output
```

Run 1: Without skill (Rubric met 100% / 91.7%)

Both cover all key findings, but A ranks a wrong Typer claim as high severity, skewing its ordering, so B wins.

Without skill100%

Final message

Review of PR #412: specify lint-names

Not ready to merge. It breaks several explicit rules in design/cli.md, and --json output is invalid. I only read the PR and the docs, and I didn't run anything.

High

  1. --json output isn't a single JSON document (lint_names.py:23,41, design §2).

    • "Checking stories..." is printed to stdout before the JSON. On success, "All stories look good!" is printed after it.
    • So specify lint-names --json | jq fails every time.
    • Progress and diagnostics belong on stderr, and in JSON mode stdout should contain only the document.
  2. Wrong exit code for a missing directory (lint_names.py:24-26, design §3).

    • A missing path is a usage error and must exit 2. The PR exits 1, which means "validation problems found".
    • CI can't tell a typo in the path apart from a real lint failure.
    • In --json mode this case also emits no JSON at all.
  3. Command module does filesystem access directly (lint_names.py:24,29, design §1).

    • os.path.isdir and os.listdir must live in a service under src/specify_cli/services/.
    • The service should return a result, and the command should only parse arguments, call the service, render, and map the exit code.
    • Since services can't call sys.exit (§3), the command layer should own the exit codes.
  4. Tests cover only the success path (tests/test_lint_names.py, design §4).

    • There is no test for a validation failure (exit 1), a usage error (exit 2), or --json output.
    • The missing --json test is how bug 1 got through.

Medium

  1. Wrong rendering path (design §2). Output uses bare print() instead of ui.render().

  2. False positives on non-directory entries (lint_names.py:29-31).

    • Every entry in specs/ is checked, including regular files and hidden entries such as .DS_Store, .gitkeep and README.md.
    • The command says it checks "story folders", so it should skip entries that aren't directories. It should probably skip hidden entries too.
    • Any repo with a stray file in specs/ will fail the lint.
  3. Pattern accepts malformed names (lint_names.py:18).

    • [a-z0-9-]+ allows 001-, 001--x and 001-foo-, which aren't valid kebab-case.
    • Suggested fix: ^\d{3}-[a-z0-9]+(-[a-z0-9]+)*$.
    • Add tests for these names.

Low

  1. Glossary violation.

    • The glossary says not to call these "stories". The unit is a feature spec under specs/<NNN-name>/.
    • The PR title, docstring, "Checking stories...", "Invalid story name" and "All stories look good!" all use "stories".
    • The user-facing strings should say "feature spec".
    • The docstring says "every story folder" while the code checks every entry, which compounds item 6.
  2. Text-mode output on success. It prints the success banner even when nothing was checked, for example when specs/ is empty. Consider reporting the count, or whether anything was checked.

  3. JSON schema is minimal. {"invalid": [...]} has no ok or checked field. This is fine if intended, but it should be documented. The design docs don't define a schema.

Suggested path to merge

Move the directory scan into a service that returns the invalid names or a "path not found" error. The command then maps path-not-found to exit 2, invalid names to exit 1, and success to 0. Route output through ui.render(), with JSON mode emitting only the document and progress going to stderr. Filter to directories, tighten the regex, rename "stories" to "feature specs", and add tests for exit 1, exit 2 and --json on each path.

Files created or changed

No files changed.

With skill91.7%

Final message

Review of PR #412: specify lint-names

Verdict: not ready to merge. There are two blocking design violations, a functional bug, and a test gap.

Findings, most severe first

1. --json output isn't a single JSON document (high). design/cli.md §2 says stdout must hold exactly one JSON document, with progress and diagnostics on stderr.

  • Line 23 prints Checking stories... to stdout unconditionally.
  • Line 41 prints All stories look good! to stdout. When --json is set and nothing is invalid, stdout is Checking stories..., then the JSON, then the success line. That is not parseable JSON.
  • Line 25 prints the missing-directory error to stdout in the same way.

2. Wrong exit code for a missing path (high). design/cli.md §3 says usage errors, including missing paths, exit with 2. Line 26 exits with 1, which the design reserves for "ran and found validation problems". A script can't tell a missing directory from a naming violation.

3. The command module does filesystem access and exits directly (high). design/cli.md §1 says command modules only parse arguments, call a service in services/, and render the result. They must not read project files directly.

  • os.path.isdir and os.listdir in commands/lint_names.py break this. The PR adds no service.
  • §3 says only the command layer maps results to exit codes. That part is fine here, but the logic should move to a service that returns a result.
  • Output uses print() rather than ui.render() (§2).
  • Nothing in the PR says this is an intentional design change, and design/cli.md isn't updated. So it reads as an unexplained violation.

4. Test coverage is incomplete (high). design/cli.md §4 requires tests for the success path and for the failure paths (validation failure and usage error), including --json. The PR has one test, the happy path without --json. Missing:

  • an invalid name, checking exit code 1 and the output
  • a missing directory, checking exit code 2
  • --json in each of the three cases, checking that stdout parses as one document

5. path is a positional argument, but the test passes --path (high, probably broken). path: str = "specs" has no typer.Option, and Typer makes a parameter with a default an option only when it's declared as typer.Option. A plain default string becomes an optional argument, so --path would fail with exit code 2. The one test should then fail. Please confirm it passes in CI. If it does, I've misjudged Typer's behaviour here. Either way, make the declaration explicit.

6. Files are linted as if they were directories (medium). os.listdir returns files too, so specs/README.md or .DS_Store is reported as an invalid story name and fails the command. The check should cover directories only. Hidden entries should be skipped, or the choice documented.

7. Terminology doesn't match the glossary (medium). docs/glossary.md defines the term as "feature spec" and says not to use "stories". The PR uses "stories" in the PR description, the docstring, Checking stories..., Invalid story name, and All stories look good!. These should say "feature spec" (or "feature spec directory").

8. The pattern's alignment with the glossary is unverified (low). The glossary names the layout specs/<NNN-name>/. The pattern ^\d{3}-[a-z0-9-]+$ allows 001--x and 001-x-. Consider ^\d{3}-[a-z0-9]+(-[a-z0-9]+)*$. Also, \d matches non-ASCII digits in Python 3, so use [0-9].

9. Smaller points (low). The sys and os imports go away once the logic moves to a service. The docstring "named correctly" is vague. It should name the NNN-kebab-name pattern.

What needs to change

  • Move the scanning into a service that returns a result, and render it through ui.render().
  • Send progress to stderr, or drop it.
  • Exit 2 for usage errors.
  • Add the missing tests.
  • Fix the terminology.

I didn't run anything, because the repo has no source tree, only PR.md. I couldn't confirm finding 5 or check that the tests pass.

Files created or changed

No files changed.

Run 2: Tie (Rubric met 100% / 100%)

Both cover all six points with correct citations, order by severity, and say not ready to merge.

Without skill100%

Final message

Not ready to merge. It has one functional bug that breaks --json, and several violations of design/cli.md.

Findings, most severe first

1. High: --json output is not valid JSON. lint_names.py:23 and :41

  • print("Checking stories...") goes to stdout before the JSON is emitted.
  • On success, print("All stories look good!") also goes to stdout after the JSON.
  • Both break the rule in cli.md §2 that stdout contains exactly one JSON document. Anything that parses the output, such as specify lint-names --json | jq, will fail.
  • Fix: send progress messages to stderr, or suppress them in JSON mode. Print the success message only in non-JSON mode.

2. High: the command touches the filesystem directly. lint_names.py:24,29

  • cli.md §1 says command modules must not read project files. The command calls os.path.isdir and os.listdir itself.
  • The directory scan and name validation belong in a service under services/. The command should only parse arguments, call the service, and render the result.
  • Services must also not call sys.exit (§3). Only the command layer should map results to exit codes.

3. High: wrong exit code for a missing directory. lint_names.py:26

  • A nonexistent path is a usage error, which should exit with 2 under cli.md §3. It exits with 1, which means "validation problems found".
  • CI can't tell "bad invocation" from "bad names" with this code.
  • The message also goes to stdout, so with --json it pollutes the output. It should go to stderr.

4. Medium: the tests don't meet cli.md §4. tests/test_lint_names.py

  • There is only a success-path test. The design requires tests for these cases too:
    • the validation failure (exit 1 with the invalid names listed)
    • the usage error (exit 2 for a missing directory)
    • --json output on both the success and failure paths
  • Tests for the --json cases would have caught finding 1.

5. Medium: the path argument is probably not what the test assumes. lint_names.py:21, test_lint_names.py:66

  • path: str = "specs" has a plain default, so Typer treats it as an optional argument, not an option. The test passes --path <dir>, which Typer would reject with "No such option". The test would then fail with exit code 2, not the expected 0.
  • I haven't run it, so please confirm in CI.
  • Either declare it with typer.Option("--path") or change the test to pass the path positionally. Decide which interface is intended.

6. Medium: human output bypasses ui.render(). lint_names.py:23,25,37,41

  • cli.md §2 requires human-readable output to go through ui.render(). The command uses raw print throughout.

7. Medium: it validates every directory entry, including files. lint_names.py:29-31

  • os.listdir returns files as well as directories. A README.md or .DS_Store in specs/ would be reported as an invalid story name.
  • It should check only directories, and probably skip hidden entries.
  • The design doesn't say what the rule should be, so the PR should state it.

8. Low: terminology doesn't match the glossary. lint_names.py:22,37,41, PR title

  • The glossary says "feature spec", not "story". The docstring, the messages ("Invalid story name", "All stories look good!") and the PR description all use "story".
  • Messages should say "feature spec" or "spec directory". The JSON key invalid is fine.

9. Low: minor items.

  • The command and PR don't say whether the name pattern matches the <NNN-name> convention in the glossary. [a-z0-9-]+ also allows 001- and 001--x. A stricter pattern such as ^\d{3}-[a-z0-9]+(-[a-z0-9]+)*$ would match "kebab-name" more closely.
  • The import re and PATTERN setup are fine, but the loop at :29-31 could be a list comprehension.
  • import sys goes away once the exit handling moves out to the command layer.

Summary

The registration in __init__.py is correct. The main work is moving the filesystem logic into a service, fixing the stdout and stderr handling and the exit code, and adding the missing tests. Findings 1–4 should be fixed before approval. Finding 5 needs a quick check of how Typer parses path.

I made no code changes.

Files created or changed

No files changed.

With skill100%

Final message

Review of PR #412: specify lint-names. I read design/cli.md and docs/glossary.md. design/workflow-step.md doesn't apply to this PR. I didn't run the code. Everything below comes from reading the diff.

Not ready to merge. There are two blocking correctness bugs and several design violations.

High

  1. --json output isn't valid JSON (lint_names.py:23,41, design/cli.md §2). The command prints "Checking stories..." to stdout before anything else. On success it also prints "All stories look good!" after the JSON document. §2 requires stdout to hold exactly one JSON document, with progress and diagnostics on stderr. Any consumer parsing --json output will fail.

  2. The command reads the filesystem directly (lint_names.py:24,29, design/cli.md §1). os.path.isdir and os.listdir are called in the command module. §1 says command modules only parse arguments, call a service in services/, and render. All filesystem access belongs in a service, and there is no service here. The pattern check is also business logic that belongs in the service.

  3. The path argument is wrong, so the test probably fails (lint_names.py:21, test_lint_names.py:66). path: str = "specs" has no typer.Option or typer.Argument, so Typer treats it as a positional argument. The test invokes --path, which Typer would reject as an unknown option with exit code 2. The "success" test likely fails as written. If you want an option, write typer.Option("specs", "--path").

  4. Exit code for a missing path is wrong (lint_names.py:26, design/cli.md §3). A missing directory is a usage error and must exit 2. The PR exits 1, which §3 reserves for validation problems. sys.exit is also called inside the command body. That is allowed in the command layer, but it should map a service result rather than be scattered through the function.

  5. The check flags files, not just story folders (lint_names.py:29-31). It matches every entry in specs/, including README.md, .DS_Store and other regular files. These are reported as invalid names. The docstring says "story folder", but the code never calls isdir on the entries. It should skip non-directories.

Medium

  1. Tests miss most of what design/cli.md §4 requires. Only the success path is tested. These are missing:

    • A validation failure that exits 1.
    • A usage error for a missing path that exits 2.
    • Any --json output, success or failure.
    • Edge cases such as non-directory entries and uppercase or malformed names.

    The one test that exists is probably broken (item 3).

  2. Human output bypasses ui.render() (lint_names.py:23,37,41, design/cli.md §2). The command uses bare print() calls instead of ui.render().

  3. Terminology doesn't match the glossary (docs/glossary.md). The docstring, the messages ("Checking stories...", "Invalid story name", "All stories look good!") and the PR description all say "story". The glossary says these are "feature specs" and "Do not call these 'stories'". The command name lint-names and the stories wording should use "feature spec". For example: "Invalid feature spec name: …".

Low

  1. Unused import and no module documentation. sys is only used for sys.exit, so it is fine, but typer's Option is used only for --json. The PR adds no docs or help text for the new command, and the one-line docstring is the only help.

  2. Pattern limits are unexplained (lint_names.py:18). ^\d{3}-[a-z0-9-]+$ accepts names such as 001-- or 001--prefixed double hyphens, and trailing hyphens. The glossary calls the format <NNN-name>. If "kebab" is meant strictly, the pattern should be ^\d{3}-[a-z0-9]+(-[a-z0-9]+)*$.

Design-change check

Nothing in the PR says it intentionally departs from design/cli.md, and it doesn't edit the design docs. So items 1, 2, 4 and 7 are unexplained violations, not deliberate design changes.

Bug-fix regression evidence

This PR adds a feature, not a bug fix, so no regression test is required.

To make it mergeable:

  • Move the scanning and validation into a services/ module that returns a result and never calls sys.exit.
  • Keep the command thin: parse arguments, call the service, render, and map exit codes (0, 1 or 2).
  • Send the progress message to stderr, or drop it, and emit a single JSON document under --json.
  • Fix the path option.
  • Skip non-directory entries.
  • Use "feature spec" wording.
  • Add the missing failure-path and --json tests.

Files created or changed

No files changed.

Run 3: Without skill (Rubric met 100% / 91.7%)

Both cover all findings, but A ranks a false claim that --path doesn't exist as High, which breaks its severity order.

Without skill100%

Final message

Verdict: not ready to merge. The PR breaks several rules in design/cli.md, and it has one functional bug.

Findings, most severe first

1. High: --json output is not a single JSON document (lint_names.py:23, 41; design/cli.md §2) print("Checking stories...") runs before anything else. In the success case, print("All stories look good!") runs after the JSON. Both go to stdout. Output with --json is therefore Checking stories...\n{"invalid": []}\nAll stories look good!, which no JSON parser accepts. Progress and diagnostics must go to stderr, and the "All stories look good!" line must not appear in JSON mode.

2. High: wrong exit code for a missing directory (lint_names.py:26; design/cli.md §3) A missing path is a usage error and should exit 2. The PR exits 1, which the design reserves for "ran and found validation problems". Scripts and CI can't tell a bad path from bad names.

3. High: the command touches the filesystem and calls sys.exit itself (lint_names.py:24, 29, 26, 40; design/cli.md §1, §3) The command calls os.path.isdir and os.listdir directly. The design requires that logic to live in src/specify_cli/services/. The command should only parse arguments, call a service and render the result. The command layer should map results to exit codes. The pattern check and directory scan should be a service function that returns results and never exits.

4. Medium: it lints every entry, including files (lint_names.py:29-31) It never checks is_dir(). A README.md, .DS_Store or .gitkeep in specs/ is reported as an "invalid story name" and fails the run. The PR describes the check as being for directories only. Hidden files and non-directories should be skipped.

5. Medium: tests miss the required failure paths and --json (tests/test_lint_names.py; design/cli.md §4) Only the success path is tested. The design requires tests for a validation failure, a usage error (missing path), and --json output. Tests for those would have caught findings 1 and 2.

6. Medium: the test relies on --path, which may not exist path is declared as a plain parameter with a default, and the PR does not use typer.Argument. In Typer, a parameter with a default becomes an option, so --path probably works. That is implicit and unclear, and it gives no help text. Make it explicit, and decide whether it is positional or an option.

7. Low: terminology breaks the glossary (lint_names.py:22, 37; PR title and description; docs/glossary.md) The glossary says not to call these "stories". It calls them feature specs, which are spec.md files under specs/<NNN-name>/. The docstring, the "Invalid story name" message, "Checking stories..." and "All stories look good!" should use "feature spec". A user-facing command named lint-names is fine, but its help text should say what it checks.

8. Low: output doesn't go through ui.render() (design/cli.md §2) Human-readable output uses raw print. It should use ui.render().

9. Low: the regex is loose and may disagree with the spec ^\d{3}-[a-z0-9-]+$ accepts names like 001--, 001- followed by trailing hyphens, and 001---foo. \d also matches non-ASCII digits in Python. Neither the PR nor the design says what "kebab" should mean. A stricter pattern such as ^[0-9]{3}-[a-z0-9]+(-[a-z0-9]+)*$ is safer. Also confirm that this pattern matches what specify init or other commands generate.

What I could not verify

  • I could not see the existing commands/init.py or commands/check.py, so I can't tell whether ui.render() and the services/ layer already exist, or how those commands handle exit codes.
  • I did not run the tests.

To get to mergeable

Fix findings 1–5 at minimum. Findings 1–3 each contradict an explicit rule in design/cli.md. Findings 6–9 can go in the same revision or a follow-up.

Files created or changed

No files changed.

With skill91.7%

Final message

Review of PR #412: specify lint-names

Not ready to merge. There are two functional bugs and several mismatches with design/cli.md. The test coverage is also incomplete.

High

  1. --json output is not valid JSON. lint_names.py:23 prints "Checking stories..." to stdout before anything else. Line 41 prints "All stories look good!" to stdout after the JSON on a clean run. design/cli.md §2 requires stdout to hold exactly one JSON document, with progress and diagnostics sent to stderr. Any consumer parsing --json output will fail on every run.

  2. The test invokes an option that doesn't exist. tests/test_lint_names.py:66 passes --path. The path: str = "specs" parameter on line 21 has no typer.Option, so typer makes it a positional argument. The test should fail with a usage error (exit code 2), not pass. Please run it. If it somehow passes, that needs explaining.

  3. Non-directory entries are flagged as invalid. Line 29 uses os.listdir without checking isdir. A stray README.md or .DS_Store in specs/ makes the command fail with exit code 1. The command is meant to check directory names, so files should be skipped.

Medium

  1. Command module accesses the filesystem directly. lint_names.py calls os.path.isdir and os.listdir itself. design/cli.md §1 says commands only parse arguments, call a service in services/, and render the result, and that all filesystem access lives in services. The naming logic should move to a service. I found no rationale in the PR for an intentional deviation, and design/cli.md is not updated, so this is an unexplained violation.

  2. Wrong exit code for a missing directory. Line 26 exits 1 for a nonexistent path. design/cli.md §3 reserves 1 for validation problems found and 2 for usage errors, including missing paths. Exit calls are also scattered through the command body rather than mapped from a service result.

  3. Output bypasses ui.render(). The command uses bare print throughout. design/cli.md §2 says human-readable output goes through ui.render(). The "No such directory" error should go to stderr.

  4. Missing negative tests. Only the success path is tested. design/cli.md §4 requires tests for these too:

    • Validation failure: invalid names give exit code 1.
    • Usage error: a missing path gives exit code 2.
    • --json output, for both clean and failing runs.

    Edge cases are also untested: files in the directory, an empty directory, uppercase names, and names such as 1-foo or 001-.

Low

  1. Glossary violation. The PR title, description, docstring, and messages say "story" and "stories" (for example "Invalid story name"). docs/glossary.md says to call these "feature spec", not "stories". The command should say "feature spec" or "spec directory". The design says nothing about naming the command lint-names, so you may want to confirm that name is intended.

  2. Regex accepts malformed names. ^\d{3}-[a-z0-9-]+$ allows 001--x, 001-x- and 001---. Also, $ matches before a trailing newline, so use fullmatch or \Z.

  3. Unused import and missing type annotations. The typer import is used, but --json is not documented with help text. No docs or changelog entry is included for the new command.

Not applicable: this is a new feature, not a bug fix, so no regression test is required. I didn't read design/workflow-step.md or any integration docs, since they don't apply. I haven't run the tests, because you asked for a review only. Finding 2 is based on reading the code.

Files created or changed

No files changed.

Task 2: Review a bug-fix PR that also edits the design doc, checking regression test validity

Request

Please review PR.md. It's a bug fix for issue #398, where running `specify init --ai copilot` twice duplicated the Copilot section in AGENTS.md. The author says the new test proves the fix, and they also updated the design doc so the change is "compliant". The relevant code is in src/. I just want your review findings and a merge recommendation. Don't change the code.

Rubric

  1. Points out that the new test calls init only once, so it would also pass without the fix and does not show that the bug existed before the change or is fixed after it. Suggests a test that runs init twice and checks for a single section
  2. Identifies that the real cause is in context.merge_section (the section is always appended, so it is not idempotent), and that the fix only hides the problem for Copilot. Claude, Gemini, and other agents still get duplicate sections
  3. Points out that `if ai == "copilot"` in init.py breaks the rule against branching on agent names, citing design/integration.md section 2, and also notes the conflict with the idempotency/re-run requirements in section 3 and/or section 4
  4. Says that adding an exception line to the design doc does not justify the change, because the PR gives no good reason for the exception and a general fix in merge_section is available
  5. Leaves the source files unchanged and gives a clear recommendation to request changes or not merge, with concrete next steps

Score per rubric item (1 = met, 0.5 = partly, 0 = not met)

#Run 1
Without skill / With skill
Run 2
Without skill / With skill
11 / 11 / 1
21 / 11 / 1
31 / 11 / 1
41 / 11 / 1
51 / 11 / 1
Starting files(5)

design/integration.md

# Agent Integration Design

## 1. Scope
An integration lets `specify init --ai <agent>` install commands and context for one agent.

## 2. Registration
Every agent integration is declared in the `INTEGRATIONS` registry in `src/specify_cli/integrations/registry.py`. Code outside the registry and the integration's own module must not branch on agent names (no `if agent == "copilot"`). Agent-specific behaviour is expressed through integration hooks.

## 3. Shared context files
Integrations write only inside their own directory (for example `.github/` for Copilot). Shared files such as `AGENTS.md` are updated only through `context.merge_section(path, section_id, body)`, which must be idempotent: running it again with the same `section_id` replaces the section instead of appending a new one.

## 4. Lifecycle
`init` must be safe to re-run. Re-running `init` with the same agent must leave the project in the same state as running it once.

src/specify_cli/context.py

import re
from pathlib import Path


def merge_section(path: Path, section_id: str, body: str) -> None:
    """Insert or replace a marked section in a shared context file."""
    start = f"<!-- specify:{section_id}:start -->"
    end = f"<!-- specify:{section_id}:end -->"
    block = f"{start}\n{body}\n{end}\n"
    text = path.read_text() if path.exists() else ""
    # BUG (#398): the pattern below does not match because the marker id is not escaped
    # and the section is always appended.
    pattern = re.compile(start + ".*?" + end + "\n", re.S)
    if pattern.search(text) and False:
        text = pattern.sub(block, text)
    else:
        text += block
    path.write_text(text)

src/specify_cli/commands/init.py

from pathlib import Path

from ..context import merge_section
from ..integrations.registry import INTEGRATIONS


def init(project: Path, ai: str) -> None:
    integration = INTEGRATIONS[ai]
    integration.install(project)
    agents_md = project / "AGENTS.md"
    # Workaround for #398: copilot section was duplicated on re-run
    if ai == "copilot" and agents_md.exists() and "specify:copilot:start" in agents_md.read_text():
        return
    merge_section(agents_md, integration.name, integration.context_body())

src/specify_cli/integrations/registry.py

class Integration:
    def __init__(self, name, folder, body):
        self.name = name
        self.folder = folder
        self._body = body

    def install(self, project):
        (project / self.folder).mkdir(parents=True, exist_ok=True)

    def context_body(self):
        return self._body


INTEGRATIONS = {
    "claude": Integration("claude", ".claude", "Use /specify commands."),
    "copilot": Integration("copilot", ".github", "Use the specify prompts."),
    "gemini": Integration("gemini", ".gemini", "Use specify commands."),
}

PR.md

# PR #401: Fix duplicated Copilot section in AGENTS.md (fixes #398)

Re-running `specify init --ai copilot` appended a second Copilot block to AGENTS.md. This PR skips the merge when the Copilot block already exists. I also updated the design doc to allow this kind of targeted fix. Added a test.

```diff
diff --git a/src/specify_cli/commands/init.py b/src/specify_cli/commands/init.py
--- a/src/specify_cli/commands/init.py
+++ b/src/specify_cli/commands/init.py
@@ -7,5 +7,9 @@ def init(project: Path, ai: str) -> None:
     integration = INTEGRATIONS[ai]
     integration.install(project)
-    merge_section(project / "AGENTS.md", integration.name, integration.context_body())
+    agents_md = project / "AGENTS.md"
+    # Workaround for #398: copilot section was duplicated on re-run
+    if ai == "copilot" and agents_md.exists() and "specify:copilot:start" in agents_md.read_text():
+        return
+    merge_section(agents_md, integration.name, integration.context_body())
diff --git a/design/integration.md b/design/integration.md
--- a/design/integration.md
+++ b/design/integration.md
@@ -6,6 +6,8 @@
 Every agent integration is declared in the `INTEGRATIONS` registry in `src/specify_cli/integrations/registry.py`. Code outside the registry and the integration's own module must not branch on agent names (no `if agent == "copilot"`). Agent-specific behaviour is expressed through integration hooks.
+
+Exception: `init` may special-case an agent when working around a known bug.
 
diff --git a/tests/test_init_copilot.py b/tests/test_init_copilot.py
new file mode 100644
--- /dev/null
+++ b/tests/test_init_copilot.py
@@ -0,0 +1,9 @@
+from specify_cli.commands.init import init
+
+
+def test_init_copilot_writes_section(tmp_path):
+    init(tmp_path, "copilot")
+    text = (tmp_path / "AGENTS.md").read_text()
+    assert "specify:copilot:start" in text
```

Note: the design/integration.md in this checkout does not yet include the PR's added exception line; src/ reflects the PR branch.

Run 1: Tie (Rubric met 100% / 100%)

Both flag root cause, design violation, doc loophole, weak test, and request changes; no real difference.

Without skill100%

Final message

Recommendation: do not merge. Request changes.

The PR hides the symptom for one agent and leaves the real bug in place. It also edits the design doc to allow the workaround, and the test doesn't cover the bug.

1. The root cause is untouched, and the fix covers only Copilot. src/specify_cli/context.py:14 has if pattern.search(text) and False:. The and False disables the replace branch, so merge_section always appends. That breaks the idempotency contract in design §3. The comment above it blames missing regex escaping, which is misleading.

  • Running init --ai claude or --ai gemini twice still duplicates the section, because the guard only checks ai == "copilot".
  • Removing and False fixes every agent.
  • I haven't run anything. This comes from reading the code.

2. The guard breaks the design rules, and the doc edit hides that.

  • init.py now branches on ai == "copilot", which design §2 explicitly forbids.
  • The PR adds "init may special-case an agent when working around a known bug". That is a loophole written to approve this one diff. It weakens an architectural rule and invites more agent-specific branches.
  • The change is therefore not compliant. It was made compliant by loosening the rule.
  • Revert the doc edit. The correct fix needs no exception.

3. The early return has side effects.

  • It exits init entirely, so any later steps added after the merge will be silently skipped for Copilot.
  • It skips the update path. If the integration's body text changes, a re-run won't refresh the section. Design §3 says the section should be replaced.
  • The check is a raw substring match on the marker. A partial or hand-edited block would also be skipped.

4. The test doesn't prove the fix. test_init_copilot_writes_section calls init once and checks that the marker exists. It passes without the PR, and it would pass with the bug still present. A real regression test would:

  • call init twice and assert the marker appears exactly once, or the file is identical after both runs (design §4);
  • do this for every agent in INTEGRATIONS;
  • call merge_section directly with changed content and assert the section is replaced.

5. Minor hardening, once the real fix is in.

  • Use re.escape(start) and re.escape(end) when building the pattern.
  • Use pattern.sub(lambda _: block, text). As written, sub(block, ...) treats backslashes in the body as replacement escapes.

Suggested path. Remove the guard in init.py and the doc exception. Delete and False from merge_section, add the escaping and lambda hardening, and add the idempotency tests above. That is a smaller diff than this one and fixes #398 for all agents.

Files created or changed

No files changed.

With skill100%

Final message

Recommendation: request changes (do not merge).

The PR hides the symptom for copilot only. It leaves the actual bug in place and weakens the design doc to excuse the workaround.

  1. Root cause not fixed. src/specify_cli/context.py:14 has if pattern.search(text) and False:, so merge_section never replaces a section and always appends. The regex also doesn't escape the marker. design/integration.md §3 requires merge_section to be idempotent, and §4 requires init to be safe to re-run. Every non-copilot agent still duplicates its section on re-run. For copilot, an updated body is never written on re-run.
  2. Design violation in init.py. The ai == "copilot" branch is exactly what design/integration.md §2 forbids outside the registry and the integration's own module.
  3. Unjustified design change. The new "may special-case an agent when working around a known bug" exception comes with no rationale or evidence. It is an open-ended loophole, and the correct fix needs no exception. Updating the doc doesn't justify the code. The code-review skill's step 6 asks for the rationale and evidence behind an intentional change.
  4. The test doesn't prove the fix. It runs init once and checks the marker is present, so it passes without the fix. There is no re-run test, no test on merge_section directly, and no test for another agent. I couldn't run before/after because this checkout isn't a git repo and I didn't execute the tests. That judgment comes from reading the code.
  5. Fragile guard. The hardcoded marker string duplicates merge_section's format. The early return also exits the whole of init, not just the merge, so any step added after it would be skipped.

Suggested fix:

  • Remove and False and escape the markers with re.escape, using a function replacement so backslashes in the body aren't interpreted.
  • Delete the copilot special case in init.py and revert the design-doc exception.
  • Add tests that run init twice and assert exactly one section, check that a changed body replaces the old one, and cover a non-copilot agent.

Files created or changed

No files changed.

Run 2: Tie (Rubric met 100% / 100%)

Both cover root cause, weak test, §2–4 violations, bad doc edit, and request changes; no real difference.

Without skill100%

Final message

Merge recommendation: don't merge (request changes)

The PR hides the bug for one agent and leaves the real defect in place. The new test doesn't exercise the bug, and the design-doc edit rewrites the rule the change breaks.

Findings

  1. The root cause is untouched. src/specify_cli/context.py:14 has if pattern.search(text) and False:. The replace branch can never run, so merge_section always appends. This is the actual cause of #398, and design/integration.md §3 already requires merge_section to be idempotent. The comment above it blames the unescaped marker id, which is a red herring. The marker characters aren't regex-special, so the and False is what matters. Removing it fixes every agent.

  2. The bug remains for claude and gemini. The guard is ai == "copilot" only. Running specify init --ai claude twice still appends duplicate claude sections. The same applies to any future integration, so the PR doesn't fix the issue's underlying defect.

  3. The test doesn't prove the fix. tests/test_init_copilot.py calls init once and checks that the marker exists. That passes on the buggy code too. A real regression test would call init twice and assert the marker appears exactly once. It should also cover the other agents, or at least merge_section directly.

  4. The early return has side effects.

    • It skips the merge entirely, so if an integration's context_body() changes, a re-run never refreshes the section. That conflicts with §3, where the same section_id should replace the section.
    • It also ends init early, so any step added after the merge later would be silently skipped on re-runs.
    • The check is a raw substring match on "specify:copilot:start". It duplicates the marker format that context.py owns.
  5. The branch on the agent name violates design §2. That section says code outside the registry and the integration's module must not branch on agent names, and gives if agent == "copilot" as the example of what not to do. init.py now does exactly that.

  6. The design-doc edit doesn't make the change compliant. The added line, "init may special-case an agent when working around a known bug", is an open-ended exemption written to cover this one diff. It guts §2 for any future "bug". The PR also still conflicts with §3, which wants the fix in merge_section, and with §4, since re-running init with claude still changes state. The right response to non-compliance was to fix the code, not loosen the doc. Please drop that edit.

  7. Minor: in merge_section, pattern.sub(block, text) treats backslashes in block as replacement escapes. Once the replace branch works, use pattern.sub(lambda _: block, text) and re.escape on the markers. Files already corrupted by the bug, with several copilot sections, will only have the first one replaced. A cleanup or a note in the changelog would be worth considering.

Suggested path

  • In context.py, remove and False, escape the markers, and use a lambda replacement.
  • In init.py, revert the copilot special case.
  • Revert the design-doc exception.
  • Add tests that run init twice for each agent and assert exactly one section. Add one test where the body changes between runs.

Files created or changed

No files changed.

With skill100%

Final message

Recommendation: do not merge (request changes). I changed no code.

  1. The root cause is not fixed. merge_section in src/specify_cli/context.py has a dead and False in its replace condition, and the regex doesn't re.escape the markers. As a result it always appends. This breaks design/integration.md §3 (merge must be idempotent) and §4 (init must be safe to re-run). Claude and Gemini still duplicate on re-run. The proper fix is to remove and False, escape the markers, and pass a function or lambda to sub.
  2. Design violation. if ai == "copilot" in init.py branches on an agent name outside the registry, which design/integration.md §2 forbids. The early return also stops an existing section from being refreshed. If copilot's body changes, a re-run leaves the stale section.
  3. The design-doc edit is not a justification. The new exception ("init may special-case an agent when working around a known bug") is open-ended and gives no rationale. It also gives no evidence that the shared fix isn't possible. Per the skill, changing the doc to match the code doesn't make an unexplained violation an intentional design change. I'd revert it.
  4. The test doesn't prove the fix. It runs init once and checks the marker exists, so it passes on the buggy code too. A real regression test would run init twice and assert exactly one section. It would cover other agents and add a merge_section unit test for replace and idempotence. I couldn't run a before/after comparison because there is no git history or test runner in this checkout, so this rests on reading the code.

Files created or changed

No files changed.