@@ -84,14 +84,89 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
8484- New features should include conceptual explanation in ` docs/concepts/ `
8585- ** Writing Style** : Grade 10 reading level, all examples must be working code
8686
87+ ## Refactoring Plan
88+
89+ The ` refactor_plan/ ` directory contains the comprehensive Instructor 2.0 refactoring plan:
90+
91+ - ** [ OVERVIEW.md] ( refactor_plan/OVERVIEW.md ) ** : Complete refactoring roadmap organized by themes
92+ - ** [ MEASUREMENTS.md] ( refactor_plan/MEASUREMENTS.md ) ** : Baseline metrics and technical debt analysis
93+ - ** Theme Directories** : Detailed phase-by-phase implementation guides
94+
95+ When working on refactoring tasks:
96+ 1 . Check ` refactor_plan/OVERVIEW.md ` for the overall strategy
97+ 2 . Find the relevant theme and phase for your work
98+ 3 . Follow the detailed implementation guide in that phase document
99+ 4 . Update progress tracking in the phase document
100+ 5 . Use the measurements as baseline for success criteria
101+
87102## Branch and Development Workflow
103+
104+ ### Standard Workflow
881051 . Fork and clone the repository
891062 . Create feature branch: ` git checkout -b feat/your-feature `
901073 . Make changes and add tests
911084 . Run tests and linting
921095 . Commit with conventional commit message
931106 . Push to your fork and create PR
94- 7 . Use stacked PRs for complex features
111+
112+ ### Stacked PRs with Graphite (Recommended for Complex Features)
113+
114+ For complex features or refactoring tasks that span multiple logical changes, use ** Graphite** to create stacked PRs:
115+
116+ ** Installation** :
117+ ``` bash
118+ brew install graphite
119+ gt auth --token < your-github-token>
120+ ```
121+
122+ ** Workflow** :
123+ ``` bash
124+ # Start from main
125+ git checkout main
126+ gt repo init
127+
128+ # Create first branch
129+ gt branch create " feat/phase1-mode-registry-infrastructure"
130+ # Make changes, commit
131+ git add < files>
132+ git commit -m " feat(core): add mode registry infrastructure"
133+
134+ # Stack second branch on top
135+ gt branch create " feat/phase1-mode-registry-anthropic"
136+ # Make changes, commit
137+ git add < files>
138+ git commit -m " feat(anthropic): migrate to mode registry"
139+
140+ # Stack third branch
141+ gt branch create " feat/phase1-mode-registry-tests"
142+ # Make changes, commit
143+ git add < files>
144+ git commit -m " test(core): add mode registry tests"
145+
146+ # Submit all branches as stacked PRs
147+ gt stack submit
148+ ```
149+
150+ ** Benefits** :
151+ - Break large refactoring into logical, reviewable chunks
152+ - Each PR can be reviewed and merged independently
153+ - Automatic rebasing when base PR merges
154+ - Clear dependency chain between changes
155+
156+ ** When to use stacked PRs** :
157+ - Multi-phase refactoring tasks (see ` refactor_plan/ ` )
158+ - Features requiring infrastructure + implementation + tests
159+ - Changes spanning multiple providers or subsystems
160+ - Any work that naturally breaks into 3+ logical steps
161+
162+ ** Graphite Commands** :
163+ ``` bash
164+ gt stack # View your stack
165+ gt stack submit # Create/update PRs for entire stack
166+ gt stack sync # Sync with remote changes
167+ gt branch checkout # Navigate between branches in stack
168+ gt log short # View commit graph
169+ ```
95170
96171## Adding New Providers
97172
@@ -165,13 +240,6 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
165240- ** Configuration** : Uses ` pyproject.toml ` settings for type checking
166241- Run ` uv run ty check ` before committing - aim for zero errors
167242
168- ### Code Quality Checks Before Committing
169- Always run these checks before committing code:
170- 1 . ** Ruff linting** : ` uv run ruff check . ` - Fix all errors
171- 2 . ** Ruff formatting** : ` uv run ruff format . ` - Apply consistent formatting
172- 3 . ** Type checking** : ` uv run ty check ` - Aim for zero type errors
173- 4 . ** Tests** : Run relevant tests to ensure changes don't break functionality
174-
175243### Type Patterns
176244- ** Bounded TypeVars** : Use ` T = TypeVar("T", bound=Union[BaseModel, ...]) ` for constraints
177245- ** Version Compatibility** : Handle Python 3.9 vs 3.10+ typing differences explicitly
0 commit comments