Skip to content
Development
Command

/f5-learn

Project learning, patterns, and code examples

From plugin
f5-framework
2469 skills104 agents69 commands
Install
$ npx -y skills add Fujigo-Software/f5-framework-claude --agent claude-code

How it fires

How this command gets triggered: by you, by Claude, or both.

  • Fires itselfClaude auto-loads it when your prompt matches the work.
  • You can call itInvoke it directly when you want it.
  • Slash command/f5-learn

Context preview

What this command does when you run it.

Project learning, patterns, and code examples

Command definition

f5-learn.md
description: Project learning, patterns, and code examples
argument-hint: <scan|show|apply|examples> [options]

/f5-learn - Unified Learning & Examples Command

**Consolidated command** that replaces:

  • `/f5-examples` → `/f5-learn examples`

Learn and apply project-specific coding patterns, naming conventions, and style preferences.

ARGUMENTS

$ARGUMENTS

MODE DETECTION

| Pattern | Mode | Description | |---------|------|-------------| | `examples <action>` | EXAMPLES | Code example management | | `<other>` (default) | LEARN | Pattern learning |

---

MODE: EXAMPLES (from /f5-examples)

`/f5-learn examples <action>`

Collect, manage, and reference high-quality code examples.

| Action | Description | |--------|-------------| | `collect` | Find and score example code | | `list [category]` | List examples by category | | `show <id>` | Display specific example | | `add <file>` | Manually add example | | `remove <id>` | Remove example | | `apply <id>` | Apply example to current context |

**Categories:** services, controllers, repositories, entities, utils, tests, components, hooks

**Examples:**

/f5-learn examples collect --category services
/f5-learn examples list tests
/f5-learn examples show svc_001
/f5-learn examples apply svc_001

---

MODE: LEARN (Default)

Learn project-specific coding patterns.

Usage

/f5-learn <action> [options]

Actions

scan

Analyze codebase to detect patterns.

/f5-learn scan [--full] [--path <dir>]

**Options:**

  • `--full` - Deep scan including all file types
  • `--path` - Specific directory to scan (default: project root)
  • `--force` - Overwrite existing profile

show

Display current learning profile.

/f5-learn show [section]

**Sections:**

  • `naming` - Naming conventions
  • `style` - Code style preferences
  • `architecture` - Architecture patterns
  • `all` - Full profile (default)

apply

Apply learned patterns to current session.

/f5-learn apply [--strict]

**Options:**

  • `--strict` - Enforce all patterns as errors

correct

Record a correction to learn from.

/f5-learn correct "<original>" "<corrected>" [--file <path>]

rule

Add or manage custom rules.

/f5-learn rule add "<name>" "<pattern>" [--severity <level>]
/f5-learn rule list
/f5-learn rule remove <id>

reset

Reset learning profile.

/f5-learn reset [--keep-custom]

Examples

# Full codebase scan
/f5-learn scan --full

# Show naming conventions
/f5-learn show naming

# Apply patterns
/f5-learn apply

# Record a correction
/f5-learn correct "getUserData" "findUserById" --file "src/services/user.ts"

# Add custom rule
/f5-learn rule add "no-any" ":\\s*any" --severity error

# Reset but keep custom rules
/f5-learn reset --keep-custom

Execution

When user runs this command:

ACTION: SCAN

1. **Initialize**:

  • Get project ID from `.f5/config.json`
  • Create/update `.f5/learning/profile.yaml`

2. **Analyze Files**:

   // Scan patterns
   const patterns = {
     naming: analyzeNamingConventions(files),
     style: analyzeCodeStyle(files),
     architecture: analyzeArchitecture(files),
     errorHandling: analyzeErrorHandling(files),
     testing: analyzeTestingPatterns(files),
     documentation: analyzeDocumentation(files)
   };

3. **Detect Naming Conventions**:

   // File naming
   analyzeFileNames(files) => {
     pattern: detectCase(fileNames), // kebab-case, camelCase, etc.
     examples: sampleFileNames,
     confidence: calculateConfidence(matches, total)
   }

   // Variable naming
   analyzeVariables(ast) => {
     pattern: detectCase(variables),
     prefixes: {
       boolean: detectBooleanPrefix(booleanVars), // is, has, should
       private: detectPrivatePrefix(privateVars), // _, __
       constant: detectConstantStyle(constants)   // UPPER_SNAKE
     }
   }

   // Function naming
   analyzeFunctions(ast) => {
     pattern: detectCase(functionNames),
     verb_prefixes: extractVerbPrefixes(functionNames) // get, set, create, etc.
   }

   // Class naming
   analyzeClasses(ast) => {
     pattern: "PascalCase", // Usually PascalCase
     suffixes: {
       service: detectSuffix(services),      // Service, Svc
       controller: detectSuffix(controllers), // Controller, Ctrl
       repository: detectSuffix(repos)        // Repository, Repo
     }
   }

4. **Detect Code Style**:

   analyzeCodeStyle(files) => {
     indentation: detectIndentation(content), // spaces/tabs, size
     quotes: detectQuoteStyle(ast),           // single/double
     semicolons: detectSemicolonUsage(ast),   // true/false
     trailingCommas: detectTrailingCommas(ast),
     imports: analyzeImportOrder(ast),
     arrowFunctions: countArrowVsFunction(ast),
     constUsage: countConstVsLet(ast)
   }

5. **Detect Architecture**:

   analyzeArchitecture(projectStructure) => {
     primary: detectArchitecturePattern(dirs),
     layers: mapLayersFromStructure(dirs),
     dependencyDirection: analyzeDependencies(imports)
   }

6. **Calculate Confidence**:

   calculateConfidence(matches, total) => {
     const ratio = matches / total;
     return Math.round(ratio * 100);
   }

7. **Save Profile**:

  • Write to `.f5/learning/profile.yaml`
  • Store examples in `.f5/learning/patterns/`

ACTION: SHOW

1. **Load Profile**:

   if [ -f ".f5/learning/profile.yaml" ]; then
     cat .f5/learning/profile.yaml
   else
     echo "No learning profile. Run /f5-learn scan first."
   fi

2. **Format Output**:

   ## Learning Profile: [PROJECT_NAME]

   Scanned: [DATE] | Files: [COUNT] | Confidence: [SCORE]%

   ### Naming Conventions

   | Element | Pattern | Examples | Confidence |
   |---------|---------|----------|------------|
   | Files | kebab-case | user-service.ts | 95% |
   | Variables | camelCase | userName,
Read more
Ships withf5-framework

AI-Powered Development Framework for Claude Code

Get the whole plugin, auto-invoked
Stats
24
Stars
0
Views
8
Forks
Quiet
Maintenance
Python
Language
MIT
License
6mo ago
Last commit
6mo ago
Created

Repo: Fujigo-Software/f5-framework-claude