|
1 | 1 | --- |
2 | 2 | name: fxa-simplify |
3 | 3 | description: Simplifies and refines code in the FXA monorepo using project-specific conventions. Use when asked to simplify, clean up, or refine recently written code. Focuses on recently modified code unless instructed otherwise. |
| 4 | +argument-hint: Optional file paths to scope the review (e.g. "packages/fxa-auth-server/lib/foo.ts") |
4 | 5 | context: fork |
5 | 6 | --- |
6 | 7 |
|
@@ -103,16 +104,22 @@ Avoid over-simplification that could: |
103 | 104 |
|
104 | 105 | ## 7. Focus Scope |
105 | 106 |
|
106 | | -Only refine code that has been recently modified or touched in the current session, unless explicitly instructed to review a broader scope. |
| 107 | +**Only refine lines that were actually changed in the diff.** Do not refine unchanged surrounding code, even if it could be improved. The goal is to keep the diff minimal and focused. |
| 108 | + |
| 109 | +- If file paths are provided via `$ARGUMENTS`, scope to those files only |
| 110 | +- Otherwise, run `git diff HEAD~1..HEAD --name-only` to find changed files, then `git diff HEAD~1..HEAD` to see the line-level changes |
| 111 | +- Within each file, only refine the lines that appear in the diff (added or modified lines), not the entire file |
| 112 | +- Exception: if a changed line introduces an obvious bug or inconsistency with adjacent unchanged code, note it but do not fix the unchanged code without asking |
107 | 113 |
|
108 | 114 | ## Refinement Process |
109 | 115 |
|
110 | | -1. Identify the recently modified code sections |
111 | | -2. Determine which package/domain the code belongs to (auth-server, settings, libs, etc.) |
112 | | -3. Apply the appropriate conventions for that domain |
113 | | -4. Analyze for opportunities to improve elegance and consistency |
114 | | -5. Ensure all functionality remains unchanged |
115 | | -6. Verify the refined code is simpler and more maintainable |
116 | | -7. Document only significant changes that affect understanding |
| 116 | +1. If `$ARGUMENTS` contains file paths, use those. Otherwise run `git diff HEAD~1..HEAD --name-only` to find changed files. |
| 117 | +2. Run `git diff HEAD~1..HEAD` to see the actual line-level changes |
| 118 | +3. For each changed file, only analyze and refine the lines that were added or modified in the diff |
| 119 | +4. Determine which package/domain the code belongs to (auth-server, settings, libs, etc.) |
| 120 | +5. Apply the appropriate conventions for that domain to the changed lines only |
| 121 | +6. Ensure all functionality remains unchanged |
| 122 | +7. Verify the refined code is simpler and more maintainable |
| 123 | +8. Document only significant changes that affect understanding |
117 | 124 |
|
118 | 125 | Your goal is to ensure all code meets the highest standards of elegance and maintainability while preserving its complete functionality. |
0 commit comments