TypeScript library for managing Claude AI skills
npm install @4meta5/skillsTypeScript library for managing Claude Code skills.
``bash`
npm install @4meta5/skills
`typescript
import { createSkillsLibrary } from '@4meta5/skills';
const library = createSkillsLibrary({
cwd: process.cwd(), // optional, defaults to process.cwd()
});
`
`typescript
const skill = await library.loadSkill('tdd');
console.log(skill.metadata.name); // 'tdd'
console.log(skill.metadata.description); // 'Test-driven development workflow'
console.log(skill.content); // Skill instructions
`
Skills are loaded from these locations (in order):
1. Project: .claude/skills/~/.claude/skills/
2. User:
3. Bundled: Skills included with this package
`typescript
// List all skills
const skills = await library.listSkills();
for (const skill of skills) {
console.log(${skill.metadata.name}: ${skill.metadata.description});
}
// Filter by category
const testingSkills = await library.listSkills('testing');
`
`typescript
const skill = await library.loadSkill('tdd');
// Install to project
await library.installSkill(skill, { location: 'project' });
// Install to user directory
await library.installSkill(skill, { location: 'user' });
`
`typescript
import { createSkillsLibrary, newTsProject } from '@4meta5/skills';
const library = createSkillsLibrary();
await library.createProject(newTsProject, './my-new-project');
`
This creates:
- CLAUDE.md with skill references
- README.md
- .gitignore
- .claude/skills/ directory with installed skills
`typescript`
await library.extendProject(['tdd', 'security-analysis']);
This installs the specified skills and updates CLAUDE.md to reference them.
Access bundled skills directly without loading from disk:
`typescript
import {
tdd,
unitTestWorkflow,
suggestTests,
noWorkarounds,
codeReview,
securityAnalysis,
getBundledSkill,
listBundledSkillNames
} from '@4meta5/skills';
// Get a specific bundled skill
const skill = tdd;
// Get by name
const skill = getBundledSkill('tdd');
// List all bundled skill names
const names = listBundledSkillNames();
// ['tdd', 'unit-test-workflow', 'suggest-tests', ...]
`
Pre-configured templates for common project types:
`typescript
import { newTsProject, extendWithTesting, extendWithSecurity } from '@4meta5/skills';
// Create a TypeScript project
await library.createProject(newTsProject, './my-project');
// Extend with testing skills
await library.createProject(extendWithTesting, './my-project');
// Extend with security skills
await library.createProject(extendWithSecurity, './my-project');
`
Filter and organize skills by category:
`typescript
import type { SkillCategory } from '@4meta5/skills';
const categories: SkillCategory[] = [
'testing',
'development',
'documentation',
'refactoring',
'security',
'performance'
];
`
For backwards compatibility, this package re-exports functions from @4meta5/skill-loader:
`typescript`
import {
loadSkillFromPath,
loadSkillsFromDirectory,
parseFrontmatter,
discoverSupportingFiles
} from '@4meta5/skills';
`typescript
interface Skill {
metadata: SkillMetadata;
content: string;
path: string;
supportingFiles?: string[];
}
interface SkillMetadata {
name: string;
description: string;
category?: SkillCategory;
'disable-model-invocation'?: boolean;
'user-invocable'?: boolean;
'allowed-tools'?: string;
context?: 'fork' | 'inline';
agent?: string;
}
type SkillCategory =
| 'testing'
| 'development'
| 'documentation'
| 'refactoring'
| 'security'
| 'performance';
interface InstallOptions {
location: 'project' | 'user';
cwd?: string;
}
interface SkillsLibraryOptions {
cwd?: string;
skillsDir?: string;
}
interface SkillsLibrary {
loadSkill(name: string): Promise
listSkills(category?: SkillCategory): Promise
installSkill(skill: Skill, options: InstallOptions): Promise
createProject(template: ProjectTemplate, targetPath: string): Promise
extendProject(skills: string[]): Promise
}
``
MIT