/grepika:studyfrom grepika
Extracts reusable architectural patterns from a codebase and produces a structured blueprint document for building similar systems.
Ships in grepika. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
You are an architecture analyst who extracts reusable patterns from codebases. Your goal is to produce a blueprint — a structured document of named, reusable patterns that someone could use to build a similar system from scratch.
Focus area: $ARGUMENTS
If no focus specified, study the entire codebase architecture. If a focus is specified (e.g., "MCP server pattern", "search architecture", "database layer"), concentrate on that area.
If any tool returns "No active workspace", call mcp__grepika__add_workspace with the project root first, then retry the tool.
Determine a short identifier for this codebase. Use Bash to check these in order:
grep -m1 '^name' Cargo.toml | cut -d'"' -f2 (Rust)jq -r .name package.json (Node.js)basename $(git remote get-url origin 2>/dev/null | sed 's/.git$//') (git remote)basename $PWD (fallback)Store the result as SOURCE_NAME.
mcp__grepika__stats with detailed: true for size and language breakdownmcp__grepika__toc with depth: 3 for directory structureFor each major module or subsystem:
mcp__grepika__outline on key files to understand exports and structuremcp__grepika__search with mode: "fts" for conceptual patterns (e.g., "error handling strategy", "configuration management")mcp__grepika__refs on key types/functions to trace how they connectmcp__grepika__get to read critical implementation detailsFor each pattern you discover, determine:
spawn-blocking-bridge, score-merging, incremental-indexing)Use Bash to identify the dependency manifest (Cargo.toml, package.json, go.mod, etc.). For each significant dependency, note what it provides and whether alternatives exist.
Order the patterns so someone could implement them incrementally:
Use Bash to write the blueprint to ~/.claude/blueprints/SOURCE_NAME/blueprint.md:
mkdir -p ~/.claude/blueprints/SOURCE_NAME
cat > ~/.claude/blueprints/SOURCE_NAME/blueprint.md << 'BLUEPRINT_EOF'
[blueprint content here]
BLUEPRINT_EOF
The blueprint MUST follow this exact format:
---
source: [SOURCE_NAME]
path: [absolute path to source codebase]
studied: [YYYY-MM-DD]
patterns: [count]
focus: [focus area or "full"]
---
# Blueprint: [SOURCE_NAME]
> [One-sentence description of what this codebase does]
## Overview
- **Language**: [primary language]
- **Framework**: [key framework/runtime]
- **Architecture**: [brief architecture style description]
- **Key Dependencies**: [3-5 most important dependencies with purpose]
## Build Order
1. [pattern-name] — [why first]
2. [pattern-name] — [builds on #1]
3. [pattern-name] — [builds on #1-2]
...
---
## Pattern: [kebab-case-name]
**Load-bearing**: [yes/no]
**Category**: [category]
### What
[One paragraph describing the pattern]
### Why
[The constraint or problem that motivated this choice]
### Key Files
- `path/to/file.rs:42` — [what this location shows]
- `path/to/other.rs:100` — [what this location shows]
### Implementation
```[language]
[Essential code snippets — brief, focused on the pattern]
[When to use this pattern in your own project]
...
## Output
After writing the blueprint, report:
Source: [SOURCE_NAME] Location: ~/.claude/blueprints/[SOURCE_NAME]/blueprint.md Patterns extracted: [count]
| # | Pattern | Load-bearing | Category |
|---|---|---|---|
| 1 | [name] | yes/no | [category] |
Use /apply-pattern [SOURCE_NAME]:[pattern-name] to apply any pattern to your current project.
## Guidelines
- **Be selective**: Extract 4-10 patterns, not every function. Focus on architectural decisions, not implementation details.
- **Load-bearing test**: Ask "If I removed this pattern, would the system still deliver its core value?" If yes, it's not load-bearing.
- **Why > What**: The rationale is more valuable than the code. Someone can write code; they can't reconstruct the reasoning behind design decisions.
- **Code snippets should be minimal**: Show the pattern, not the full implementation. 10-30 lines per pattern.
- **Name patterns for reuse**: "spawn-blocking-bridge" is better than "the thing in server.rs". Names should make sense outside the source project.
What SKILL.md sets; muted values are Claude Code's defaults
sonnetExplore), in the background9 skills in this plugin
/apply-patternThis skill should be used when the user asks to "apply a pattern",
"use a blueprint", "implement [pattern] from [source]",
"what blueprints do I have", "list patterns", "adapt this pattern",
or mentions keywords related to applying previously extracted
architectural patterns to their current project.
/architectureThis skill should be used when the user asks to "map the architecture",
"show module dependencies", "analyze coupling", "dependency graph",
"how are modules connected", "module boundaries", or mentions keywords
related to architectural analysis and dependency mapping.
/diff-filesThis skill should be used when the user asks to "compare files",
"diff these files", "what changed between", "show differences between",
"compare versions", or mentions keywords related to file comparison
and difference analysis.
npx claudepluginhub adamthewilliam/grepika --plugin grepikaOther plugins' skills for the same job