$npx -y skills add giuseppe-trisciuoglio/developer-kit --skill learnProvides autonomous project pattern learning by analyzing the codebase to discover development conventions, architectural patterns, and coding standards, then generates project rule files in .claude/rules/. Use when user asks to "learn from project", "extract project rules", "ana
| 1 | # Learn |
| 2 | |
| 3 | Autonomously analyzes a project's codebase to discover development patterns, conventions, and architectural decisions, then generates project rule files in `.claude/rules/` for Claude Code to follow. |
| 4 | |
| 5 | ## Overview |
| 6 | |
| 7 | This skill acts as the **Orchestrator** in a two-agent architecture. It coordinates the overall workflow: gathering project context, delegating deep analysis to the `learn-analyst` sub-agent, filtering and ranking results, presenting findings to the user, and persisting approved rules to `.claude/rules/`. |
| 8 | |
| 9 | The separation of concerns ensures the analyst operates with a focused forensic prompt while the orchestrator manages user interaction and file persistence. |
| 10 | |
| 11 | ## When to Use |
| 12 | |
| 13 | Use this skill when: |
| 14 | |
| 15 | - User asks to "learn from this project" or "understand project conventions" |
| 16 | - User wants to auto-generate `.claude/rules/` files from the existing codebase |
| 17 | - User asks to "extract project rules" or "discover patterns" |
| 18 | - User wants Claude Code to learn the project's coding standards |
| 19 | - After joining a new project and wanting to codify existing conventions |
| 20 | - Before starting a large feature to ensure Claude follows project patterns |
| 21 | |
| 22 | **Trigger phrases:** "learn from project", "extract rules", "analyze conventions", "discover patterns", "generate project rules", "learn codebase", "auto-generate rules" |
| 23 | |
| 24 | ## Instructions |
| 25 | |
| 26 | ### Phase 1: Project Context Assessment |
| 27 | |
| 28 | Before delegating to the analyst, gather high-level project context: |
| 29 | |
| 30 | 1. **Verify project root**: Confirm the current working directory is a project root (has `package.json`, `pom.xml`, `pyproject.toml`, `go.mod`, `.git/`, or similar markers) |
| 31 | |
| 32 | 2. **Check existing rules**: Scan for pre-existing rule files to understand what is already documented: |
| 33 | |
| 34 | ```bash |
| 35 | # Check for existing rules |
| 36 | ls -la .claude/rules/ 2>/dev/null || echo "No .claude/rules/ directory found" |
| 37 | cat CLAUDE.md 2>/dev/null || echo "No CLAUDE.md found" |
| 38 | cat AGENTS.md 2>/dev/null || echo "No AGENTS.md found" |
| 39 | ls -la .cursorrules 2>/dev/null || echo "No .cursorrules found" |
| 40 | ``` |
| 41 | |
| 42 | 3. **Assess project size**: Get a quick overview of the project scope: |
| 43 | |
| 44 | ```bash |
| 45 | # Quick project overview |
| 46 | find . -maxdepth 1 -type f -name "*.json" -o -name "*.toml" -o -name "*.xml" -o -name "*.gradle*" -o -name "Makefile" -o -name "*.yaml" -o -name "*.yml" | head -20 |
| 47 | find . -type f -name "*.ts" -o -name "*.js" -o -name "*.java" -o -name "*.py" -o -name "*.go" -o -name "*.php" | wc -l |
| 48 | ``` |
| 49 | |
| 50 | 4. **Inform the user**: Briefly tell the user what you found and that you are about to start analysis: |
| 51 | - "I found a [TypeScript/NestJS] project with [N] source files and [M] existing rules. Starting deep analysis..." |
| 52 | |
| 53 | ### Phase 2: Delegate to Analyst Sub-Agent |
| 54 | |
| 55 | Invoke the `learn-analyst` sub-agent to perform the deep codebase analysis. |
| 56 | |
| 57 | Use the **Task tool** to delegate analysis to the `learn-analyst` agent: |
| 58 | |
| 59 | - **Agent**: `learn-analyst` |
| 60 | - **Prompt**: "Analyze the codebase in the current working directory. Follow your full process: discovery, pattern extraction, classification, and prioritization. Return your findings as a JSON report." |
| 61 | - **Mode**: Run synchronously to receive the JSON report directly |
| 62 | |
| 63 | The analyst will return a structured JSON report with classified findings. |
| 64 | |
| 65 | ### Phase 3: Review and Filter Results |
| 66 | |
| 67 | Process the analyst's report: |
| 68 | |
| 69 | 1. **Parse the JSON report** returned by the analyst |
| 70 | 2. **Validate findings**: Ensure each finding has: |
| 71 | - A clear title |
| 72 | - Evidence from at least 2 files |
| 73 | - Impact score ≥ 4 (discard low-impact findings) |
| 74 | - Well-formed markdown content |
| 75 | 3. **Deduplicate against existing rules**: Compare each finding title and content against existing `.claude/rules/` files. Skip findings that duplicate existing rules. |
| 76 | 4. **Select top 3**: From the remaining findings, select the top 3 by impact score. If fewer than 3 remain after filtering, present whatever is left. |
| 77 | 5. **If zero findings remain**: Inform the user that the project is already well-documented or no significant undocumented patterns were found. |
| 78 | |
| 79 | ### Phase 4: Present to User |
| 80 | |
| 81 | Present the filtered findings to the user in a clear, structured format: |
| 82 | |
| 83 | ``` |
| 84 | I analyzed your codebase and found N patterns worth documenting as project rules: |
| 85 | |
| 86 | 1. **[RULE]** <Title> (Impact: X/10) |
| 87 | <One-line explanation> |
| 88 | |
| 89 | 2. **[RULE]** <Title> (Impact: X/10) |
| 90 | <One-line explanation> |
| 91 | |
| 92 | 3. **[RULE]** <Title> (Impact: X/10) |
| 93 | <One-line explanation> |
| 94 | ``` |
| 95 | |
| 96 | Then ask the user for confirmation using **AskUserQuestion**: |
| 97 | |
| 98 | - Present choices: "Save all N rules", "Le |