agentleFS
hugo-fixithugo-fixit/FixIt/CLAUDE.md

FixIt

CLAUDE.md1.1k starsChanged 15 months agoMITView on GitHub

FixIt is a modern, responsive theme for the Hugo static site generator. Built with Hugo templates, SCSS, UnoCSS, and TypeScript. When theme params are added, removed, or renamed, or Hugo templates/partials (including shortcodes and render hooks) are added, removed, or renamed: There are no unit tests. Verify changes by building pnpm build:demo or pnpm build:test and inspecting the output. Root package.json is @hugo-fixit/core. pnpm workspaces include apps/* and packages/*: Service-class architecture with direct constructor calls:

  • Installs packages

Adopted by

Steady: 0 new projects took it in the last 4 weeks, none the 4 weeks before.thin data

Week of Sep 13: 0 new projectsWeek of Sep 20: 0 new projectsWeek of Sep 27: 0 new projectsWeek of Oct 4: 0 new projectsWeek of Oct 11: 0 new projectsWeek of Oct 18: 0 new projectsWeek of Oct 25: 0 new projectsWeek of Nov 1: 0 new projects
Sep 2026Oct 2026Nov 2026
New projects taking a version of this file each week, over the 8 weeks our latest run read: only 0 in all, so this is a hint, not a trend.

Who's talking about hugo-fixit/FixIt

The biggest 5 of 51 mentions linking to the repository that our crawl found. Each line is their own headline.

See all 51

Talked about on GitHub and Bluesky (51 times).

On GitHub · 50

45 more on GitHub

On Bluesky · 1

The file

Show its rules and text

We split this CLAUDE.md into the rules it gives an agent

18 rules. About 0 are common, 5 are distinctive, and 13 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 13

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When theme params are added, removed, or renamed, or Hugo templates/partials (including shortcodes and render hooks) are added, removed, or …

    line 44
  2. Very specific:

    Update the corresponding pages in ../fixit-docs/content/en/ and ../fixit-docs/content/zh-cn/.

    line 47
  3. Very specific:

    Do not hand-edit content between the HUGO_FIXIT_PARAMS or HUGO_FIXIT_PARTIALS markers.

    line 49
  4. Very specific:

    Run pnpm -C ../fixit-docs lint after editing docs.

    line 50
  5. Very specific:

    Use fi-var(name, fallback) to reference CSS custom properties (auto-adds the --fi- prefix), never use var(--fi-...) directly

    line 122
  6. Very specific:

    Put nested selectors and at-rules after the parent block's declarations and @includes

    line 124
  7. Distinctive:

    Use CSS variables for theme switching.

    line 126
  8. Distinctive:

    Prefer relative units (rem, em, %) over absolute units

    line 127
  9. Distinctive:

    Keep selector nesting shallow

    line 128
  10. Very specific:

    Use UnoCSS for one-off layout, spacing, visibility, and alignment on template markup: hidden, sr-only, flex, items-center, justify-center, …

    line 153
  11. Very specific:

    Use SCSS for component styling: visual identity, is-active/is-open states, pseudo-elements, --fi-* custom properties, light-dark(), RTL, …

    line 154
  12. Distinctive:

    Never mix both on the same concern: a component class owns its internal styling.

    line 156
  13. Very specific:

    Do not use @apply in SCSS.

    line 157
  14. Very specific:

    Use ES6 # private fields — not TypeScript private with _ prefix

    line 169
  15. Very specific:

    Import the shared eventBus singleton from core/event-bus — do not create new instances

    line 172
  16. Very specific:

    Use partialCached for expensive partials that don't change per page

    line 181
  17. Very specific:

    Use .Site.Store for shared computed values (e.g.

    line 182
  18. Very specific:

    Check hugo.IsProduction before adding analytics or minification

    line 183

≈ “Common” is an estimate: at least 1 in 5 of the 26,980 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
CLAUDE.md

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

Project Overview

FixIt is a modern, responsive theme for the Hugo static site generator. Built with Hugo templates, SCSS, UnoCSS, and TypeScript.

Development Commands

Prerequisites

  • Node.js >= 20
  • Hugo Extended >= 0.166.0 (Dart Sass required)
  • pnpm

Development

pnpm install           # Install dependencies
pnpm dev:demo          # Start demo site dev server
pnpm dev:test          # Start test site dev server
pnpm dev:docs          # Start docs dev server (requires fixit-docs as sibling directory)

Build

pnpm build:demo        # Build demo site
pnpm build:test        # Build test site
pnpm build             # Build all sites (demo + test, merged into public/)
pnpm preview           # Preview built site (requires build first)

Code Generation

pnpm gen:lexers        # Regenerate assets/scss/core/maps/_chroma-lexers.scss from Chroma source
pnpm gen:docs          # Regenerate English theme config and partials docs into ../fixit-docs

Documentation

When theme params are added, removed, or renamed, or Hugo templates/partials (including shortcodes and render hooks) are added, removed, or renamed:

  1. Run pnpm gen:docs.
  2. Update the corresponding pages in ../fixit-docs/content/en/ and ../fixit-docs/content/zh-cn/.
  3. gen:docs regenerates English pages only; manually sync the Chinese translations.
  4. Do not hand-edit content between the HUGO_FIXIT_PARAMS or HUGO_FIXIT_PARTIALS markers; regenerate it instead.
  5. Run pnpm -C ../fixit-docs lint after editing docs.

Code Quality

pnpm lint              # Run ESLint
pnpm typecheck         # Run TypeScript type checking

There are no unit tests. Verify changes by building pnpm build:demo or pnpm build:test and inspecting the output.

Architecture

Monorepo Structure

Root package.json is @hugo-fixit/core. pnpm workspaces include apps/* and packages/*:

  • apps/demo/ — Demo site (deployed to demo.fixit.lruihao.cn)
  • apps/test/ — Test site for exercising theme features
  • packages/shared — Shared utilities (exports workspaceRoot, fromRoot, runCommand, capitalize, consola)
  • packages/versioning — Version management (auto-updates version in layouts/_partials/init/index.html during pre-commit)
  • packages/integration — Post-build: merges demo/test output into public/
  • packages/chroma-lexers — Generates Chroma lexer SCSS map from GitHub

JavaScript Module System (assets/js/)

Service-class architecture with direct constructor calls:

  • main.ts — Entry point. Instantiates all modules with direct constructor calls, builds the typed window.fixit public API facade, and runs the init sequence on DOMContentLoaded.
  • types/ — TypeScript type definitions:
    • config.ts — FixItConfig and all config sub-types.
    • ui.ts — FixItPublicAPI, global window augmentation for third-party libs.
    • third-party.ts — Types for vendored libraries.
  • core/ — Infrastructure layer:
    • event-bus.ts — Typed event bus singleton wrapping DOM CustomEvents. Exports eventBus (module-level singleton) and FixItEventMap type.
    • tokens.ts — Service interfaces (CoreService, ThemeService, CodeService, etc.) used for module constructor typing.
  • modules/ — Feature modules. Each is a class implementing its service interface. Dependencies are constructor-injected. Private state uses ES6 # fields. Modules: charts, code, content, core, encryption, events, menu, misc, search, theme, toc. pagefind.ts is a standalone factory consumed by SearchModule.
  • utils/ — Pure utility functions (no side effects, no DOM state). Re-exported from utils/index.ts.
  • i18n/ — Runtime translations for JS-only strings (not available via Hugo's T function or data-* attributes). Each language is a separate file (en.ts, zh-CN.ts, etc.) exporting a Translations object. Language codes match Hugo's i18n file names and document.documentElement.lang. Exports t(key) with English fallback. To add a language: create <lang>.ts, import in index.ts. To add a key: add to Translations interface and every language file.
  • lib/ — Third-party library wrappers (aplayer, echarts, file-tree, fixit-decryptor, lightgallery, mapbox, mathjax, mermaid, etc.). All import the shared eventBus singleton.
  • head/ — color-scheme.ts runs synchronously in <head> before body render to prevent flash of wrong theme.
  • pages/ — Page-specific scripts (e.g. link.ts for the link guard redirection page).

Cross-module communication uses the shared eventBus singleton, not direct module imports. The window.fixit facade exposes a typed public API for user custom scripts (custom.ts): theme control, scroll state, mask overlay management, content re-initialization, and the event bus.

Hugo Templates (layouts/)

  • _partials/ — Reusable template components (organized into init/, base/, function/, plugin/, single/, store/)
  • _shortcodes/ — 31 custom shortcodes (admonition, aplayer, echarts, file-tree, mermaid, tabs, timeline, etc.)
  • _markup/ — 15 render hooks (code blocks, headings, images, links, tables, blockquote alerts, passthrough for math)

Asset Pipeline

Hugo Pipes processes all assets. The key orchestration is in _partials/base/assets.html:

  • CSS: scss/main.scss is the entry point importing core/, pages/, widgets/, custom. SCSS variables are configured via hugo:vars (user-configurable from [params.appearance]) and hugo:vars/internal (theme system config). UnoCSS utility classes are pre-built to assets/css/unocss.css (via pnpm unocss), loaded before the main SCSS bundle.
  • JS: _partials/function/js-build.html wraps js.Build with minify-in-production defaults. Hugo's @params injection passes config values into TypeScript at build time.
  • Third-party libraries: Stored in assets/lib/ (vendored, not npm-managed). Tracked by librarybot.yml and updated quarterly by the hugo-fixit/librarybot GitHub Action. Can be overridden via CDN config in assets/data/cdn/jsdelivr.yml or unpkg.yml.

Theme Configuration

  • hugo.toml — Default theme configuration (1700+ lines). Uses _merge = "shallow" to let user configs override without deep merging.
  • theme.toml — Theme metadata

Coding Standards

SCSS (assets/scss/)

  • CSS classes: BEM or semantic naming (header-desktop, menu-item)
  • SCSS variables: hyphen-separated, semantic ($global-font-family)
  • CSS custom properties: prefixed with --fi-, written through @include set-fi-var(name, value) (or set-fi-vars for a map); never write --fi-*: ... directly in SCSS
  • Runtime JS-set custom properties (e.g. --fi-nav-scroll-x) are the exception: set them with style.setProperty, and read them with fi-var(name, fallback)
  • Use fi-var(name, fallback) to reference CSS custom properties (auto-adds the --fi- prefix), never use var(--fi-...) directly
  • Within a block, put @include calls after all regular declarations and before nested blocks
  • Put nested selectors and at-rules after the parent block's declarations and @includes
  • Separate sibling blocks (nested selectors, at-rules, mixin blocks) with one blank line
  • Use CSS variables for theme switching; SCSS variables for colors (no hardcoded values)
  • Prefer relative units (rem, em, %) over absolute units
  • Keep selector nesting shallow
.sub-menu {
  position: absolute;
  // regular declarations...

  @include set-fi-var(submenu-offset, -0.5rem);
  @include border-radius;
  @include z-index(base, 1);

  [dir="rtl"] & {
    @include set-fi-var(submenu-offset, 0.5rem);
  }

  .menu-item {
    // ...
  }
}

UnoCSS vs SCSS

UnoCSS handles placement; SCSS handles appearance. Do not translate existing component styles into utilities.

  • Use UnoCSS for one-off layout, spacing, visibility, and alignment on template markup: hidden, sr-only, flex, items-center, justify-center, w-full, mx-auto, me-1, my-4, max-sm:w-full, print:hidden, theme colors (text-secondary, bg-danger), and placement wrappers in shortcodes.
  • Use SCSS for component styling: visual identity, is-active/is-open states, pseudo-elements, --fi-* custom properties, light-dark(), RTL, transitions/animations, and anything reused across templates.
  • Threshold: at most 3 utility classes on one element. Four or more means it is appearance, not placement — extract a component class.
  • Never mix both on the same concern: a component class owns its internal styling.
  • Do not use @apply in SCSS.

Generation and constraints:

  • assets/css/unocss.css is pre-built and committed. Build and dev do not regenerate it: after adding or removing utility classes in layouts/ or assets/js/, run pnpm unocss and commit the CSS. Classes that are not regenerated silently do nothing.
  • Dynamically composed class names must be written as complete literals or added to the safelist in packages/unocss-preset/src/index.ts (e.g., order-*, sm:hidden).
  • Semantic class names must not collide with utility names (e.g., table-caption). Add unavoidable collisions to the preset blocklist.
  • Responsive breakpoints: sm: (>=680px), md: (>=960px), lg: (>=1200px), xl: (>=1440px). Use max-sm: for xs (<680px).
  • Wrap comment prose and SVG d path data with @unocss-skip-start / @unocss-skip-end when they contain utility-like words (e.g., grid, filter); the extractor otherwise treats them as class names.

TypeScript

  • Use ES6 # private fields — not TypeScript private with _ prefix
  • One module per file, one service interface per module
  • Constructor injection for dependencies — no global state access
  • Import the shared eventBus singleton from core/event-bus — do not create new instances
  • Pure functions only in utils/ — no side effects, no DOM state
  • Comment style: follow TSDoc conventions

Hugo Templates

  • Variable naming: camelCase ($footerConfig, $fingerprint)
  • Translation: use T function ({{ T "header.switchTheme" }})
  • Whitespace: use {{- -}} trim markers
  • Use partialCached for expensive partials that don't change per page
  • Use .Site.Store for shared computed values (e.g. fingerprint)
  • Check hugo.IsProduction before adding analytics or minification
  • Minimize id attribute usage — prefer class selectors for styling and JS queries. Reserve id for: <label for>, aria-controls/aria-labelledby, fragment anchors, or third-party library requirements

Commit Convention

Follows Conventional Commits:

<type>(<scope>): <subject>

Types: feat, fix, refactor, chore, docs, perf, style, test, ci, build

Scopes: workflow, archetypes, assets, i18n, layouts, config, or specific directories.

Pre-commit Hooks

Pre-commit runs: versioning (dev mode), typecheck, lint-staged (eslint --fix on staged files).

ESLint

Uses @antfu/eslint-config with TypeScript support. Config at eslint.config.ts.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.