.cursor/skills/learn/SKILL.md
Extract patterns from codebase and generate or update rule files
npx skillsauth add washingtonguilhardes/example.hr-module learnInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Persona: Execute this task as the @architect subagent.
Load the persona characteristics from .rulesync/subagents/architect.md before proceeding.
Extract actual patterns/conventions/styles from YOUR codebase (not generic best practices), generate/update rule files to match reality.
Discovery: - Aspect: Architecture/Testing/Components/Database/Integrations/tRPC Routers/Everything - Scope: Entire codebase or specific directories? - Goal: Document current patterns/Identify inconsistencies/Generate new rules/Update existing rules?
Scan: - Architecture: app/**/page.tsx, app/**/layout.tsx, app/**/components/*.tsx, app/lib/*/queries.ts - Testing: **/*.test.ts, **/*.test.tsx, **/e2e/**/*.ts - Components: app/**/components/**/*.tsx, components/components/**/*.tsx - Database: app/lib/*/queries.ts, prisma/schema.prisma - tRPC Routers: app/api/trpc/routers/**/*.ts, app/lib/*/actions.ts
Extract patterns: - File Organization: Naming conventions, file structure, directory hierarchy - Code Patterns: Function structure, error handling, logging, validation, types - Conventions: Import order, export patterns, comment styles, variable naming
Analyze consistency: - Measure pattern usage: Dominant pattern (percentage, count), Alternative patterns, Outliers, Recommendation
Codebase fingerprint: - Overview: Files analyzed, directories - Key Patterns: Pattern name, Usage percentage, Example from codebase, Files using pattern - Naming Conventions: Functions, Variables, Types, Files - Import Style: Standard import order - Testing Patterns: Test file location, Mock strategy, Assertion style - Inconsistencies Found: List with file counts
Rule recommendations: - Target rule domain (e.g., "unit testing", "code quality", "architecture"), Section, Content to add (Pattern name, Usage percentage, Standard approach with code, Real examples with file:line, When to use, Common mistakes)
Refactoring opportunities: - High Priority: Pattern name, Files affected, Impact, Effort, Files list - Medium/Low Priority: Same structure
Compare with existing rules: - Rules Matching Codebase: List with compliance percentages - Rules Needing Updates: What should be documented - Missing Rules: Patterns found but not documented
Update/create rules: - Ask: Update existing/Create new sections/Generate refactoring tasks/All? - If updating: Show diffs before applying - If creating: Ask which rule file
Summary: - Codebase analysis: Files scanned, patterns identified, consistency score - Findings: Well-established patterns, variations (standardization opportunity), anti-patterns (refactoring needed) - Rule updates: Updated sections, new sections, flagged for manual review - Files modified: List with changes - Next steps: Run /extract-pattern for deep-dives, create refactoring tasks, share rules
/learn --aspect Testing --scope app/api/trpc/routers/ - Scans all router test files, extracts the dominant test structure, mock strategy, and assertion style, then compares against existing testing rules./learn --aspect Everything --goal "Identify inconsistencies" - Full codebase scan across all aspects, produces a fingerprint with consistency scores per pattern, and flags rules that are out of sync with reality./extract-pattern - Deep-dive on a specific pattern identified during learning/audit - Identifies code quality patterns that may need attentiontesting
Analyze distributed traces to find blocking queries, N+1 patterns, and missing tRPC encapsulation, then produce prioritized fixes
testing
required reading for all test/spec files or test related queries.
testing
Transform Product Brief into Technical Specification
development
Detect drift between code implementations and specification documents