Automates the generation of project documentation files from code state.
Install
mkdir -p .claude/skills/doc-socialgouv && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/13183" && unzip -o skill.zip -d .claude/skills/doc-socialgouv && rm skill.zipInstalls to .claude/skills/doc-socialgouv
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Régénère la documentation utilisateur (`docs/*.md`) à partir de l'état courant du code. Usage : /doc (sur la branche courante) ou /doc <issue#> (sur la branche linkée à un epic / ticket).Key capabilities
- →Regenerate user documentation (`docs/*.md`) from current code state
- →Delegate documentation tasks to the `doc-writer` agent
- →Operate on the current branch for local commits
- →Operate on a ticket/epic branch for automatic commit and push
- →Compare HEAD against `origin/alpha` for changes
- →Handle dirty working trees by refusing to proceed
How it works
The skill regenerates user documentation by delegating to a `doc-writer` agent, which calculates code diffs, rewrites affected documentation files, and then commits changes locally or pushes them automatically based on the invocation mode.
Inputs & outputs
When to use doc
- →Update docs from code
- →Generate architecture docs
- →Document feature updates
About this skill
/doc
Régénération de la documentation utilisateur du repo. Le skill délègue à l'agent doc-writer qui réécrit docs/features.md, docs/architecture.md, et docs/parcours-utilisateurs.md à partir de l'état courant du code.
Le skill est l'entrée humaine ; l'entrée orchestrée (en fin d'epic) passe par scripts/orchestration/run_doc_writer.sh invoqué directement depuis epic_loop.sh.
| Mode d'invocation | Comportement |
|---|---|
/doc sans argument | Tourne sur la branche courante. Compare HEAD vs origin/alpha. Commit local seulement — l'humain pousse lui-même. |
/doc <issue#> | Tourne sur la branche d'un ticket / epic. Si <issue#> est un epic, opère sur origin/epic/<N>. Sinon opère sur la branche linkée à l'issue (sidebar Development). Commit + push automatique. |
Step 0 — Pré-conditions
Refuser si :
- Le working tree est dirty (
git status --porcelainnon-vide) → demander à l'humain de commit/stash d'abord - La branche courante est
alphaoumasterdirectement → la doc est régénérée sur les branches feature, pas sur la branche stable
if [ -n "$(git status --porcelain)" ]; then
echo "Working tree dirty — commit ou stash d'abord."
exit 1
fi
CURRENT=$(git branch --show-current)
if [ "$CURRENT" = "alpha" ] || [ "$CURRENT" = "master" ]; then
echo "Refus : /doc ne tourne pas directement sur $CURRENT. Crée une branche dédiée."
exit 1
fi
Step 1 — Résoudre la branche cible
Sans argument
Branche cible = branche courante. Base de comparaison = origin/alpha.
git fetch origin alpha --quiet
TARGET_BRANCH=$(git branch --show-current)
BASE_BRANCH=alpha
EPIC_N=null
PUSH_AUTO=false # commit local, l'humain push lui-même
Avec un argument <issue#>
ISSUE_N="${ARGUMENTS%% *}"; ISSUE_N="${ISSUE_N#\#}"
ISSUE_TYPE=$(gh issue view "$ISSUE_N" --json issueType --jq '.issueType.name')
if [ "$ISSUE_TYPE" = "Feature" ]; then
# Epic → tourne sur la branche d'intégration
TARGET_BRANCH="epic/$ISSUE_N"
BASE_BRANCH=alpha
EPIC_N="$ISSUE_N"
else
# Task / Bug → trouver la branche linkée à l'issue
TARGET_BRANCH=$(gh api graphql -f query='
query($owner:String!, $repo:String!, $n:Int!) {
repository(owner:$owner, name:$repo) {
issue(number:$n) {
linkedBranches(first:5) { nodes { ref { name } } }
}
}
}' -f owner=SocialGouv -f repo=egapro -F n=$ISSUE_N \
--jq '.data.repository.issue.linkedBranches.nodes[0].ref.name // empty')
if [ -z "$TARGET_BRANCH" ]; then
echo "Aucune branche linkée à l'issue #$ISSUE_N."
exit 1
fi
# Base = parent epic si l'issue est sub-issue d'un epic, sinon alpha
PARENT=$(gh api graphql -f query='...parent...' --jq '.parent.number // empty')
if [ -n "$PARENT" ]; then
BASE_BRANCH="epic/$PARENT"
else
BASE_BRANCH=alpha
fi
EPIC_N="${PARENT:-null}"
fi
PUSH_AUTO=true
git fetch origin "$TARGET_BRANCH" "$BASE_BRANCH" --quiet
git checkout "$TARGET_BRANCH"
git pull --ff-only origin "$TARGET_BRANCH"
Step 2 — Invoquer l'agent doc-writer
Inputs à passer à l'agent (via le prompt de subagent) :
epic:$EPIC_N(ounull)branch:$TARGET_BRANCHbase_branch:$BASE_BRANCHmode:pipelinesiPUSH_AUTO=true,skillsinonworktree:.(skill = repo courant ; pas de worktree dédié)
L'agent suit .claude/agents/doc-writer/AGENT.md :
- Calcule le diff
<base>...HEAD - Heuristique no-op : si rien de fonctionnel n'a changé → retour
no_changes - Sinon : régénère from scratch les fichiers
docs/*.mdimpactés - Commit
- Push si
mode=pipeline, sinon laisse le commit local
L'agent retourne un JSON strict (4 cas possibles, voir AGENT.md).
Step 3 — Parser le JSON retourné
.status | Action | Markdown affiché |
|---|---|---|
updated | (mode skill) signaler le commit local non poussé ; (mode pipeline) signaler le push | ## Doc: UPDATED + liste des fichiers + sha |
no_changes | aucune | ## Doc: NO_CHANGES + reason |
rate_limited | proposer de retenter dans retry_in secondes | ## Doc: RATE_LIMITED |
failed | propager l'erreur | ## Doc: FAILED + raison |
Si notes est présent dans le JSON, l'afficher tel quel à l'humain (ex : "couverture insuffisante, envisager docs/api-publique.md").
En mode skill (commit local), terminer le message par :
Le commit a été créé localement. Relis le diff (`git show HEAD`) et push avec `git push` quand tu es prêt.
Quand utiliser /doc
- Hotfix sur
alphadirect : non, refusé par Step 0. - Branche feature standalone (sans epic) :
/doc(sans arg) — utile après une grosse refacto. - Sub-task d'un epic :
/doc <ticket#>ou laisseepic_loop.shinvoquerdoc-writerautomatiquement à la fin de l'epic. Cumul possible mais redondant. - Avant d'ouvrir une PR feature manuelle :
/doc→ relit le commit doc → push avec le reste. - Régénération forcée : invoquer
/doc <epic#>après un merge important suralphapour resynchroniser le wiki dans la foulée.
Quand NE PAS utiliser /doc
- Sur
alphaoumaster→ refusé - Quand le diff vs base est uniquement du code de tests / CI / scripts d'orchestration → l'agent retournera
no_changesde toutes façons, autant ne pas le lancer - Sur une branche en cours de travail (working tree dirty) → refusé
Référence
- Agent :
.claude/agents/doc-writer/AGENT.md - Script orchestration (mode pipeline) :
scripts/orchestration/run_doc_writer.sh - Workflow GitHub Action de sync wiki :
.github/workflows/sync-docs-to-wiki.yaml - Décision architecturale : voir mémoire
project_doc_system
When not to use it
- →When operating directly on `alpha` or `master` branches
- →When the diff versus base only contains test code, CI, or orchestration scripts
Limitations
- →Refuses to run on `alpha` or `master` branches directly
- →Refuses to run with a dirty working tree
- →Does not regenerate documentation if only test code, CI, or orchestration scripts have changed
How it compares
This skill automates the regeneration of specific user documentation files based on the current code state, integrating with a `doc-writer` agent and handling different Git branch workflows, which is more structured than manual documentatio
Compared to similar skills
doc side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| doc (this skill) | 0 | 3mo | Review | Intermediate |
| ml-paper-writing | 48 | 6mo | Review | Advanced |
| docs-review | 10 | 7mo | No flags | Beginner |
| claude-md-improver | 21 | 6mo | Review | Beginner |
Try saying
Example prompts that trigger this skill in your AI assistant.
You might also like
ml-paper-writing
davila7
Write publication-ready ML/AI papers for NeurIPS, ICML, ICLR, ACL, AAAI, COLM. Use when drafting papers from research repos, structuring arguments, verifying citations, or preparing camera-ready submissions. Includes LaTeX templates, reviewer guidelines, and citation verification workflows.
docs-review
metabase
Review documentation changes for compliance with the Metabase writing style guide. Use when reviewing pull requests, files, or diffs containing documentation markdown files.
claude-md-improver
anthropics
Audit and improve CLAUDE.md files in repositories. Use when user asks to check, audit, update, improve, or fix CLAUDE.md files. Scans for all CLAUDE.md files, evaluates quality against templates, outputs quality report, then makes targeted updates. Also use when the user mentions "CLAUDE.md maintenance" or "project memory optimization".
write-docs
tldraw
Writing SDK documentation for tldraw. Use when creating new documentation articles, updating existing docs, or when documentation writing guidance is needed. Applies to docs in apps/docs/content/.
update-docs
vercel
This skill should be used when the user asks to "update documentation for my changes", "check docs for this PR", "what docs need updating", "sync docs with code", "scaffold docs for this feature", "document this feature", "review docs completeness", "add docs for this change", "what documentation is affected", "docs impact", or mentions "docs/", "docs/01-app", "docs/02-pages", "MDX", "documentation update", "API reference", ".mdx files". Provides guided workflow for updating Next.js documentation based on code changes.
wiki-architect
microsoft
Analyzes code repositories and generates hierarchical documentation structures with onboarding guides. Use when the user wants to create a wiki, generate documentation, map a codebase structure, or understand a project's architecture at a high level.