Agent skill
libutil
libutil - General utilities. countTokens and estimateTokens for GPT-style token counting. generateHash creates SHA256 hashes. generateUuid creates unique IDs findProjectRoot locates repository root. updateEnvFile modifies environment files. exec runs child processes. createBundler downloads code bundles. Use for token counting, hashing, and project utilities.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/libutil
SKILL.md
libutil Skill
When to Use
- Counting tokens for LLM context management
- Generating hashes and UUIDs
- Finding project root directory
- Running child processes
- Managing generated code bundles
Key Concepts
Token counting: GPT-compatible tokenization for context window management.
Project root: Finds repository root by looking for package.json markers.
Bundle management: Download and extract pre-generated code bundles.
Usage Patterns
Pattern 1: Count tokens
import { countTokens, estimateTokens } from "@copilot-ld/libutil";
const exact = countTokens("Hello, world!"); // Accurate count
const fast = estimateTokens("Hello, world!"); // Quick estimate
Pattern 2: Generate identifiers
import { generateHash, generateUuid } from "@copilot-ld/libutil";
const hash = generateHash(content); // 16-char SHA256
const uuid = generateUuid(); // Standard UUID
Pattern 3: Find project root
import { findProjectRoot } from "@copilot-ld/libutil";
const root = await findProjectRoot(); // /path/to/copilot-ld
Integration
Used across packages for common utilities. countTokens used by libmemory.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?