modular-skills
Build composable skill modules with hub-and-spoke loading. Use when token budget is tight.
它会碰到什么
这一栏是扫描器报的事实,不是结论。命中多不等于有毒(安全工具、规则库、示例脚本本来就会包含危险写法),命中少也不等于干净。它和你手上的凭据、文件、网络有什么关系,需要你自己看。
技能内容
When NOT To Use
- A single-file skill already inside its token budget (use
abstract:skill-authoring)
- The lazy-loading contract itself (use
leyline:progressive-loading)
Table of Contents
- [Overview](#overview)
- [Quick Start](#quick-start)
- [Workflow and Tasks](#workflow-and-tasks)
- [Quality Checks](#quality-checks)
- [Resources](#resources)
Modular Skills Design
Overview
This framework breaks complex skills into focused modules to keep token usage predictable and avoid monolithic files. We use progressive disclosure: starting with essentials and loading deeper technical details via @include or Load: statements only when needed. This approach prevents hitting context limits during long-running tasks.
Modular design keeps file sizes within recommended limits, typically under 150 lines. Shallow dependencies and clear boundaries simplify testing and maintenance. The hub-and-spoke model allows the project to grow without bloating primary skill files, making focused modules easier to verify in isolation and faster to parse.
Core Components
Three tools support modular skill development:
skill-analyzer: Checks complexity and suggests where to split code.token-estimator: Forecasts usage and suggests optimizations.module_validator: Verifies that structure complies with project standards.
Design Principles
We design skills around single responsibility and loose coupling. Each module focuses on one task, minimizing dependencies to keep the architecture cohesive. Clear boundaries and well-defined interfaces prevent changes in one module from breaking others. This follows Anthropic's Agent Skills best practices: provide a high-level overview first, then surface details as needed to maintain context efficiency.
Module Ownership (IMPORTANT)
Deprecated: skills/shared/modules/ directories. This pattern caused orphaned references when shared modules were updated or removed.
Current pattern: Each skill owns its modules at skills/<skill-name>/modules/. When multiple skills need the same content, the primary owner holds the module and others reference it via relative path (e.g., ../skill-authoring/modules/description-writing.md). The validator flags any remaining skills/shared/ directories.
Quick Start
Skill Analysis
Analyze modularity using scripts/skill_analyzer.py. You can set a custom threshold for line counts to identify files that need splitting.
python scripts/skill_analyzer.py --file path/to/SKILL.md --threshold 100
From Python, use analyze_skill from abstract.skill_tools.
Token Usage Planning
Estimate token consumption to verify your skill stays within budget. Run this from the skill directory:
python scripts/tokens.py
Module Validation
Check for structure and pattern compliance before deployment.
python scripts/abstract_validator.py --scan
Workflow and Tasks
Start by assessing complexity with skill_analyzer.py. If a skill exceeds 150 lines, break it into focused modules following the patterns in ../../docs/examples/modular-skills/. Use token_estimator.py to check efficiency and abstract_validator.py to verify the final structure. This iterative process maintains module maintainability and token efficiency.
Quality Checks
Identify modules needing attention by checking line counts and missing Table of Contents. Any module over 100 lines requires a TOC after the frontmatter to aid navigation.
# Find modules exceeding 100 lines
find modules -name "*.md" -exec wc -l {} + | awk '$1 > 100'
Standards Compliance
Our standards prioritize concrete examples and a consistent voice. Always provide actual commands in Quick Start sections instead of abstract descriptions. Use third-person perspective (e.g., "the project", "developers") rather than "you" or "your". Each code example should be followed by a validation command. For discoverability, descriptions must include at least five specific trigger phrases.
TOC Template
## Table of Contents
- [Section Name](#section-name)
- [Examples](#examples)
- [Troubleshooting](#troubleshooting)
Resources
Shared Modules: Cross-Skill Patterns
Standard patterns for triggers and for deciding whether a skill applies:
- Trigger Patterns: See [enforcement-patterns.md](modules/enforcement-patterns.md)
- Skill Selection: See [skill-selection-judgment.md](../../shared-modules/skill-selection-judgment.md)
Skill-Specific Modules
Detailed guides for implementation and maintenance:
- Enforcement Patterns: See
modules/enforcement-patterns.md - Core Workflow: See
modules/core-workflow.md - Implementation Patterns: See
modules/implementation-patterns.md - Migration Guide: See
modules/antipatterns-and-migration.md - Design Philosophy: See
modules/design-philosophy.md - Troubleshooting: See
modules/troubleshooting.md - Optimization Techniques: See
modules/optimization-techniques.md- reducing large skill file sizes through externalization, consolidation, and progressive loading
Tools and Examples
- Tools:
skill_analyzer.py,token_estimator.py, andabstract_validator.pyin../../scripts/. - Examples: See
../../docs/examples/modular-skills/for reference implementations.
Exit Criteria
- [ ] Every module file produced is at or under 150 lines; any module exceeding 100 lines has a
Table of Contents immediately after its frontmatter.
- [ ] No
skills/shared/modules/directory exists; all modules live under
skills/<skill-name>/modules/.
- [ ]
python scripts/abstract_validator.py --scanexits 0 with no structural warnings on the
affected skill directory.
- [ ]
python scripts/tokens.pyreports total estimated tokens within the declared
estimated_tokens budget for the hub SKILL.md.
想直接用这个技能?
本站把开放许可(MIT / Apache 等)的技能按仓库打包整理到网盘,点一下转存到你自己的网盘,不用一个个从 GitHub 拉。许可未声明的技能只给原始仓库链接,不打包。
它属于哪个仓库
plugins/abstract/skills/modular-skills/SKILL.md同一个仓库里的其他技能
- claude-code-plugin-reference
- night-market-architecture-contract
- night-market-build-and-env
- night-market-change-control
- night-market-collective-memory
- night-market-completion-integrity-campaign
- night-market-config-catalog
- night-market-debugging-playbook
- night-market-diagnostics-toolkit
- night-market-docs-and-writing
- night-market-failure-archaeology
- night-market-model-and-harness-updates