From 3af87654d42debfd6b748bbc68665d9ab9aab383 Mon Sep 17 00:00:00 2001 From: Zhongwei Li Date: Sat, 29 Nov 2025 18:49:19 +0800 Subject: [PATCH] Initial commit --- .claude-plugin/plugin.json | 12 + README.md | 3 + plugin.lock.json | 48 ++ skills/engineer-skill-creator/SKILL.md | 563 +++++++++++++++++ .../scripts/create_expert_skill.sh | 579 ++++++++++++++++++ 5 files changed, 1205 insertions(+) create mode 100644 .claude-plugin/plugin.json create mode 100644 README.md create mode 100644 plugin.lock.json create mode 100644 skills/engineer-skill-creator/SKILL.md create mode 100755 skills/engineer-skill-creator/scripts/create_expert_skill.sh diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json new file mode 100644 index 0000000..29cf45a --- /dev/null +++ b/.claude-plugin/plugin.json @@ -0,0 +1,12 @@ +{ + "name": "engineer-skill-creator", + "description": "Transform extracted engineer expertise into an actionable skill with progressive disclosure, allowing agents to find and apply relevant patterns for specific tasks.", + "version": "0.0.0-2025.11.28", + "author": { + "name": "James Rochabrun", + "email": "jamesrochabrun@gmail.com" + }, + "skills": [ + "./skills/engineer-skill-creator" + ] +} \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..cba7330 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# engineer-skill-creator + +Transform extracted engineer expertise into an actionable skill with progressive disclosure, allowing agents to find and apply relevant patterns for specific tasks. diff --git a/plugin.lock.json b/plugin.lock.json new file mode 100644 index 0000000..f1bdde2 --- /dev/null +++ b/plugin.lock.json @@ -0,0 +1,48 @@ +{ + "$schema": "internal://schemas/plugin.lock.v1.json", + "pluginId": "gh:jamesrochabrun/skills:engineer-skill-creator", + "normalized": { + "repo": null, + "ref": "refs/tags/v20251128.0", + "commit": "c1bbf295eb7eeaf9b4fbb851fe4425950fe26548", + "treeHash": "053eab64b54ec70840a15a8d78152160062f0b272b9004299dd6f51142d4432a", + "generatedAt": "2025-11-28T10:17:47.914952Z", + "toolVersion": "publish_plugins.py@0.2.0" + }, + "origin": { + "remote": "git@github.com:zhongweili/42plugin-data.git", + "branch": "master", + "commit": "aa1497ed0949fd50e99e70d6324a29c5b34f9390", + "repoRoot": "/Users/zhongweili/projects/openmind/42plugin-data" + }, + "manifest": { + "name": "engineer-skill-creator", + "description": "Transform extracted engineer expertise into an actionable skill with progressive disclosure, allowing agents to find and apply relevant patterns for specific tasks." + }, + "content": { + "files": [ + { + "path": "README.md", + "sha256": "176b83fd32d5e8bd8c97d580a890ce2eb43f0c3a4086bc336c4edee64a0aadba" + }, + { + "path": ".claude-plugin/plugin.json", + "sha256": "672c899f59fc2d4b39f4f4a0f60a51aead485fdb25a22d1c3024a262aebd3f6c" + }, + { + "path": "skills/engineer-skill-creator/SKILL.md", + "sha256": "71ae0143eaa03d8656efc9e5e391a2a112347431578c0c9a28929e887074bc2a" + }, + { + "path": "skills/engineer-skill-creator/scripts/create_expert_skill.sh", + "sha256": "970912a8fb637a677a3d56c5410a2500ad3bff577e6289117a5418e8ec7a3bf6" + } + ], + "dirSha256": "053eab64b54ec70840a15a8d78152160062f0b272b9004299dd6f51142d4432a" + }, + "security": { + "scannedAt": null, + "scannerVersion": null, + "flags": [] + } +} \ No newline at end of file diff --git a/skills/engineer-skill-creator/SKILL.md b/skills/engineer-skill-creator/SKILL.md new file mode 100644 index 0000000..f77664d --- /dev/null +++ b/skills/engineer-skill-creator/SKILL.md @@ -0,0 +1,563 @@ +--- +name: engineer-skill-creator +description: Transform extracted engineer expertise into an actionable skill with progressive disclosure, allowing agents to find and apply relevant patterns for specific tasks. +--- + +# Engineer Skill Creator + +Transform extracted engineer profiles into ready-to-use skills with progressive disclosure, enabling AI agents to efficiently find and apply the right expertise for any coding task. + +## What This Skill Does + +Takes the output from **engineer-expertise-extractor** and creates a structured, queryable skill that: +- **Organizes expertise by task type** - Find relevant patterns quickly +- **Uses progressive disclosure** - Show only what's needed for current task +- **Provides contextual examples** - Real code samples for specific scenarios +- **Guides agents intelligently** - Help find the right expertise at the right time +- **Enables task-specific queries** - "How would they handle authentication?" + +## The Two-Step Process + +### Step 1: Extract (engineer-expertise-extractor) +```bash +./extract_engineer.sh senior_dev +# Output: engineer_profiles/senior_dev/ +``` + +### Step 2: Create Skill (THIS SKILL) +```bash +./create_expert_skill.sh senior_dev +# Output: expert-skills/senior-dev-mentor/ +``` + +**Result:** A ready-to-use skill that agents can query for specific guidance. + +## Why Progressive Disclosure Matters + +**Without progressive disclosure:** +- Agent gets all expertise at once (overwhelming) +- Hard to find relevant information +- Context limits reached quickly +- Inefficient and slow + +**With progressive disclosure:** +- Agent asks specific question +- Gets only relevant expertise +- Focused, actionable guidance +- Efficient use of context +- Faster, better results + +## Output Structure + +When you create a skill from an engineer profile, you get: + +``` +expert-skills/ +└── [engineer-name]-mentor/ + ├── SKILL.md (skill documentation) + ├── query_expertise.sh (interactive query tool) + ├── expertise/ + │ ├── by_task/ + │ │ ├── authentication.md + │ │ ├── api_design.md + │ │ ├── database_design.md + │ │ ├── error_handling.md + │ │ └── testing.md + │ ├── by_language/ + │ │ ├── typescript.md + │ │ ├── python.md + │ │ └── go.md + │ ├── by_pattern/ + │ │ ├── dependency_injection.md + │ │ ├── repository_pattern.md + │ │ └── factory_pattern.md + │ └── quick_reference/ + │ ├── coding_style.md + │ ├── naming_conventions.md + │ └── best_practices.md + └── examples/ + ├── authentication_service.ts + ├── api_controller.ts + └── test_example.spec.ts +``` + +## Progressive Disclosure System + +### Query by Task + +**Agent asks:** "How would they implement user authentication?" + +**Skill provides:** +1. Relevant patterns from `by_task/authentication.md` +2. Code examples from their auth PRs +3. Their testing approach for auth +4. Security considerations they use +5. Related best practices + +**NOT provided (yet):** +- Unrelated patterns +- Database design details +- Payment processing approach +- Everything else + +### Query by Language + +**Agent asks:** "Show me their TypeScript coding style" + +**Skill provides:** +1. TypeScript-specific conventions +2. Type usage patterns +3. Interface design approach +4. Error handling in TS +5. Real TS examples + +### Query by Pattern + +**Agent asks:** "How do they implement dependency injection?" + +**Skill provides:** +1. DI pattern from their code +2. Constructor injection examples +3. IoC container setup +4. Testing with DI +5. When they use it vs when they don't + +## Skill Usage by Agents + +### Basic Query +``` +"Using the skill expert-skills/senior-dev-mentor/, show me how to +implement authentication" +``` + +**Skill responds with:** +- Authentication patterns they use +- Real code examples +- Testing approach +- Security practices +- Step-by-step guidance + +### Language-Specific Query +``` +"Using expert-skills/senior-dev-mentor/, write a TypeScript service +following their style" +``` + +**Skill provides:** +- TypeScript coding conventions +- Class structure patterns +- Type definitions approach +- Import organization +- Testing patterns for services + +### Pattern-Specific Query +``` +"Using expert-skills/senior-dev-mentor/, implement the repository +pattern as they would" +``` + +**Skill provides:** +- Their repository pattern implementation +- Interface definitions +- Concrete implementation example +- Testing approach +- When to use this pattern + +## Created Skill Features + +### 1. Task-Based Navigation +Expertise organized by common development tasks: +- Authentication & Authorization +- API Design +- Database Design +- Error Handling +- Testing Strategies +- Performance Optimization +- Security Practices +- Code Review Guidelines + +### 2. Language-Specific Guidance +Separate docs for each language they use: +- Naming conventions per language +- Language-specific patterns +- Idiomatic code examples +- Framework preferences + +### 3. Pattern Library +Design patterns they commonly use: +- When to apply each pattern +- Implementation examples +- Testing approach +- Common pitfalls to avoid + +### 4. Quick Reference +Fast access to essentials: +- Coding style at a glance +- Naming conventions cheat sheet +- Common commands/snippets +- Review checklist + +### 5. Interactive Query Tool +Script that helps find expertise: +```bash +./query_expertise.sh + +What are you working on? +1) Authentication +2) API Design +3) Database +4) Testing +5) Custom query + +Select: 1 + +=== Authentication Expertise === + +[Shows relevant patterns, examples, best practices] +``` + +## How Skills Are Created + +### Input +Engineer profile from extractor: +``` +engineer_profiles/senior_dev/ +├── coding_style/ +├── patterns/ +├── best_practices/ +├── architecture/ +├── code_review/ +└── examples/ +``` + +### Process +1. **Analyze profile structure** +2. **Categorize by task** - Group related expertise +3. **Extract examples** - Pull relevant code samples +4. **Create navigation** - Build progressive disclosure system +5. **Generate queries** - Create query tool +6. **Package skill** - Ready-to-use skill structure + +### Output +Skill with progressive disclosure: +``` +expert-skills/senior-dev-mentor/ +├── SKILL.md +├── query_expertise.sh +├── expertise/ +│ ├── by_task/ +│ ├── by_language/ +│ ├── by_pattern/ +│ └── quick_reference/ +└── examples/ +``` + +## Example Created Skill + +### Authentication Task Doc + +**File:** `expertise/by_task/authentication.md` + +```markdown +# Authentication - Senior Dev's Approach + +## Overview +How senior_dev implements authentication based on 15 PRs analyzed. + +## Preferred Approach +- JWT-based authentication +- Refresh token rotation +- HttpOnly cookies for web +- Token in headers for mobile/API + +## Implementation Pattern + +### Service Structure +[Code example from their PR #1234] + +### Token Generation +[Code example from their PR #5678] + +### Token Validation +[Code example from their PR #9012] + +## Testing Approach +- Unit tests for token generation +- Integration tests for auth flow +- Security tests for token validation + +[Test examples from their code] + +## Security Considerations +From their code reviews: +- Always validate token signature +- Check expiration +- Implement rate limiting +- Use secure random for secrets + +## Common Pitfalls They Avoid +- Storing tokens in localStorage (XSS risk) +- Not rotating refresh tokens +- Weak secret keys +- Missing token expiration + +## Related Patterns +- Error handling for auth failures +- Middleware pattern for auth checks +- Repository pattern for user lookup + +## Examples +See: examples/authentication_service.ts +``` + +## Use Cases + +### 1. Consistent Code Generation + +**Problem:** AI generates code that doesn't match team style + +**Solution:** +``` +"Using expert-skills/senior-dev-mentor/, write a user service" +``` + +**Result:** Code matching senior dev's exact style and patterns + +### 2. Task-Specific Guidance + +**Problem:** How would senior dev approach this specific problem? + +**Solution:** +``` +"Using expert-skills/tech-lead-mentor/, how do I handle rate limiting?" +``` + +**Result:** Their specific approach, examples, and reasoning + +### 3. Code Review Training + +**Problem:** Learn what experienced engineer looks for + +**Solution:** +``` +"Using expert-skills/architect-mentor/, review this code" +``` + +**Result:** Review following their standards and priorities + +### 4. Onboarding + +**Problem:** New engineer needs to learn team conventions + +**Solution:** Give them access to expert-skills + +**Result:** Learn from real examples, specific to their tasks + +## Skill Query Examples + +### Example 1: Authentication +```bash +./query_expertise.sh +> Working on: Authentication +> Language: TypeScript + +Output: +=== Authentication in TypeScript === + +Preferred approach: JWT with refresh tokens + +[Shows specific auth pattern] +[Provides TS code example] +[Testing strategy] +[Security checklist] + +Related: error_handling.md, api_design.md +``` + +### Example 2: Database Design +```bash +./query_expertise.sh +> Working on: Database design +> Database: PostgreSQL + +Output: +=== Database Design - PostgreSQL === + +Schema design approach: +- Normalized tables +- Foreign keys enforced +- Indexes on lookups +- Migrations for changes + +[Shows migration example] +[Query optimization patterns] +[Testing approach] +``` + +### Example 3: Error Handling +```bash +./query_expertise.sh +> Working on: Error handling +> Language: Python + +Output: +=== Error Handling in Python === + +Pattern: Custom exception classes + global handler + +[Shows exception hierarchy] +[Handler implementation] +[Logging approach] +[User-facing messages] +``` + +## Creating a Skill + +### Basic Usage +```bash +cd engineer-skill-creator +./scripts/create_expert_skill.sh [engineer-username] +``` + +### Advanced Usage +```bash +./scripts/create_expert_skill.sh [engineer-username] --focus api,testing +``` + +Limits skill to specific focus areas. + +### What Gets Generated + +**Automatic categorization:** +- Groups related patterns +- Organizes by common tasks +- Separates by language +- Highlights best practices + +**Query system:** +- Interactive CLI tool +- Smart search +- Related content linking +- Example suggestions + +**Documentation:** +- Task-specific guides +- Language references +- Pattern library +- Quick reference cards + +## Integration with Development Workflow + +### In Claude Code +``` +"Load the expert-skills/senior-dev-mentor/ skill and help me +implement this feature following their approach" +``` + +### In Code Review +``` +"Using expert-skills/tech-lead-mentor/, review this PR for: +- Code style compliance +- Pattern usage +- Best practices +- Security considerations" +``` + +### In Architecture Decisions +``` +"Using expert-skills/architect-mentor/, how would they design +this microservice?" +``` + +## Skill Maintenance + +### Updating Skills +When engineer profile is updated: +```bash +./scripts/update_expert_skill.sh senior-dev +``` + +Re-generates skill with new expertise. + +### Version Control +Each skill generation includes: +- Source profile version +- Generation date +- Expertise count +- Last PR analyzed + +## Best Practices + +### When Creating Skills + +**DO:** +- ✅ Create skills for different expertise areas +- ✅ Update skills regularly (quarterly) +- ✅ Test queries before deploying +- ✅ Document what the skill covers + +**DON'T:** +- ❌ Create skills from insufficient data (< 20 PRs) +- ❌ Mix multiple engineers in one skill +- ❌ Ignore profile updates +- ❌ Over-categorize (keep it simple) + +### When Using Skills + +**DO:** +- ✅ Ask specific questions +- ✅ Provide context (language, task) +- ✅ Reference examples +- ✅ Combine with your judgment + +**DON'T:** +- ❌ Blindly copy patterns +- ❌ Skip understanding reasoning +- ❌ Ignore project context +- ❌ Treat as inflexible rules + +## Limitations + +**What Skills Can Do:** +- ✅ Provide proven patterns +- ✅ Show real examples +- ✅ Guide implementation +- ✅ Explain reasoning +- ✅ Surface best practices + +**What Skills Cannot Do:** +- ❌ Make decisions for you +- ❌ Understand your specific context +- ❌ Replace senior engineer judgment +- ❌ Guarantee correctness +- ❌ Adapt to new technologies automatically + +## Summary + +The Engineer Skill Creator transforms extracted expertise into actionable, queryable skills: + +**Input:** Engineer profile (from extractor) +**Process:** Categorize, organize, create query system +**Output:** Progressive disclosure skill + +**Benefits:** +- Find expertise fast +- Get task-specific guidance +- Learn from real examples +- Maintain consistency +- Scale knowledge + +**Use with agents:** +``` +"Using expert-skills/[engineer]-mentor/, [task description]" +``` + +**The complete workflow:** +1. Extract expertise: `extract_engineer.sh username` +2. Create skill: `create_expert_skill.sh username` +3. Use with agents: Reference skill in prompts +4. Get consistent, expert-level results + +--- + +**"Progressive disclosure: Show only what's needed, when it's needed."** diff --git a/skills/engineer-skill-creator/scripts/create_expert_skill.sh b/skills/engineer-skill-creator/scripts/create_expert_skill.sh new file mode 100755 index 0000000..1a3914c --- /dev/null +++ b/skills/engineer-skill-creator/scripts/create_expert_skill.sh @@ -0,0 +1,579 @@ +#!/bin/bash + +# Engineer Skill Creator +# Transform extracted engineer expertise into progressive disclosure skill + +set -e + +# Colors +GREEN='\033[0;32m' +BLUE='\033[0;34m' +YELLOW='\033[1;33m' +RED='\033[0;31m' +MAGENTA='\033[0;35m' +CYAN='\033[0;36m' +NC='\033[0m' + +echo -e "${BLUE}╔══════════════════════════════════════════════════╗${NC}" +echo -e "${BLUE}║ Engineer Skill Creator ║${NC}" +echo -e "${BLUE}╚══════════════════════════════════════════════════╝${NC}" +echo "" +echo -e "${YELLOW}Transform engineer expertise into actionable skill${NC}" +echo "" + +# Helper function +prompt_input() { + local prompt_text="$1" + local var_name="$2" + local required="$3" + + while true; do + echo -e "${CYAN}${prompt_text}${NC}" + read -r input + + if [ -n "$input" ]; then + eval "$var_name=\"$input\"" + break + elif [ "$required" != "true" ]; then + eval "$var_name=\"\"" + break + else + echo -e "${RED}This field is required.${NC}" + fi + done +} + +# Check for profile directory +PROFILES_DIR="engineer_profiles" + +if [ ! -d "$PROFILES_DIR" ]; then + echo -e "${RED}Error: engineer_profiles/ directory not found${NC}" + echo "Run engineer-expertise-extractor first to create profiles" + exit 1 +fi + +# Step 1: Select Engineer Profile +echo -e "${MAGENTA}━━━ Step 1: Select Engineer Profile ━━━${NC}" +echo "" + +echo "Available engineer profiles:" +ls -1 "$PROFILES_DIR" 2>/dev/null | nl || echo "No profiles found" +echo "" + +if [ -n "$1" ]; then + ENGINEER_USERNAME="$1" +else + prompt_input "Engineer username:" ENGINEER_USERNAME true +fi + +PROFILE_DIR="$PROFILES_DIR/$ENGINEER_USERNAME" + +if [ ! -d "$PROFILE_DIR" ]; then + echo -e "${RED}Error: Profile not found: $PROFILE_DIR${NC}" + echo "Available profiles:" + ls -1 "$PROFILES_DIR" + exit 1 +fi + +echo -e "${GREEN}✓ Found profile: $ENGINEER_USERNAME${NC}" + +# Read engineer name from profile README +if [ -f "$PROFILE_DIR/README.md" ]; then + ENGINEER_NAME=$(grep "^**Name:**" "$PROFILE_DIR/README.md" | cut -d: -f2 | xargs || echo "$ENGINEER_USERNAME") +else + ENGINEER_NAME="$ENGINEER_USERNAME" +fi + +echo " Name: $ENGINEER_NAME" +echo "" + +# Step 2: Skill Configuration +echo -e "${MAGENTA}━━━ Step 2: Skill Configuration ━━━${NC}" +echo "" + +# Skill name (sanitized) +SKILL_NAME="${ENGINEER_USERNAME}-mentor" +SKILL_NAME=$(echo "$SKILL_NAME" | tr '[:upper:]' '[:lower:]' | tr '_' '-') + +prompt_input "Skill name [$SKILL_NAME]:" CUSTOM_SKILL_NAME false +SKILL_NAME="${CUSTOM_SKILL_NAME:-$SKILL_NAME}" + +echo "" +echo "Focus areas (leave empty for all):" +prompt_input "Specific areas to include (e.g., 'api,testing,auth'):" FOCUS_AREAS false + +# Create output directory +OUTPUT_DIR="expert-skills/$SKILL_NAME" +mkdir -p "$OUTPUT_DIR" +mkdir -p "$OUTPUT_DIR/expertise/by_task" +mkdir -p "$OUTPUT_DIR/expertise/by_language" +mkdir -p "$OUTPUT_DIR/expertise/by_pattern" +mkdir -p "$OUTPUT_DIR/expertise/quick_reference" +mkdir -p "$OUTPUT_DIR/examples" + +echo "" +echo -e "${BLUE}━━━ Creating Skill ━━━${NC}" +echo "" + +# Step 3: Create Skill README +echo -e "${YELLOW}Generating skill documentation...${NC}" + +cat > "$OUTPUT_DIR/SKILL.md" << EOF +--- +name: $SKILL_NAME +description: Expert guidance from $ENGINEER_NAME's coding expertise. Progressive disclosure for task-specific patterns, best practices, and real code examples. +--- + +# $ENGINEER_NAME - Expert Mentor Skill + +Learn from $ENGINEER_NAME's proven patterns and best practices. This skill provides progressive disclosure of their expertise, showing only what's relevant for your current task. + +## How to Use This Skill + +### Quick Query +\`\`\` +"Using this skill, how do I implement [feature]?" +\`\`\` + +### Task-Specific +\`\`\` +"Using this skill, show me authentication patterns" +"Using this skill, TypeScript coding style" +"Using this skill, repository pattern implementation" +\`\`\` + +### Code Generation +\`\`\` +"Using this skill, write a service following their style" +"Using this skill, review this code using their standards" +\`\`\` + +## Expertise Areas + +Based on analysis of $ENGINEER_NAME's GitHub contributions: + +EOF + +# List expertise areas from profile +if [ -d "$PROFILE_DIR/patterns" ]; then + echo "### Patterns" >> "$OUTPUT_DIR/SKILL.md" + find "$PROFILE_DIR/patterns" -name "*.md" -type f | while read -r file; do + basename "$file" .md | sed 's/_/ /g' | sed 's/^/- /' >> "$OUTPUT_DIR/SKILL.md" + done + echo "" >> "$OUTPUT_DIR/SKILL.md" +fi + +if [ -d "$PROFILE_DIR/best_practices" ]; then + echo "### Best Practices" >> "$OUTPUT_DIR/SKILL.md" + find "$PROFILE_DIR/best_practices" -name "*.md" -type f | while read -r file; do + basename "$file" .md | sed 's/_/ /g' | sed 's/^/- /' >> "$OUTPUT_DIR/SKILL.md" + done + echo "" >> "$OUTPUT_DIR/SKILL.md" +fi + +cat >> "$OUTPUT_DIR/SKILL.md" << EOF + +## Structure + +This skill uses **progressive disclosure** - you get only what's needed: + +\`\`\` +expertise/ +├── by_task/ # Query by what you're building +│ ├── authentication.md +│ ├── api_design.md +│ ├── database_design.md +│ └── testing.md +├── by_language/ # Query by language +│ ├── typescript.md +│ ├── python.md +│ └── [others].md +├── by_pattern/ # Query by design pattern +│ ├── dependency_injection.md +│ ├── repository_pattern.md +│ └── [others].md +└── quick_reference/ # Quick lookups + ├── coding_style.md + ├── naming_conventions.md + └── best_practices.md +\`\`\` + +## Interactive Query + +Use the query tool for guided navigation: + +\`\`\`bash +./query_expertise.sh +\`\`\` + +## Examples + +Real code examples from their work: + +\`\`\` +examples/ +├── [language]_examples/ +└── [pattern]_examples/ +\`\`\` + +## Quick Reference + +For fast lookups: +- **Coding Style:** expertise/quick_reference/coding_style.md +- **Naming:** expertise/quick_reference/naming_conventions.md +- **Best Practices:** expertise/quick_reference/best_practices.md + +## Source + +Expertise extracted from: \`engineer_profiles/$ENGINEER_USERNAME/\` + +Generated: $(date +%Y-%m-%d) + +--- + +**Use this skill to code like $ENGINEER_NAME - progressive, focused, and effective.** +EOF + +echo -e "${GREEN}✓ Skill documentation created${NC}" + +# Step 4: Organize by Task +echo -e "${YELLOW}Organizing expertise by task...${NC}" + +# Create task-based docs +cat > "$OUTPUT_DIR/expertise/by_task/authentication.md" << 'EOF' +# Authentication & Authorization + +## Overview +Authentication and authorization patterns from analyzed code. + +## Preferred Approach +[Extract from profile's architecture/ and patterns/ folders] + +## Implementation +[Code examples from examples/ folder] + +## Testing Strategy +[From best_practices/testing_approach.md] + +## Security Considerations +[From best_practices/security.md] + +## Examples +See: ../../examples/ + +--- +**Note:** Populate with specific patterns from engineer profile +EOF + +cat > "$OUTPUT_DIR/expertise/by_task/api_design.md" << 'EOF' +# API Design + +## Overview +API design patterns and conventions. + +## REST API Design +[Extract from architecture/ and patterns/] + +## Error Handling +[From patterns/error_handling.md] + +## Validation +[Input validation patterns] + +## Documentation +[API documentation approach] + +## Examples +See: ../../examples/ + +--- +**Note:** Populate with specific patterns from engineer profile +EOF + +cat > "$OUTPUT_DIR/expertise/by_task/testing.md" << 'EOF' +# Testing Approach + +## Overview +Testing strategies and patterns. + +## Test Structure +[From best_practices/testing_approach.md] + +## Unit Testing +[Unit test patterns] + +## Integration Testing +[Integration test patterns] + +## Test Coverage +[Coverage standards] + +## Examples +See: ../../examples/ + +--- +**Note:** Populate with specific patterns from engineer profile +EOF + +echo -e "${GREEN}✓ Task-based organization created${NC}" + +# Step 5: Create Quick Reference +echo -e "${YELLOW}Creating quick reference guides...${NC}" + +# Copy coding style if available +if [ -f "$PROFILE_DIR/coding_style/naming_conventions.md" ]; then + cp "$PROFILE_DIR/coding_style/naming_conventions.md" "$OUTPUT_DIR/expertise/quick_reference/" +fi + +if [ -f "$PROFILE_DIR/coding_style/code_structure.md" ]; then + cp "$PROFILE_DIR/coding_style/code_structure.md" "$OUTPUT_DIR/expertise/quick_reference/" +fi + +# Create coding style summary +cat > "$OUTPUT_DIR/expertise/quick_reference/coding_style.md" << EOF +# Coding Style - Quick Reference + +## Overview +Fast reference for $ENGINEER_NAME's coding conventions. + +## Naming Conventions + +$([ -f "$PROFILE_DIR/coding_style/naming_conventions.md" ] && cat "$PROFILE_DIR/coding_style/naming_conventions.md" || echo "See full profile for details") + +## Code Structure + +$([ -f "$PROFILE_DIR/coding_style/code_structure.md" ] && cat "$PROFILE_DIR/coding_style/code_structure.md" || echo "See full profile for details") + +## Source +Full details: \`engineer_profiles/$ENGINEER_USERNAME/coding_style/\` + +--- +Generated: $(date +%Y-%m-%d) +EOF + +echo -e "${GREEN}✓ Quick reference created${NC}" + +# Step 6: Create Query Tool +echo -e "${YELLOW}Creating interactive query tool...${NC}" + +cat > "$OUTPUT_DIR/query_expertise.sh" << 'QUERYEOF' +#!/bin/bash + +# Interactive expertise query tool + +GREEN='\033[0;32m' +BLUE='\033[0;34m' +CYAN='\033[0;36m' +NC='\033[0m' + +echo -e "${BLUE}╔══════════════════════════════════════════════════╗${NC}" +echo -e "${BLUE}║ Expert Guidance Query ║${NC}" +echo -e "${BLUE}╚══════════════════════════════════════════════════╝${NC}" +echo "" + +echo "What are you working on?" +echo "" +echo "1) Authentication" +echo "2) API Design" +echo "3) Database Design" +echo "4) Testing" +echo "5) Error Handling" +echo "6) Quick Reference (coding style)" +echo "7) Browse all expertise" +echo "" + +read -p "Select (1-7): " CHOICE + +case $CHOICE in + 1) + echo "" + echo -e "${GREEN}=== Authentication Expertise ===${NC}" + cat expertise/by_task/authentication.md + ;; + 2) + echo "" + echo -e "${GREEN}=== API Design Expertise ===${NC}" + cat expertise/by_task/api_design.md + ;; + 3) + echo "" + echo -e "${GREEN}=== Database Design Expertise ===${NC}" + [ -f expertise/by_task/database_design.md ] && cat expertise/by_task/database_design.md || echo "Not available" + ;; + 4) + echo "" + echo -e "${GREEN}=== Testing Expertise ===${NC}" + cat expertise/by_task/testing.md + ;; + 5) + echo "" + echo -e "${GREEN}=== Error Handling Expertise ===${NC}" + [ -f expertise/by_task/error_handling.md ] && cat expertise/by_task/error_handling.md || echo "Not available" + ;; + 6) + echo "" + echo -e "${GREEN}=== Quick Reference ===${NC}" + cat expertise/quick_reference/coding_style.md + ;; + 7) + echo "" + echo -e "${GREEN}=== All Expertise Areas ===${NC}" + find expertise/ -name "*.md" -type f | sort + ;; + *) + echo "Invalid selection" + exit 1 + ;; +esac + +echo "" +echo -e "${CYAN}━━━ Related Resources ━━━${NC}" +echo "Examples: ./examples/" +echo "Full profile: engineer_profiles/$ENGINEER_USERNAME/" +echo "" +QUERYEOF + +chmod +x "$OUTPUT_DIR/query_expertise.sh" + +echo -e "${GREEN}✓ Query tool created${NC}" + +# Step 7: Copy Examples +echo -e "${YELLOW}Copying code examples...${NC}" + +if [ -d "$PROFILE_DIR/examples" ]; then + cp -r "$PROFILE_DIR/examples/"* "$OUTPUT_DIR/examples/" 2>/dev/null || true + EXAMPLES_COUNT=$(find "$OUTPUT_DIR/examples" -type f | wc -l) + echo -e "${GREEN}✓ Copied $EXAMPLES_COUNT example files${NC}" +else + echo -e "${YELLOW}⚠ No examples found in profile${NC}" +fi + +# Step 8: Create Usage Guide +echo -e "${YELLOW}Creating usage guide...${NC}" + +cat > "$OUTPUT_DIR/HOW_TO_USE.md" << EOF +# How to Use This Expert Skill + +## For AI Agents + +### Basic Usage +\`\`\` +"Using the skill at expert-skills/$SKILL_NAME/, help me implement +user authentication" +\`\`\` + +### Language-Specific +\`\`\` +"Using expert-skills/$SKILL_NAME/, write a TypeScript service +following their coding style" +\`\`\` + +### Pattern-Specific +\`\`\` +"Using expert-skills/$SKILL_NAME/, show me how they implement +the repository pattern" +\`\`\` + +### Code Review +\`\`\` +"Using expert-skills/$SKILL_NAME/, review this code using their +standards and best practices" +\`\`\` + +## For Humans + +### Interactive Query +\`\`\`bash +cd expert-skills/$SKILL_NAME +./query_expertise.sh +\`\`\` + +### Browse by Task +\`\`\`bash +cat expertise/by_task/authentication.md +cat expertise/by_task/api_design.md +cat expertise/by_task/testing.md +\`\`\` + +### Quick Reference +\`\`\`bash +cat expertise/quick_reference/coding_style.md +cat expertise/quick_reference/naming_conventions.md +\`\`\` + +### View Examples +\`\`\`bash +ls examples/ +cat examples/[filename] +\`\`\` + +## Progressive Disclosure + +This skill shows only what you need: + +1. **Ask specific question** → Get specific answer +2. **Request by task** → Get task-specific patterns +3. **Query by language** → Get language-specific style +4. **Search by pattern** → Get pattern implementation + +## Tips + +- Start with quick_reference/ for overview +- Use query tool for guided exploration +- Reference specific tasks for focused guidance +- Check examples/ for real code samples + +## Source Profile + +Full engineer profile: \`engineer_profiles/$ENGINEER_USERNAME/\` + +Last updated: $(date +%Y-%m-%d) +EOF + +echo -e "${GREEN}✓ Usage guide created${NC}" + +# Step 9: Generate Summary +echo "" +echo -e "${BLUE}╔════════════════════════════════════════════════╗${NC}" +echo -e "${BLUE}║ Skill Creation Complete! ║${NC}" +echo -e "${BLUE}╚════════════════════════════════════════════════╝${NC}" +echo "" +echo -e "${GREEN}Expert skill created: ${BLUE}$OUTPUT_DIR${NC}" +echo "" +echo -e "${YELLOW}━━━ Skill Details ━━━${NC}" +echo "Skill Name: $SKILL_NAME" +echo "Engineer: $ENGINEER_NAME" +echo "Source Profile: $PROFILE_DIR" +echo "" +echo -e "${YELLOW}━━━ Structure Created ━━━${NC}" +echo "├── SKILL.md (skill documentation)" +echo "├── HOW_TO_USE.md (usage guide)" +echo "├── query_expertise.sh (interactive query)" +echo "├── expertise/" +echo "│ ├── by_task/ (task-specific guidance)" +echo "│ ├── by_language/ (language-specific style)" +echo "│ ├── by_pattern/ (design patterns)" +echo "│ └── quick_reference/ (fast lookups)" +echo "└── examples/ (code samples)" +echo "" +echo -e "${CYAN}━━━ Next Steps ━━━${NC}" +echo "" +echo "1. Review the skill:" +echo -e " ${BLUE}cat $OUTPUT_DIR/SKILL.md${NC}" +echo "" +echo "2. Test the query tool:" +echo -e " ${BLUE}cd $OUTPUT_DIR && ./query_expertise.sh${NC}" +echo "" +echo "3. Enhance with profile content:" +echo " - Populate by_task/ docs with specific patterns" +echo " - Add language-specific guides to by_language/" +echo " - Document patterns in by_pattern/" +echo "" +echo "4. Use with AI agents:" +echo -e " ${BLUE}\"Using expert-skills/$SKILL_NAME/, implement authentication\"${NC}" +echo "" +echo -e "${YELLOW}💡 Tip: The skill provides progressive disclosure - agents get only${NC}" +echo -e "${YELLOW} what's needed for their specific task${NC}" +echo "" +echo -e "${GREEN}✅ Skill is ready to use!${NC}" +echo ""