-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
587 lines (543 loc) · 35.3 KB
/
Copy pathindex.html
File metadata and controls
587 lines (543 loc) · 35.3 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
<!doctype html>
<html lang="en" data-theme="light">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Clean Code — refactor legacy code without changing its behavior</title>
<meta name="description" content="An agent skill that refactors legacy code behind retained characterization tests. Precise names and locality over abstraction; every edit evidence-backed and reversible." />
<link rel="icon" href="assets/icon.svg" />
<link rel="alternate" type="text/plain" href="llms.txt" title="Agent-readable summary (llms.txt)" />
<style>
/* ---------- Tokens ---------- */
:root {
--bg: #faf8f3; /* warm paper */
--bg-soft: #f3efe6;
--surface: #ffffff;
--fg: #1c1b18; /* warm ink */
--fg-2: #5c564b; /* warm secondary — ~6.6:1 on bg */
--fg-3: #807968;
--rule: #e6e0d2;
--rule-2: #efe9dc;
--brand: #3d3d3b; /* icon charcoal, warmed */
--brand-fg: #ffffff;
--accent: #0f6b4b; /* pine — "tests stay green" */
--accent-strong: #0c5a3f; /* button bg, white text ~8:1 */
--accent-soft: #e7f0eb;
--code-bg: #f1ede2;
--code-fg: #2a2722;
--maxw: 72rem;
--measure: 68ch;
--radius: 14px;
--radius-sm: 9px;
--shadow: 0 1px 2px rgba(28,27,24,.04), 0 10px 30px -12px rgba(28,27,24,.18);
--shadow-lg: 0 2px 4px rgba(28,27,24,.05), 0 24px 60px -20px rgba(28,27,24,.28);
--serif: ui-serif, "Iowan Old Style", "Apple Garamond", Baskerville, Georgia, "Times New Roman", serif;
--sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, "Helvetica Neue", Arial, sans-serif;
--mono: ui-monospace, "SF Mono", "JetBrains Mono", "Fira Code", Menlo, Consolas, monospace;
}
[data-theme="dark"] {
--bg: #121214;
--bg-soft: #18181b;
--surface: #1b1b1f;
--fg: #f2efe9;
--fg-2: #b4ad9f; /* tinted from fg */
--fg-3: #837d70;
--rule: #2a2a2f;
--rule-2: #232327;
--brand: #e6e3dd;
--brand-fg: #1c1b18;
--accent: #34b781;
--accent-strong: #1f8f63;
--accent-soft: #16241e;
--code-bg: #232327;
--code-fg: #ece7db;
--shadow: 0 1px 2px rgba(0,0,0,.4), 0 12px 34px -14px rgba(0,0,0,.6);
--shadow-lg: 0 2px 6px rgba(0,0,0,.45), 0 30px 70px -26px rgba(0,0,0,.7);
}
/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
margin: 0;
background: var(--bg);
color: var(--fg);
font-family: var(--sans);
font-size: clamp(1rem, .96rem + .2vw, 1.09375rem);
line-height: 1.65;
-webkit-font-smoothing: antialiased;
text-rendering: optimizeLegibility;
transition: background-color .35s ease, color .35s ease;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
::selection { background: var(--accent-soft); color: var(--accent-strong); }
/* ---------- Layout ---------- */
.wrap { width: min(100% - 2.5rem, var(--maxw)); margin-inline: auto; }
.measure { max-width: var(--measure); }
section { padding: clamp(3.5rem, 7vw, 6.5rem) 0; }
.lead { font-size: clamp(1.15rem, 1rem + .6vw, 1.4rem); line-height: 1.55; color: var(--fg-2); }
h1, h2, h3 { font-family: var(--serif); font-weight: 540; letter-spacing: -.02em; line-height: 1.08; text-wrap: balance; }
h2 { font-size: clamp(1.9rem, 1.4rem + 2.4vw, 3rem); margin: 0 0 1.25rem; }
h3 { font-size: clamp(1.2rem, 1.05rem + .8vw, 1.5rem); letter-spacing: -.015em; }
p { margin: 0 0 1.1rem; }
.kicker {
font-family: var(--sans); font-size: .78rem; font-weight: 600; letter-spacing: .14em;
text-transform: uppercase; color: var(--accent); margin: 0 0 1.1rem;
}
/* ---------- Nav ---------- */
.nav {
position: sticky; top: 0; z-index: 50;
backdrop-filter: saturate(1.4) blur(10px);
background: color-mix(in srgb, var(--bg) 82%, transparent);
border-bottom: 1px solid transparent;
transition: border-color .3s ease, background .3s ease;
}
.nav.scrolled { border-bottom-color: var(--rule); }
.nav-inner { display: flex; align-items: center; gap: 1rem; height: 4rem; }
.brand { display: inline-flex; align-items: center; gap: .6rem; font-weight: 600; color: var(--fg); font-size: 1.02rem; letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand .mark { width: 26px; height: 26px; border-radius: 7px; flex: none; }
.brand .mark path:first-child { fill: var(--brand); }
.nav-links { display: flex; align-items: center; gap: 1.5rem; margin-left: auto; }
.nav-links a { color: var(--fg-2); font-size: .94rem; font-weight: 500; }
.nav-links a:hover { color: var(--fg); text-decoration: none; }
.icon-btn {
appearance: none; border: 1px solid var(--rule); background: var(--surface); color: var(--fg-2);
width: 38px; height: 38px; border-radius: 10px; cursor: pointer; display: inline-grid; place-items: center;
transition: color .2s, border-color .2s, background .2s;
}
.icon-btn:hover { color: var(--fg); border-color: var(--fg-3); }
.icon-btn svg { width: 18px; height: 18px; }
.gh-btn {
display: inline-flex; align-items: center; gap: .45rem; border: 1px solid var(--rule);
background: var(--surface); color: var(--fg); padding: .5rem .85rem; border-radius: 10px; font-size: .9rem; font-weight: 550;
}
.gh-btn:hover { border-color: var(--fg-3); text-decoration: none; }
@media (max-width: 640px) { .nav-links .hide-sm { display: none; } }
/* ---------- Hero ---------- */
.hero { padding-top: clamp(3rem, 8vw, 6rem); padding-bottom: clamp(2.5rem, 6vw, 4.5rem); }
.hero-grid { display: grid; grid-template-columns: 1fr; gap: 2.5rem; align-items: center; }
@media (min-width: 960px) { .hero-grid { grid-template-columns: 1.35fr .9fr; gap: 3.5rem; } }
.hero .mark-tile {
width: 92px; height: 92px; border-radius: 24px; display: grid; place-items: center;
background: var(--brand); box-shadow: var(--shadow); margin-bottom: 1.75rem;
}
.hero .mark-tile svg { width: 52px; height: 52px; }
.hero h1 {
font-size: clamp(2.5rem, 1.7rem + 4vw, 4.25rem); letter-spacing: -.035em; margin: 0 0 1.25rem; font-weight: 560;
}
.hero h1 em { font-style: italic; color: var(--accent); font-weight: 540; }
.hero .lead { max-width: 46ch; margin-bottom: 2rem; }
.cta-row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }
.btn {
display: inline-flex; align-items: center; gap: .5rem; border-radius: 11px; padding: .8rem 1.25rem;
font-weight: 600; font-size: .98rem; cursor: pointer; border: 1px solid transparent; transition: transform .15s ease, box-shadow .2s, background .2s, border-color .2s;
}
.btn-primary { background: var(--accent-strong); color: #fff; box-shadow: var(--shadow); }
.btn-primary:hover { text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.btn-ghost { background: transparent; color: var(--fg); border-color: var(--rule); }
.btn-ghost:hover { text-decoration: none; border-color: var(--fg-3); }
.btn svg { width: 18px; height: 18px; }
.hero-card { position: relative; }
.terminal {
background: var(--surface); border: 1px solid var(--rule); border-radius: 16px; box-shadow: var(--shadow-lg);
overflow: hidden; font-family: var(--mono); font-size: .86rem;
}
.term-bar { display: flex; align-items: center; gap: .4rem; padding: .7rem .9rem; border-bottom: 1px solid var(--rule); background: var(--bg-soft); }
.term-bar .dot { width: 11px; height: 11px; border-radius: 50%; background: var(--rule); }
.term-bar .term-title { margin-left: .5rem; font-size: .76rem; color: var(--fg-3); font-family: var(--sans); }
.term-body { padding: 1.1rem 1.2rem; color: var(--code-fg); line-height: 1.85; }
.term-body .prompt { color: var(--accent); }
.term-body .cmd { color: var(--fg); }
.term-body .out { color: var(--fg-2); }
.term-body .ok { color: var(--accent); }
.term-body .cmt { color: var(--fg-3); }
.cursor { display: inline-block; width: 8px; height: 1.05em; background: var(--accent); vertical-align: -2px; animation: blink 1.1s steps(2) infinite; border-radius: 1px; }
@keyframes blink { 50% { opacity: 0; } }
/* authored motion: one hero entrance */
.reveal { opacity: 0; transform: translateY(14px); }
.reveal.in { opacity: 1; transform: none; transition: opacity .7s cubic-bezier(.16,1,.3,1), transform .7s cubic-bezier(.16,1,.3,1); }
.reveal.d1 { transition-delay: .05s; } .reveal.d2 { transition-delay: .16s; } .reveal.d3 { transition-delay: .27s; } .reveal.d4 { transition-delay: .38s; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } .cursor { animation: none; } }
/* ---------- Pillars strip ---------- */
.pillars { border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); background: var(--bg-soft); }
.pillars-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0; }
.pillar { padding: 1.6rem 1.25rem; border-right: 1px solid var(--rule); }
.pillar:last-child { border-right: 0; }
@media (max-width: 720px) { .pillar { border-right: 0; border-bottom: 1px solid var(--rule); } .pillar:last-child { border-bottom: 0; } }
.pillar .n { font-family: var(--serif); font-size: 2.1rem; color: var(--accent); line-height: 1; letter-spacing: -.02em; }
.pillar .t { margin-top: .5rem; font-size: .95rem; color: var(--fg-2); line-height: 1.45; }
/* ---------- Narrative ---------- */
.narr p { font-size: 1.08rem; color: var(--fg-2); }
.narr strong { color: var(--fg); font-weight: 600; }
.pull { font-family: var(--serif); font-size: clamp(1.4rem, 1.1rem + 1.4vw, 2rem); line-height: 1.3; letter-spacing: -.02em; color: var(--fg); border-left: 2px solid var(--accent); padding-left: 1.25rem; margin: 2.5rem 0; max-width: 30ch; }
/* ---------- Workflow ---------- */
.flow { position: relative; margin-top: 2.5rem; }
.flow::before { content: ""; position: absolute; left: 17px; top: 8px; bottom: 8px; width: 2px; background: var(--rule); }
.step { position: relative; display: grid; grid-template-columns: 44px 1fr; gap: 1.1rem; padding-bottom: 2rem; }
.step:last-child { padding-bottom: 0; }
.step .num {
width: 36px; height: 36px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent);
color: var(--accent); display: grid; place-items: center; font-family: var(--serif); font-weight: 600; font-size: 1rem;
position: relative; z-index: 1;
}
.step h3 { margin: .15rem 0 .35rem; }
.step p { color: var(--fg-2); margin: 0; max-width: 60ch; }
.step .gate { display: inline-flex; align-items: center; gap: .35rem; margin-top: .55rem; font-size: .82rem; font-weight: 600; color: var(--accent); }
/* ---------- Guarantees ---------- */
.dl { display: grid; grid-template-columns: 1fr; gap: 0; margin-top: 2rem; }
@media (min-width: 820px) { .dl { grid-template-columns: 1fr 1fr; gap: 0 3rem; } }
.dl div { padding: 1.05rem 0; border-bottom: 1px solid var(--rule-2); }
.dl dt { font-weight: 600; color: var(--fg); letter-spacing: -.005em; }
.dl dd { margin: .2rem 0 0; color: var(--fg-2); font-size: .96rem; }
/* ---------- Install ---------- */
.install-grid { display: grid; grid-template-columns: 1fr; gap: 2rem; margin-top: 2rem; }
@media (min-width: 900px) { .install-grid { grid-template-columns: 1.1fr .9fr; align-items: start; } }
.tabs { display: flex; gap: .35rem; flex-wrap: wrap; margin-bottom: 1rem; }
.tab {
appearance: none; border: 1px solid var(--rule); background: var(--surface); color: var(--fg-2);
padding: .5rem .9rem; border-radius: 9px; font-size: .9rem; font-weight: 550; cursor: pointer; transition: all .2s;
}
.tab[aria-selected="true"] { background: var(--accent-soft); color: var(--accent-strong); border-color: color-mix(in srgb, var(--accent) 30%, var(--rule)); }
[data-theme="dark"] .tab[aria-selected="true"] { color: var(--accent); }
.panel { display: none; }
.panel.active { display: block; }
.codeblock { position: relative; background: var(--code-bg); border: 1px solid var(--rule); border-radius: 12px; }
.codeblock pre { margin: 0; padding: 1rem 3.2rem 1rem 1.15rem; overflow-x: auto; font-family: var(--mono); font-size: .875rem; line-height: 1.7; color: var(--code-fg); }
.codeblock pre code { white-space: pre; }
.copy {
position: absolute; top: .6rem; right: .6rem; appearance: none; border: 1px solid var(--rule); background: var(--surface);
color: var(--fg-2); border-radius: 8px; padding: .35rem .55rem; font-size: .78rem; font-weight: 600; cursor: pointer;
display: inline-flex; align-items: center; gap: .3rem; transition: all .15s;
}
.copy:hover { color: var(--fg); border-color: var(--fg-3); }
.copy.done { color: var(--accent); border-color: var(--accent); }
.copy svg { width: 14px; height: 14px; }
.agent-note {
background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--rule));
border-radius: 12px; padding: 1.25rem 1.35rem;
}
[data-theme="dark"] .agent-note { background: var(--accent-soft); }
.agent-note h3 { margin: 0 0 .6rem; font-size: 1.1rem; color: var(--accent-strong); }
[data-theme="dark"] .agent-note h3 { color: var(--accent); }
.agent-note p { font-size: .95rem; color: var(--fg-2); margin: 0 0 .75rem; }
.agent-note ul { margin: .5rem 0 0; padding-left: 1.1rem; color: var(--fg-2); font-size: .92rem; }
.agent-note li { margin-bottom: .35rem; }
.agent-note code { font-family: var(--mono); font-size: .86em; background: color-mix(in srgb, var(--fg) 8%, transparent); padding: .1em .35em; border-radius: 5px; }
code.inline { font-family: var(--mono); font-size: .86em; background: var(--code-bg); padding: .12em .4em; border-radius: 5px; color: var(--code-fg); }
.scope-label { font-size: .82rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--fg-3); margin: 1.1rem 0 .4rem; }
/* ---------- Invoke ---------- */
.invoke .codeblock { max-width: 60ch; }
/* ---------- Footer ---------- */
footer { border-top: 1px solid var(--rule); padding: 2.5rem 0 3.5rem; color: var(--fg-3); font-size: .92rem; }
.foot-grid { display: flex; flex-wrap: wrap; gap: 1rem 2rem; align-items: center; justify-content: space-between; }
footer a { color: var(--fg-2); }
.foot-links { display: flex; gap: 1.25rem; flex-wrap: wrap; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
a:focus-visible, button:focus-visible, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
</style>
</head>
<body>
<a href="#main" class="sr-only">Skip to content</a>
<!-- Nav -->
<header class="nav" id="nav">
<div class="wrap nav-inner">
<a class="brand" href="#top" aria-label="Clean Code home">
<svg class="mark" viewBox="0 0 24 24" aria-hidden="true">
<path d="M7 20.45C6.23 20.45 5.53 20.29 4.93 19.95C4.32 19.61 3.84 19.14 3.5 18.53C3.17 17.92 3 17.23 3 16.45V6.45C3 5.68 3.17 4.99 3.5 4.38C3.84 3.77 4.32 3.3 4.93 2.96C5.53 2.62 6.23 2.45 7 2.45H17C17.78 2.45 18.47 2.62 19.08 2.96C19.69 3.3 20.15 3.77 20.49 4.38C20.83 4.99 21 5.68 21 6.45V16.45C21 17.23 20.83 17.92 20.49 18.53C20.15 19.14 19.69 19.61 19.08 19.95C18.47 20.29 17.78 20.45 17 20.45H7Z"/>
<path fill-rule="evenodd" clip-rule="evenodd" fill="#fff" d="M7.96 8.77c.27-.35.76-.42 1.12-.16.35.27.43.77.16 1.12L7.8 11.65l1.44 1.92c.26.35.2.85-.16 1.12-.35.26-.85.2-1.12-.16l-1.8-2.4a.86.86 0 0 1 0-1.04l1.8-2.4ZM12.68 8.89c.2-.4.68-.56 1.08-.36.4.2.56.68.36 1.08l-2.4 4.8c-.2.4-.68.56-1.08.36-.4-.2-.56-.68-.36-1.08l2.4-4.8ZM15.32 8.61c.35-.26.85-.2 1.12.16l1.8 2.4a.86.86 0 0 1 0 1.04l-1.8 2.4c-.27.36-.77.42-1.12.16-.35-.27-.43-.77-.16-1.12l1.44-1.92-1.44-1.92c-.27-.35-.19-.85.16-1.12Z"/>
</svg>
<span>Clean Code</span>
</a>
<nav class="nav-links" aria-label="Primary">
<a href="#workflow" class="hide-sm">Workflow</a>
<a href="#guarantees" class="hide-sm">Guarantees</a>
<a href="#install">Install</a>
<button class="icon-btn" id="theme" aria-label="Toggle color theme" title="Toggle theme">
<svg id="icon-sun" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><circle cx="12" cy="12" r="4"/><path d="M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4"/></svg>
<svg id="icon-moon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:none"><path d="M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8Z"/></svg>
</button>
<a class="gh-btn" href="https://github.com/cskwork/clean-code" rel="noopener">
<svg viewBox="0 0 24 24" width="17" height="17" fill="currentColor" aria-hidden="true"><path d="M12 2C6.48 2 2 6.58 2 12.25c0 4.53 2.87 8.37 6.84 9.73.5.1.68-.22.68-.49l-.01-1.7c-2.78.62-3.37-1.37-3.37-1.37-.46-1.18-1.11-1.5-1.11-1.5-.91-.64.07-.62.07-.62 1 .07 1.53 1.06 1.53 1.06.9 1.57 2.34 1.12 2.91.85.09-.66.35-1.12.63-1.38-2.22-.26-4.55-1.14-4.55-5.06 0-1.12.39-2.03 1.03-2.75-.1-.26-.45-1.3.1-2.71 0 0 .84-.28 2.75 1.05a9.4 9.4 0 0 1 5 0c1.91-1.33 2.75-1.05 2.75-1.05.55 1.41.2 2.45.1 2.71.64.72 1.03 1.63 1.03 2.75 0 3.93-2.34 4.79-4.57 5.05.36.32.68.94.68 1.9l-.01 2.82c0 .27.18.6.69.49A10.26 10.26 0 0 0 22 12.25C22 6.58 17.52 2 12 2Z"/></svg>
GitHub
</a>
</nav>
</div>
</header>
<main id="top">
<span id="main"></span>
<!-- Hero -->
<section class="hero">
<div class="wrap hero-grid">
<div>
<div class="mark-tile reveal d1" aria-hidden="true">
<svg viewBox="0 0 24 24"><path d="M7 20.45C6.23 20.45 5.53 20.29 4.93 19.95C4.32 19.61 3.84 19.14 3.5 18.53C3.17 17.92 3 17.23 3 16.45V6.45C3 5.68 3.17 4.99 3.5 4.38C3.84 3.77 4.32 3.3 4.93 2.96C5.53 2.62 6.23 2.45 7 2.45H17C17.78 2.45 18.47 2.62 19.08 2.96C19.69 3.3 20.15 3.77 20.49 4.38C20.83 4.99 21 5.68 21 6.45V16.45C21 17.23 20.83 17.92 20.49 18.53C20.15 19.14 19.69 19.61 19.08 19.95C18.47 20.29 17.78 20.45 17 20.45H7Z" fill="#3d3d3b"/><path fill="#fff" fill-rule="evenodd" clip-rule="evenodd" d="M7.96 8.77c.27-.35.76-.42 1.12-.16.35.27.43.77.16 1.12L7.8 11.65l1.44 1.92c.26.35.2.85-.16 1.12-.35.26-.85.2-1.12-.16l-1.8-2.4a.86.86 0 0 1 0-1.04l1.8-2.4ZM12.68 8.89c.2-.4.68-.56 1.08-.36.4.2.56.68.36 1.08l-2.4 4.8c-.2.4-.68.56-1.08.36-.4-.2-.56-.68-.36-1.08l2.4-4.8ZM15.32 8.61c.35-.26.85-.2 1.12.16l1.8 2.4a.86.86 0 0 1 0 1.04l-1.8 2.4c-.27.36-.77.42-1.12.16-.35-.27-.43-.77-.16-1.12l1.44-1.92-1.44-1.92c-.27-.35-.19-.85.16-1.12Z"/></svg>
</div>
<p class="kicker reveal d1">Agent Skill · v1.0.0 · MIT</p>
<h1 class="reveal d2">Change the code.<br><em>Preserve the behavior.</em></h1>
<p class="lead reveal d3">A repository-aware agent skill that refactors legacy code behind retained characterization tests. It favors precise names and locality over abstraction — so every edit is evidence-backed, focused, and reversible.</p>
<div class="cta-row reveal d4">
<a class="btn btn-primary" href="#install">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 3v12m0 0 4-4m-4 4-4-4M5 21h14"/></svg>
Install the skill
</a>
<a class="btn btn-ghost" href="https://github.com/cskwork/clean-code/blob/main/SKILL.md" rel="noopener">Read SKILL.md</a>
</div>
</div>
<div class="hero-card reveal d3">
<div class="terminal" aria-label="Example agent session">
<div class="term-bar">
<span class="dot"></span><span class="dot"></span><span class="dot"></span>
<span class="term-title">codex — clean-code</span>
</div>
<div class="term-body">
<div><span class="prompt">$</span> <span class="cmd">clean-code Refactor the legacy order-pricing</span></div>
<div><span class="cmd"> module without changing behavior.</span></div>
<div class="out"> </div>
<div class="cmt"># 1 · establishing boundary — tracing callers</div>
<div class="cmt"># 2 · locking behavior with characterization tests</div>
<div class="ok">✓ 6 retained tests pass on unchanged code</div>
<div class="cmt"># 4 · smallest useful refactor (rename + guard clauses)</div>
<div class="ok">✓ all characterization tests still green</div>
<div class="out"> </div>
<div class="out">Refactor complete. Behavior preserved.<span class="cursor"></span></div>
</div>
</div>
</div>
</div>
</section>
<!-- Pillars -->
<section class="pillars" style="padding:0">
<div class="wrap" style="padding:0">
<div class="pillars-grid">
<div class="pillar"><div class="n">7</div><div class="t">Enforced workflow steps, each with completion criteria</div></div>
<div class="pillar"><div class="n">0</div><div class="t">Production changes allowed before tests pass</div></div>
<div class="pillar"><div class="n">1</div><div class="t">API versioning decision gate, asked once</div></div>
<div class="pillar"><div class="n">MIT</div><div class="t">Licensed, open, Agent Skills compatible</div></div>
</div>
</div>
</section>
<!-- Narrative -->
<section class="narr">
<div class="wrap measure">
<p class="kicker">What it is</p>
<h2>Refactoring, without the silent rewrite.</h2>
<p>Most “clean code” efforts drift into rewrites — new files, interfaces, and patterns that change behavior in ways nobody asked for. <strong>Clean Code</strong> is an agent skill built on the opposite premise: <strong>behavior is characterized before it is touched</strong>, and every later edit is checked against that evidence.</p>
<p>It follows the Agent Skills open specification and runs wherever Codex or compatible clients do. The skill deliberately does <strong>not</strong> equate clean code with more methods, smaller functions, interfaces, or abstraction layers. A focused diff beats a broad refactor; a precise rename beats an extracted framework.</p>
<blockquote class="pull">If a change isn't protected by a test, it doesn't ship.</blockquote>
<p>Surprising legacy behavior is treated as <em>legacy behavior</em>, not a bug to quietly fix — preserved unless you explicitly authorize changing it. Verification reports distinguish what passed, what already failed, what newly failed, and what was never run. Nothing is overstated.</p>
</div>
</section>
<!-- Workflow -->
<section id="workflow" class="narr" style="background:var(--bg-soft); border-top:1px solid var(--rule); border-bottom:1px solid var(--rule);">
<div class="wrap">
<p class="kicker">The enforced sequence</p>
<h2>Seven steps. Every one gated.</h2>
<p class="lead measure" style="margin-bottom:0">The order is the safety. Tests before edits, versioning before implementation, verification before claims.</p>
<ol class="flow" style="list-style:none;padding-left:0">
<li class="step">
<div class="num">1</div>
<div>
<h3>Establish the refactoring boundary</h3>
<p>Read repo instructions, trace the full call path, discover the real test/lint/build commands, and record the baseline — including any tests that already fail.</p>
</div>
</li>
<li class="step">
<div class="num">2</div>
<div>
<h3>Lock current behavior with retained characterization tests</h3>
<p>Test through the most stable observable seam. Capture main paths, boundaries, errors, and legacy quirks. They must pass on the unchanged code before anything moves.</p>
<span class="gate">◆ Gate — no production diff yet</span>
</div>
</li>
<li class="step">
<div class="num">3</div>
<div>
<h3>Apply the API versioning gate</h3>
<p>For an externally consumed API, ask exactly one question: preserve v1 in place, or leave v1 untouched and add a side-by-side v2? Then stop until you answer.</p>
<span class="gate">◆ Decision gate — asked once</span>
</div>
</li>
<li class="step">
<div class="num">4</div>
<div>
<h3>Design the smallest useful refactor</h3>
<p>Plan rename → control flow → duplication → cohesion → extraction, in that order. Every new abstraction must justify itself against a concrete problem.</p>
</div>
</li>
<li class="step">
<div class="num">5</div>
<div>
<h3>Implement in small behavior-preserving batches</h3>
<p>One coherent transformation per batch. Run the narrow tests after each. Revert instantly if a previously green test surprises you.</p>
</div>
</li>
<li class="step">
<div class="num">6</div>
<div>
<h3>Verify the completed refactor</h3>
<p>Run every applicable check — tests, types, lint, build, security. Compare to baseline. Any new, unexplained failure blocks the claim of “done.”</p>
</div>
</li>
<li class="step">
<div class="num">7</div>
<div>
<h3>Report the result</h3>
<p>Scope, API strategy, retained tests, improvements, verification evidence, intentionally-preserved quirks, and unverified risks — separated as fact vs. assumption.</p>
</div>
</li>
</ol>
</div>
</section>
<!-- Guarantees -->
<section id="guarantees">
<div class="wrap">
<p class="kicker">Core guarantees</p>
<h2>What it will and won't do.</h2>
<dl class="dl">
<div><dt>Behavior characterized first</dt><dd>Production behavior is locked by retained tests before any production edit.</dd></div>
<div><dt>Tests stay as regression tests</dt><dd>Characterization tests are kept permanently — never deleted or weakened after the refactor.</dd></div>
<div><dt>API versioning is explicit</dt><dd>An decision gate after tests and before implementation — not a silent contract change.</dd></div>
<div><dt>Side-by-side v2 is untouched v1</dt><dd>Under the v2 strategy, v1 production files are left alone even when sharing would be convenient.</dd></div>
<div><dt>Refactor ≠ behavior change</dt><dd>Never combined with a bug fix, feature, dependency bump, or formatting pass.</dd></div>
<div><dt>Locality over size metrics</dt><dd>Names, cohesion, and local comprehension win over arbitrary method or file counts.</dd></div>
<div><dt>Honest verification</dt><dd>Distinguishes passing, pre-existing failures, new failures, and commands not run.</dd></div>
<div><dt>No speculative architecture</dt><dd>No interfaces, factories, or extension points added for hypothetical future needs.</dd></div>
</dl>
</div>
</section>
<!-- Install -->
<section id="install" style="background:var(--bg-soft); border-top:1px solid var(--rule); border-bottom:1px solid var(--rule);">
<div class="wrap">
<p class="kicker">Install</p>
<h2>One folder. Three ways in.</h2>
<p class="lead measure">Place <code class="inline">SKILL.md</code> at the root of the skill folder. That's the whole install.</p>
<div class="install-grid">
<div>
<div class="tabs" role="tablist" aria-label="Install method">
<button class="tab" role="tab" aria-selected="true" data-target="p-clone">Clone</button>
<button class="tab" role="tab" aria-selected="false" data-target="p-project">Project scope</button>
<button class="tab" role="tab" aria-selected="false" data-target="p-user">User scope</button>
</div>
<div id="p-clone" class="panel active">
<div class="scope-label">Get the skill</div>
<div class="codeblock">
<button class="copy" data-copy="git clone https://github.com/cskwork/clean-code.git"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="9" y="9" width="11" height="11" rx="2"/><path d="M5 15V5a2 2 0 0 1 2-2h10"/></svg>Copy</button>
<pre><code>git clone https://github.com/cskwork/clean-code.git
cp -r clean-code <repo>/.agents/skills/clean-code</code></pre>
</div>
</div>
<div id="p-project" class="panel">
<div class="scope-label">Codex · project scope</div>
<div class="codeblock">
<button class="copy" data-copy="cp -r clean-code <repository>/.agents/skills/clean-code/"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="9" y="9" width="11" height="11" rx="2"/><path d="M5 15V5a2 2 0 0 1 2-2h10"/></svg>Copy</button>
<pre><code># travels with the repository
cp -r clean-code <repository>/.agents/skills/clean-code/</code></pre>
</div>
</div>
<div id="p-user" class="panel">
<div class="scope-label">Codex · user scope</div>
<div class="codeblock">
<button class="copy" data-copy="cp -r clean-code $HOME/.agents/skills/clean-code/"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="9" y="9" width="11" height="11" rx="2"/><path d="M5 15V5a2 2 0 0 1 2-2h10"/></svg>Copy</button>
<pre><code># available across every project
cp -r clean-code $HOME/.agents/skills/clean-code/</code></pre>
</div>
</div>
<p style="margin-top:1.1rem;color:var(--fg-3);font-size:.92rem">For other Agent Skills-compatible clients, place the complete <code class="inline">clean-code</code> directory in the client's configured skills directory.</p>
</div>
<aside class="agent-note">
<h3>Reading this as an agent?</h3>
<p>The skill's routing entry point is <a href="https://github.com/cskwork/clean-code/blob/main/SKILL.md"><code>SKILL.md</code></a> — its frontmatter carries <code>name</code>, <code>description</code>, and <code>version</code> for implicit routing.</p>
<ul>
<li><a href="llms.txt"><code>llms.txt</code></a> — machine-readable summary of the skill and its install paths.</li>
<li><a href="https://raw.githubusercontent.com/cskwork/clean-code/main/SKILL.md">Raw <code>SKILL.md</code></a> — ingest directly.</li>
<li>Compatibility: requires repo access + the project's own test/verification commands.</li>
</ul>
<div style="margin-top:1rem">
<a class="btn btn-primary" style="padding:.6rem 1rem;font-size:.9rem" href="https://raw.githubusercontent.com/cskwork/clean-code/main/SKILL.md">Fetch SKILL.md</a>
</div>
</aside>
</div>
</div>
</section>
<!-- Invoke -->
<section class="invoke">
<div class="wrap measure">
<p class="kicker">Invoke</p>
<h2>Ask plainly. Get evidence back.</h2>
<p>Explicit invocation, or implicit routing on requests about legacy cleanup, technical debt, naming, and behavior-preserving refactors.</p>
<div class="codeblock">
<button class="copy" data-copy="$clean-code Refactor the legacy order-pricing module without changing behavior."><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="9" y="9" width="11" height="11" rx="2"/><path d="M5 15V5a2 2 0 0 1 2-2h10"/></svg>Copy</button>
<pre><code>$clean-code Refactor the legacy order-pricing module without changing behavior.</code></pre>
</div>
<p style="margin-top:1.5rem"><a href="https://github.com/cskwork/clean-code/blob/main/REFERENCES.md">See the sources that shaped the workflow →</a></p>
</div>
</section>
</main>
<footer>
<div class="wrap foot-grid">
<div>
<div class="brand" style="margin-bottom:.3rem">
<svg class="mark" viewBox="0 0 24 24" aria-hidden="true" style="width:22px;height:22px;border-radius:6px"><path d="M7 20.45C6.23 20.45 5.53 20.29 4.93 19.95C4.32 19.61 3.84 19.14 3.5 18.53C3.17 17.92 3 17.23 3 16.45V6.45C3 5.68 3.17 4.99 3.5 4.38C3.84 3.77 4.32 3.3 4.93 2.96C5.53 2.62 6.23 2.45 7 2.45H17C17.78 2.45 18.47 2.62 19.08 2.96C19.69 3.3 20.15 3.77 20.49 4.38C20.83 4.99 21 5.68 21 6.45V16.45C21 17.23 20.83 17.92 20.49 18.53C20.15 19.14 19.69 19.61 19.08 19.95C18.47 20.29 17.78 20.45 17 20.45H7Z" fill="#3d3d3b"/><path fill="#fff" fill-rule="evenodd" clip-rule="evenodd" d="M7.96 8.77c.27-.35.76-.42 1.12-.16.35.27.43.77.16 1.12L7.8 11.65l1.44 1.92c.26.35.2.85-.16 1.12-.35.26-.85.2-1.12-.16l-1.8-2.4a.86.86 0 0 1 0-1.04l1.8-2.4ZM15.32 8.61c.35-.26.85-.2 1.12.16l1.8 2.4a.86.86 0 0 1 0 1.04l-1.8 2.4c-.27.36-.77.42-1.12.16-.35-.27-.43-.77-.16-1.12l1.44-1.92-1.44-1.92c-.27-.35-.19-.85.16-1.12Z"/></svg>
<span>Clean Code</span>
</div>
<span>MIT licensed · Agent Skills v1.0.0</span>
</div>
<div class="foot-links">
<a href="https://github.com/cskwork/clean-code">GitHub</a>
<a href="https://github.com/cskwork/clean-code/blob/main/SKILL.md">SKILL.md</a>
<a href="https://github.com/cskwork/clean-code/blob/main/README.md">README</a>
<a href="llms.txt">llms.txt</a>
<a href="https://agentskills.io/">Agent Skills spec</a>
</div>
</div>
</footer>
<script>
// Theme
(function () {
var root = document.documentElement;
var pref = localStorage.getItem('cc-theme');
var sys = matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
var t = pref || sys;
root.setAttribute('data-theme', t);
function paint(){ document.getElementById('icon-sun').style.display = t === 'dark' ? 'none' : 'block'; document.getElementById('icon-moon').style.display = t === 'dark' ? 'block' : 'none'; }
paint();
document.getElementById('theme').addEventListener('click', function () {
t = t === 'dark' ? 'light' : 'dark';
root.setAttribute('data-theme', t);
localStorage.setItem('cc-theme', t);
paint();
});
})();
// Nav shadow on scroll
var nav = document.getElementById('nav');
addEventListener('scroll', function () { nav.classList.toggle('scrolled', scrollY > 8); }, { passive: true });
// Hero entrance (the one authored moment)
requestAnimationFrame(function () {
document.querySelectorAll('.reveal').forEach(function (el) { el.classList.add('in'); });
});
// Tabs
document.querySelectorAll('.tab').forEach(function (tab) {
tab.addEventListener('click', function () {
document.querySelectorAll('.tab').forEach(function (x) { x.setAttribute('aria-selected', 'false'); });
tab.setAttribute('aria-selected', 'true');
document.querySelectorAll('.panel').forEach(function (p) { p.classList.remove('active'); });
document.getElementById(tab.dataset.target).classList.add('active');
});
});
// Copy buttons
document.querySelectorAll('.copy').forEach(function (btn) {
btn.addEventListener('click', function () {
var text = btn.getAttribute('data-copy');
navigator.clipboard.writeText(text).then(function () {
var label = btn.childNodes[btn.childNodes.length - 1];
btn.classList.add('done'); label.nodeValue = 'Copied';
setTimeout(function () { btn.classList.remove('done'); label.nodeValue = 'Copy'; }, 1400);
});
});
});
</script>
</body>
</html>