new-unit
Skill1 starsChanged 6 days agoMITView on GitHub
Use when creating or improving a habits unit: the user asks for guidance on a language, tool, framework, platform, testing practice or workflow that has no unit yet, habits suggested creating one, or an existing unit needs work. Covers choosing triggers, what to write, and registering and validating the unit.
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 1 is distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 17
Check the root is a git working copy (git -C <root> rev-parse --show-toplevel).
- Very specific: line 18
Run habits units to see what exists.
- Distinctive: line 38
Write for a strong developer who already knows the language but not the conventions.
- Very specific: line 75
Commit with the commit skill (feat(units): add <id> unit).
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill 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.
Files
Creating a habits unit
A unit is one small file of professional guidance for one technology, which habits injects only when a project uses that technology. Getting the triggers and the content right is what makes it useful.
1. Find where units live
Units are the units/<category>/<id>.md files in the habits plugin. The plugin root was given at session start, and habits on the PATH runs the CLI.
- Check the root is a git working copy (
git -C <root> rev-parse --show-toplevel). If it's an installed copy under~/.claude/plugins/cache/, an update would overwrite your edit. Tell the user to clone the habits repo and install from that folder (claude plugin marketplace add <folder>), then work there. - Run
habits unitsto see what exists. Improve an existing unit rather than adding a near-duplicate.
2. Scope it
- One technology per unit, named in one or two lowercase words joined by a hyphen:
swift,gradle,spring-boot,docker-compose. Never a combination likekotlin-gradle; those are two units that load together. - Categories:
languages,tools(build tools, CLIs, package managers),frameworks,platforms,testing,workflows(processes like OpenSpec). Add a category folder only when none fits. - The file name is the id.
3. Choose the triggers
A unit should load in every session that needs it, and in no other. Use as many triggers as fit:
paths: globs of the technology's own files: its source extension (**/*.swift) and its config files (**/Package.swift,**/docker-compose.y{a,}ml). Avoid globs another unit already owns: checkhabits units.commands: the CLI names someone runs when using it (docker compose,xcodebuild). Command prefixes match word by word, after strippingcd …&&, env assignments andsudo.markers: only for project-level workflows that should load at session start (openspec/specs). Relative globs without{}; add*/…variants for monorepos.lsp: the language server plugin id, if an official one exists (<name>-lsp@claude-plugins-official).script: only when the guidance must be computed from the project, like the OpenSpec spec index. A Python script next to the unit; it gets{"cwd", "root"}as JSON on stdin and prints text.
4. Write the content
Write for a strong developer who already knows the language but not the conventions. Every line is read in every session that loads the unit, so each must earn its place.
Include:
- The official style guide or conventions, linked in the first line, and the points from it that are most often gotten wrong.
- Idioms that separate professional code from merely working code.
- Concrete pitfalls, with the correct alternative.
- How to build, test and verify narrowly (exact commands), and what to gitignore.
Leave out:
- General programming advice, and anything already covered by the
hygiene,secrets,dependenciesorerrorsskills. - Facts about a single project; those belong in that project's CLAUDE.md or OpenSpec config.
- Tutorials and explanations of basics.
Format: a first line naming the technology and its style guide, then short sections (Style, Idioms, Pitfalls, Verify, or whatever fits) of terse imperative bullets. Aim for 20 to 45 lines.
---
id: swift
title: Swift
paths: ["**/*.swift"]
lsp: swift-lsp@claude-plugins-official
---
Swift. Follow the Swift API Design Guidelines (swift.org/documentation/api-design-guidelines).
Style
- …5. Register and check it
There is no registry to edit: the file's location registers it. Then:
habits validate: fix every error and warning.habits units: confirm the triggers read as intended.habits status <a project that uses the technology>: the unit should be listed with matching files, and nothing unrelated should match.habits load <id>: read it the way Claude will receive it.
Commit with the commit skill (feat(units): add <id> unit). Don't push unless the user asks.
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
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.

