-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathvibe-coding-guide.html
More file actions
1358 lines (1256 loc) · 45.8 KB
/
Copy pathvibe-coding-guide.html
File metadata and controls
1358 lines (1256 loc) · 45.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Vibe Coding 提升指南 - 基于 29 次 Session 的深度复盘</title>
<style>
:root {
--bg: #0a0a0f;
--surface: #12121a;
--surface2: #1a1a2e;
--border: #2a2a3e;
--text: #e0e0e8;
--text-muted: #8888a0;
--accent: #6c63ff;
--accent-light: #8b83ff;
--red: #ff6b6b;
--red-bg: rgba(255,107,107,0.08);
--green: #51cf66;
--green-bg: rgba(81,207,102,0.08);
--yellow: #ffd43b;
--yellow-bg: rgba(255,212,59,0.08);
--blue: #4dabf7;
--blue-bg: rgba(77,171,247,0.08);
--orange: #ff922b;
--orange-bg: rgba(255,146,43,0.08);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans SC', sans-serif;
background: var(--bg);
color: var(--text);
line-height: 1.8;
overflow-x: hidden;
}
/* Hero */
.hero {
min-height: 100vh;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
text-align: center;
padding: 2rem;
position: relative;
overflow: hidden;
}
.hero::before {
content: '';
position: absolute;
top: -50%;
left: -50%;
width: 200%;
height: 200%;
background: radial-gradient(ellipse at 30% 50%, rgba(108,99,255,0.12) 0%, transparent 50%),
radial-gradient(ellipse at 70% 50%, rgba(255,107,107,0.08) 0%, transparent 50%);
animation: drift 20s ease-in-out infinite;
}
@keyframes drift {
0%, 100% { transform: translate(0, 0); }
50% { transform: translate(-3%, 2%); }
}
.hero > * { position: relative; z-index: 1; }
.hero h1 {
font-size: clamp(2.5rem, 6vw, 4.5rem);
font-weight: 800;
letter-spacing: -0.03em;
margin-bottom: 1rem;
background: linear-gradient(135deg, #fff 0%, var(--accent-light) 50%, var(--red) 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
}
.hero .subtitle {
font-size: 1.25rem;
color: var(--text-muted);
max-width: 600px;
margin-bottom: 2rem;
}
.stats-row {
display: flex;
gap: 2rem;
flex-wrap: wrap;
justify-content: center;
margin-top: 2rem;
}
.stat-card {
background: var(--surface);
border: 1px solid var(--border);
border-radius: 16px;
padding: 1.5rem 2rem;
text-align: center;
min-width: 140px;
}
.stat-card .number {
font-size: 2.5rem;
font-weight: 800;
line-height: 1;
}
.stat-card .label {
font-size: 0.85rem;
color: var(--text-muted);
margin-top: 0.5rem;
}
.stat-card.bad .number { color: var(--red); }
.stat-card.ok .number { color: var(--yellow); }
.stat-card.good .number { color: var(--green); }
/* Scroll indicator */
.scroll-hint {
position: absolute;
bottom: 2rem;
left: 50%;
transform: translateX(-50%);
color: var(--text-muted);
font-size: 0.85rem;
animation: bounce 2s infinite;
}
@keyframes bounce {
0%, 100% { transform: translateX(-50%) translateY(0); }
50% { transform: translateX(-50%) translateY(8px); }
}
/* Section layout */
.container {
max-width: 1100px;
margin: 0 auto;
padding: 0 1.5rem;
}
section {
padding: 6rem 0;
}
.section-header {
text-align: center;
margin-bottom: 4rem;
}
.section-header .tag {
display: inline-block;
padding: 0.35rem 1rem;
border-radius: 100px;
font-size: 0.8rem;
font-weight: 600;
letter-spacing: 0.05em;
text-transform: uppercase;
margin-bottom: 1rem;
}
.tag-red { background: var(--red-bg); color: var(--red); border: 1px solid rgba(255,107,107,0.2); }
.tag-green { background: var(--green-bg); color: var(--green); border: 1px solid rgba(81,207,102,0.2); }
.tag-blue { background: var(--blue-bg); color: var(--blue); border: 1px solid rgba(77,171,247,0.2); }
.tag-yellow { background: var(--yellow-bg); color: var(--yellow); border: 1px solid rgba(255,212,59,0.2); }
.tag-orange { background: var(--orange-bg); color: var(--orange); border: 1px solid rgba(255,146,43,0.2); }
.section-header h2 {
font-size: clamp(1.8rem, 4vw, 2.8rem);
font-weight: 700;
letter-spacing: -0.02em;
margin-bottom: 0.75rem;
}
.section-header p {
color: var(--text-muted);
font-size: 1.1rem;
max-width: 650px;
margin: 0 auto;
}
/* Divider */
.divider {
width: 100%;
height: 1px;
background: linear-gradient(90deg, transparent, var(--border), transparent);
}
/* Flow diagram */
.flow-diagram {
display: flex;
align-items: stretch;
gap: 0;
margin: 3rem 0;
overflow-x: auto;
padding-bottom: 1rem;
}
.flow-step {
flex: 1;
min-width: 180px;
text-align: center;
position: relative;
padding: 0 0.5rem;
}
.flow-step .icon-circle {
width: 64px;
height: 64px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
margin: 0 auto 1rem;
font-size: 1.6rem;
border: 2px solid;
position: relative;
z-index: 2;
}
.flow-step::after {
content: '';
position: absolute;
top: 32px;
left: calc(50% + 40px);
width: calc(100% - 80px);
height: 2px;
background: var(--border);
z-index: 1;
}
.flow-step:last-child::after { display: none; }
.flow-step h4 {
font-size: 0.95rem;
font-weight: 600;
margin-bottom: 0.4rem;
}
.flow-step p {
font-size: 0.8rem;
color: var(--text-muted);
line-height: 1.5;
}
/* Problem cards */
.problem-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
gap: 1.5rem;
margin-top: 2rem;
}
.problem-card {
background: var(--surface);
border: 1px solid var(--border);
border-radius: 16px;
padding: 2rem;
position: relative;
overflow: hidden;
transition: transform 0.2s, border-color 0.2s;
}
.problem-card:hover {
transform: translateY(-2px);
border-color: var(--accent);
}
.problem-card .severity {
position: absolute;
top: 0;
right: 0;
padding: 0.4rem 1rem;
border-radius: 0 16px 0 12px;
font-size: 0.75rem;
font-weight: 600;
}
.severity-high { background: var(--red-bg); color: var(--red); }
.severity-mid { background: var(--yellow-bg); color: var(--yellow); }
.problem-card .icon {
font-size: 2rem;
margin-bottom: 1rem;
display: block;
}
.problem-card h3 {
font-size: 1.15rem;
font-weight: 700;
margin-bottom: 0.75rem;
}
.problem-card .desc {
font-size: 0.9rem;
color: var(--text-muted);
line-height: 1.7;
}
.problem-card .metric {
display: inline-flex;
align-items: center;
gap: 0.4rem;
margin-top: 1rem;
padding: 0.3rem 0.8rem;
border-radius: 8px;
font-size: 0.8rem;
font-weight: 600;
}
/* Comparison (before/after) */
.comparison {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 1.5rem;
margin: 2rem 0;
}
@media (max-width: 768px) {
.comparison { grid-template-columns: 1fr; }
}
.compare-panel {
background: var(--surface);
border-radius: 16px;
overflow: hidden;
border: 1px solid var(--border);
}
.compare-panel .panel-header {
padding: 1rem 1.5rem;
font-weight: 700;
font-size: 0.9rem;
display: flex;
align-items: center;
gap: 0.5rem;
}
.compare-panel.bad .panel-header { background: var(--red-bg); color: var(--red); }
.compare-panel.good .panel-header { background: var(--green-bg); color: var(--green); }
.compare-panel .panel-body {
padding: 1.5rem;
}
/* Code blocks */
pre {
background: #0d0d14;
border: 1px solid var(--border);
border-radius: 12px;
padding: 1.25rem;
overflow-x: auto;
font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', monospace;
font-size: 0.85rem;
line-height: 1.7;
color: #c0c0d0;
margin: 1rem 0;
}
pre .comment { color: #5c5c7a; }
pre .keyword { color: var(--accent-light); }
pre .string { color: var(--green); }
pre .highlight { color: var(--yellow); background: rgba(255,212,59,0.08); padding: 0 0.2rem; border-radius: 3px; }
/* Checklist */
.checklist {
list-style: none;
margin: 1.5rem 0;
}
.checklist li {
padding: 0.75rem 0;
padding-left: 2.2rem;
position: relative;
border-bottom: 1px solid rgba(42,42,62,0.5);
font-size: 0.95rem;
}
.checklist li:last-child { border-bottom: none; }
.checklist li::before {
content: '';
position: absolute;
left: 0;
top: 0.85rem;
width: 18px;
height: 18px;
border-radius: 4px;
border: 2px solid var(--border);
}
.checklist li.done::before {
background: var(--green);
border-color: var(--green);
}
.checklist li.done::after {
content: '';
position: absolute;
left: 4px;
top: 0.92rem;
width: 10px;
height: 5px;
border-left: 2px solid #fff;
border-bottom: 2px solid #fff;
transform: rotate(-45deg);
}
/* Pipeline visualization */
.pipeline {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 0;
margin: 2rem 0;
position: relative;
}
.pipeline-stage {
background: var(--surface);
border: 1px solid var(--border);
padding: 1.5rem;
text-align: center;
position: relative;
}
.pipeline-stage:first-child { border-radius: 16px 0 0 16px; }
.pipeline-stage:last-child { border-radius: 0 16px 16px 0; }
.pipeline-stage .stage-num {
width: 32px;
height: 32px;
border-radius: 50%;
background: var(--accent);
color: #fff;
display: flex;
align-items: center;
justify-content: center;
font-size: 0.85rem;
font-weight: 700;
margin: 0 auto 0.75rem;
}
.pipeline-stage h4 {
font-size: 0.95rem;
margin-bottom: 0.4rem;
}
.pipeline-stage p {
font-size: 0.8rem;
color: var(--text-muted);
line-height: 1.5;
}
.pipeline-stage .gate {
position: absolute;
right: -14px;
top: 50%;
transform: translateY(-50%);
z-index: 2;
width: 28px;
height: 28px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-size: 0.8rem;
}
.gate-check { background: var(--green); color: #fff; }
.gate-block { background: var(--red); color: #fff; }
/* Tips box */
.tip-box {
background: var(--surface2);
border-left: 4px solid;
border-radius: 0 12px 12px 0;
padding: 1.25rem 1.5rem;
margin: 1.5rem 0;
font-size: 0.9rem;
}
.tip-box.info { border-color: var(--blue); }
.tip-box.warn { border-color: var(--yellow); }
.tip-box.danger { border-color: var(--red); }
.tip-box .tip-title {
font-weight: 700;
margin-bottom: 0.4rem;
font-size: 0.95rem;
}
.tip-box.info .tip-title { color: var(--blue); }
.tip-box.warn .tip-title { color: var(--yellow); }
.tip-box.danger .tip-title { color: var(--red); }
/* Big number highlight */
.big-insight {
text-align: center;
padding: 3rem 2rem;
margin: 2rem 0;
background: var(--surface);
border-radius: 20px;
border: 1px solid var(--border);
}
.big-insight .number {
font-size: 5rem;
font-weight: 900;
line-height: 1;
margin-bottom: 0.5rem;
}
.big-insight .unit {
font-size: 1.2rem;
color: var(--text-muted);
}
.big-insight .explanation {
margin-top: 1rem;
font-size: 1rem;
color: var(--text-muted);
max-width: 500px;
margin-left: auto;
margin-right: auto;
}
/* Timeline */
.timeline {
position: relative;
margin: 2rem 0;
padding-left: 2rem;
}
.timeline::before {
content: '';
position: absolute;
left: 0;
top: 0;
bottom: 0;
width: 2px;
background: var(--border);
}
.timeline-item {
position: relative;
padding: 1.5rem;
padding-left: 2rem;
margin-bottom: 1.5rem;
background: var(--surface);
border-radius: 12px;
border: 1px solid var(--border);
}
.timeline-item::before {
content: '';
position: absolute;
left: -2.55rem;
top: 1.8rem;
width: 12px;
height: 12px;
border-radius: 50%;
border: 2px solid;
}
.timeline-item.step1::before { border-color: var(--blue); background: var(--blue); }
.timeline-item.step2::before { border-color: var(--accent); background: var(--accent); }
.timeline-item.step3::before { border-color: var(--yellow); background: var(--yellow); }
.timeline-item.step4::before { border-color: var(--green); background: var(--green); }
.timeline-item.step5::before { border-color: var(--orange); background: var(--orange); }
.timeline-item h4 {
font-size: 1rem;
margin-bottom: 0.5rem;
}
.timeline-item p {
font-size: 0.9rem;
color: var(--text-muted);
}
/* Prompt template cards */
.prompt-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
gap: 1.5rem;
margin: 2rem 0;
}
.prompt-card {
background: var(--surface);
border: 1px solid var(--border);
border-radius: 16px;
overflow: hidden;
}
.prompt-card .prompt-header {
padding: 1rem 1.5rem;
background: var(--surface2);
font-weight: 700;
font-size: 1rem;
border-bottom: 1px solid var(--border);
display: flex;
align-items: center;
gap: 0.5rem;
}
.prompt-card .prompt-body {
padding: 1.5rem;
}
.prompt-card .scenario {
font-size: 0.85rem;
color: var(--text-muted);
margin-bottom: 1rem;
padding-bottom: 1rem;
border-bottom: 1px solid var(--border);
}
/* Guardrail diagram */
.guardrail-stack {
display: flex;
flex-direction: column;
gap: 1rem;
margin: 2rem 0;
}
.guardrail-layer {
display: flex;
align-items: center;
gap: 1.5rem;
padding: 1.25rem 1.5rem;
background: var(--surface);
border-radius: 12px;
border: 1px solid var(--border);
transition: transform 0.2s;
}
.guardrail-layer:hover { transform: translateX(4px); }
.guardrail-layer .layer-icon {
width: 48px;
height: 48px;
border-radius: 12px;
display: flex;
align-items: center;
justify-content: center;
font-size: 1.4rem;
flex-shrink: 0;
}
.guardrail-layer .layer-content { flex: 1; }
.guardrail-layer h4 { font-size: 0.95rem; margin-bottom: 0.25rem; }
.guardrail-layer p { font-size: 0.85rem; color: var(--text-muted); }
.guardrail-layer .trigger {
font-size: 0.75rem;
padding: 0.25rem 0.6rem;
border-radius: 6px;
white-space: nowrap;
}
/* Table */
.data-table {
width: 100%;
border-collapse: separate;
border-spacing: 0;
margin: 1.5rem 0;
font-size: 0.9rem;
}
.data-table th {
background: var(--surface2);
padding: 0.75rem 1rem;
text-align: left;
font-weight: 600;
font-size: 0.8rem;
color: var(--text-muted);
text-transform: uppercase;
letter-spacing: 0.05em;
border-bottom: 1px solid var(--border);
}
.data-table th:first-child { border-radius: 8px 0 0 0; }
.data-table th:last-child { border-radius: 0 8px 0 0; }
.data-table td {
padding: 0.75rem 1rem;
border-bottom: 1px solid rgba(42,42,62,0.3);
}
.data-table tr:last-child td { border-bottom: none; }
/* Footer */
footer {
text-align: center;
padding: 4rem 2rem;
color: var(--text-muted);
font-size: 0.85rem;
border-top: 1px solid var(--border);
}
/* Nav dots */
.nav-dots {
position: fixed;
right: 1.5rem;
top: 50%;
transform: translateY(-50%);
display: flex;
flex-direction: column;
gap: 0.75rem;
z-index: 100;
}
.nav-dot {
width: 10px;
height: 10px;
border-radius: 50%;
background: var(--border);
cursor: pointer;
transition: background 0.2s, transform 0.2s;
border: none;
}
.nav-dot:hover, .nav-dot.active {
background: var(--accent);
transform: scale(1.3);
}
.nav-dot[title]::after {
content: attr(title);
position: absolute;
right: 20px;
top: 50%;
transform: translateY(-50%);
font-size: 0.75rem;
background: var(--surface2);
padding: 0.3rem 0.6rem;
border-radius: 6px;
white-space: nowrap;
opacity: 0;
pointer-events: none;
transition: opacity 0.2s;
}
.nav-dot:hover::after { opacity: 1; }
/* Responsive */
@media (max-width: 768px) {
.flow-diagram { flex-direction: column; }
.flow-step::after { display: none; }
.pipeline { grid-template-columns: 1fr; }
.pipeline-stage { border-radius: 12px !important; }
.pipeline-stage .gate { display: none; }
.prompt-grid { grid-template-columns: 1fr; }
.nav-dots { display: none; }
.stats-row { gap: 1rem; }
.stat-card { min-width: 100px; padding: 1rem; }
}
/* Animations */
.fade-in {
opacity: 0;
transform: translateY(20px);
transition: opacity 0.6s ease, transform 0.6s ease;
}
.fade-in.visible {
opacity: 1;
transform: translateY(0);
}
</style>
</head>
<body>
<!-- ===== HERO ===== -->
<section class="hero" id="top">
<h1>Vibe Coding 提升指南</h1>
<p class="subtitle">基于你 29 次 Claude Code Session 的深度复盘<br>从数据中提炼出的编码工作流改进方案</p>
<div class="stats-row">
<div class="stat-card bad">
<div class="number">16</div>
<div class="label">Buggy Code 事件</div>
</div>
<div class="stat-card bad">
<div class="number">15</div>
<div class="label">方向错误次数</div>
</div>
<div class="stat-card ok">
<div class="number">60%</div>
<div class="label">目标完成率</div>
</div>
<div class="stat-card good">
<div class="number">12</div>
<div class="label">成功提交</div>
</div>
</div>
<div class="scroll-hint">↓ 向下滚动查看完整指南</div>
</section>
<div class="divider"></div>
<!-- ===== SECTION 1: 核心问题诊断 ===== -->
<section id="diagnosis">
<div class="container">
<div class="section-header fade-in">
<span class="tag tag-red">问题诊断</span>
<h2>你的 Vibe Coding 卡在哪里?</h2>
<p>29 个 Session 的数据揭示了三个系统性瓶颈,它们互相放大,形成恶性循环</p>
</div>
<!-- Vicious cycle diagram -->
<div class="big-insight fade-in">
<div style="display:flex; justify-content:center; align-items:center; gap:2rem; flex-wrap:wrap;">
<div style="text-align:center;">
<div style="font-size:2.5rem; margin-bottom:0.5rem;">🗣</div>
<div style="font-weight:700; color:var(--red);">上下文不足</div>
<div style="font-size:0.8rem; color:var(--text-muted);">Claude 靠猜</div>
</div>
<div style="font-size:2rem; color:var(--text-muted);">→</div>
<div style="text-align:center;">
<div style="font-size:2.5rem; margin-bottom:0.5rem;">🐛</div>
<div style="font-weight:700; color:var(--yellow);">方向错误 / Bug</div>
<div style="font-size:0.8rem; color:var(--text-muted);">代码不对</div>
</div>
<div style="font-size:2rem; color:var(--text-muted);">→</div>
<div style="text-align:center;">
<div style="font-size:2.5rem; margin-bottom:0.5rem;">🔄</div>
<div style="font-weight:700; color:var(--orange);">多轮调试</div>
<div style="font-size:0.8rem; color:var(--text-muted);">反复纠正</div>
</div>
<div style="font-size:2rem; color:var(--text-muted);">→</div>
<div style="text-align:center;">
<div style="font-size:2.5rem; margin-bottom:0.5rem;">😴</div>
<div style="font-weight:700; color:var(--red);">耐心耗尽</div>
<div style="font-size:0.8rem; color:var(--text-muted);">中断 Session</div>
</div>
</div>
<div class="explanation" style="margin-top:2rem;">
↑ 这个循环在你 <strong>8 个 partially_achieved</strong> 的 session 中反复出现
</div>
</div>
<div class="problem-grid fade-in">
<div class="problem-card">
<span class="severity severity-high">高频</span>
<span class="icon">⚠️</span>
<h3>任务打包过大</h3>
<p class="desc">你习惯一个 Session 塞多个大功能。Claude 在第一个功能上就消耗大量上下文,第二个任务要么没开始,要么质量崩塌。</p>
<span class="metric" style="background:var(--red-bg); color:var(--red);">8 次 session 未完成第二个任务</span>
</div>
<div class="problem-card">
<span class="severity severity-high">高频</span>
<span class="icon">🔎</span>
<h3>零测试覆盖</h3>
<p class="desc">后端没有 pytest 测试文件,前端只有 smoke test。Claude 改完代码没有自动验证,bug 只能靠你肉眼发现,发现时往往已经扩散。</p>
<span class="metric" style="background:var(--red-bg); color:var(--red);">16 次 buggy code 事件</span>
</div>
<div class="problem-card">
<span class="severity severity-mid">中频</span>
<span class="icon">📄</span>
<h3>Claude 逃避 Bug</h3>
<p class="desc">你报了 bug,Claude 转头写文档或优化。原因:你的 bug 报告和其他需求混在一起,Claude 自动挑了"更容易"的任务。</p>
<span class="metric" style="background:var(--yellow-bg); color:var(--yellow);">多个 session 核心 bug 未修复</span>
</div>
<div class="problem-card">
<span class="severity severity-mid">中频</span>
<span class="icon">🎯</span>
<h3>TypeScript 编译错误积累</h3>
<p class="desc">Claude 改完 .ts / .vue 文件不做类型检查,错误积累到后面变成连锁问题,需要多轮调试才能修好。</p>
<span class="metric" style="background:var(--yellow-bg); color:var(--yellow);">GLM 集成花了 4 轮修编译</span>
</div>
</div>
</div>
</section>
<div class="divider"></div>
<!-- ===== SECTION 2: 正确的 Vibe Coding 工作流 ===== -->
<section id="workflow">
<div class="container">
<div class="section-header fade-in">
<span class="tag tag-blue">核心方法论</span>
<h2>正确的 Vibe Coding 编码循环</h2>
<p>用这个流程替换你现在的"给目标 → 边做边纠"模式</p>
</div>
<div class="flow-diagram fade-in">
<div class="flow-step">
<div class="icon-circle" style="border-color:var(--blue); background:var(--blue-bg); color:var(--blue);">①</div>
<h4>给上下文</h4>
<p>告诉 Claude 读哪些文件、改动范围、约束条件</p>
</div>
<div class="flow-step">
<div class="icon-circle" style="border-color:var(--accent); background:rgba(108,99,255,0.08); color:var(--accent);">②</div>
<h4>确认理解</h4>
<p>让 Claude 复述方案、列出要改的文件,你确认后才动手</p>
</div>
<div class="flow-step">
<div class="icon-circle" style="border-color:var(--yellow); background:var(--yellow-bg); color:var(--yellow);">③</div>
<h4>小步实现</h4>
<p>每次只改一个功能点,改完立即验证</p>
</div>
<div class="flow-step">
<div class="icon-circle" style="border-color:var(--green); background:var(--green-bg); color:var(--green);">④</div>
<h4>自动验证</h4>
<p>Hooks + 测试自动拦截 bug,不通过不进下一步</p>
</div>
<div class="flow-step">
<div class="icon-circle" style="border-color:var(--orange); background:var(--orange-bg); color:var(--orange);">⑤</div>
<h4>确认提交</h4>
<p>验证全部通过后才 commit,进入下一个任务</p>
</div>
</div>
<div class="tip-box info fade-in">
<div class="tip-title">关键区别</div>
你现在的流程是<strong>"给大目标 → Claude 自由发挥 → 出问题再纠"</strong>。
正确的流程是<strong>"给精确上下文 → 确认方案 → 小步改动 → 自动验证 → 再走下一步"</strong>。
看起来步骤多了,但你节省的是后面 3-5 轮的返工时间。
</div>
</div>
</section>
<div class="divider"></div>
<!-- ===== SECTION 3: 三道护栏 ===== -->
<section id="guardrails">
<div class="container">
<div class="section-header fade-in">
<span class="tag tag-green">防线建设</span>
<h2>三道护栏:让 Bug 无处可藏</h2>
<p>你的编码效率瓶颈在于缺少自动化质量门禁</p>
</div>
<div class="guardrail-stack fade-in">
<div class="guardrail-layer">
<div class="layer-icon" style="background:var(--red-bg); color:var(--red);">🚫</div>
<div class="layer-content">
<h4>第一道:CLAUDE.md 行为约束</h4>
<p>写进项目的规则文件,Claude 每次启动都会读取。控制它的行为模式,防止跑偏写文档。</p>
</div>
<span class="trigger" style="background:var(--red-bg); color:var(--red);">每次 session 生效</span>
</div>
<div class="guardrail-layer">
<div class="layer-icon" style="background:var(--yellow-bg); color:var(--yellow);">⚡</div>
<div class="layer-content">
<h4>第二道:Hooks 自动检查</h4>
<p>Claude 每次编辑文件后自动触发类型检查和语法检查,编译错误当场暴露。</p>
</div>
<span class="trigger" style="background:var(--yellow-bg); color:var(--yellow);">每次编辑触发</span>
</div>
<div class="guardrail-layer">
<div class="layer-icon" style="background:var(--green-bg); color:var(--green);">✅</div>
<div class="layer-content">
<h4>第三道:测试套件</h4>
<p>关键路径的自动化测试,改完代码跑一遍就知道有没有回归,不靠人肉验证。</p>
</div>
<span class="trigger" style="background:var(--green-bg); color:var(--green);">每次提交前运行</span>
</div>
</div>
<!-- 护栏 1: CLAUDE.md -->
<h3 style="margin-top:3rem; margin-bottom:1.5rem; font-size:1.3rem;" class="fade-in">护栏一:CLAUDE.md 行为规则</h3>
<p style="color:var(--text-muted); margin-bottom:1rem;" class="fade-in">在你的 CLAUDE.md 开头加入以下规则。这些不是"建议",是 Claude 必须遵守的硬性约束:</p>
<pre class="fade-in"><span class="comment">## Working Rules</span>
<span class="keyword">1.</span> <span class="highlight">修 bug 优先于一切。</span>用户报了 bug,在 bug 确认修复前不做任何其他事
(包括写文档、重构、优化、添加注释)。
<span class="keyword">2.</span> <span class="highlight">改代码前先读代码。</span>不要基于猜测修改文件。先 Read 相关文件,
理解现有逻辑后再提出方案。
<span class="keyword">3.</span> <span class="highlight">每次改动都要验证。</span>
- 后端:uv run pytest
- 前端:npx tsc --noEmit && npm run test
验证不通过不算完成。
<span class="keyword">4.</span> <span class="highlight">单任务原则。</span>每轮只做一件事,做完确认后再接下一件。
不要在一轮里同时改 auth、chat、workflow。
<span class="keyword">5.</span> <span class="highlight">大改动先列清单。</span>涉及 3 个以上文件的改动,
先列出要改哪些文件、每个文件改什么,确认后再动手。</pre>
<!-- 护栏 2: Hooks -->
<h3 style="margin-top:3rem; margin-bottom:1.5rem; font-size:1.3rem;" class="fade-in">护栏二:Hooks 配置</h3>
<p style="color:var(--text-muted); margin-bottom:1rem;" class="fade-in">在 <code>.claude/settings.json</code> 中添加,Claude 每次编辑文件都会自动触发检查:</p>
<pre class="fade-in"><span class="comment">// .claude/settings.json</span>
{
<span class="string">"hooks"</span>: {
<span class="string">"postToolUse"</span>: [
{
<span class="string">"matcher"</span>: <span class="string">"Edit|Write"</span>,
<span class="string">"hooks"</span>: [
{
<span class="string">"type"</span>: <span class="string">"command"</span>,
<span class="string">"command"</span>: <span class="string">"filepath=\"$CLAUDE_FILE_PATH\"; \
if echo \"$filepath\" | grep -qE '\\.ts$|\\.vue$'; then \
cd frontend && npx tsc --noEmit 2>&1 | head -30; \
elif echo \"$filepath\" | grep -qE '\\.py$'; then \
cd backend && uv run python -m py_compile \"$filepath\" 2>&1; \
fi"</span>
}
]
}
]
}
}</pre>
<div class="comparison fade-in">
<div class="compare-panel bad">
<div class="panel-header">❌ 没有 Hooks 的情况</div>
<div class="panel-body">
<ol style="font-size:0.9rem; padding-left:1.2rem; color:var(--text-muted);">
<li>Claude 改了 3 个 .ts 文件</li>
<li>你运行页面,白屏</li>
<li>打开控制台发现 TypeError</li>
<li>告诉 Claude 有编译错误</li>
<li>Claude 修了,又引入新错误</li>
<li>继续来回 3 轮...</li>
</ol>
<div style="margin-top:1rem; padding:0.5rem; background:var(--red-bg); border-radius:8px; text-align:center; font-size:0.85rem; color:var(--red);">
结果:浪费 5-6 轮对话
</div>
</div>
</div>
<div class="compare-panel good">
<div class="panel-header">✅ 有 Hooks 的情况</div>
<div class="panel-body">
<ol style="font-size:0.9rem; padding-left:1.2rem; color:var(--text-muted);">
<li>Claude 改了第 1 个 .ts 文件</li>
<li>Hook 自动运行 tsc,报错</li>
<li>Claude 立即看到错误,当场修复</li>
<li>Hook 再次运行,通过</li>
<li>继续改下一个文件...</li>
</ol>
<div style="margin-top:1rem; padding:0.5rem; background:var(--green-bg); border-radius:8px; text-align:center; font-size:0.85rem; color:var(--green);">
结果:每个错误都在产生的瞬间修复
</div>
</div>
</div>
</div>
<!-- 护栏 3: 测试 -->
<h3 style="margin-top:3rem; margin-bottom:1.5rem; font-size:1.3rem;" class="fade-in">护栏三:测试套件</h3>
<p style="color:var(--text-muted); margin-bottom:1rem;" class="fade-in">你的后端 pyproject.toml 已经配好了 pytest,但 <code>tests/</code> 目录是空的。从这三个优先级开始:</p>
<div class="pipeline fade-in">
<div class="pipeline-stage">
<div class="stage-num">P0</div>
<h4>Auth API</h4>
<p>登录、登出、token 验证、权限隔离</p>
<span class="gate gate-check">✓</span>
</div>
<div class="pipeline-stage">
<div class="stage-num">P0</div>
<h4>Session 持久化</h4>
<p>创建、保存、加载、权限、删除</p>
<span class="gate gate-check">✓</span>
</div>
<div class="pipeline-stage">
<div class="stage-num">P1</div>
<h4>Skill 解析</h4>
<p>@skill 解析、加载、输入映射</p>
<span class="gate gate-check">✓</span>
</div>
<div class="pipeline-stage">