From d07fcec6269c01705079ae02013aaaab3ee9fa68 Mon Sep 17 00:00:00 2001 From: Jacob Dahl <37091262+dakejahl@users.noreply.github.com> Date: Thu, 23 Apr 2026 12:39:08 -0800 Subject: [PATCH] chore(claude): add CLAUDE.md and tighten commit/pr skills (#27119) Signed-off-by: Jacob Dahl Signed-off-by: Ramon Roche Co-authored-by: Ramon Roche --- .claude/skills/commit/SKILL.md | 29 ++++++++++++++++++----------- .claude/skills/pr/SKILL.md | 24 ++++++++++++++++-------- CLAUDE.md | 12 ++++++++++++ 3 files changed, 46 insertions(+), 19 deletions(-) create mode 100644 CLAUDE.md diff --git a/.claude/skills/commit/SKILL.md b/.claude/skills/commit/SKILL.md index 1b05b52531..bf8e2deab1 100644 --- a/.claude/skills/commit/SKILL.md +++ b/.claude/skills/commit/SKILL.md @@ -7,21 +7,28 @@ allowed-tools: Bash, Read, Glob, Grep # PX4 Conventional Commit -Create a git commit: `type(scope): description` +Create a git commit in conventional-commit format: `type(scope): description`. -**NEVER add Co-Authored-By lines. No Claude attribution in commits.** +- **type:** `feat`, `fix`, `refactor`, `perf`, `docs`, `style`, `test`, + `build`, `ci`, `chore`, `revert`. Append `!` before `:` for breaking changes. +- **scope:** the module/driver/area affected — derive from the directory + path of the changed files (`src/modules/ekf2/` → `ekf2`, + `src/drivers/imu/invensense/icm42688p/` → `drivers/icm42688p`, + `.github/workflows/` → `ci`). +- **description:** imperative, concise, ≥5 chars. -Follow [CONTRIBUTING.md](../../CONTRIBUTING.md) for full project conventions. +**NEVER add Co-Authored-By Claude Code. No Claude attribution.** ## Steps -1. **Read [CONTRIBUTING.md](../../CONTRIBUTING.md)** for commit message format, types, scopes, and conventions. -2. Check branch (`git branch --show-current`). If on `main`, create a feature branch. Use `/` format where `` comes from `gh api user --jq .login`. If unavailable, just use ``. -3. Run `git status` and `git diff --staged`. If nothing staged, ask what to stage. -4. Follow the commit message convention from CONTRIBUTING.md: pick the correct **type** and **scope**, write a concise imperative description. The scope table is not exhaustive — derive the scope from the directory path of the changed files. -5. Body (if needed): explain **why**, not what. -6. Run `make format` or `./Tools/astyle/fix_code_style.sh ` on changed C/C++ files before committing. -7. Check if GPG signing is available: `git config --get user.signingkey`. If set, use `git commit -S -s`. Otherwise, use `git commit -s`. -8. Stage and commit. No `Co-Authored-By`. +1. Check branch (`git branch --show-current`). If on `main`, create a feature + branch `/` where `` comes from + `gh api user --jq .login`. +2. Run `git status` and `git diff --staged`. If nothing staged, ask what to stage. +3. Run `make format` (or `./Tools/astyle/fix_code_style.sh `) on changed + C/C++ files. +4. Body (if needed): explain **why**, not what. +5. Check GPG signing: `git config --get user.signingkey`. If set, + `git commit -S -s`; else `git commit -s`. If the user provided arguments, use them as context: $ARGUMENTS diff --git a/.claude/skills/pr/SKILL.md b/.claude/skills/pr/SKILL.md index 18e7e2435f..6ef9ba0da9 100644 --- a/.claude/skills/pr/SKILL.md +++ b/.claude/skills/pr/SKILL.md @@ -9,15 +9,23 @@ allowed-tools: Bash, Read, Glob, Grep **No Claude attribution anywhere (no Co-Authored-By, no "Generated with Claude").** -Follow [CONTRIBUTING.md](../../CONTRIBUTING.md) for full project conventions. - ## Steps -1. Check branch. If on `main`, create a feature branch. Use `/` format where `` comes from `gh api user --jq .login`. If unavailable, just use ``. -2. Gather context: `git status`, `git log --oneline main..HEAD`, `git diff main...HEAD --stat`, check if remote tracking branch exists. -3. PR **title**: `type(scope): description` — under 72 chars, describes the overall change across all commits. This becomes the squash-merge commit message. -4. PR **body**: brief summary + bullet points for key changes. No filler. -5. Push with `-u` if needed, then `gh pr create`. Default base is `main` unless user says otherwise. -6. Return the PR URL. +1. Check branch. If on `main`, create a feature branch `/` + where `` comes from `gh api user --jq .login`. +2. Gather context: `git status`, `git log --oneline main..HEAD`, + `git diff main...HEAD --stat`, check for remote tracking branch. +3. Sanity-build the targets we care about. Fix any build errors before opening + the PR: + - `make px4_fmu-v6x` — hardware target + - `make px4_sitl` — simulation +4. PR **title:** `type(scope): description` — under 72 chars, covers the + overall change across all commits. This becomes the squash-merge commit + message. +5. PR **body:** start with a plain leading paragraph explaining what the PR does and why. No headings (`## Summary`, `## Test plan`, etc.), no boilerplate, no Claude attribution. Use bullet lists only to enumerate discrete changes; don't force prose into bullets. Describe testing inline if relevant, no separate test plan section. Use markdown (links, code blocks, lists) only when warranted. Keep it concise and well-formatted. + +6. Push with `-u` if needed, then `gh pr create`. Default base is `main` + unless user says otherwise. +7. Return the PR URL. If the user provided arguments, use them as context: $ARGUMENTS diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000000..88355ff8b8 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,12 @@ +# PX4-Autopilot + +Safety-critical C/C++ flight control firmware for autopilots, plus SITL +simulation and Python tooling. + +- **Commits:** use the `/commit` skill. Conventional commit format with + topic-based scope: `type(scope): description`. +- **Pull requests:** use the `/pr` skill. +- **No Claude attribution** — no `Co-Authored-By: Claude`, no "Generated + with Claude Code" footer. +- **Style:** run `make format` on changed C/C++ before committing; CI + enforces `make check_format`.