AgentSkillsCN

skill-create

建议在逻辑间隔内手动进行上下文精简,以在任务阶段间保持上下文的连贯性,而非依赖随机的自动压缩。

SKILL.md
--- frontmatter
name: skill-create
description: Analyze local git history to extract coding patterns and generate SKILL.md files
user-invocable: true
disable-model-invocation: true

/skill-create - Local Skill Generation

Analyze your repository's git history to extract coding patterns and generate SKILL.md files that teach Claude your team's practices.

Usage

bash
/skill-create                    # Analyze current repo
/skill-create --commits 100      # Analyze last 100 commits
/skill-create --output ./skills  # Custom output directory

What It Does

  1. Parses Git History - Analyzes commits, file changes, and patterns
  2. Detects Patterns - Identifies recurring workflows and conventions
  3. Generates SKILL.md - Creates valid Claude Code skill files

Analysis Steps

Step 1: Gather Git Data

bash
# Get recent commits with file changes
git log --oneline -n ${COMMITS:-200} --name-only --pretty=format:"%H|%s|%ad" --date=short

# Get commit frequency by file
git log --oneline -n 200 --name-only | grep -v "^$" | grep -v "^[a-f0-9]" | sort | uniq -c | sort -rn | head -20

# Get commit message patterns
git log --oneline -n 200 | cut -d' ' -f2- | head -50

Step 2: Detect Patterns

Look for these pattern types:

PatternDetection Method
Commit conventionsRegex on commit messages (feat:, fix:, chore:)
File co-changesFiles that always change together
Workflow sequencesRepeated file change patterns
ArchitectureFolder structure and naming conventions
Testing patternsTest file locations, naming, coverage

Step 3: Generate SKILL.md

Output format:

markdown
---
description: Coding patterns extracted from {repo-name}
---

# {Repo Name} Patterns

## Commit Conventions
{detected commit message patterns}

## Code Architecture
{detected folder structure and organization}

## Workflows
{detected repeating file change patterns}

## Testing Patterns
{detected test conventions}

Example Output

Running /skill-create on a TypeScript project might produce:

markdown
---
description: Coding patterns from my-app repository
---

# My App Patterns

## Commit Conventions

This project uses **conventional commits**:
- `feat:` - New features
- `fix:` - Bug fixes
- `chore:` - Maintenance tasks
- `docs:` - Documentation updates

## Code Architecture

src/ ├── components/ # React components (PascalCase.tsx) ├── hooks/ # Custom hooks (use*.ts) ├── utils/ # Utility functions ├── types/ # TypeScript type definitions └── services/ # API and external services

code

## Workflows

### Adding a New Component
1. Create `src/components/ComponentName.tsx`
2. Add tests in `src/components/__tests__/ComponentName.test.tsx`
3. Export from `src/components/index.ts`

### Database Migration
1. Modify `src/db/schema.ts`
2. Run `pnpm db:generate`
3. Run `pnpm db:migrate`

## Testing Patterns

- Test files: `__tests__/` directories or `.test.ts` suffix
- Coverage target: 80%+
- Framework: Vitest

Related Commands

  • /learn - Manual pattern extraction from current session