Monorepo
Skill ralfstrobel/agentic-brownfield-coding/claude-plugins/abc-init/skills/monorepo
Claude Code scaffolding and first steps for complex brownfield projects
npx -y skills add ralfstrobel/agentic-brownfield-coding --skill monorepoAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 23 stars23 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Create an initial Claude Code setup for a brownfield project with monorepo topology (including hybrid submodular configurations).
SKILL.md
15.9 KB, as published. Nobody here has run it
Claude Code Monorepo Scaffolding
Your goal is to create an initial setup for Claude Code in a large pre-existing monorepo project, including agent instructions and context information. You work in close collaboration with the user to obtain the required base knowledge about the goals and structure of the project as well as each sub-project.
Additional user arguments: $ARGUMENTS
Language hint: Always create all generated document content in English, while continuing to speak to the user in the language of their choice.
Platform hint: Instructions and templates assume a Linux host with GNU coreutils. Adapt to the detected user OS.
- macOS — Substitute BSD equivalents for GNU-only utilities.
- Windows — Still use
.shfiles (skip irrelevantchmod +x), assuming Git Bash is available at runtime. Highlight this requirement in the Debriefing. Set"shell": "bash"on command hooks insettings.json. Omit the entiresandboxblock fromsettings.jsonas long as bash sandboxing is unsupported.
Agent Content Principles
When generating content for .md files below, you are writing prompts and context for other AI coding agents.
Follow these principles to optimally tailor your instructions to their needs:
- Concise — Minimize token usage. Prefer keywords and terse bullet points over prose.
- Structured — Use compact Markdown to delineate connected aspects.
- Actionable — Generate concrete operational directives, not abstract guidelines. Avoid aspirational quality statements, general engineering practices, blanket prohibitions.
- Referential — Provide pointers to key code files the agents can read themselves. Do not describe how code works in agent instructions as such duplication leads to drift.
- Scoped — Context is hierarchical. The central CLAUDE.md applies to every scope and must only contain core project identity and semantics. Sub-project CLAUDE.md, rules and agent instructions progressively disclose domain- and task-specific knowledge.
- Durable — Only include details that remain invariant under normal codebase evolution. Avoid specific technology versions. Reference namespaces or search terms instead of single artifacts.
Workflow
- Begin execution by creating a formal task list for progress tracking using the
TaskCreatetool. Create a task for each of the following phases (##) and sub-phases (###). Do not duplicate the contents in the description, only reference this skill (abc-init:monorepo) and the workflow item. - Create a dependency chain between all tasks using
TaskUpdate, settingaddBlockedByto the predecessor task. - Work through the
TaskListusingTaskUpdateto mark tasks as in_progress and completed as you go.
Phase 1: Reconnaissance
- Use
Exploreagents to scan the repository and build an initial understanding of its structure- Top-level directory content that hints at used technologies (e.g.
package.json,composer.json,Cargo.toml,go.mod,Makefile,Dockerfile) - Existing documentation (e.g.
README.md,CONTRIBUTING.mdordocs/) - Style (e.g. imperative mood) and common patterns (e.g. ticket numbers) in commit messages from the
git log.
- Top-level directory content that hints at used technologies (e.g.
- Read any discovered documentation and technology manifest files
- Check for an existing
CLAUDE.mdor.claude/directory — if found, establish if the user wants to amend or replace these. - Summarize your findings and conclusions briefly for the user and ask if they want to comment or add information.
Phase 2: User Interview
Interview the user to establish the project's base details and sub-project boundaries.
Use AskUserQuestion where appropriate to keep the conversation structured.
Offer pre-defined choice options if likely answers to a question are already known from context. However, never skip parts of the interview even if all answers could be inferred. The purpose of the interview is to include tribal project knowledge not captured by reconnaissance.
General Question Catalogue
- What is the name of the project?
- Who is the project creator and/or maintainer (company/organization)?
- What is the overall purpose of the project (one-sentence summary)?
- What is the production scale of the project (data size, number of users)?
- What is the general technological approach of the project (one-sentence summary)?
- What are key concepts or vocabulary that every developer needs to learn on their first day (independent of sub-project)?
- What sub-projects or applications exist in this monorepo?
Sub-Project Question Catalogue
Go through every sub-project established in general question 6 and repeat these questions for each of them.
- What is the name of the sub-project or the development team (e.g. "backend" / "frontend")? (If the name is more than one word, also establish a short slug to use in generated files.)
- What are the main purposes / functions of the sub-project?
- What are key terms or vocabulary that every developer in this sub-project needs to know?
- What are the main technologies used (programming language, framework, deployment...)?
- Does this sub-project live under a dedicated root directory?
- If yes: what is the path to that directory relative to the project root?
- If no: what file/path glob pattern uniquely identifies its source files? (e.g.
src/Payments/**/*.ts) This is typically<namespace-path>/**/*.<language-extension>.
- What are the key source directories?
- How are automated tests organized and run?
- Are there tools for linting or other automated code quality control?
Phase 3: Generate Artifacts
3a — Claude Code Settings
- Copy the settings template to
<project-dir>/.claude/settings.json - Copy the statusline template to
<project-dir>/.claude/statusline.shand make it executable (chmod +x). - Duplicate the permissions with the
{{SUB-PROJECT-PATH}}placeholder for each sub-project. - Inject
{{GITIGNORE-EXCLUSIONS}}into the sandbox config, limiting write access to version-controlled files only. - Replace general
{{PLACEHOLDERS}}with answers from the general user interview questions.
3b — Central CLAUDE.md
- Copy the template to
<project-dir>/CLAUDE.md - Replace the
{{PLACEHOLDERS}}with answers from the general user interview questions.
The content is written for AI, not humans. There is no need for verbose introductions or explanations. Keep this file as brief as possible to preserve tokens. Prefer keywords and enumeration over continuous text. Use clear section headers and other Markdown formatting to demark connected aspects.
3c — Local Override Files
- Copy the template to
<project-dir>/CLAUDE.local.md.example - If a
.gitignorefile exists in the project root, add the following entries (if not already present):/CLAUDE.local.md /.claude/settings.local.json /.claude/plans/
3d — Sub-Project Explorer Agents
Perform these steps for every established sub-project:
- Copy the template to
<project-dir>/.claude/agents/<sub-project-slug>-explorer.md - Replace the
{{PLACEHOLDERS}}with acquired context for the respective sub-project. Add available{{MCP-SEARCH-TOOLS}}for read-only exploration. Omit the nativeGlobandGreptools if suitable MCP replacements are present. - Use a general purpose
Exploreagent to perform a more thorough exploration of the sub-project's code and add additional context information and instructions that are helpful to navigate the code structure as well as common conventions and nomenclature.
After creation of all explorer agents, modify .claude/settings.json:
- Add
"Agent(Explore)"to thepermissions.denyarray (create it if it does not exist).
3e — Sub-Project Context Rules
Perform these steps for every established sub-project. The approach differs depending on whether the sub-project has a dedicated root directory (interview question 5). If any of the steps seem inapplicable to the given sub-project, skip them and note this during the summary.
Case A: Sub-project with a dedicated root directory
- Copy the template to
<sub-project-path>/CLAUDE.md - Replace the
{{PLACEHOLDERS}}with acquired context for the respective sub-project. - For placeholders that do not have corresponding answers, ask the user whether they want to provide an answer, generate an answer from code exploration or omit the section.
- Create a
.claude/rules/directory inside the sub-project root. - For each programming language used in the sub-project, create a code style rule
from the template at
<sub-project-path>/.claude/rules/<language>-code-style.md- The
pathsglob in the template uses**/*.<ext>— this is relative to the sub-project directory and is correct as-is. - Replace the
{{PLACEHOLDERS}}according to the aspects of the programming language. - Populate the style rules from linting tool configuration if discovered in Phase 1, or from conventions observed during code exploration.
- The
- For each testing framework used in the sub-project, create a testing rule
from the template
at
<sub-project-path>/.claude/rules/testing.md- Determine a glob pattern matching only existing test files (e.g.
**/*.test.ts,**/*Test.php,**/test_*.py,**/*_test.go). - Derive common convention from test files discovered in Phase 1 or the interview answers about test organization.
- Populate with concrete test conventions (file placement, naming, assertion style, setup patterns) discovered in Phase 1 or the interview answers about test organization.
- Determine a glob pattern matching only existing test files (e.g.
Case B: Sub-project without a dedicated root directory
Use this approach when sub-project files are spread across shared directories and are identified only by a path glob pattern.
All rules go under the project root .claude/rules/<sub-project-slug>/ so their paths globs can reference the full path from root.
- Copy the template to
<project-root>/.claude/rules/<sub-project-slug>/<sub-project-slug>-development.md - Set the
pathsfrontmatter to the glob pattern established in interview question 5. - Replace the
{{PLACEHOLDERS}}with acquired context for the respective sub-project. - For placeholders that do not have corresponding answers, ask the user whether they want to provide an answer, generate an answer from code exploration or omit the section.
- For each programming language used in the sub-project, create a code style rule
from the template at
<project-root>/.claude/rules/<sub-project-slug>/<language>-code-style.md- Set the
pathsglob to the same pattern as in step 2 (or a narrowed variant, e.g. excluding test directories). - Replace the
{{PLACEHOLDERS}}according to the aspects of the programming language. - Populate the style rules from linting tool configuration or observed conventions.
- Set the
- For each testing framework used in the sub-project, create a testing rule
from the template at
<project-root>/.claude/rules/<sub-project-slug>/testing.md- Set the
pathsglob to match only test files within the sub-project pattern. - Populate with concrete test conventions discovered in Phase 1 or interview answers.
- Set the
3f — Quality Gate Hooks
The following hooks are project-wide (not per sub-project) and pre-registered in the settings template.
They depend on bash 4+, jq, and tac — check that these are on PATH and report any missing one in the debriefing.
If a sub-project's quality tooling is unclear or not yet set up, leave its cases out or place illustrative comments only. The project owner can extend the hooks later.
Post-Edit hook
- Copy the template to
<project-dir>/.claude/hooks/post-edit.shandchmod +x. - Replace
{{FILE-TYPE-CASES}}with dispatching logic using the linting/formatting tools from all sub-projects' Q8. If handling of same file types differs between sub-projects, distinguish by path prefix before dispatching.
Stop hook
- Copy the template to
<project-dir>/.claude/hooks/stop.shandchmod +x. - Replace the placeholders using all sub-projects' test frameworks (Q7) and conventions from Phase 1. Only split the mapping further by sub-project if two sub-projects share technology but use different testing methods.
- Tailor the
append_test_coverage_reminderstrings to encompass all sub-projects' review/testing cultures; optionally add further conditionalappend_remindercalls for (sub-)project-specific code change concerns.
Phase 4: Debriefing & Disclaimers
- Present a summary table of everything created (file path, artifact type, purpose).
- Explain that this was a long agentic workflow and that agents can be prone to skipping steps. So the user should carefully test everything that was created and compare it against this skill document.
- Explain that this is an initial scaffold, not a turnkey setup. Specifically:
- Settings: The settings are intentionally restrictive and disable potentially confusing and expensive functions. The user should review and re-endable these if explicitly desired by the project.
- Sandboxing: The sandbox settings are untested. Call
/sandboxto review. Runclaude doctoron startup issues. If the user is executing Claude Code in an isolated environment such as a container, sandboxing may not be required. - Status Line: The
statusline.shscript runs automatically every time Claude Code renders a prompt. Due to this fact it should be treated as particularly sensitive and protected from unwanted modification. - Explorer Agents: The generated agents contain only minimal structural knowledge. Developers should refine known directories and output format until they reliably return useful context.
- Quality Gate Hooks: The generated commands and test-file discovery logic may be incorrect. Trigger both hooks via a few manual edits and a full agent turn (modifying source and test files) in each sub-project, and verify that linter feedback, executed tests, and coverage reminders all work as intended. If a hook was left as a stub for some sub-projects, implement their project-specific dispatching logic.
- Silent Git Staging: The post-edit hook runs
git addautomatically without confirmation on any file created via theWritetool. This ensures new files are tracked by git but also includes them in the next commit. Ensure this behavior is acceptable for your intended workflow before operating the hook. - Rules: The generated rules contain minimal conventions. Developers should expand them with the implicit conventions of this project over time.
- Promote the
/abc-init:bashlessskill, which can replace theBashtool with structured MCP tools to prevent the agent from being attracted to unstructured shell access. - Promote the
/abc:buildworkflow example command, by explaining that agent context files alone are not a guarantee for reliable agent behavior and are unsuitable as enforceable constraints. They should be paired with concrete workflow protocol commands with explicit steps and deterministic hooks that enforce quality gates automatically. - Promote the
/abc:learnworkflow command, that can be used to generate additional agent context rules to manifest implicit tribal knowledge.