create-agents-md
Create AGENTS.md - Code Style Guide Injection
Detect project languages, select matching style guides, and inject them into the host project's AGENTS.md.
Arguments
$ARGUMENTS
--remove: Remove the injected code style section fromAGENTS.mdand exit.- Default (no args): Detect languages and inject/update style guides.
Step 1: Handle --remove
If $ARGUMENTS contains --remove:
- Select a target file:
- Use
AGENTS.mdif it exists. - Otherwise, use
AGENTS.MDif it exists. - Otherwise, report
No AGENTS.md/AGENTS.MD foundand stop.
- Use
- Read the selected target file.
- Find marker pair:
<!-- create-agents-md:code-styleguides:start -->and<!-- create-agents-md:code-styleguides:end -->
- If markers are found, remove everything between and including the markers, plus surrounding blank lines.
- Write the updated file.
- Report:
Removed code style guides from {target file}. - Stop.
If no markers are found, report No code style guides found in {target file} and stop.
Step 2: Detect Project Languages
Scan the project root for configuration files to determine which languages are used. Collect all matches because a project can use multiple languages.
| 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 |
Cargo.toml |
Rust | rust.md |
Package.swift |
Swift | swift.md |
CMakeLists.txt or *.cpp/*.cc/*.cxx in src/ |
C++ | cpp.md |
*.csproj or *.sln |
C# | csharp.md |
*.html in root or src/, or *.css/*.scss in root or src/ |
HTML/CSS | html-css.md |
Use fast glob checks and run checks in parallel where possible.
TypeScript refinement:
- If
package.jsonand anytsconfig*.jsonare present, include both JavaScript and TypeScript. - If
package.jsonexists without TypeScript config, include only JavaScript.
If no languages are detected, ask the user which languages to include:
Question: No language config files detected. Which languages does this project use?
Header: Select Languages
Options:
- JavaScript (Google JavaScript Style Guide)
- TypeScript (Google TypeScript Style Guide)
- Python (Google Python Style Guide)
- Go (Effective Go)
- Rust (Rust Style Guide)
- Swift (Swift API Design Guidelines)
- C++ (Google C++ Style Guide)
- C# (Google C# Style Guide)
- HTML/CSS (Google HTML/CSS Style Guide)
Multi-select: yes
Step 3: Confirm With User
Present detected languages and ask for confirmation before writing:
Yes, inject: add general principles plus the detected language guides.Customize: let the user choose the language list.Cancel: stop without changing files.
Suggested prompt:
Question: Detected languages: {list}. Inject these style guides into AGENTS.md?
Header: Confirm Style Guides
Options:
- Yes, inject (Add style guides for detected languages + general principles)
- Customize (Choose languages manually)
- Cancel (Do not modify AGENTS.md)
Multi-select: no
On Customize, run the language picker from Step 2.
On Cancel, stop without modifying files.
Step 4: Assemble Style Guide Section
Build the injection content in this order:
- Opening marker:
<!-- create-agents-md:code-styleguides:start --> - Section header:
## Code Style Guidelines - Note:
<!-- Auto-generated by /create-agents-md. Do not edit manually. Re-run to update. --> - Attribution:
> Source: [conductor style guides](https://github.com/gemini-cli-extensions/conductor/tree/main/templates/code_styleguides) - Append
references/general.md - Append each selected language guide from
references/*.md - Closing marker:
<!-- create-agents-md:code-styleguides:end -->
Guide location:
- Primary:
skills/create-agents-md/references/(when running from repo root) - Fallback: resolve relative to this skill's directory (
references/adjacent to thisSKILL.md)
Step 5: Inject Into AGENTS.md
Target file selection:
- Use
AGENTS.mdif it exists. - Otherwise, use
AGENTS.MDif it exists. - Otherwise, create
AGENTS.md.
Injection behavior:
- If the marker pair exists, replace that full marked block with the new assembled content.
- If markers are missing, append the assembled content to the end of the file with a blank line separator.
If creating a new file, initialize with:
# AGENTS
{assembled style guide content}
Step 6: Ensure CLAUDE.md Exists
After updating AGENTS.md/AGENTS.MD:
- Check whether
CLAUDE.mdexists in the project root. - If
CLAUDE.mdexists, leave it unchanged. - If
CLAUDE.mddoes not exist, create it with:
@AGENTS.md
Step 7: Report
Output:
## Style Guides Injected
**Languages**: {list}
**File**: {AGENTS.md or AGENTS.MD}
**Guides included**:
- General Code Style Principles
- {Language 1} Style Guide
- {Language 2} Style Guide
- ...
To update: `/create-agents-md`
To remove: `/create-agents-md --remove`