Typescript Best Practices
bretzel-app/crumbs
Provides TypeScript patterns for type-first development, making illegal states unrepresentable, exhaustive handling, and runtime validation.
A skill your agent uses when creating, moving, splitting, or organizing TypeScript files and folders.
$ npx skills add hashintel/hash --skill fractal-file-structuring -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install hashintel/hash fractal-file-structuring --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/hashintel/hash.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/fractal-file-structuring .claude/skills/fractal-file-structuring && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "fractal-file-structuring" agent skill from https://github.com/hashintel/hash/tree/main/.agents/skills/fractal-file-structuring into .claude/skills/fractal-file-structuring/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "fractal-file-structuring", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/hashintel/hash/tree/main/.agents/skills/fractal-file-structuringType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add hashintel/hash --skill fractal-file-structuring -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install hashintel/hash fractal-file-structuring --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/hashintel/hash.git skills-src && mkdir -p .agents/skills && cp -r skills-src/.agents/skills/fractal-file-structuring .agents/skills/fractal-file-structuring && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "fractal-file-structuring" agent skill from https://github.com/hashintel/hash/tree/main/.agents/skills/fractal-file-structuring into .agents/skills/fractal-file-structuring/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "fractal-file-structuring", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add hashintel/hash --skill fractal-file-structuring -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install hashintel/hash fractal-file-structuring --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/hashintel/hash.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/.agents/skills/fractal-file-structuring .cursor/skills/fractal-file-structuring && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "fractal-file-structuring" agent skill from https://github.com/hashintel/hash/tree/main/.agents/skills/fractal-file-structuring into .cursor/skills/fractal-file-structuring/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "fractal-file-structuring", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/hashintel/hash.git --path .agents/skills/fractal-file-structuring--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add hashintel/hash --skill fractal-file-structuring -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install hashintel/hash fractal-file-structuring --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/hashintel/hash.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/.agents/skills/fractal-file-structuring .gemini/skills/fractal-file-structuring && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "fractal-file-structuring" agent skill from https://github.com/hashintel/hash/tree/main/.agents/skills/fractal-file-structuring into .gemini/skills/fractal-file-structuring/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "fractal-file-structuring", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install hashintel/hash fractal-file-structuringInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add hashintel/hash --skill fractal-file-structuring -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/hashintel/hash.git skills-src && mkdir -p .github/skills && cp -r skills-src/.agents/skills/fractal-file-structuring .github/skills/fractal-file-structuring && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "fractal-file-structuring" agent skill from https://github.com/hashintel/hash/tree/main/.agents/skills/fractal-file-structuring into .github/skills/fractal-file-structuring/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "fractal-file-structuring", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add hashintel/hash --skill fractal-file-structuring -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install hashintel/hash fractal-file-structuring --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/hashintel/hash.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/.agents/skills/fractal-file-structuring .opencode/skills/fractal-file-structuring && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "fractal-file-structuring" agent skill from https://github.com/hashintel/hash/tree/main/.agents/skills/fractal-file-structuring into .opencode/skills/fractal-file-structuring/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "fractal-file-structuring", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
fractal-file-structuringA skill your agent uses when creating, moving, splitting, or organizing TypeScript files and folders.
Fractal File Structuring is an agent skill from hashintel/hash. Use when creating, moving, splitting, or organizing TypeScript files and folders. Applies fractal tree file-structuring rules which reduce the cognitive overhead of choosing where to put files and ultimately navigating a codebase (once the structure is established and understood).
Its SKILL.md is about 2.2k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.
It sits in Frontend & Design, covering React components. It works with TypeScript and JavaScript. The repository describes itself as: 🚀 The open-source, multi-tenant platform for self-building knowledge graphs and simulation. The licence is MIT.
7 steps, taken from the first numbered list in SKILL.md.
Read from SKILL.md and the folder at commit e189ab2. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
No scripts in the folder and no shell commands in SKILL.md (its code samples are typescript).
From the folder's file list and the shell code blocks in SKILL.md.
Links to these hosts (documentation or services it may open):
hash.devFrom URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Fractal File Structuring loads about 2.2k tokens when it runs. Until then it costs about 77 tokens; SKILL.md has 803 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from hashintel/hash at commit e189ab2, republished under its MIT licence (© hashintel). 803 words, ~2,153 tokens.
.claude/skills/fractal-file-structuring/SKILL.md (or your agent's skills folder).TypeScript and JavaScript files should be organised in a fractal tree structure. Use this skill when deciding where to create, move, split, or organize files and folders in a TypeScript or JavaScript workspace.
This guidance is based on HASH's file-structuring approach: https://hash.dev/blog/file-structuring
Apply this skill to TypeScript and JavaScript source files, including modules, components, hooks, helpers, types, tests, scripts, and entry points.
Use kebab-case for all TypeScript and JavaScript file and folder names.
create-worker-factory.ts
playback-settings-menu.tsx
button.tsxAvoid PascalCase, camelCase, and mixed-case file names, even for React components.
Do not add index.ts, index.tsx, index.js, or index.jsx files for folder imports. Prefer explicit file entry points with meaningful names.
If a subtree needs a public entry point, name that file after the concept it exposes (e.g. schema.ts)
A file should expose one or more named exports with a shared semantic purpose. The file name should summarize that purpose (e.g. users.ts)
If a file contains only one main export, prefer naming the file after that export in kebab-case (e.g. create-user.ts)
Avoid default exports unless a framework or external API requires them.
When a file becomes too large or contains implementation details worth extracting, create a same-named folder next to it and move private pieces there.
editor-view.tsx # public mini-library: the component other files import
editor-view/
panels.tsx # private entry point imported by editor-view.tsx
panels/
simulate-view.tsx # private to panels.tsx
calculate-timeline-range.ts # private helper used only by editor-view.tsx
create-panel-state.ts # private helper used only by editor-view.tsxOnly editor-view.tsx should import from direct child mini-libraries such as editor-view/panels.tsx and editor-view/calculate-timeline-range.ts. Only editor-view/panels.tsx should import from editor-view/panels/*.tsx. Other files should import from editor-view.tsx, not from its private subtree. This keeps editor-view.tsx as the API boundary and makes editor-view/ read as its implementation.
If editor-view/calculate-timeline-range.ts grows and needs its own private implementation files, create editor-view/calculate-timeline-range/. Only editor-view/calculate-timeline-range.ts should import from that deeper subtree.
editor-view/
calculate-timeline-range.ts
calculate-timeline-range/
clamp-time.ts # private to calculate-timeline-range.ts
get-visible-duration.ts # private to calculate-timeline-range.tsDo not import directly from another file's implementation folder.
// Avoid: reaches into another file's private subtree
import { SimulateView } from "../editor-view/panels/simulate-view";
// Prefer (1): import from a public mini-library (if it is conceptually part of editor-view)
import { EditorView } from "../editor-view";
// Prefer (2): move shared code to a shared folder (if it is NOT conceptually part of editor-view)
import { Button } from "../shared/button";If a resource must be available outside the subtree, re-export it from the subtree root only when it is part of that root's public concept. If it is independently useful to sibling branches, move it to an appropriate shared/ folder instead.
When multiple sibling branches need the same helper, type, component, constant, or hook, place it in the nearest applicable shared/ folder.
editor-view.tsx
editor-view/
shared/
duration-label.tsx # used by both panels.tsx and bottom-section.tsx
playback-time.ts # shared formatting/parsing logic for this subtree
panels.tsx # imports from panels/
panels/
simulate-view.tsx # private to panels.tsx
bottom-section.tsx # imports from bottom-section/
bottom-section/
bottom-bar.tsx # private to bottom-section.tsxPlace shared files as deep as possible while still covering all current consumers. Do not move something to a high-level shared folder just because it might be reused later.
Here editor-view.tsx imports ./editor-view/panels and ./editor-view/bottom-section. panels.tsx may import ./panels/simulate-view and ./shared/duration-label; bottom-section.tsx may import ./bottom-section/bottom-bar and ./shared/duration-label. Nothing else should import from panels/ or bottom-section/ directly.
Shared files are mini-libraries too. A shared file can have its own private same-named subtree, and those internals should remain private to that shared file.
editor-view/
shared/
playback-time.ts # public to editor-view/* branches
playback-time/
parse-playback-time.ts # private to playback-time.ts
format-playback-time.ts # private to playback-time.tsIf later only bottom-bar.tsx uses duration-label.tsx, move it beside bottom-bar.tsx or under bottom-bar/. The folder structure should describe current consumers, not preserve old sharing.
For imports inside the same workspace, use relative paths. Do not introduce workspace-local aliases just to shorten paths.
Imports from other workspaces should use the package name.
Place unit tests next to the file they cover.
foo.ts
foo.test.tsIf a private extracted file needs direct tests, place those tests next to that extracted file.
editor-view.tsx
editor-view.test.tsx
editor-view/
calculate-timeline-range.ts
calculate-timeline-range.test.tsPrefer testing through the public mini-library when that gives enough coverage. Add direct tests for private extracted files when the logic is complex enough that tests through the owner would be indirect or brittle.
Organize files for the code's current relationships, not speculative future reuse. Moving files later is expected and cheaper than adding premature structure now.
Before creating a TypeScript or JavaScript file or folder:
shared/ folder.index files and implicit folder imports.Choose the location that communicates the file's current consumers and API boundary most clearly:
shared/ folder when multiple branches need that API.Do not add broad components, hooks, utils, types, or services folders unless absolutely necessary. If they exist, these folders MUST only be imported from by files called components.ts, hooks.ts, etc.
© hashintel, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
Just SKILL.md in .agents/skills/fractal-file-structuring of hashintel/hash.
Open the folder on GitHubat commit e189ab2
Fractal File Structuring next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Fractal File Structuring this skillhashintel/hash | 1.7k | — | ~2.2k | Automated safety check: Pass | MIT | |
| Typescript Best Practicesbretzel-app/crumbs | 127 | 1 repos | ~2.2k | Automated safety check: Pass | MIT | |
| Connect Component To Figmadequelabs/cauldron | 129 | — | ~2k | Automated safety check: Pass | MPL-2.0 | |
| Fork And GoSimplePDF/simplepdf-embed | 407 | — | ~7.9k | Automated safety check: Notes | MIT | |
| Typescriptccusage/ccusage | 19k | — | ~696 | Automated safety check: Pass | Custom licence | |
| Javascript Practiceseser/stack | 128 | — | ~599 | Automated safety check: Pass | Custom licence |
bretzel-app/crumbs
Provides TypeScript patterns for type-first development, making illegal states unrepresentable, exhaustive handling, and runtime validation.
dequelabs/cauldron
Add a Figma Code Connect (.figma.tsx) file for a Cauldron React component.
SimplePDF/simplepdf-embed
Guided walkthrough for forking and deploying your own SimplePDF Copilot: hosting choice, Pro-account confirmation, AI-provider wiring, demo customization, deploy, and the SimplePDF whitelist step.
ccusage/ccusage
Guides ccusage TypeScript and JavaScript work. An agent skill from ccusage/ccusage.
eser/stack
TS and JS conventions for eserstack packages: namespace imports, mod.ts entries, cross-runtime APIs, explicit checks, async, tests and laroux React components.
softspark/ai-toolkit
TypeScript/JavaScript coding rules: style, patterns, security, testing.
hashintel/hash
Rust documentation practices for HASH codebase. An agent skill from hashintel/hash.
hashintel/hash
HASH error handling patterns using error-stack crate. An agent skill from hashintel/hash.
hashintel/hash
Cargo.toml dependency management patterns for HASH workspace.
hashintel/hash
HashQL testing strategies including compiletest (UI tests), unit tests, and snapshot tests.
hashintel/hash
HashQL diagnostic writing patterns using hashql-diagnostics crate.
hashintel/hash
HashQL J-Expr syntax for writing queries. An agent skill from hashintel/hash.
Works with
Categories
A skill your agent uses when creating, moving, splitting, or organizing TypeScript files and folders. Fractal File Structuring is an agent skill from hashintel/hash. Use when creating, moving, splitting, or organizing TypeScript files and folders.
Fractal File Structuring fits situations like: organizing TypeScript files and folders; tasks that involve React components.
Run `npx skills add hashintel/hash --skill fractal-file-structuring -a claude-code`. Or copy the skill folder (.agents/skills/fractal-file-structuring in hashintel/hash) into .claude/skills/fractal-file-structuring in your project. Claude Code loads it when a task matches its description.
Run `npx skills add hashintel/hash --skill fractal-file-structuring -a codex`. Or copy the skill folder (.agents/skills/fractal-file-structuring in hashintel/hash) into .agents/skills/fractal-file-structuring in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add hashintel/hash --skill fractal-file-structuring -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/fractal-file-structuring, .gemini/skills/fractal-file-structuring, .github/skills/fractal-file-structuring and .opencode/skills/fractal-file-structuring in your project.
SKILL.md names no scripts, command-line tools or credentials: Fractal File Structuring is instructions for the agent only.
SKILL.md names 1 domain. As links in the text: hash.dev. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
Fractal File Structuring is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.
About 2.2k tokens (SKILL.md is roughly 8.6k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.
Skills that share tags, products or a category with Fractal File Structuring: Typescript Best Practices (bretzel-app/crumbs, 127 stars), Connect Component To Figma (dequelabs/cauldron, 129 stars), Fork And Go (SimplePDF/simplepdf-embed, 407 stars) and Typescript (ccusage/ccusage, 19k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
hashintel (a GitHub organization) maintains it in hashintel/hash, which has 1,668 GitHub stars. The repository holds 17 skills in this directory. The repository was last updated on October 7, 2026.
Source: hashintel/hash on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.