Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
143 changes: 0 additions & 143 deletions .claude/CLAUDE.md

This file was deleted.

7 changes: 7 additions & 0 deletions .claude/commands/ci-fix.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
---
description: Diagnose and fix all CI failures autonomously — format, lint, docstrings, types, tests, and coverage. Use when the user asks to "fix CI", "make CI green", or resolve pipeline failures.
allowed-tools: Read Write Edit Grep Glob Bash(just *) Bash(uv *) Bash(git diff:*) Bash(git status:*)
disable-model-invocation: true
context: fork
---

Diagnose and fix all CI failures in this project. You are an autonomous CI-fixing agent.

## Step 1 — Run CI and capture output
Expand Down
20 changes: 9 additions & 11 deletions .claude/commands/ci.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
Run the full local CI pipeline for this Copier template repository and report results.
---
description: Run the full local CI pipeline (fix, fmt, lint, type, test) and report results. Use when the user asks to "run CI", "check everything", or verify the project before committing.
allowed-tools: Bash(just *)
---

Run the full local CI pipeline for this repository and report results.

Execute `just ci` which runs in this order:
1. `just fix` — auto-fix ruff lint issues
2. `just fmt` — ruff formatting
3. `just check` — read-only mirror of GitHub Actions, which runs:
- `uv sync --frozen --extra dev`
- `just fmt-check` — verify formatting (read-only)
- `ruff check .` — lint
- `basedpyright` — type check
- `just docs-check` — docstring coverage (`--select D`)
- `just test-ci` — pytest with coverage XML output
- `pre-commit run --all-files --verbose`
- `just audit` — pip-audit dependency security scan
3. `just lint` — ruff lint check
4. `just type` — basedpyright type check
5. `just test` — pytest

After running, summarize:
- Which steps passed and which failed
- Any lint errors or type errors with file + line number
- Any failing test names and their assertion messages
- Any security vulnerabilities found by pip-audit
- Suggested fixes for any failures
27 changes: 17 additions & 10 deletions .claude/commands/coverage.md
Original file line number Diff line number Diff line change
@@ -1,43 +1,50 @@
---
description: Analyse test coverage and write tests to fill any gaps below the 85% threshold. Use when the user asks to "check coverage", "improve coverage", or "find uncovered code".
allowed-tools: Read Write Edit Grep Glob Bash(just *) Bash(uv *)
disable-model-invocation: true
---

Analyse test coverage and write tests for any gaps found.

## Steps

1. **Run coverage** — execute `just coverage` to get the full report with missing lines:
```
uv run --active pytest --cov --cov-report=term-missing --cov-report=xml
uv run --active pytest tests/ --cov=my_library --cov-report=term-missing
```

2. **Parse results** — from the output identify:
- Overall coverage percentage
- Every module below **80 %** (list module name + actual percentage + missing line ranges)
- Overall coverage percentage (target: ≥ **85 %** per `[tool.coverage.report] fail_under`)
- Every module below 85 % (list module name + actual percentage + missing line ranges)

3. **Gap analysis** — for each under-covered module:
- Open the source file
- Open the source file at `src/my_library/`
- Read the lines flagged as uncovered
- Identify what scenarios, branches, or edge cases those lines represent

4. **Write missing tests** — for each gap:
- Locate the appropriate test file in `tests/`
- Locate the appropriate test file under `tests/`
- Write one or more test functions that exercise the uncovered lines
- Follow the existing test style (arrange / act / assert, parametrize over similar cases)
- Ensure new tests pass: run `just test` after writing them

5. **Re-run coverage** — run `just coverage` again and confirm overall coverage has improved.
5. **Re-run coverage** — run `just coverage` again and confirm overall coverage has improved
and no module is below the 85 % threshold.

## Report format

```
## Coverage Report
## Coverage Report — my_library

Overall: X% (target: ≥ 80%)
Overall: X% (target: ≥ 85%)

### Modules below threshold
| Module | Coverage | Missing lines |
|---------------|----------|----------------------|
| foo.bar | 62% | 45-52, 78, 91-95 |
| my_library.core | 72% | 45-52, 78 |

### Tests written
- tests/foo/test_bar.py: added test_edge_case_x, test_branch_y
- tests/.../test_core.py: added test_edge_case_x, test_branch_y

### After fixes
Overall: Y%
Expand Down
5 changes: 5 additions & 0 deletions .claude/commands/dependency-check.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
---
description: Validate that uv.lock is in sync with pyproject.toml and committed. Use when the user asks to "check dependencies", "verify the lockfile", or before releasing.
allowed-tools: Read Bash(test *) Bash(git ls-files:*) Bash(git diff:*) Bash(stat *) Bash(date *) Bash(uv sync:*)
---

Validate that `uv.lock` is in sync with `pyproject.toml` and committed.

This command ensures dependencies are reproducible and locked, catching silent drift that
Expand Down
16 changes: 11 additions & 5 deletions .claude/commands/docs-check.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
---
description: Audit and repair Google-style docstrings across all Python source files. Use when the user asks to "check docs", "fix docstrings", or "audit documentation".
allowed-tools: Read Write Edit Grep Glob Bash(uv run:*)
disable-model-invocation: true
---

Audit and repair documentation across all Python source files.

## Steps

1. **Run ruff docstring check** — `uv run --active ruff check --select D .`
1. **Run ruff docstring check** — `uv run --active ruff check --select D src/ tests/ scripts/`
Report every violation with file, line, and rule code.

2. **Deep symbol scan** — for every `.py` file (including `tests/` and `scripts/`; ruff `D` applies there too):
2. **Deep symbol scan** — for every `.py` file under `src/my_library/`, `tests/`, and `scripts/`:
- Read the file
- Identify all public symbols: module-level functions, classes, methods not prefixed with `_`
- For each symbol check:
Expand All @@ -16,7 +22,7 @@ Audit and repair documentation across all Python source files.
- Names match the actual parameter names exactly
d. **Returns section** — present when the return type is not `None`
e. **Raises section** — present when the function raises documented exceptions
f. **Style** — Google convention (sections use `Args:`, `Returns:`, `Raises:` headers)
f. **Style** — Google convention (`Args:`, `Returns:`, `Raises:` section headers)

3. **Module docstrings** — verify each `.py` file has a module-level docstring that describes
the module's purpose in one sentence.
Expand All @@ -25,12 +31,12 @@ Audit and repair documentation across all Python source files.
docstring. Base the content on the function's signature, body, and surrounding context.
Do not invent descriptions — if the purpose is unclear, write a minimal stub with a `TODO`.

5. **Verify** — re-run `uv run --active ruff check --select D .` and confirm zero violations.
5. **Verify** — re-run `uv run --active ruff check --select D src/ tests/ scripts/` and confirm zero violations.

## Output format

```
## Documentation Audit
## Documentation Audit — my_library

### Ruff violations: N found
[list violations]
Expand Down
11 changes: 0 additions & 11 deletions .claude/commands/generate.md

This file was deleted.

Loading
Loading