mirror of
https://github.com/codeflash-ai/codeflash.git
synced 2026-05-04 18:25:17 +00:00
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.
This commit is contained in:
parent
beb6df99e3
commit
2e9ce93324
4 changed files with 16 additions and 9 deletions
|
|
@ -11,5 +11,3 @@
|
|||
- **Paths**: Always use absolute paths
|
||||
- **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.
|
||||
- **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
|
||||
- **Pre-commit**: Run `uv run prek` before committing — fix any issues before creating the commit
|
||||
- **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`
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@
|
|||
- Commit message body should be concise (1-2 sentences max)
|
||||
- Merge for simple syncs, rebase when branches have diverged significantly
|
||||
- When committing to an external/third-party repo, follow that repo's own conventions for versioning, changelog, and CI
|
||||
- Pre-commit: Run `uv run prek` before committing — fix any issues before creating the commit
|
||||
- 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`
|
||||
|
||||
## Pull Requests
|
||||
- PR titles should use conventional format
|
||||
|
|
|
|||
13
.claude/rules/workflow.md
Normal file
13
.claude/rules/workflow.md
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
# Workflow
|
||||
|
||||
## Code Changes
|
||||
- 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
|
||||
|
||||
## Response Style
|
||||
- When listing items (PRs, functions, optimization targets), always provide the complete list ordered by priority on the first attempt. Do not give partial lists
|
||||
|
||||
## Commands
|
||||
- When running long-running commands (benchmarks, profiling, optimizers like codeflash), always run them in the foreground. Do not use background processes
|
||||
|
||||
## Debugging
|
||||
- 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
|
||||
|
|
@ -10,13 +10,7 @@ CodeFlash is an AI-powered code optimizer that automatically improves performanc
|
|||
Discovery → Ranking → Context Extraction → Test Gen + Optimization → Baseline → Candidate Evaluation → PR
|
||||
```
|
||||
|
||||
1. **Discovery** (`discovery/`): Find optimizable functions across the codebase
|
||||
2. **Ranking** (`benchmarking/function_ranker.py`): Rank functions by addressable time using trace data
|
||||
3. **Context** (`languages/<lang>/context/`): Extract code dependencies (read-writable code + read-only imports)
|
||||
4. **Optimization** (`optimization/`, `api/`): Generate candidates via AI service, run in parallel with test generation
|
||||
5. **Verification** (`verification/`): Run candidates against tests, compare outputs via custom pytest plugin
|
||||
6. **Benchmarking** (`benchmarking/`): Measure performance, select best candidate by speedup
|
||||
7. **Result** (`result/`, `github/`): Create PR with winning optimization
|
||||
See `.claude/rules/architecture.md` for directory mapping and entry points.
|
||||
|
||||
# Instructions
|
||||
- **Bug fix workflow** — follow these steps in order, do not skip ahead:
|
||||
|
|
|
|||
Loading…
Reference in a new issue