openlore-analyze-codeb…
Run a full static OpenLore analysis and summarize architecture, call graph, refactoring issues, and duplicate code. Use when…
Implement a brownfield story with OpenLore orientation, risk checks, spec validation, tests, and drift detection. Use when asked to implement or continue a story in an existing codebase.
$ npx -y skills add clay-good/OpenLore --skill openlore-implement-story --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/openlore-implement-storyContext preview
The summary Claude sees to decide when to auto-load this skill.
Implement a brownfield story with OpenLore orientation, risk checks, spec validation, tests, and drift detection. Use when asked to implement or continue a story in an existing codebase.
name: openlore-implement-story description: Implement a brownfield story with OpenLore orientation, risk checks, spec validation, tests, and drift detection. Use when asked to implement or continue a story in an existing codebase.
Trigger this skill when the user asks to **implement a story or task** on a codebase that has openlore analysis available, with phrasings like:
**Prerequisite**: openlore analysis must exist (`openlore analyze` has been run). If `orient` returns `"error": "no cache"` → run `analyze_codebase` first, then retry.
---
Read the story file. Extract:
| Situation | Approach | |---|---| | `risk_context` present, risk 🟢 < 40 | Skip to Step 3 — use insertion point from context | | `risk_context` present, risk 🟡 40–69 | Run Step 2 impact check, then proceed | | `risk_context` present, risk 🔴 ≥ 70 | Stop — a blocking refactor story must be resolved first | | `risk_context` absent | Run the full Step 2 orientation |
---
Call the openlore MCP tool `orient` with:
{
"directory": "$PROJECT_ROOT",
"task": "$STORY_TITLE",
"limit": 7
}For the top 2 functions returned, get minimal context first (callers, callees, body, test coverage in one call):
// get_minimal_context
{
"directory": "$PROJECT_ROOT",
"functionName": "$FUNCTION_NAME"
}**What to read from the result before proceeding:**
If `riskLevel` is `"high"` or any callee is external, check the cluster:
// get_cluster
{
"directory": "$PROJECT_ROOT",
"functionName": "$FUNCTION_NAME"
}Then check risk:
// analyze_impact
{
"directory": "$PROJECT_ROOT",
"symbol": "$FUNCTION_NAME",
"depth": 2
}**If any function has `riskScore ≥ 70`: stop.** Do not implement. Run `/openlore-execute-refactor` on the blocking function first, or create a blocking refactor task and return to this story once the risk is resolved.
---
Based on the story title and orient results, call the relevant inventory tool(s) **before reading any source file**. Skip if the story clearly involves none of these areas.
| Story involves | Tool | Purpose | |---|---|---| | Data models / ORM / database / tables | `get_schema_inventory` | See existing tables and fields — don't re-invent what already exists | | HTTP routes / API / endpoints | `get_route_inventory` | See existing routes before adding new ones | | Config / env vars / secrets | `get_env_vars` | Identify which vars are required vs have defaults | | UI components | `get_ui_components` | See existing component props and framework |
Call whichever openlore MCP inventory tool applies, e.g. `get_schema_inventory` with `{"directory": "$PROJECT_ROOT"}`.
Use the results to ground the implementation in existing schemas/routes — the plan cannot contradict what already exists.
---
First, verify that OpenSpec specs exist:
ls $PROJECT_ROOT/openspec/specs/ 2>/dev/null | wc -l
**If 0 specs found:** > No OpenSpec specs exist yet. `search_specs` will return empty results and > `check_spec_drift` (Step 7) will flag everything as uncovered. > > Recommended: run `/openlore-generate` after this story to create a spec baseline. > You only need to do this once. > > Continuing with structural analysis only.
Skip the `search_specs` call and go to Step 4.
**If specs exist:**
Call the openlore MCP tool `search_specs` with:
{
"directory": "$PROJECT_ROOT",
"query": "$STORY_TITLE",
"limit": 5
}If relevant requirements are found, read the domain spec before writing any code. Note any constraints that apply.
---
Call the openlore MCP tool `audit_spec_coverage` with `{"directory": "$PROJECT_ROOT"}`.
From the result, check:
Run the `openlore-repair` host skill before implementing. It uses deterministic `prepare_spec_repair` evidence and the current host agent; do not silently switch to the optional paid standalone `openlore generate` pipeline.
add it to the adversarial check in Step 4b (high blast radius + no spec = risk).
If both are clean, continue to Step 4 without action.
---
Use `insertion_points` from `risk_context` if present. Otherwise:
Call the openlore MCP tool `suggest_insertion_points` with:
{
"directory": "$PROJECT_ROOT",
"description": "$STORY_TITLE",
"limit": 5
}Read the skeleton of the target file by calling the openlore MCP tool `get_function_skeleton` with:
{
"dirDeterministic, local-first memory and guardrails for AI coding agents with no LLM in the hot path.
Run a full static OpenLore analysis and summarize architecture, call graph, refactoring issues, and duplicate code. Use when…
Transform a feature idea into an annotated story using a Domain Sketch or Constrained Option Tree. Use when asked to brainstorm,…
Debug with OpenLore structural context, an explicit root-cause hypothesis, and RED/GREEN verification. Use when a bug, failure,…
Apply a confirmed .openlore/refactor-plan.md with a test gate after each change. Use when asked to execute or continue an…
Author a new OpenSpec domain specification from deterministic OpenLore MCP evidence. Use when asked to reverse-engineer,…
Retrieve relevant functions, callers, spec sections, and insertion points from OpenLore before reading source files. Use when…