Skip to content

Commit 2e9ce93

Browse files
committed
chore: reorganize Claude rules and add workflow guidelines
Move pre-commit/pre-push prek rules from code-style.md to git.md, deduplicate pipeline docs in CLAUDE.md, and add shared workflow rules.
1 parent beb6df9 commit 2e9ce93

4 files changed

Lines changed: 16 additions & 9 deletions

File tree

.claude/rules/code-style.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,3 @@
1111
- **Paths**: Always use absolute paths
1212
- **Encoding**: Always pass `encoding="utf-8"` to `open()`, `read_text()`, `write_text()`, etc. in new or changed code — Windows defaults to `cp1252` which breaks on non-ASCII content. Don't flag pre-existing code that lacks it unless you're already modifying that line.
1313
- **Verification**: Use `uv run prek` to verify code — it handles ruff, ty, mypy in one pass. Don't run `ruff`, `mypy`, or `python -c "import ..."` separately; `prek` is the single verification command
14-
- **Pre-commit**: Run `uv run prek` before committing — fix any issues before creating the commit
15-
- **Pre-push**: Before pushing, run `uv run prek run --from-ref origin/<base>` to check all changed files against the PR base — this matches CI behavior and catches issues that per-commit prek misses. To detect the base branch: `gh pr view --json baseRefName -q .baseRefName 2>/dev/null || echo main`

.claude/rules/git.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
- Commit message body should be concise (1-2 sentences max)
1010
- Merge for simple syncs, rebase when branches have diverged significantly
1111
- When committing to an external/third-party repo, follow that repo's own conventions for versioning, changelog, and CI
12+
- Pre-commit: Run `uv run prek` before committing — fix any issues before creating the commit
13+
- Pre-push: Run `uv run prek run --from-ref origin/<base>` to check all changed files against the PR base — this matches CI behavior and catches issues that per-commit prek misses. To detect the base branch: `gh pr view --json baseRefName -q .baseRefName 2>/dev/null || echo main`
1214

1315
## Pull Requests
1416
- PR titles should use conventional format

.claude/rules/workflow.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Workflow
2+
3+
## Code Changes
4+
- Before making any changes, outline your approach in 3-5 numbered steps. Include which repo/branch you'll work in, what commands you'll run, and what success looks like. Wait for approval before starting
5+
6+
## Response Style
7+
- When listing items (PRs, functions, optimization targets), always provide the complete list ordered by priority on the first attempt. Do not give partial lists
8+
9+
## Commands
10+
- When running long-running commands (benchmarks, profiling, optimizers like codeflash), always run them in the foreground. Do not use background processes
11+
12+
## Debugging
13+
- When claiming something is a pre-existing issue (e.g., test failures on main), verify by checking out main and running the tests before making that claim

CLAUDE.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,7 @@ CodeFlash is an AI-powered code optimizer that automatically improves performanc
1010
Discovery → Ranking → Context Extraction → Test Gen + Optimization → Baseline → Candidate Evaluation → PR
1111
```
1212

13-
1. **Discovery** (`discovery/`): Find optimizable functions across the codebase
14-
2. **Ranking** (`benchmarking/function_ranker.py`): Rank functions by addressable time using trace data
15-
3. **Context** (`languages/<lang>/context/`): Extract code dependencies (read-writable code + read-only imports)
16-
4. **Optimization** (`optimization/`, `api/`): Generate candidates via AI service, run in parallel with test generation
17-
5. **Verification** (`verification/`): Run candidates against tests, compare outputs via custom pytest plugin
18-
6. **Benchmarking** (`benchmarking/`): Measure performance, select best candidate by speedup
19-
7. **Result** (`result/`, `github/`): Create PR with winning optimization
13+
See `.claude/rules/architecture.md` for directory mapping and entry points.
2014

2115
# Instructions
2216
- **Bug fix workflow** — follow these steps in order, do not skip ahead:

0 commit comments

Comments
 (0)