plugins/sc-skills/skills/sc-patterns/SKILL.md
Detect codebase conventions and generate pattern briefs for AI-guided planning. This skill SHOULD be used when the user asks to "analyze patterns", "detect conventions", "what patterns does this codebase use", "pattern brief", "initialize pattern detection", or before major planning/implementation work.
npx skillsauth add kylesnowschwartz/simpleclaude sc-patternsInstall 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.
Purpose: Extract high-confidence coding conventions from a codebase and make them available as planning constraints for AI agents.
Parse $ARGUMENTS to determine the mode:
| Input | Mode | Action |
|-------|------|--------|
| Empty or analyze | Analyze | Full pattern scan, cache results |
| brief <task description> | Brief | Task-scoped pattern constraints from cache |
| init | Init | Analyze + generate starter policy.yaml |
| refresh | Refresh | Force full re-analysis, ignore cache |
Run the sc-pattern-analyzer agent to scan the codebase.
Steps:
.patterns/evidence.json exists and is fresh:
.patterns/.cache-meta.json for the last-analyzed commit SHAgit rev-parse HEADgit status --porcelainsc-pattern-analyzer agent with the full analysis task.patterns/policy.yaml exists)Output example:
## Pattern Analysis Complete
Analyzed 342 files (89 excluded) | Primary: Ruby/Rails
### Enforceable (8 patterns)
- Service objects use `def call` pattern (92% in app/services/)
- Controllers use before_action guards (88% in app/controllers/)
- Models use scopes over class methods (78% in app/models/)
...
### Probable (4 patterns)
- Repository pattern for DB access (65% in app/repositories/)
...
### Conflicted (2 areas)
- Error handling in services: 40% Result objects, 35% exceptions, 25% booleans
- Component styling: 55% CSS modules, 45% styled-components
### No Strong Pattern
- Serializer conventions in app/serializers/
Cache written to .patterns/evidence.json
Brief written to .patterns/brief.json
Generate task-scoped pattern constraints from cached analysis.
Steps:
.patterns/evidence.json (run analyze first if missing/stale)app/services/).patterns/policy.yaml for any overrides affecting the task scopeOutput example for /sc-patterns brief add a new user registration service:
## Pattern Brief: User Registration Service
Relevant scope: app/services/, app/models/, spec/services/
### Follow These Patterns
1. **Service objects use `def call`** (enforceable, 92%)
See: app/services/create_user_service.rb:8-22
2. **Services accept a params hash** (enforceable, 88%)
See: app/services/update_profile_service.rb:5-12
3. **Tests mirror source structure** (enforceable, 95%)
Place test at: spec/services/register_user_service_spec.rb
### Avoid
- Do NOT use multiple public methods (legacy pattern in legacy_export_service.rb)
- Do NOT raise exceptions for business logic failures (per policy.yaml — use Result objects)
### No Consensus (your judgment)
- Error return format: 40% Result objects, 35% exceptions. Policy says use Result objects.
Run analysis and generate a starter .patterns/policy.yaml for human review.
Steps:
.patterns/policy.yaml pre-populated with:
enforce: entries (for human confirmation)exclude_paths for the detected frameworkboundaries sectionOutput:
## Pattern Detection Initialized
Analysis complete. Generated:
- .patterns/evidence.json (full analysis, gitignored)
- .patterns/brief.json (compact brief, gitignored)
- .patterns/policy.yaml (human overrides — review and commit this)
Next steps:
1. Review .patterns/policy.yaml — confirm, edit, or remove entries
2. Commit policy.yaml to your repo
3. Run /sc-patterns analyze after significant codebase changes
4. Use /sc-patterns brief <task> before planning new features
Force a full re-analysis regardless of cache state. Same as analyze but skips the freshness check.
The .patterns/ directory at project root stores analysis artifacts:
.patterns/
evidence.json # Full analysis — all patterns, all confidence levels
brief.json # Compact — enforceable + probable only, for prompt injection
policy.yaml # Human overrides — committed to repo
.cache-meta.json # Fingerprint: HEAD SHA, analyzed paths, detector version
Gitignore guidance: evidence.json, brief.json, and .cache-meta.json should be gitignored. policy.yaml should be committed. On first init, check if .gitignore includes .patterns/ entries and suggest additions if missing.
This command writes files that sc-plan and sc-work can read. The integration is file-based, not import-based:
sc-plan/sc-work check if .patterns/brief.json existsUser Request: $ARGUMENTS
testing
Use when writing or editing a Slack message, email, pull request body, GitHub issue, Reddit post, agenda, or doc. Enforces a direct, warm, unfilled tone and removes AI tells. Always scores the final draft and runs a self-audit pass before delivery.
development
Reframe code design through functional programming principles for agent-assisted development. This skill SHOULD be used when the user says "think functional", "think FP", "make this pure", "separate effects", "where should this side effect go", "this function does too much", "how should I structure this for agents", "make this easier to review", "reduce context needed", or when planning module structure, store design, or code that agents will write and humans will review. Applies FP discipline within any language to maximize agent effectiveness and human reviewability.
development
Use when the user is clarifying beliefs, assumptions, goals, or framing before committing to decision or plan.
testing
Audit and improve project memory files (CLAUDE.md, AGENTS.md, .claude.local.md) — assess against a quality rubric, then apply additions and removals. This skill SHOULD be used when the user asks to audit, improve, edit, fix, tighten, rewrite, or update a memory file, or to check whether one is too long, stale, or bloated.