agentleFS
philippe-desplatsphilippe-desplats/second-brain/.claude/skills/to-knowledge/SKILL.md

to-knowledge

Skill8 starsChanged 5 days agoMITView on GitHub

Distill a recurring pattern from sources/ into knowledge/. Scans the notes to find N similar occurrences (by topic, tag, or keyword), generates a pattern, playbook, guide, runbook, or decision in knowledge/{ops,tech,business}/ with the canonical Basic Memory frontmatter, and creates back-links to the distilled sources. Core of the layered second-brain philosophy: it turns recurring artifacts into reusable knowledge. Use when a subject, technique, or process recurs at least 3 times in the workspace and deserves to be codified.

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 2 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    After the last write of a run, add one line to the operations log with --skill to-knowledge, see AGENTS.md, Logging writes.

    line 15
  2. Very specific:

    Always scan before proposing: no pattern without at least 3 real sources (or the -m threshold)

    line 96
  3. Distinctive:

    Anonymize client content: no registration numbers, no internal emails, no confidential details

    line 98
  4. Very specific:

    Validate before writing: always show the draft to the user (except with -a)

    line 101
  5. Distinctive:

    If already distilled: if a file knowledge/{target}/{subtype}-{slug}.md exists, offer to update rather than duplicate </execution_rules>

    line 103

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Arguments

/to-knowledge <topic|--auto> [-t ops|tech|business] [-k pattern|playbook|guide|runbook|decision] [-m N] [-a]

Flags, input and examples are detailed below.

Questions to the owner follow AGENTS.md, Asking the owner.

After the last write of a run, add one line to the operations log with --skill to-knowledge, see AGENTS.md, Logging writes.

<objective> Distill repeated knowledge in `sources/` into reusable notes in `knowledge/`. Aim for the **3rd repetition**, the pattern documented in `.claude/rules/knowledge.md`. Without this workflow, `knowledge/` stays empty forever and the second brain never performs its distillation role.

Out of scope: creating content outside the workspace, scraping external sources, or inventing unsourced content. </objective>

<quick_start>

/to-knowledge accessibility-audit                     # distill the accessibility-audit pattern
/to-knowledge accessibility-audit -t ops -k playbook  # force the domain and the subtype
/to-knowledge --auto                                  # scan all of sources/, propose distillation candidates
/to-knowledge api-retry-pattern -t tech               # distill a technical retry pattern
/to-knowledge pricing-website -t business -k guide
/to-knowledge accessibility-audit -m 5                # require at least 5 occurrences (default: 3)
/to-knowledge -a accessibility-audit                  # auto, no intermediate confirmations

</quick_start>

<flags>
FlagLongDescription
-t--targetTarget subfolder in knowledge/, values: ops, tech, business. Auto-deduced if absent
-k--kindDeliverable subtype, values: pattern, playbook, guide, runbook, decision. Auto-deduced if absent
-m--minMinimum occurrence threshold to distill (default: 3)
-a--unattendedSkip confirmations, generate and publish directly, the note stays unread until /mark-read
--auto (mode)no valueScan all of sources/ to propose distillation candidates (discovery mode)
</flags><workflow> 1. **Init** -> Parse topic, flags, deduce target/kind if not provided 2. **Scan** -> Find the occurrences (frontmatter topics:, wiki-links, keywords), group by client/project 3. **Draft** -> Pre-fill the knowledge template with the extracted patterns, cite the sources 4. **Publish** -> User validation, save into knowledge/{target}/, create the back-links </workflow>

<step_files>

StepFilePurpose
00steps/step-00-init.mdParse args, deduce target/kind, validate threshold
01steps/step-01-scan.mdScan sources/ for occurrences, group, score
02steps/step-02-draft.mdPre-fill the template with Basic Memory frontmatter + distilled body
03steps/step-03-publish.mdValidate, save, create back-links to sources

</step_files>

<state_variables>

VariableTypeSet by
{topic}stringstep-00
{mode}enum (topic|auto)step-00
{target}enum (ops|tech|business)step-00 (or step-01 auto-deduce)
{kind}enum (pattern|playbook|guide|runbook|decision)step-00 (or step-01 auto-deduce)
{min_occurrences}numberstep-00 (default 3)
{auto_mode}booleanstep-00
{sources_found}liststep-01 (paths + excerpts)
{occurrence_count}numberstep-01
{draft_path}stringstep-02
{draft_content}stringstep-02
{published_path}stringstep-03

</state_variables>

<references>
ReferenceUsed by
references/knowledge-template.mdstep-02 (subtype-specific template)
.claude/rules/knowledge.mdstep-00, step-02 (conventions)
basic-memory/schemas/note.mdstep-02 (frontmatter validation)
</references>

<execution_rules>

  • Always scan before proposing: no pattern without at least 3 real sources (or the -m threshold)
  • Cite every source in the produced pattern via distilled_from [[Source]] wiki-links
  • Anonymize client content: no registration numbers, no internal emails, no confidential details
  • Strict frontmatter: type: note + subtype: (no dedicated BM schemas)
  • Naming convention: knowledge/{target}/{short-subtype}-{slug}.md
  • Validate before writing: always show the draft to the user (except with -a)
  • If fewer than N occurrences: refuse to distill, suggest trying again later
  • If already distilled: if a file knowledge/{target}/{subtype}-{slug}.md exists, offer to update rather than duplicate </execution_rules>

<entry_point> FIRST ACTION: Load steps/step-00-init.md </entry_point>

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.