docs-workflow-code-analysis
Skill4 starsChanged 4 months agoApache-2.0View on GitHub
Run code-learner analysis on a source repository for the docs orchestrator workflow. Dispatches a subagent to run learn-code, keeping the heavy orchestration out of the main context. Produces ONBOARDING.md, module registry, per-module summaries, and cross-module relationship data.
In this repository53 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- action-commentsSkill
- article-extractorSkill
- docs-convert-gdoc-mdSkill
- docs-orchestratorSkill
- docs-review-content-qualitySkill
- docs-review-modular-docsSkill
- docs-review-securitySkill
- docs-review-styleSkill
- docs-review-technicalSkill
- docs-ticket-readinessSkill
- docs-workflow-create-jiraSkill
- docs-workflow-create-merge-requestSkill
- docs-workflow-jira-readySkill
- docs-workflow-pipeline-diagnosticsSkill
- docs-workflow-planningSkill
- docs-workflow-pr-analysisSkill
- docs-workflow-quality-gateSkill
- docs-workflow-requirementsSkill
- docs-workflow-scope-req-auditSkill
- docs-workflow-security-reviewSkill
- docs-workflow-startSkill
- docs-workflow-style-reviewSkill
- docs-workflow-tech-reviewSkill
- docs-workflow-writingSkill
- git-pr-readerSkill
- ibm-sg-audience-and-mediumSkill
- ibm-sg-language-and-grammarSkill
- ibm-sg-legal-informationSkill
- ibm-sg-numbers-and-measurementSkill
- ibm-sg-punctuationSkill
- ibm-sg-referencesSkill
- ibm-sg-structure-and-formatSkill
- ibm-sg-technical-elementsSkill
- jira-readerSkill
- jira-writerSkill
- learn-codeSkill
- lint-with-valeSkill
- mdita-writeSkill
- query-codeSkill
- redhat-docs-tocSkill
- rh-ssg-accessibilitySkill
- rh-ssg-formattingSkill
- rh-ssg-grammar-and-languageSkill
- rh-ssg-gui-and-linksSkill
- rh-ssg-legal-and-supportSkill
- rh-ssg-release-notesSkill
- rh-ssg-structureSkill
- rh-ssg-technical-examplesSkill
- rn-known-issuesSkill
- understand-pull-requestSkill
- validate-plugin-prereqsSkill
The file
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 3 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 24
Verify --repo directory exists and is a git repository
- Very specific: line 25
Verify --output-dir parent exists.
- Distinctive: line 29
Check if learn-code output already exists.
- Very specific: line 54
If an ONBOARDING.md is found at either location, the analysis was already completed.
- Distinctive: line 81
After the agent completes, locate the learn-code output.
- Very specific: line 106
If ONBOARDING.md is not found at either location after the agent completes, mark the step as failed and report the error.
- Distinctive: line 110
Do not hand-author the sidecar — a hand-written sidecar drifts from the schema (e.g.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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.
Files
docs-workflow-code-analysis
Orchestrator step skill that wraps learn-code to analyze a source repository and produce structured code understanding for downstream documentation steps.
Arguments
| Flag | Required | Description |
--repo | Yes | Path to the cloned source repository |
--ticket | Yes | JIRA ticket ID |
--output-dir | Yes | Base output directory (.agent_workspace/<ticket>/code-analysis/) |
Execution
1. Validate inputs
- Verify
--repodirectory exists and is a git repository - Verify
--output-dirparent exists; create output directory if needed
2. Check for cached analysis
Check if learn-code output already exists. Learn-code may store results in two locations depending on the subagent's working directory:
- Inside the repo:
${REPO}/.agent_workspace/*/synthesis/ONBOARDING.md - At the docs repo level:
${GIT_ROOT}/.agent_workspace/${REPO_NAME}/synthesis/ONBOARDING.md(whereGIT_ROOTis the documentation repo root andREPO_NAMEisbasename "${REPO}")
Check both locations:
REPO_NAME="$(basename "$REPO")"
# Derive the docs-repo root from OUTPUT_DIR
# (<docs-root>/.agent_workspace/<ticket>/code-analysis) by stripping from
# `.agent_workspace` onward. Do NOT use `git rev-parse`, which returns
# whichever repo the cwd is inside and points at the wrong root if the agent
# drifted into the source repo.
GIT_ROOT="${OUTPUT_DIR%%/.agent_workspace/*}"
# Check inside the cloned repo first
LEARN_CODE_ONBOARDING="$(ls "${REPO}/.agent_workspace/"*/synthesis/ONBOARDING.md 2>/dev/null | head -1)"
# Fall back to docs-repo-level .agent_workspace/<repo-name>/
if [[ -z "$LEARN_CODE_ONBOARDING" ]]; then
LEARN_CODE_ONBOARDING="$(ls "${GIT_ROOT}/.agent_workspace/${REPO_NAME}/synthesis/ONBOARDING.md" 2>/dev/null)"
fiIf an ONBOARDING.md is found at either location, the analysis was already completed. Locate the corresponding base directory (the parent of synthesis/) and copy the onboarding guide to --output-dir. All other analysis files stay at the cached location — downstream agents read them from there directly.
# Find the learn-code base directory containing the cached analysis
LEARN_CODE_BASE="$(dirname "$(dirname "$LEARN_CODE_ONBOARDING")")"
cp "${LEARN_CODE_BASE}/synthesis/ONBOARDING.md" "${OUTPUT_DIR}/"Skip to step 4.
3. Dispatch learn-code subagent
You MUST use the Agent tool to run learn-code in an isolated subagent. Do NOT invoke Skill: learn-code inline — that would load 850+ lines of skill text plus all intermediate orchestration into the main context.
Agent:
description: "Run learn-code analysis on <REPO>"
prompt: |
Run the learn-code skill to analyze the source repository.
Skill: learn-code, args: "<REPO>"
After learn-code completes, report the location of the output files
(ONBOARDING.md, registry.json, detection.json, summaries/, relationships/).After the agent completes, locate the learn-code output. Check both possible locations (same as step 2):
REPO_NAME="$(basename "$REPO")"
# Derive the docs-repo root from OUTPUT_DIR
# (<docs-root>/.agent_workspace/<ticket>/code-analysis) by stripping from
# `.agent_workspace` onward. Do NOT use `git rev-parse`, which returns
# whichever repo the cwd is inside and points at the wrong root if the agent
# drifted into the source repo.
GIT_ROOT="${OUTPUT_DIR%%/.agent_workspace/*}"
# Check inside the cloned repo first
LEARN_CODE_ONBOARDING="$(ls "${REPO}/.agent_workspace/"*/synthesis/ONBOARDING.md 2>/dev/null | head -1)"
# Fall back to docs-repo-level .agent_workspace/<repo-name>/
if [[ -z "$LEARN_CODE_ONBOARDING" ]]; then
LEARN_CODE_ONBOARDING="$(ls "${GIT_ROOT}/.agent_workspace/${REPO_NAME}/synthesis/ONBOARDING.md" 2>/dev/null)"
fi
# Copy analysis output to the step's output directory
LEARN_CODE_BASE="$(dirname "$(dirname "$LEARN_CODE_ONBOARDING")")"
cp "${LEARN_CODE_BASE}/synthesis/ONBOARDING.md" "${OUTPUT_DIR}/"If ONBOARDING.md is not found at either location after the agent completes, mark the step as failed and report the error.
4. Write step-result.json
Do not hand-author the sidecar — a hand-written sidecar drifts from the schema (e.g. string counts where the schema requires integers) and uses an orchestrator-delayed timestamp instead of a real wall-clock one. Run the script:
python3 ${CLAUDE_SKILL_DIR}/scripts/write_step_result.py \
--ticket "<TICKET>" \
--repo "$REPO" \
--analysis-path "$LEARN_CODE_BASE" \
--sidecar "${OUTPUT_DIR}/step-result.json"The script reads the analysis files at LEARN_CODE_BASE (not OUTPUT_DIR — the analysis files are
not copied there) to derive the metrics deterministically:
- module_count: length of the
module-registry/registry.jsonarray. - relationship_count: count of
.jsonfiles inrelationships/. - languages_detected: keys of
language_countsindetection/detection.json, falling back toprimary_language.
It writes the conformant step-result.json with a real wall-clock completed_at. If the script
exits non-zero, fix the arguments and re-run; do not substitute a stub.
5. Report completion
Print summary:
Code analysis complete:
- Modules: <N>
- Relationships: <N>
- Languages: <list>
- Output: <output-dir>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
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.

