This skill should be used when capturing solved problems as categorized documentation with YAML frontmatter for fast lookup. It auto-documents solutions after confirmation and builds searchable institutional knowledge.
From soleurnpx claudepluginhub jikig-ai/soleur --plugin soleurThis skill is limited to using the following tools:
assets/critical-pattern-template.mdassets/resolution-template.mdreferences/yaml-schema.mdschema.yamlPurpose: Automatically document solved problems to build searchable institutional knowledge with category-based organization (enum-validated problem types).
If $ARGUMENTS contains --headless, set HEADLESS_MODE=true. Strip --headless from $ARGUMENTS before processing remaining args. Headless mode affects Steps 2, 3, 5, 8, and auto-consolidation Step E.
This skill captures problem solutions immediately after confirmation, creating structured documentation that serves as a searchable knowledge base for future sessions.
Organization: Single-file architecture - each problem documented as one markdown file in its symptom category directory (e.g., knowledge-base/project/learnings/performance-issues/n-plus-one-briefs.md). Files use YAML frontmatter for metadata and searchability.
<critical_sequence name="documentation-capture" enforce_order="strict">
Auto-invoke after phrases:
OR manual: /doc-fix command
Non-trivial problems only:
Skip documentation for:
Extract from conversation history:
Check for session-state.md: Run git branch --show-current. If on a feat-* branch, check if knowledge-base/project/specs/feat-<name>/session-state.md exists. If it does, read it and incorporate forwarded errors from ### Errors and decisions from ### Decisions into the context below. These came from preceding pipeline phases whose context was compacted.
Required information:
Session errors (beyond the target problem):
Scan conversation history AND session-state.md (if present) for errors unrelated to the main problem investigation documented above. Only capture errors that are NOT part of the investigation attempts. Skip trivial errors immediately corrected (typos in commands, expected test failures during TDD).
Extract for each error found:
If no session errors are found, output "Session errors: none detected" (do not skip silently — the explicit acknowledgment prevents the model from accidentally dropping errors by judging the session as clean).
Environment details:
BLOCKING REQUIREMENT: If critical context is missing (module name, exact error, stage, or resolution steps):
Headless mode: Infer missing fields from session context (conversation history, session-state.md, git log). Skip any field that cannot be reasonably inferred — do not prompt. Proceed to Step 3 with whatever context is available.
Interactive mode: Ask user and WAIT for response before proceeding to Step 3:
I need a few details to document this properly:
1. Which module had this issue? [ModuleName]
2. What was the exact error message or symptom?
3. What stage were you in? (0-6 or post-implementation)
[Continue after user provides details]
</step>
<step number="3" required="false" depends_on="2">
### Step 3: Check Existing Docs
Search knowledge-base/project/learnings/ for similar issues:
# Search by error message keywords
grep -r "exact error phrase" knowledge-base/project/learnings/
# Search by symptom category
ls knowledge-base/project/learnings/[category]/
IF similar issue found:
Headless mode: Auto-select "Create new doc with cross-reference" without prompting.
Interactive mode: Present decision options:
Found similar issue: knowledge-base/project/learnings/[path]
What's next?
1. Create new doc with cross-reference (recommended)
2. Update existing doc (only if same root cause)
3. Other
Choose (1-3): _
WAIT for user response, then execute chosen action.
ELSE (no similar issue found):
Proceed directly to Step 4 (no user interaction needed). </step>
<step number="4" required="true" depends_on="2"> ### Step 4: Generate FilenameFormat: [sanitized-symptom]-[module]-[YYYYMMDD].md
Sanitization rules:
Examples:
missing-include-BriefSystem-20251110.mdparameter-not-saving-state-EmailProcessing-20251110.mdwebview-crash-on-resize-Assistant-20251110.md
</step>
CRITICAL: All docs require validated YAML frontmatter with enum validation.
<validation_gate name="yaml-schema" blocking="true">
Validate against schema:
Load schema.yaml and classify the problem against the enum values defined in yaml-schema.md. Ensure all required fields are present and match allowed values exactly.
BLOCK if validation fails:
❌ YAML validation failed
Errors:
- problem_type: must be one of schema enums, got "compilation_error"
- severity: must be one of [critical, high, medium, low], got "invalid"
- symptoms: must be array with 1-5 items, got string
Please provide corrected values.
GATE ENFORCEMENT: Do NOT proceed to Step 6 (Create Documentation) until YAML frontmatter passes all validation rules defined in schema.yaml.
Headless mode exception: If HEADLESS_MODE=true and YAML validation fails after auto-correction attempts, skip the problematic learning and continue with remaining work. Log the skipped learning for manual review.
</validation_gate> </step>
<step number="6" required="true" depends_on="5"> ### Step 6: Create DocumentationDetermine category from problem_type: Use the category mapping defined in yaml-schema.md (lines 49-61).
Create documentation file:
Determine the category from the validated YAML problem_type field and generate a filename. Then:
mkdir -p knowledge-base/project/learnings/<category>knowledge-base/project/learnings/<category>/<filename>.md using the template from resolution-template.mdReplace <category> with the mapped category and <filename> with the generated filename.
Result:
Create documentation: Populate the structure from resolution-template.md with context gathered in Step 2 and validated YAML frontmatter from Step 5. </step>
<step number="7" required="false" depends_on="6"> ### Step 7: Cross-Reference & Critical Pattern DetectionIf similar issues found in Step 3:
Update existing doc:
Append a "See also" cross-reference link to the similar document, using the new document's filename and path.
Update new doc: Already includes cross-reference from Step 6.
Update patterns if applicable:
If this represents a common pattern (3+ similar issues):
# Add to knowledge-base/project/learnings/patterns/common-solutions.md
cat >> knowledge-base/project/learnings/patterns/common-solutions.md << 'EOF'
## [Pattern Name]
**Common symptom:** [Description]
**Root cause:** [Technical explanation]
**Solution pattern:** [General approach]
**Examples:**
- [Link to doc 1]
- [Link to doc 2]
- [Link to doc 3]
EOF
Critical Pattern Detection (Optional Proactive Suggestion):
If this issue has automatic indicators suggesting it might be critical:
critical in YAMLThen in the decision menu, add a note:
💡 This might be worth adding to Required Reading (Option 2)
But NEVER auto-promote. User decides via decision menu (Option 2).
Template for critical pattern addition:
When user selects Option 3 (Add to Required Reading), use the template from critical-pattern-template.md to structure the pattern entry. Number it sequentially based on existing patterns in knowledge-base/project/learnings/patterns/critical-patterns.md.
</step>
After capturing and cross-referencing the learning, route the insight to the skill, agent, or command definition that needs it. This ensures definitions improve over time with sharp-edge gotchas that prevent repeated mistakes.
Skip this step if:
plugins/soleur/ directory does not existIdentify which skills, agents, or commands were invoked in this session by examining the conversation history.
Map detected component names to file paths:
foo -> plugins/soleur/skills/foo/SKILL.mdsoleur:engineering:review:baz -> plugins/soleur/agents/engineering/review/baz.mdsoleur:bar -> plugins/soleur/commands/bar.mdIf no components detected, skip to the decision menu.
If one component detected: propose it as the routing target.
If multiple detected: use AskUserQuestion to present a numbered list ordered by relevance to the learning content. Include an option to skip.
Headless mode: If HEADLESS_MODE=true and multiple components detected, select the component most relevant to the learning content using LLM judgment. If one component detected, use it. Do not prompt.
If the target file does not exist at the expected path, warn and skip.
Route two categories of insights to each target:
A. Solution insight (the main learning):
B. Error prevention (from session errors):
## Session Errors section. For each error with a **Prevention:** line, determine if the error could have been prevented by a skill instruction in the target definition.../ step before prescribing them in plans.").This dual-routing ensures session errors feed back into the definitions that caused them, not just the learning archive.
Headless mode: If HEADLESS_MODE=true, do not apply the edit directly. Instead, create a GitHub issue to track the proposed edit. Write the issue body to a temporary file, then create the issue:
/tmp/compound-rtd-body.md containing: the proposed edit text (as a fenced code block), the target file path, and the source learning file pathgh issue create --title "compound: route-to-definition proposal for <target-basename>" --body-file /tmp/compound-rtd-body.md --milestone "Post-MVP / Later"gh issue create fails (network error, auth failure), log the error and continue to the decision menu -- do not block the pipeline on issue creation failuresynced_to frontmatter with the bare <definition-name> (same format as interactive mode) to prevent /soleur:sync from re-proposing this pairInteractive mode: Use AskUserQuestion with options:
If accepted, write the edit to the definition file. Then update the learning file's synced_to frontmatter to prevent /soleur:sync from re-proposing this pair:
synced_to array exists in frontmatter: append the definition namesynced_to is absent: add synced_to: [definition-name]--- block with only synced_to: [definition-name]Do NOT commit -- the edits are staged for the normal workflow completion protocol. </step>
</critical_sequence>
After documentation is complete and before the decision menu, automatically consolidate and archive KB artifacts on feature branches. This replaces the former manual Option 2 in the decision menu.
Branch detection:
Run git branch --show-current to get the current branch. If it does not start with feat-, feat/, fix-, or fix/, skip consolidation entirely.
If on a feature branch (feat-*, feat/*, fix-*, or fix/*), run the following steps automatically:
Extract the slug from the current branch name by stripping the branch type prefix. Handle all prefix variants:
feat/ -- strip prefix (e.g., feat/domain-leaders becomes domain-leaders)feat- -- strip prefix (e.g., feat-domain-leaders becomes domain-leaders)fix/ -- strip prefix (e.g., fix/typo becomes typo)fix- -- strip prefix (e.g., fix-typo becomes typo)Glob for related artifacts:
Search for artifacts matching the feature slug. Replace <slug> with the actual feature slug derived from the branch name:
find knowledge-base/project/brainstorms/ -name "*<slug>*" -not -path "*/archive/*" 2>/dev/null
find knowledge-base/project/plans/ -name "*<slug>*" -not -path "*/archive/*" 2>/dev/null
test -d "knowledge-base/project/specs/feat-<slug>" && echo "knowledge-base/project/specs/feat-<slug>/"
If no artifacts found: Skip consolidation silently and proceed to the decision menu.
If artifacts found: Present the discovered list:
Found artifacts for feat-<slug>:
1. knowledge-base/project/brainstorms/2026-02-09-<slug>-brainstorm.md
2. knowledge-base/project/plans/2026-02-09-feat-<slug>-plan.md
3. knowledge-base/project/specs/feat-<slug>/
Proceed with consolidation? (Y/n/add more)
Replace <slug> with the actual feature slug throughout.
If user selects "add more," prompt for additional file paths and append to the list.
A single agent reads ALL discovered artifacts and proposes updates to:
knowledge-base/project/constitution.md -- new Always/Never/Prefer rules under the appropriate domainknowledge-base/project/components/*.md -- new component documentation entriesknowledge-base/project/README.md -- architectural insights or pattern notesThe agent produces proposals as structured markdown blocks. Each proposal specifies:
Present proposals one at a time:
Proposal 1 of N:
Target: knowledge-base/project/constitution.md
Section: Architecture > Always
Content:
- Archive completed feature artifacts after consolidation to prevent knowledge-base bloat
Accept / Skip / Edit? _
Accept: Apply the proposal immediately (see Step D).
Skip: Move to the next proposal. The skipped content is not applied.
Edit: User provides corrected text. Re-display the edited proposal for Accept/Skip.
Idempotency check: Before applying, perform a simple substring check against the target file. If similar content already exists, flag it:
Similar content found in constitution.md:
"Archive outdated learnings to knowledge-base/project/learnings/archive/"
Still apply this proposal? (Y/n)
Apply each accepted proposal immediately after approval:
Archive ALL discovered artifacts regardless of how many proposals were accepted or skipped.
Run the archival script from the repository root:
bash ./plugins/soleur/skills/archive-kb/scripts/archive-kb.sh
The script discovers artifacts matching the current branch's feature slug, creates archive directories, and moves each artifact with a timestamped prefix using git mv. It handles untracked files automatically. If the script exits non-zero, display the error and stop -- do not proceed to Step F.
Context-aware archival confirmation:
Headless mode: Auto-archive without prompting (equivalent to answering "Y").
Interactive mode:
If at least one proposal was accepted:
Overview files updated. Archive the source artifacts? (Y/n)
If all proposals were skipped:
No project updates applied. Still archive the source artifacts? (Y/n)
All changes (project edits + archival moves) go into a single commit:
git add -A knowledge-base/
git commit -m "compound: consolidate and archive feat-<slug> artifacts"
Replace <slug> with the actual feature slug.
This ensures git revert restores everything in one operation.
After commit, proceed to the decision menu.
<decision_gate name="post-documentation" wait_for_user="true">
Headless mode: If HEADLESS_MODE=true, auto-select "Continue workflow" without presenting the menu.
Interactive mode: After successful documentation, present options and WAIT for user response:
✓ Solution documented
File created:
- knowledge-base/project/learnings/[category]/[filename].md
What's next?
1. Continue workflow (recommended)
2. Add to Required Reading - Promote to critical patterns (critical-patterns.md)
3. Link related issues - Connect to similar problems
4. Add to existing skill - Add to a learning skill (e.g., hotwire-native)
5. Create new skill - Extract into new learning skill
6. View documentation - See what was captured
7. Other
Note: Consolidation and archival of KB artifacts now runs automatically before this menu on feat-* branches. See "Automatic Consolidation" section above.
Handle responses:
Option 1: Continue workflow
Option 2: Add to Required Reading ⭐ PRIMARY PATH FOR CRITICAL PATTERNS
User selects this when:
Action:
knowledge-base/project/learnings/patterns/critical-patterns.mdOption 3: Link related issues
Option 4: Add to existing skill
User selects this when the documented solution relates to an existing learning skill:
Action:
Example: For Hotwire Native Tailwind variants solution:
hotwire-native/references/resources.md under "Project-Specific Resources"hotwire-native/references/examples.md with link to solution docOption 5: Create new skill
User selects this when the solution represents the start of a new learning domain:
Action:
python3 plugins/soleur/skills/skill-creator/scripts/init_skill.py [skill-name]Option 6: View documentation
Option 7: Other
</decision_gate>
<integration_protocol>
Invoked by:
Invokes:
Handoff expectations: All context needed for documentation should be present in conversation history before invocation.
</integration_protocol>
<success_criteria>
Documentation is successful when ALL of the following are true:
</success_criteria>
Missing context:
YAML validation failure:
Similar issue ambiguity:
Module not in modules documentation:
MUST do:
mkdir -p)MUST NOT do:
Good documentation has:
Avoid:
User: "That worked! The N+1 query is fixed."
Skill activates:
Detect confirmation: "That worked!" triggers auto-invoke
Gather context:
includes(:emails) on Brief modelCheck existing: No similar issue found
Generate filename: n-plus-one-brief-generation-BriefSystem-20251110.md
Validate YAML:
module: Brief System
date: 2025-11-10
problem_type: performance_issue
component: rails_model
symptoms:
- "N+1 query when loading email threads"
- "Brief generation taking >5 seconds"
root_cause: missing_include
severity: high
tags: [n-plus-one, eager-loading, performance]
✅ Valid
Create documentation:
knowledge-base/project/learnings/performance-issues/n-plus-one-brief-generation-BriefSystem-20251110.mdCross-reference: None needed (no similar issues)
Output:
✓ Solution documented
File created:
- knowledge-base/project/learnings/performance-issues/n-plus-one-brief-generation-BriefSystem-20251110.md
What's next?
1. Continue workflow (recommended)
2. Add to Required Reading - Promote to critical patterns (critical-patterns.md)
3. Link related issues - Connect to similar problems
4. Add to existing skill - Add to a learning skill (e.g., hotwire-native)
5. Create new skill - Extract into new learning skill
6. View documentation - See what was captured
7. Other
Not in Phase 7 scope, but potential: