Skip to content

feat: Claude Code tooling — 2 agents, 7 commands, 2 rules, 4 skills#491

Open
FlorianBruniaux wants to merge 2 commits intodevelopfrom
feat/claude-tooling-agents-rules-skills
Open

feat: Claude Code tooling — 2 agents, 7 commands, 2 rules, 4 skills#491
FlorianBruniaux wants to merge 2 commits intodevelopfrom
feat/claude-tooling-agents-rules-skills

Conversation

@FlorianBruniaux
Copy link
Collaborator

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

Catégorie Artifact Description
🤖 Agent code-reviewer (rewrite) Red flags RTK (Regex::new en fn, unwrap prod, async, no fallback, no savings test), patterns défensifs before/after, 7 questions adversariales
🤖 Agent system-architect (new) Architecture map RTK, patterns filter modules (1-4), guide TOML DSL vs Rust, budget perf (<10ms/<5MB), boundaries modules
⌨️ Command tech:worktree Crée des worktrees git avec cargo check --all-targets en background, flags --fast/--no-check
⌨️ Command tech:worktree-status Vérifie le statut du cargo check background via /tmp/worktree-cargo-check-{branch}.log
⌨️ Command tech:remove-worktree Supprime worktree + ref git + branche, protège master/main
⌨️ Command tech:clean-worktrees Auto-supprime les worktrees sur branches mergées dans master
⌨️ Command tech:clean-worktree Nettoyage interactif avec prompt y/N
⌨️ Command tech:codereview Review pre-PR vs master, 🔴 checks (unwrap, non-lazy regex, .context(), async deps, savings manquants), mode --auto (cargo fmt + clippy + test)
⌨️ Command tech:audit-codebase Audit santé 7 catégories scorées 0-10 : secrets, sécurité, deps (cargo audit), structure, tests, perf, AI patterns
📋 Rule search-strategy Navigation codebase RTK — module map, priorité Grep > Glob > Read > Explore, patterns par cas (filter functions, lazy_static, test coverage, TOML filters)
📋 Rule rust-patterns Non-négociables RTK (no async, lazy_static obligatoire, fallback pattern, exit code propagation) + idiomes Rust (iterators, ownership, error handling, template module)
🛠️ Skill code-simplifier Simplification Rust idiomatique (chains, join, Option chaining, early returns, suppression clones), garde-fous RTK (ne pas toucher lazy_static, .context(), fallback)
🛠️ Skill performance Benchmark startup (hyperfine), binary size (cargo-bloat), memory profiling, audit regex compilation, deps interdits, template before/after regression
🛠️ Skill design-patterns Patterns Rust pour RTK — Newtype, Builder, State Machine (parsers multi-phase), Trait Object, RAII, Extension Trait; guide de sélection + anti-patterns
🛠️ Skill tdd-rust Workflow Red-Green-Refactor complet : capture fixtures réelles, snapshot tests (insta), count_tokens() assertion ≥60%, test fallback, test ANSI stripping, checklist "done"

Aucun 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 stale 0.27.2 → 0.28.0 détectées par le hook pre-push.

Test plan

  • Vérifier que les commandes /tech:worktree, /tech:codereview, /tech:audit-codebase s'affichent dans Claude Code
  • Vérifier que les agents code-reviewer, system-architect sont disponibles
  • Vérifier que les skills tdd-rust, performance, design-patterns, code-simplifier se triggent correctement

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings March 10, 2026 23:03
@FlorianBruniaux FlorianBruniaux changed the base branch from master to develop March 10, 2026 23:03
@FlorianBruniaux FlorianBruniaux force-pushed the feat/claude-tooling-agents-rules-skills branch from 7039119 to 814dc82 Compare March 10, 2026 23:04
FlorianBruniaux and others added 2 commits March 11, 2026 00:05
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>
@FlorianBruniaux FlorianBruniaux force-pushed the feat/claude-tooling-agents-rules-skills branch from 814dc82 to bab7363 Compare March 10, 2026 23:05
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.0 instead of 0.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-architect agent; rewrite code-reviewer to 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.

Comment on lines +35 to +44
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
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines +57 to +60
# Parse flags
RAW_ARGS="$ARGUMENTS"
BRANCH_NAME="$RAW_ARGS"
SKIP_CHECK=false
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines +39 to +49
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}')

Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines +160 to +174
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));
}
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Suggested change
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);
}

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants