ReinaMacCredy

styleguide

Detect project languages and inject code style guides into CLAUDE.md. Provides consistent coding conventions for all Claude Code interactions.

ReinaMacCredy 184 20 Updated 3mo ago

Resources

1
GitHub

Install

npx skillscat add reinamaccredy/maestro/styleguide

Install via the SkillsCat registry.

SKILL.md

Styleguide — Code Style Guide Injection

Detect project languages, select matching style guides, and inject them into the host project's CLAUDE.md.

Arguments

$ARGUMENTS

  • --remove: Remove the injected code style section from CLAUDE.md and exit.
  • Default (no args): Detect languages and inject/update style guides.

Step 1: Handle --remove

If $ARGUMENTS contains --remove:

  1. Read the project's CLAUDE.md
  2. Find the markers <!-- maestro:code-styleguides:start --> and <!-- maestro:code-styleguides:end -->
  3. If found, remove everything between and including the markers (plus any surrounding blank lines)
  4. Write the updated file
  5. Report: "Removed code style guides from CLAUDE.md"
  6. Stop.

If markers not found, report: "No code style guides found in CLAUDE.md" and stop.

Step 2: Detect Project Languages

Scan the project root for configuration files to determine which languages are used. Collect ALL matches — a project can use multiple languages.

Detection rules (check all, collect matches):

Config File Language Guide File
package.json JavaScript javascript.md
tsconfig.json OR tsconfig*.json TypeScript typescript.md
pyproject.toml OR setup.py OR requirements.txt OR Pipfile Python python.md
go.mod Go go.md
CMakeLists.txt OR *.cpp/*.cc/*.cxx in src/ C++ cpp.md
*.csproj OR *.sln C# csharp.md
pubspec.yaml Dart dart.md
*.html in root or src/ OR *.css/*.scss in root or src/ HTML/CSS html-css.md

Use Glob to check for each config file. Run these checks in parallel where possible:

Glob(pattern: "package.json")
Glob(pattern: "tsconfig*.json")
Glob(pattern: "pyproject.toml")
Glob(pattern: "setup.py")
Glob(pattern: "requirements.txt")
Glob(pattern: "Pipfile")
Glob(pattern: "go.mod")
Glob(pattern: "CMakeLists.txt")
Glob(pattern: "*.csproj")
Glob(pattern: "*.sln")
Glob(pattern: "pubspec.yaml")

TypeScript refinement: If package.json is found, also check for tsconfig.json. If both exist, include both JavaScript AND TypeScript guides. If only package.json exists (no tsconfig), include only JavaScript.

If no languages detected: Ask the user which languages to include:

AskUserQuestion(
  questions: [{
    question: "No language config files detected. Which languages does this project use?",
    header: "Select Languages",
    options: [
      { label: "JavaScript", description: "Google JavaScript Style Guide" },
      { label: "TypeScript", description: "Google TypeScript Style Guide" },
      { label: "Python", description: "Google Python Style Guide" },
      { label: "Go", description: "Effective Go" },
      { label: "C++", description: "Google C++ Style Guide" },
      { label: "C#", description: "Google C# Style Guide" },
      { label: "Dart", description: "Effective Dart" },
      { label: "HTML/CSS", description: "Google HTML/CSS Style Guide" }
    ],
    multiSelect: true
  }]
)

Step 3: Confirm with User

Present the detected languages and ask for confirmation:

AskUserQuestion(
  questions: [{
    question: "Detected languages: {list}. Inject these style guides into CLAUDE.md?",
    header: "Confirm Style Guides",
    options: [
      { label: "Yes, inject", description: "Add style guides for detected languages + general principles" },
      { label: "Customize", description: "Let me choose which languages to include" },
      { label: "Cancel", description: "Do not modify CLAUDE.md" }
    ],
    multiSelect: false
  }]
)

On "Customize": Show the multi-select language picker from Step 2's fallback.
On "Cancel": Stop without modifying anything.

Step 4: Assemble Style Guide Section

Build the injection content:

  1. Start with the opening marker: <!-- maestro:code-styleguides:start -->
  2. Add a section header: ## Code Style Guidelines
  3. Add a note: <!-- Auto-generated by Maestro /styleguide. Do not edit manually. Re-run /styleguide to update. -->
  4. Add attribution: > Source: [conductor style guides](https://github.com/gemini-cli-extensions/conductor/tree/main/templates/code_styleguides)
  5. Read and append general.md from the Maestro plugin's styleguides library
  6. For each detected language, read and append the corresponding guide file
  7. End with the closing marker: <!-- maestro:code-styleguides:end -->

Locating the guide files: The guide templates live in this skill's references/ directory (.claude/skills/styleguide/references/). To find them:

# Try project path first (if Maestro is the current project)
ls .claude/skills/styleguide/references/ 2>/dev/null

# Fall back to global plugin path
find ~/.claude/plugins/marketplaces -path "*/maestro/.claude/skills/styleguide/references" -type d 2>/dev/null

Try the project path first, then fall back to the global plugin path.

Assembled content example:

<!-- maestro:code-styleguides:start -->
## Code Style Guidelines

<!-- Auto-generated by Maestro /styleguide. Do not edit manually. Re-run /styleguide to update. -->

> Source: [conductor style guides](https://github.com/gemini-cli-extensions/conductor/tree/main/templates/code_styleguides)

{content of general.md}

{content of typescript.md}

{content of python.md}
<!-- maestro:code-styleguides:end -->

Step 5: Inject into CLAUDE.md

If CLAUDE.md exists in the project root:

  1. Read the file
  2. Check if markers already exist (<!-- maestro:code-styleguides:start --> and <!-- maestro:code-styleguides:end -->)
    • If markers found: Replace everything between and including the markers with the new assembled content
    • If no markers: Append the assembled content at the end of the file, preceded by a blank line
  3. Write the updated file

If CLAUDE.md does not exist:

  1. Create CLAUDE.md with a minimal header and the assembled content:
    # Project
    
    {assembled style guide content}

Step 6: Report

Output a summary:

## Style Guides Injected

**Languages**: {list of languages}
**File**: CLAUDE.md
**Guides included**:
- General Code Style Principles
- {Language 1} Style Guide
- {Language 2} Style Guide
- ...

To update: `/styleguide`
To remove: `/styleguide --remove`