feat: Claude Code tooling — 2 agents, 7 commands, 2 rules, 4 skills#491
feat: Claude Code tooling — 2 agents, 7 commands, 2 rules, 4 skills#491FlorianBruniaux wants to merge 2 commits intodevelopfrom
Conversation
7039119 to
814dc82
Compare
Port and adapt 15 Claude Code artifacts from MethodeAristote/ccboard
to RTK's Rust/CLI context. All TypeScript/web-specific references
replaced with Rust idioms, cargo toolchain, and RTK constraints.
## Agents (2)
- **code-reviewer** (rewrite): RTK-specific red flags table
(Regex::new in fn, unwrap in prod, async deps, no fallback, no savings
test), defensive patterns with before/after examples, adversarial
questions for RTK (savings ≥60%, fallback, startup, exit code,
cross-platform, ANSI, fixtures)
- **system-architect** (new): RTK architecture map, filter module
pattern (Pattern 1-4), TOML DSL vs Rust decision guide, performance
budget (<10ms startup, <5MB binary), module boundary definitions
## Commands (7, under .claude/commands/tech/)
- **worktree**: Creates git worktrees with background `cargo check
--all-targets`, `--fast`/`--no-check` flags, branch naming
`feature/xxx` → `.worktrees/feature-xxx`
- **worktree-status**: Checks background cargo check log
(`/tmp/worktree-cargo-check-{branch}.log`)
- **remove-worktree**: Removes worktree + git ref + branch, protected
branches: `master`/`main`
- **clean-worktrees**: Auto-removes worktrees on branches merged into
master (`git branch --merged master`)
- **clean-worktree**: Interactive cleanup with `y/N` prompt
- **codereview**: Pre-PR review, base `master`, 🔴 checks for
`unwrap()`, non-lazy regex, missing `.context()`, async deps, missing
token savings tests; `--auto` mode runs `cargo fmt + clippy + test`
- **audit-codebase**: 7-category health audit scored 0-10 (secrets,
security, deps via cargo audit, structure, tests, perf <10ms, AI
patterns), weighted global score
## Rules (2, under .claude/rules/)
- **search-strategy**: Navigation codebase RTK — module map, priority
order (Grep > Glob > Read > Explore), patterns for finding commands,
filter functions, lazy_static regexes, test coverage, TOML filters
- **rust-patterns**: RTK non-negotiables (no async, lazy_static
mandatory, fallback pattern, exit code propagation) + idiomatic Rust
(iterators, ownership, error handling, module structure template,
anti-patterns table)
## Skills (4, under .claude/skills/)
- **code-simplifier**: Rust simplification patterns (iterator chains,
string joining, Option/Result chaining, early returns, clone removal),
RTK guard-rails (never simplify away lazy_static, .context(), fallback)
- **performance**: Startup benchmark (hyperfine), binary size
(cargo-bloat), memory profiling (/usr/bin/time), regex compilation
audit, forbidden deps table, before/after regression template
- **design-patterns**: Rust patterns for RTK — Newtype (type safety),
Builder (complex config), State Machine (multi-phase output parsing),
Trait Object (command dispatch), RAII, Extension Trait; selection guide
+ anti-patterns
- **tdd-rust**: Full Red-Green-Refactor workflow — real fixtures capture,
snapshot tests (insta), count_tokens() savings assertion (≥60%),
fallback test, ANSI stripping test, Arrange-Act-Assert pattern,
"done" checklist
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Florian BRUNIAUX <florian@bruniaux.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Florian BRUNIAUX <florian@bruniaux.com>
814dc82 to
bab7363
Compare
There was a problem hiding this comment.
Pull request overview
Ports a set of Claude Code artifacts into RTK (agents/commands/rules/skills) and refreshes documentation references to the current RTK version, aiming to standardize local workflows (worktrees, audits, pre-PR review) without changing Rust runtime behavior.
Changes:
- Update docs to reference RTK
0.28.0instead of0.27.2. - Add new Claude Code commands under
.claude/commands/tech/for worktree management, local code review, and codebase auditing. - Add new RTK-focused rules/skills and a new
system-architectagent; rewritecode-reviewerto be RTK/Rust-specific.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| README.md | Bumps example rtk --version output to 0.28.0 |
| CLAUDE.md | Bumps installation verification version hint to 0.28.0 |
| ARCHITECTURE.md | Updates “rtk Version” metadata to 0.28.0 |
| .claude/skills/tdd-rust/SKILL.md | Adds TDD workflow skill; includes templates/examples for RTK filter development |
| .claude/skills/performance/SKILL.md | Adds perf analysis skill (startup/binary/memory/regex audit guidance) |
| .claude/skills/design-patterns/SKILL.md | Adds RTK-oriented Rust design patterns guidance |
| .claude/skills/code-simplifier/SKILL.md | Adds simplification guidance aligned with RTK constraints |
| .claude/rules/search-strategy.md | Adds navigation/search strategy guidance for RTK codebase |
| .claude/rules/rust-patterns.md | Adds RTK “non-negotiable” Rust patterns/rules doc |
| .claude/commands/tech/worktree.md | Adds command to create a git worktree + background cargo check |
| .claude/commands/tech/worktree-status.md | Adds command to check background cargo check status/log |
| .claude/commands/tech/remove-worktree.md | Adds command to remove a worktree + branch cleanup |
| .claude/commands/tech/clean-worktrees.md | Adds automatic cleanup of merged worktrees |
| .claude/commands/tech/clean-worktree.md | Adds interactive cleanup of merged worktrees |
| .claude/commands/tech/codereview.md | Adds local pre-PR review command with optional “auto” loop |
| .claude/commands/tech/audit-codebase.md | Adds a scored codebase audit command/checklist |
| .claude/agents/system-architect.md | Adds RTK architecture-focused agent |
| .claude/agents/code-reviewer.md | Rewrites agent prompt to be RTK/Rust-specific and constraint-aware |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| set -- "$ARGUMENTS" | ||
| while [[ $# -gt 0 ]]; do | ||
| case "$1" in | ||
| --verbose) VERBOSE=true; shift ;; | ||
| --auto) AUTO_MODE=true; shift ;; | ||
| --max) MAX_ITERATIONS="$2"; shift 2 ;; | ||
| --staged) STAGED=true; shift ;; | ||
| *) BASE_BRANCH="$1"; shift ;; | ||
| esac | ||
| done |
There was a problem hiding this comment.
Argument parsing is broken here: set -- "$ARGUMENTS" sets a single positional parameter containing the whole string, so flags like --verbose, --auto, --max and a base branch won’t be parsed as intended. Split $ARGUMENTS into an array (e.g., read -r -a args <<< "$ARGUMENTS"; set -- "${args[@]}") or otherwise parse flags robustly so the documented usage works.
| # Parse flags | ||
| RAW_ARGS="$ARGUMENTS" | ||
| BRANCH_NAME="$RAW_ARGS" | ||
| SKIP_CHECK=false |
There was a problem hiding this comment.
The script doesn’t guard against an empty/missing branch argument. With set -euo pipefail, running /tech:worktree with no args will fall through and attempt git worktree add ... -b "", producing a confusing failure. Add an early usage check for empty $ARGUMENTS/$BRANCH_NAME and exit with a clear message.
| if ! git worktree list | grep -q "$BRANCH_NAME"; then | ||
| echo "❌ Worktree not found: $BRANCH_NAME" | ||
| echo "" | ||
| echo "Available worktrees:" | ||
| git worktree list | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Get worktree path from git | ||
| WORKTREE_FULL_PATH=$(git worktree list | grep "$BRANCH_NAME" | awk '{print $1}') | ||
|
|
There was a problem hiding this comment.
Worktree selection uses substring matches (git worktree list | grep -q "$BRANCH_NAME" and later grep "$BRANCH_NAME" | awk '{print $1}'). This can match the wrong entry (e.g., feature/foo matches feature/foo-bar) and potentially remove the wrong worktree. Prefer git worktree list --porcelain and match the exact branch refs/heads/<name> line, or at least grep for the bracketed form \[$BRANCH_NAME\] to ensure exact matching.
| let output = execute_command("mycmd", &args.to_vec()) | ||
| .context("Failed to execute mycmd")?; | ||
|
|
||
| let filtered = filter_mycmd(&output.stdout) | ||
| .unwrap_or_else(|e| { | ||
| eprintln!("rtk: filter warning: {}", e); | ||
| output.stdout.clone() | ||
| }); | ||
|
|
||
| tracking::record("mycmd", &output.stdout, &filtered)?; | ||
| print!("{}", filtered); | ||
|
|
||
| if !output.status.success() { | ||
| std::process::exit(output.status.code().unwrap_or(1)); | ||
| } |
There was a problem hiding this comment.
The integration example in this section doesn’t match the current RTK Rust APIs: utils::execute_command returns (stdout, stderr, exit_code) (not a struct with .stdout/.status), and command modules typically record metrics via tracking::TimedExecution::start().track(...) rather than tracking::record(...). Since this is meant to be a copy/pasteable template, update the example to the actual helper signatures/patterns used in src/*_cmd.rs (e.g., package_manager_exec + cmd.output() + timer.track(...) + exit-code propagation).
| let output = execute_command("mycmd", &args.to_vec()) | |
| .context("Failed to execute mycmd")?; | |
| let filtered = filter_mycmd(&output.stdout) | |
| .unwrap_or_else(|e| { | |
| eprintln!("rtk: filter warning: {}", e); | |
| output.stdout.clone() | |
| }); | |
| tracking::record("mycmd", &output.stdout, &filtered)?; | |
| print!("{}", filtered); | |
| if !output.status.success() { | |
| std::process::exit(output.status.code().unwrap_or(1)); | |
| } | |
| // Build command using shared helper, consistent with other *_cmd modules | |
| let mut cmd = package_manager_exec("mycmd")?; | |
| cmd.args(args.to_vec()); | |
| // Start timing / metrics | |
| let timer = tracking::TimedExecution::start("mycmd"); | |
| // Execute and collect output | |
| let output = cmd.output().context("Failed to execute mycmd")?; | |
| let stdout = String::from_utf8_lossy(&output.stdout).to_string(); | |
| let filtered = filter_mycmd(&stdout).unwrap_or_else(|e| { | |
| eprintln!("rtk: filter warning: {}", e); | |
| stdout.clone() | |
| }); | |
| timer.track(&stdout, &filtered)?; | |
| print!("{}", filtered); | |
| // Propagate child exit code | |
| let code = output.status.code().unwrap_or(1); | |
| if code != 0 { | |
| std::process::exit(code); | |
| } |
Summary
Port et adaptation de 15 artifacts Claude Code depuis MethodeAristote/ccboard vers RTK. Tout le contexte TypeScript/web a été remplacé par des idiomes Rust, le toolchain cargo, et les contraintes RTK (startup <10ms, savings ≥60%, no async, lazy_static).
Tableau récap
code-reviewer(rewrite)system-architect(new)tech:worktreecargo check --all-targetsen background, flags--fast/--no-checktech:worktree-status/tmp/worktree-cargo-check-{branch}.logtech:remove-worktreemaster/maintech:clean-worktreestech:clean-worktreey/Ntech:codereviewmaster, 🔴 checks (unwrap, non-lazy regex, .context(), async deps, savings manquants), mode--auto(cargo fmt + clippy + test)tech:audit-codebasesearch-strategyrust-patternscode-simplifierperformancedesign-patternstdd-rustAucun changement Rust
Ces artifacts sont purement dans
.claude/— aucun code Rust modifié, aucun risque de régression. Les 3 commits de fix versioning (README.md,CLAUDE.md,ARCHITECTURE.md) mettent à jour des références stale0.27.2 → 0.28.0détectées par le hook pre-push.Test plan
/tech:worktree,/tech:codereview,/tech:audit-codebases'affichent dans Claude Codecode-reviewer,system-architectsont disponiblestdd-rust,performance,design-patterns,code-simplifierse triggent correctement🤖 Generated with Claude Code