Skip to content

Refactoring Section - #12

Merged
kryptt merged 8 commits into
masterfrom
refactorings-section
Sep 3, 2026
Merged

kryptt merged 8 commits into
masterfrom
refactorings-section

Conversation

@kryptt

@kryptt kryptt commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

No description provided.

kryptt and others added 2 commits September 3, 2026 14:19
…n examples

New section /refactorings/: the Constructive Programming refactoring
catalogue (35 entries across plain, higher-kinded and dependent types),
driven by _data/refactorings.yml; the 2019 post that held the list is
removed.

First entry, /refactorings/extract-method/: the OO move (Fowler, Opdyke,
Griswold) read as Burstall–Darlington define-and-fold, with lambda
lifting/dropping, let-floating, the GHC inliner and HaRe as the same
move at other scales; the extract/inline pair as one equation; the five
cases where it is not an equivalence; 15 verified references.

Three examples, each Before/After/Spec in Scala 3 and Haskell, included
verbatim into the page and proven equivalent with hedgehog properties on
both sides (run.sh runs all six; docker fallback for GHC). An independent
review mutation-tested every spec (12 mutants caught) and probed
strictness, evaluation count, Int boundaries and totality. Inline SVG
diagrams for the koan and each example.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HspK7yTkC5Jw5aiMV1Jqeq
…e catalogue

.claude/skills/refactoring-entry/: SKILL.md (procedure), brief.md (agent
brief template), workflow.js (research ∥ examples → mutation-review loop
→ diagrams, parameterised by slug) and LESSONS.md (append-only log and
calibration table; every run must add what it learned and fold rules
back into the procedure). Seeded with everything the extract-method run
learned: toolchain, generator calibration, reviewer findings, Jekyll
plumbing.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HspK7yTkC5Jw5aiMV1Jqeq
@github-actions

github-actions Bot commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-09-03 15:20 UTC

@kryptt kryptt changed the title Skill: refactoring-entry — repeatable, self-improving pipeline for the catalogue .claude/skills/refactoring-entry/: SKILL.md (procedure), brief.md (agent brief template), workflow.js (research ∥ examples → mutation-review loop → diagrams, parameterised by slug) and LESSONS.md (append-only log and calibration table; every run must add what it learned and fold rules back into the procedure). Seeded with everything the extract-method run learned: toolchain, generator calibration, reviewer findings, Jekyll plumbing. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HspK7yTkC5Jw5aiMV1Jqeq Refactoring Section Sep 3, 2026

@kryptt kryptt left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An additional point is that the extract method page should not show up in the top right nav

Comment thread pages/refactorings.md Outdated
Comment thread pages/refactorings.md Outdated
- Hide the extract-method entry page from the top-right nav (it is
  reached from the /refactorings/ catalogue, like the other entries).
- Link Hedgehog to its actual repos on both sides: scala-hedgehog and
  haskell-hedgehog, instead of hedgehog.qa.
- Acknowledge that the shared refactoring vocabulary is recent: the
  practice existed informally or less structured before Fowler's
  catalogue, Opdyke's thesis, and IDE Refactoring menus.
…in duals

- Rename the catalogue entry and page to "Extract / Inline Method" (permalink
  /refactorings/extract-method/ unchanged, sources dir unchanged).
- Add a Motivation section as the first section of the entry: why go in
  either direction — duplication and long methods drive Extract; speculative
  generality and coupling drive Inline.
- Skill (refactoring-entry): Motivation is always the first section of an
  entry; each entry is written with its dual, and the catalogue name carries
  both sides. Folded into SKILL.md, brief.md, and the workflow.js research
  prompt; LESSONS.md entry added.
Page (extract-method):
- Rename 'When it is not an equivalence' to 'Pitfalls' and fold the
  'The functional reading' prose into a collapsible footnote inside it
  (the FP framing is context, not a sales pitch).
- Rename 'Checking it' to 'Verification'.
- Motivation: link 'code smells' to the Wikipedia article; add a
  paragraph on nested methods (Scala/Haskell) where the extraction
  scope is a judgement about which values stay captured vs become
  parameters.
- Example 02 is now a nested extraction: step stays inside settle,
  capturing limit and fee; the fold supplies balance and tx. Sources
  rewritten (parallel Scala/Haskell), sheet now checks only
  Before.settle == After.settle, diagram redrawn for the nested shape.

Skill (refactoring-entry):
- brief.md: every entry carries the Extract / Inline page structure;
  OO reading only when one exists; 'Inverse' renamed 'Dual' and always
  present; code guidance: common domain subject, enough code to make
  the point, no accidental complexity.
- Sync renamed sections (Pitfalls, Verification) through SKILL.md
  section order and the workflow.js research prompt.
Page (extract-method):
- Every [n] citation is now a link [[n](#ref-n)] that jumps to the
  numbered reference at the bottom of the page.
- References section rewritten as raw HTML: a plain <ol> of <li id=ref-N>
  items so each has a stable anchor; inline markdown hand-rendered to
  <em>/<a> because Kramdown does not process markdown inside raw block HTML
  and IALs on numbered items split the list.

Skill (refactoring-entry):
- SKILL.md, brief.md, workflow.js all now require citation links and the
  raw-HTML reference list pattern; LESSONS.md documents the Kramdown traps
  (raw-block markdown is escaped; IALs land on the enclosing <ol>).
@kryptt
kryptt merged commit ea1e1d0 into master Sep 3, 2026
1 check passed
@kryptt
kryptt deleted the refactorings-section branch September 3, 2026 15:19
kryptt added a commit that referenced this pull request Sep 3, 2026
The rebase onto master (Refactoring Section #12) brought in the
refactorings catalogue, its raw-HTML citation blocks, and the internal
.claude/skills/refactoring-entry docs. Tune the lint config for what is
site content vs. tooling:

- mdl_style.rb: allow inline HTML (MD033) — the refactorings citations
  are raw-HTML <li> lines by design (kramdown won't process markdown
  inside raw block HTML).
- .overcommit.yml Mdl: exclude pages/refactorings/**/* (same reason;
  unwrappable citation lines), pages/refactorings.md, and
  .claude/**/* (agent-internal docs, not site prose). Overcommit
  excludes use File.fnmatch, so '**' needs the trailing '/*'.
- .git-hooks/pre_commit/spellr.rb: also skip .claude/, refactorings,
  scala/hs/js, run.sh, and dotfiles when overcommit passes absolute
  paths; spellr only honors .spellr.yml excludes when given no files.
- .spellr.yml + wordlist: exclude the same non-prose trees; wordlist
  refactorings/catalogue/opdyke/fowler/kramdown.
- pages/refactorings/extract-method.md: drop the trailing blank lines.
kryptt added a commit that referenced this pull request Sep 3, 2026
The rebase onto master (Refactoring Section #12) brought in the
refactorings catalogue, its raw-HTML citation blocks, and the internal
.claude/skills/refactoring-entry docs. Tune the lint config for what is
site content vs. tooling:

- mdl_style.rb: allow inline HTML (MD033) — the refactorings citations
  are raw-HTML <li> lines by design (kramdown won't process markdown
  inside raw block HTML).
- .overcommit.yml Mdl: exclude pages/refactorings/**/* (same reason;
  unwrappable citation lines), pages/refactorings.md, and
  .claude/**/* (agent-internal docs, not site prose). Overcommit
  excludes use File.fnmatch, so '**' needs the trailing '/*'.
- .git-hooks/pre_commit/spellr.rb: also skip .claude/, refactorings,
  scala/hs/js, run.sh, and dotfiles when overcommit passes absolute
  paths; spellr only honors .spellr.yml excludes when given no files.
- .spellr.yml + wordlist: exclude the same non-prose trees; wordlist
  refactorings/catalogue/opdyke/fowler/kramdown.
- pages/refactorings/extract-method.md: drop the trailing blank lines.
kryptt added a commit that referenced this pull request Sep 3, 2026
* Add linting: pre-commit + CI for markdown, spelling, and sample code

- .pre-commit-config.yaml: hygiene checks, codespell, markdownlint-cli2
  (pinned; local node hook), and a 72-char pane-width check for the
  refactoring samples (pages/refactorings/*.scala|.hs).
- .markdownlint-cli2.yaml: shared markdown style (80-col prose, tables
  and headings exempt, compact pipe style allowed).
- scripts/check-sample-width.sh: enforces the sample width rule the
  refactoring skill already documents (LESSONS.md 'pane width').
- .github/workflows/lint.yml: runs the same pre-commit config on every
  PR and push to master, so local and CI can't drift.
- Fixes the pre-existing issues the new rules surface: a duplicated H1
  and trailing-punctuation headings in the Refactorings post, trailing
  whitespace, long prose lines in about/libraries/README, a folded
  header_subtitle scalar, and a 'Vist' typo (Visit).

* Switch linting from pre-commit (python) to overcommit (ruby/bundler)

Same checks, Ruby toolchain:
- .overcommit.yml + .git-hooks/pre_commit/*.rb: hygiene checks
  (trailing whitespace, final newline, YAML/JSON syntax, merge markers,
  case conflicts, executable/shebang consistency), codespell, mdl
  (markdownlint), and the 72-char pane-width check for refactoring samples.
- .mdlrc + mdl_style.rb: mdl config (front-matter, git-recurse, MD013
  80-col prose, MD029 ordered, MD026 punctuation like markdownlint).
- scripts/lint.sh = bundle exec overcommit --run; CI runs it, so local
  and CI can't drift. Gemfile dev group: overcommit + mdl.
- Removes .pre-commit-config.yaml, .markdownlint-cli2.yaml,
  scripts/check-sample-width.sh.
- Wraps a few long prose lines for the 80-col rule.

* Replace codespell with spellr for Ruby-only spelling checks

- Gemfile: add spellr (~> 0.12).
- .git-hooks/pre_commit/spellr.rb: overcommit hook running bundle exec
  spellr on the committed files.
- .spellr.yml + .spellr_wordlists/english.txt: config and site wordlist.
- .overcommit.yml: Codespell -> Spellr hook.
- .github/workflows/lint.yml: drop the pip codespell install (everything
  is now Ruby/bundler).
- scripts/lint.sh: export OVERCOMMIT_NO_VERIFY for fresh checkouts (CI).
- README: document spellr + wordlist.

* Make linting pass on the refactoring section merged from master

The rebase onto master (Refactoring Section #12) brought in the
refactorings catalogue, its raw-HTML citation blocks, and the internal
.claude/skills/refactoring-entry docs. Tune the lint config for what is
site content vs. tooling:

- mdl_style.rb: allow inline HTML (MD033) — the refactorings citations
  are raw-HTML <li> lines by design (kramdown won't process markdown
  inside raw block HTML).
- .overcommit.yml Mdl: exclude pages/refactorings/**/* (same reason;
  unwrappable citation lines), pages/refactorings.md, and
  .claude/**/* (agent-internal docs, not site prose). Overcommit
  excludes use File.fnmatch, so '**' needs the trailing '/*'.
- .git-hooks/pre_commit/spellr.rb: also skip .claude/, refactorings,
  scala/hs/js, run.sh, and dotfiles when overcommit passes absolute
  paths; spellr only honors .spellr.yml excludes when given no files.
- .spellr.yml + wordlist: exclude the same non-prose trees; wordlist
  refactorings/catalogue/opdyke/fowler/kramdown.
- pages/refactorings/extract-method.md: drop the trailing blank lines.

* Disable AuthorName and AuthorEmail hooks in CI linting

Overcommit enables AuthorName and AuthorEmail pre-commit hooks by default,
which check git config user.name and user.email. In GitHub Actions runners,
these are unset, causing overcommit --run to fail in CI.

* Allow multiple blank lines at end of file in FinalNewline hook

The hook should only enforce that files end with a newline (preventing
POSIX/git missing-newline errors), not fail on multiple trailing blank
lines which occurs naturally in source files like Optics.hs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant