You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: crates/quarto-markdown-pandoc/CLAUDE.md
+17-3Lines changed: 17 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,13 +25,27 @@ Whenever you start working on a coding task, follow these steps:
25
25
26
26
- Make a plan to yourself.
27
27
- The plan should include adding appropriate tests to the test suite.
28
-
- Before implementing the feature, write the test that you think should fail, and ensure that the test fails the way you expect to!
28
+
-**FIRST**: Write the test that you think should fail
29
+
-**SECOND**: Run ONLY that test and verify it fails with the expected error
30
+
-**THIRD**: Implement the fix
31
+
-**FOURTH**: Run the test again and verify it now passes
29
32
- Work on the plan item by item.
30
33
- You are not done until the test you wrote passes.
31
34
- You are not done until the test you wrote is integrated to our test suite.
32
35
- If you run out of ideas and still can't make the test pass, do not erase the test. Report back to me and we will work on it together.
33
36
- If in the process of writing tests you run into an unexpected parse error, store it in a separate file and report it to me. We're still improving the parser and it's possible that you will run into bugs.
34
37
38
+
## BEFORE YOU IMPLEMENT ANY BUG FIX - MANDATORY CHECKLIST
39
+
40
+
Before implementing ANY bug fix, you MUST complete this checklist in order:
41
+
42
+
-[ ] Have you written the test?
43
+
-[ ] Have you run the test and confirmed it fails?
44
+
-[ ] Have you verified the failure is exactly what you expected?
45
+
-[ ] Only after all three above are complete: proceed with implementation
46
+
47
+
This is non-negotiable. Do not skip this process.
48
+
35
49
# Error messages
36
50
37
51
The error message infrastructure is based on Clinton Jeffery's TOPLAS 2003 paper "Generating Syntax Errors from Examples". You don't need to read the entire paper to understand what's happening. The abstract of the paper is:
@@ -65,12 +79,12 @@ The `quarto-markdown-pandoc` binary accepts the following options:
65
79
- The qmd format only supports the inline syntax for a link [link](./target.html), and not the reference-style syntax [link][1].
66
80
- Always strive for test documents as small as possible. Prefer a large number of small test documents instead of small number of large documents.
67
81
- When fixing bugs, always try to isolate and fix one bug at a time.
68
-
- When fixing bugs using tests, run the failing test before attempting to fix issues. This helps ensuring that tests are exercising the failure as expected, and fixes actually fixthe particular issue.
82
+
-**CRITICAL - TEST FIRST**: When fixing bugs using tests, you MUST run the failing test BEFORE implementing any fix. This is non-negotiable. Verify the test fails in the expected way, then implement the fix, then verify the test passes.
69
83
- If you need to fix parser bugs, you will find use in running the application with "-v", which will provide a large amount of information from the tree-sitter parsing process, including a print of the concrete syntax tree out to stderr.
70
84
- use "cargo run --" instead of trying to find the binary location, which will often be outside of this crate.
71
85
- If you need to fix parser bugs, you will find use in running the application with "-v", which will provide a large amount of information from the tree-sitter parsing process, including a print of the concrete syntax tree out to stderr.
72
86
- When fixing inconsistency bugs, use `pandoc -t json -i <input_file>` to get Pandoc's output, and `cargo run -- -t json -i <input_file>` to get our output.
73
-
- When fixing roundtripping bugs, make sure to always add a roundtripping test to `tests/roundtrip_tests/qmd-json-qmd`.
87
+
-**When fixing roundtripping bugs**: FIRST add the failing test to `tests/roundtrip_tests/qmd-json-qmd`, run it to verify it fails with the expected output, THEN implement the fix, THEN verify the test passes.
74
88
- When I say "@doit", I mean "create a plan, and work on it item by item."
75
89
- When you're done editing a Rust file, run `cargo fmt` on it.
76
90
- If I ask you to write notes to yourself, do it in markdown and write the output in the `docs/for-claude` directory.
0 commit comments