dewey-classification
npx machina-cli add skill brege/dewey-decimal-skill/dewey-classification --openclawDewey Classification
Assign Dewey codes and determine shelf location in BOOKS_DIR/.
Assignment Process
- Identify primary subject matter
- ALWAYS read data/codes.md to find the correct code and category name
- Check existing BOOKS_DIR/ directory structure
- Apply leafing rules to determine final path
CRITICAL: Directory Naming
NEVER invent or guess category names. Before creating any directory:
- Read data/codes.md
- Find the exact line matching the code (e.g.,
- 130 Parapsychology and occultism) - Use the EXACT name from that file:
130 - Parapsychology and occultism
Format: XXX - [exact name from codes.md]
Examples from data/codes.md:
- 110 Metaphysics→ directory:110 - Metaphysics- 130 Parapsychology and occultism→ directory:130 - Parapsychology and occultism- 160 Philosophical logic→ directory:160 - Philosophical logic
If you cannot find a code in data/codes.md, ask the user.
Leafing Rules
Directories stay flat until thresholds trigger subdivision. Do not create empty directories.
Hierarchy: centennials (X00) → decades (XY0) → integrals (XYZ)
Rule: When to Create Subdirectory
Create XY0 subdirectory under X00 ONLY when BOTH conditions met:
- X00 contains 6+ books total
- 3+ books share the same Y value (would belong in XY0)
Same rule applies recursively: create XYZ under XY0 when XY0 has 6+ books and 3+ share same Z.
Rule: Do NOT Create Preemptively
- Never create empty directories
- Never create a subdivision with fewer than 3 books
- Keep books at the parent level until the threshold is reached
- Example: If you have 2 ethics books in 100/, leave them in 100/. Do not create 170/ until you have 3+ ethics books AND 6+ total in 100/.
The goal is minimal bureaucratic structure. Only subdivide when the volume justifies separating material from the pack.
Example
500 - Natural Sciences and Mathematics/
(5 physics books, 2 math books, 1 astronomy book)
Total: 8 books. Physics has 5 (3+ threshold met). Create 530 subdirectory:
500 - Natural Sciences and Mathematics/
530 - Physics/
(5 physics books)
(2 math books, 1 astronomy book remain in 500)
When math reaches 3+ books, create 510 subdirectory.
Current Structure
Check BOOKS_DIR/ before placing. Always verify directory names against data/codes.md.
Subdirectories are created dynamically based on leafing rules. Do not assume a fixed structure - scan the actual directory and cross-reference with data/codes.md.
Category Guidelines
Always look up the exact code and name in data/codes.md. Common top-level categories:
- 000 - Computer science, information, general works
- 100 - Philosophy & psychology (includes 150 Psychology)
- 300 - Social sciences (economics, politics, law)
- 500 - Natural sciences and mathematics
- 600 - Technology (includes 640 Home economics)
- 700 - Arts
- 800 - Literature (810 N. American, 820 English, 890 other languages)
- 900 - History & geography (includes 920 Biography)
Classification Examples
When classifying, find the most specific applicable code:
- Philosophy of mind → look up 12X codes in data/codes.md
- Ethics → 170 Ethics (Moral philosophy)
- Psychology → 150 Psychology
- Cooking → 641 Food & drink (check data/codes.md for exact name)
Always verify against data/codes.md before creating directories.
Code Reference
The authoritative source is data/codes.md. Read it before every classification decision.
When to Ask User
- Book spans multiple primary subjects equally
- Subject is specialized and code unclear
- Purpose ambiguous (philosophy about X vs history of X)
- New directory creation uncertain
Source
git clone https://github.com/brege/dewey-decimal-skill/blob/main/skills/dewey-classification/SKILL.mdView on GitHub Overview
Dewey-classification assigns exact Dewey Decimal codes to books and determines their shelf path under __BOOKS_DIR__. It relies on data/codes.md for exact names and uses leafing rules to minimize the directory structure.
How This Skill Works
Identify the primary subject, read data/codes.md to find the exact code and name, then review the current __BOOKS_DIR__ to decide if a subdirectory is justified under the leafing rules. If the required code is not found, ask the user for confirmation.
When to Use It
- Cataloging a newly acquired book with a clearly defined code in codes.md.
- Reorganizing shelves when a category hits leafing thresholds (6+ total in a parent and 3+ sharing a Y).
- Adding multiple volumes and determining whether to create a new XY0/XYZ subdirectory.
- Handling a book that spans multiple primary subjects or lacks a clear code, prompting user confirmation.
- Auditing existing __BOOKS_DIR__ to ensure directory names match data/codes.md and no empty directories exist.
Quick Start
- Step 1: Identify the primary subject and locate the exact code line in data/codes.md.
- Step 2: Check __BOOKS_DIR__ to see current structure and whether leafing thresholds are met.
- Step 3: If code exists and thresholds are satisfied, create the directory named 'XXX - [exact name from codes.md]' and place the item there; otherwise, keep at parent and ask the user.
Best Practices
- Always consult data/codes.md before creating or naming directories.
- Use the exact code line from codes.md for directory naming: XXX - [exact name].
- Check __BOOKS_DIR__ first to reflect the current structure and existing leafing state.
- Do not create subdirectories unless leafing thresholds are met (6+ total in X00 and 3+ share same Y; same at deeper levels).
- Do not invent names; if no code match is found, ask the user.
Example Use Cases
- A new book on ESP labeled 130 → create '130 - Parapsychology and occultism' under the correct parent.
- A physics book is added to 500; with 5 physics, 2 math, and 1 astronomy, 530 is created under 500.
- Ethics books in 100/ reach 2 items; no new subdirectory is created until the count reaches 3 and total in 100 is at least 6.
- Culinary books collected under 641 → create '641 - Food & drink' when the threshold criteria are met.
- Ethics code 170 - Ethics (Moral philosophy) is used directly when reading codes.md to determine the exact directory name.