build
Mini spec-first development workflow for well-scoped implementation tasks with human in the loop.
Codify implicit codebase knowledge as agent rules.
> /plugin marketplace add ralfstrobel/agentic-brownfield-codingHow it fires
How this command gets triggered: by you, by Claude, or both.
/learnContext preview
What this command does when you run it.
Codify implicit codebase knowledge as agent rules.
description: Codify implicit codebase knowledge as agent rules.
argument-hint: "[ explicit fact | conversation aspect ] into [ rule file or directory (optional) ]"
disable-model-invocation: true
metadata:
hint: >
This command is best executed mid-conversation to capture missing implicit knowledge contextually.
Use "/rewind" to restore the previous conversation state after completion to keep your agent context window clean.Create or update agent rule files to capture implicit knowledge about the code base.
Consider the following arguments given by the user: $ARGUMENTS
Determine the goal of this learning session based on the given user input:
**A — Conversation learning (no arguments, or arguments refine focus only):** Reflect on the prior conversation or development session with the user:
**B — Explicit fact (arguments contain a concrete statement to codify):** The user has stated a fact directly in: $ARGUMENTS
If neither source yields clear content, ask the user what to capture before continuing.
Rules always live in `.claude/rules` directories.
Respect user preferences for the **target directory** that were explicitly specified via context or arguments. Otherwise, default to the global `<project-dir>/.claude/rules` directory.
1. Use an appropriate **explorer subagent** or dedicated search tools to search the **target directory** for existing content related to the new knowledge. 2. If relevant rule files already exist, choose the best fitting as the selected **target file(s)** and skip to 2d.
Skip this step if all knowledge to manifest already has appropriate target files.
1. List the subdirectories of the **target directory** and choose one if it fits semantically. 2. Choose the **target file** name using descriptive kebab-case (e.g., `api-error-handling.md`, `test-conventions.md`).
Rules apply to files matching the `paths` glob declared in their YAML frontmatter. Each path is relative to the parent directory of the `.claude` directory that contains the `rules/` folder. Note: You *must* include the paths frontmatter, as otherwise the rule applies globally!
Single matching path:
--- paths: "src/**/*.php" ---
Multiple matching paths:
---
paths:
- "src/**/*.{ts,tsx}
- "lib/**/*.ts"
---Present the chosen target file path and a brief content outline to the user for confirmation before writing.
The goal is to reduce friction for the next agent working in this codebase. For each content aspect candidate, ask: does it answer one of these two questions?
1. **Navigation shortcut** — "Which files should I have read first to understand this faster?" → Point to those files and describe why/when they matter. Don't describe what's in them. Also applies when the knowledge *is* in code/docs but hard to find or easy to misread:
2. **Tribal knowledge** — "What did I need to know that no amount of reading the code could reveal?" → State that fact. Common types:
If an item answers neither question, discard it — the code already conveys it.
**Important:** The codebase MUST always remain the source of truth for implementation details. Do not list specific class members, only refer to entire files or classes by name if essential.
**Note:** Improving embedded code documentation is a valid alternative to writing agent rules.
You are writing instructions for other AI coding agents. Follow these principles to optimally tailor your instructions to their needs:
No verbose introductions or concept explanations.
Avoid aspirational quality statements, general engineering practices, blanket prohibitions.
Prefer references to namespaces or search terms over single artifacts where possible.
Section headers followed by terse bullet points:
# {{Component Name and/or Topic}}
- {{ statement }}
- {{ statement }}When updating an existing file, do not simply append content at the end but combine new context into the existing structure efficiently.
This Claude Code plugin repo assists complex software projects in their first steps towards agentic coding: Scaffolding and gradually augmenting an existing codebase with an efficient harness setup.
Mini spec-first development workflow for well-scoped implementation tasks with human in the loop.