/code-knowledge:docs-folderfrom code-knowledge
A standard layout for the docs/ directory of a code base, where a file's path tells you its role (spec, decision record, how-to, work item) and its authority (whether it can be built on without re-verifying against the code). Use when creating, moving, or organizing documentation, when deciding where a new document belongs, when judging whether an existing doc is trustworthy, when creating, picking up, resuming, or archiving a work item under docs/wip/, or when asked to set up, initialize, or scaffold docs/ in a new or existing project.
Ships in code-knowledge. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Always use the standard layout for docs/ below, so that a file's role and authority can be inferred from its path in the file tree.
Most of docs/ describes the present state of the world and may be built on without re-verification. Three directories promise nothing:
wip/ -- work in flight.archive/ -- work that has landed. It described the code accurately when the work finished; it may have drifted since.resources/ -- material fetched from elsewhere, and material generated by AI or by scripts.Everything else is reference material. Human and agent both take pains to keep it current: drift between docs and code is a bug and gets corrected, stale files are removed, and 'less is more' thinking is applied to avoid churn. A reference file that has stopped being true is wrong. Delete it; git keeps the copy. Before deleting, promote whatever outlives it -- the reason a thing went away is usually a decision record. Decision records themselves are the exception to the delete rule: one records a decision at a point in time, so a superseded record stays put (see /decision-records skill).
The split is also a writing rule. In reference material, state observed fact only -- what has been verified against the code. Inside wip/, hypotheses and assumptions are welcome, but frame them as such ('probably', 'assuming X', 'unverified'): a future reader cannot tell a guess from an observation unless the words carry the uncertainty. It follows that promotion out of wip/ requires re-verification against the code, unless the human explicitly waives it.
Finished work is the only thing archived so far, and archive/completed/ is its bucket; another kind of archived material would get a sibling directory. A reference file is current or it is gone, so it never moves into archive/.
Reference .md files carry two frontmatter fields:
---
name: Issue deletion
description: What deleting an issue does and doesn't remove
---
They tell a reader what the file is about without opening it, and they make INDEX.md files generatable instead of hand-maintained (see /context-wikis:index-md skill). Deliberately absent: type (the path already encodes a file's role) and dates (git records them).
docs/./ # repository root
README.md # entrypoint for humans. Short sections: what, (why), how to get started. Always reference docs/ files instead of duplicating content.
CONTRIBUTING.md # how to get started contributing. brief!
CHANGELOG.md # all notable changes to the project (see /changelog-md skill)
docs/
INDEX.md # optional. directory listing; can be generated (see /context-wikis:index-md skill)
glossary.md # project-specific jargon must be defined here.
architecture.md # high-level architecture of the project (see /architecture-md skill)
philosophy.md # optional. design principles and high-level goals -- one-line claims, each linking to an explainer (e.g. in explanation/)
... # reference files, e.g. api.md. Succinctly describes the machinery. Should be austere. Reference material is consulted, not 'read'.
explanation/ # optional. Diataxis concept. focus: user understanding.
<slug>.md # e.g. why-x-does-it-this-way.md
how-tos/ # optional. Diataxis concept. focus: user goal.
<slug>.md # e.g. how-to-setup-mcp-server.md
specs/ # optional. specs describe capabilities.
<slug>.md # e.g. issue-deletion.md
decisions/ # optional. decision records (see /decision-records skill)
<NNNN>-<slug>.md # e.g. 0001-no-soft-deletions.md
resources/ # optional. no authority promise
... # fetched material, e.g. pydantic-llms.txt from https://pydantic.dev/llms.txt
generated/ # generated by AI or by scripts -- may contain mistakes
<slug>.md # e.g. db-schema.md
wip/ # work in flight, e.g. plans, investigations. holds live items only. no authority promise
<slug>/ # e.g. fix-bad-exception-handling/. every file within is optional:
slices/ # optional. split large work items into 'slices' (sub-items, same files)
<slug>/
INDEX.md # only needed in case of non-obvious files
plan.md # goal + approach in one file, for simple work items only
goal.md # problem context, desired outcome, success criteria -- the why and the what
approach.md # the how: assumptions, decisions, verification
status.md # recommended: few sentences on where the work stands (see 'Revisiting an item')
requirements.md # only when acceptance criteria outgrow goal.md, or when no specs are in use
research.md # what the agent learns from web searches. Record source and date per finding; note how authoritative and current the source is
gotchas.md # sharp edges encountered while working
specs/ # if the work affects reference specs in docs/specs/
# Note: load /code-knowledge:incremental-specs skill when working with specs.
<spec-name>.delta.md # 'delta' because only *difference* w.r.t. spec is described.
decisions/ # draft decision records, unnumbered until promoted
<slug>.md
resources/ # material fetched while doing this work
...
backlog.md # optional. a good place to log ideas for future improvements
archive/ # no authority promise. created on demand
completed/
<iso-date>-<work-slug>/ # e.g. 2026-03-20-fix-bad-exception-handling/ (prepend date to the live work slug)
The files listed under <slug>/ are suggestions; a work item may contain any files. A work item has either plan.md or goal/approach/status, never both. Default to goal/approach/status; plan.md is for a simple item that can likely be completed in a single short session. If such an item grows beyond that, split plan.md into goal/approach/status and delete it. Use whatever section structure seems appropriate, unless the human has instructed you to use a particular template.
A work item is live or it is archived, and its location says which:
wip/<slug>/ -- being worked on. Blocked, paused, and waiting-on-someone all count as live; record the reason in status.md.archive/completed/<iso-date>-<slug>/ -- the work landed. The item describes code that exists, though it may have drifted since.Two states, no more. Extra directories for finer status turn the file tree into a state machine somebody has to maintain, and status.md already covers the nuance.
There is no bucket for abandoned work. When an item is dropped or superseded, promote whatever outlives it -- "we decided not to do X because Y" is a decision record, and a sharp edge someone will hit again belongs in reference docs -- then delete the directory. Git keeps the copy. Everything under archive/ therefore describes code that was actually written, and a reader never has to ask.
Live items sit directly in wip/, so ls docs/wip/ is the list of what is in flight and a search under wip/ returns live material only.
A work item drafts decision records in wip/<slug>/decisions/<slug>.md. Drafts are unnumbered: the number is assigned on promotion to docs/decisions/<NNNN>-<slug>.md, so two concurrent work items can never claim the same one. A draft that reverses an existing decision is an ordinary draft naming the record it supersedes -- decision records are never edited in place, so they have no delta form the way specs do.
wip/<slug>/resources/ holds material fetched while doing the work. Most of it dies with the item; promote a file to docs/resources/ only when it outlives the work, the same test applied to decisions and spec deltas. Promote with git mv so nothing ends up duplicated.
Read status.md first when returning to an item. Keep it short and easy to read -- a few sentences on where the work stands -- and update it before leaving the item. On every revisit, answer three questions:
When nothing is outstanding and any reference-doc changes have been applied, archive the item instead of leaving it in wip/.
To set the layout up in a repository, greenfield or brownfield, follow
references/adopting.md. It ships a scaffold
script under scripts/ for the baseline files.
Each project in a monorepo gets its own docs/, following this layout. The top-level docs/ brings together cross-cutting information only, e.g. system architecture spanning projects, org-wide decision records. If it applies to a single project, it belongs in that project's docs/.
explanation/ and how-tos/ borrow its vocabulary of documentation modes.What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub a3lem/knowledge-powerups --plugin code-knowledge5 skills in this plugin
/architecture-mdGuidance for writing docs/architecture.md, the high-level architecture overview of a code base. Use when creating an architecture overview, updating one after a large refactor, or deciding what belongs in it versus elsewhere in docs/./changelog-mdGuidance for maintaining CHANGELOG.md following the Keep a Changelog convention. Use when recording a notable change, cutting a release, marking a yanked release, or creating a changelog for a project that lacks one./decision-recordsGuidance for writing decision records under docs/decisions/ -- when a decision is worth recording, how they are numbered, and the minimal format. Use when recording a decision, adding or superseding a decision record, or judging whether a decision warrants one./incremental-specsLoad this skill when creating, using, or managing specs for spec-driven development, or when encountering spec files, .delta.md files, statement codes like [2b342], or "spec:" reference comments in a repo.