Help us improve
Share bugs, ideas, or general feedback.
From dogma
Interactively sets up Prettier and linting tools: checks NVM/Node version, detects project file types via git, suggests plugins for JS/TS/Vue/PHP/Astro/etc., configures .prettierrc.
npx claudepluginhub marcel-bich/marcel-bich-claude-marketplace --plugin dogmaHow this command is triggered — by the user, by Claude, or both
Slash command
/dogma:setuplint/Files this command reads when invoked
This command is limited to the following tools:
The summary Claude sees in its command listing — used to decide when to auto-load this command
# Claude-Dogma: Lint/Prettier Setup You are executing the `/dogma:lint:setup` command. Your task is to **interactively set up Prettier and related linting tools** for the current project. ## Step 1: NVM/Node Check ### 1.1 Check if nvm is installed **If nvm is NOT installed:** Detect OS and shell: Ask the user: If yes, provide OS-specific instructions: - **macOS/Linux (bash/zsh):** - **Fish shell:** - **Windows:** Recommend nvm-windows from https://github.com/coreybutler/nvm-windows ### 1.2 Check Node.js version **If Node.js version < 20:** ### 1.3 Create .nvmrc If nv...
/setup-formattingConfigures code formatting tools for JavaScript/TypeScript and Python projects: installs Prettier/Black/Isort, creates configs like .prettierrc/pyproject.toml, adds npm scripts, sets up Husky pre-commit hooks.
/repo-toolingConfigures linting (ESLint/Ruff), formatting (Prettier), git hooks (Husky/pre-commit), and GitHub Actions CI/CD based on detected project language (TypeScript/Next.js or Python).
/formatFormats code files using Prettier with auto-detection of types and configs. Supports globs, directories, --check mode, custom config/ignore paths. Reports changes and errors.
/metaswarm-setupGuides you through setting up metaswarm in your project — detects your tech stack and customizes configuration automatically.
/auditAudits tech stack and sets up one dev tooling bundle per run (formatting, linting, types, tests, observability, git hooks, database), installing/validating/remediating monorepo-aware.
/setup-code-qualityDetects project type and tools (JS/TS, Python, Go, Rust, PHP, Java), installs missing linting/typechecking dependencies if needed, generates /fix command for checks and fixes.
Share bugs, ideas, or general feedback.
You are executing the /dogma:lint:setup command. Your task is to interactively set up Prettier and related linting tools for the current project.
nvm -v 2>/dev/null
If nvm is NOT installed:
Detect OS and shell:
# OS detection
OSTYPE="$OSTYPE"
uname -s
# Shell detection
echo "$SHELL"
Ask the user:
nvm is not installed. It helps manage Node.js versions.
Would you like installation instructions?
1. Yes, show me how to install nvm
2. No, I already have Node.js managed differently
If yes, provide OS-specific instructions:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
# Use fisher: fisher install jorgebucaran/nvm.fish
node -v 2>/dev/null
If Node.js version < 20:
Node.js version is $(node -v), but v20+ is recommended for modern tooling.
Would you like to upgrade?
1. Yes, run: nvm install 20 && nvm use 20
2. No, keep current version
If nvm is available and no .nvmrc exists:
echo "v20" > .nvmrc
Report:
Created .nvmrc with v20
Run 'nvm use' to switch to this version.
# Find all source file extensions
# Respects .gitignore AND .git/info/exclude
git ls-files --cached --others --exclude-standard 2>/dev/null \
| sed 's/.*\.//' | sort | uniq -c | sort -rn | head -20
| Extension | Plugin | Notes |
|---|---|---|
.php | @prettier/plugin-php | Requires phpVersion config |
.vue | (built-in) | No extra plugin needed |
.twig | @shopify/prettier-plugin-liquid | Uses liquid-html parser |
.astro | prettier-plugin-astro | For Astro projects |
.ts/.tsx/.js/.jsx | (built-in) | No extra plugin needed |
.json/.yaml/.yml | (built-in) | No extra plugin needed |
.md | (built-in) | No extra plugin needed |
.scss/.css | (built-in) | No extra plugin needed |
# Check for existing Prettier config
ls -la .prettierrc* prettier.config.* 2>/dev/null
# Check package.json for prettier config
grep -l '"prettier"' package.json 2>/dev/null
# Check for .editorconfig
ls -la .editorconfig 2>/dev/null
# Check for existing package.json
ls -la package.json 2>/dev/null
Project Analysis Complete
File types detected:
- TypeScript/JavaScript: 42 files
- PHP: 15 files
- Vue: 8 files
- SCSS: 12 files
Existing configuration:
- package.json: [Found/Missing]
- .prettierrc: [Found/Missing]
- .editorconfig: [Found/Missing]
Recommended plugins:
- @prettier/plugin-php (for .php files)
If no package.json exists:
No package.json found.
Would you like to create one?
1. Yes, create minimal package.json
2. No, skip (Prettier setup requires package.json)
If yes, create with this base structure:
{
"scripts": {
"format": "prettier --write .",
"format:check": "prettier --check ."
},
"devDependencies": {
"@prettier/plugin-php": "^0.22.2",
"@shopify/prettier-plugin-liquid": "^1.4.1",
"prettier": "^3.2.5"
}
}
Then run:
npm install
Note: Adapt devDependencies based on detected file types (Step 2). Remove plugins for languages not used in the project.
Build list of packages to install:
prettier (always required)npm install --save-dev prettier @prettier/plugin-php @shopify/prettier-plugin-liquid
Report each installation:
Installing prettier@3.2.5... OK
Installing @prettier/plugin-php@0.22.2... OK
Use this template for .editorconfig:
# this is the global editor configuration which should always be chosen to set group/team-wide configuration for the IDE
root = true
# global config (maybe get's overridden below)
[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
max_line_length = 120
tab_width = 4
trim_trailing_whitespace = true
ij_formatter_off_tag = @formatter:off
ij_formatter_on_tag = @formatter:on
# Markdown
[{*.markdown,*.md}]
trim_trailing_whitespace = false
Ask user:
Create .editorconfig for consistent editor settings?
Preview:
- charset: utf-8
- indent: 4 spaces
- line ending: LF
- max line length: 120
1. Yes, create with these settings
2. No, skip
3. Customize settings first
Use this as base template (full-stack with PHP/Twig support):
{
"arrowParens": "always",
"printWidth": 120,
"semi": false,
"singleQuote": true,
"trailingComma": "es5",
"htmlWhitespaceSensitivity": "ignore",
"vueIndentScriptAndStyle": true,
"singleAttributePerLine": true,
"plugins": [
"@prettier/plugin-php",
"@shopify/prettier-plugin-liquid"
],
"phpVersion": "8.2",
"overrides": [
{
"files": [
"*.js"
],
"options": {
"parser": "babel"
}
},
{
"files": [
"*.html"
],
"options": {
"parser": "html"
}
},
{
"files": "*.php",
"options": {
"parser": "php"
}
},
{
"files": [
"*.vue"
],
"options": {
"parser": "vue"
}
},
{
"files": [
"*.scss"
],
"options": {
"parser": "scss"
}
},
{
"files": [
"*.twig"
],
"options": {
"parser": "liquid-html"
}
},
{
"files": [
"*.json"
],
"options": {
"parser": "json"
}
},
{
"files": [
"*.graphql"
],
"options": {
"parser": "graphql"
}
}
]
}
Adapt to detected file types:
Build config based on detected file types:
Ask user:
Create .prettierrc?
Settings:
- printWidth: 120
- semi: false
- singleQuote: true
- trailingComma: es5
- Plugins: [list detected plugins]
1. Yes, create
2. No, skip
3. Customize settings
Use this template for .prettierignore:
# Prettier is automatically considering .gitignore paths by manually running `npm run prettier-path`,
# see also $npm_package_config_prettier in package.json.
#
# In this ignore file there are explicit prettier ignores to prevent prettier on save hook and in all other circumstances
# IDE
.vscode/*
.git/*
.svn/*
.hg/*
.husky/*
.idea/*
.run/*
**/.git
**/.svn
**/.hg
# generated/artifacts
node_modules/*
vendor/*
dist/*
build
coverage
# resources
material/*
# other
deploy.php
package-lock.json
.prettierrc
**/*.svg
**/*.lock
**/*.sql
**/*.map
**/*.legacy
**/*.meta
**/*.log
**/*.example
Ask user:
Create .prettierignore?
Will ignore:
- node_modules, vendor, dist, build
- .git, .idea, .vscode
- Lock files, binary files
- [any additional project-specific paths]
1. Yes, create
2. No, skip
3. Customize paths
Read current package.json and add scripts:
{
"scripts": {
"format": "prettier --write .",
"format:check": "prettier --check .",
"format:staged": "prettier --write $(git diff --cached --name-only --diff-filter=ACMR | grep -E '\\.(js|ts|jsx|tsx|json|md|css|scss|vue|php)$' | xargs)"
}
}
Ask user:
Add Prettier scripts to package.json?
Scripts to add:
- format: Format all files
- format:check: Check formatting without changes
- format:staged: Format only staged files
1. Yes, add scripts
2. No, skip
Which IDE do you use?
1. PhpStorm/WebStorm/IntelliJ
2. VS Code
3. Other/None
Create .idea/prettier.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="PrettierConfiguration">
<option name="myConfigurationMode" value="AUTOMATIC" />
<option name="myRunOnSave" value="true" />
<option name="myRunOnReformat" value="true" />
</component>
</project>
Report:
Created .idea/prettier.xml
Prettier will run on save and on reformat (Ctrl+Alt+L / Cmd+Alt+L)
Create or update .vscode/settings.json:
{
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[javascript]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
"[typescript]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
"[json]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
"[vue]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
"[php]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }
}
Report:
Updated .vscode/settings.json
Install the 'Prettier - Code formatter' extension if not already installed.
If user selects "Other":
Would you like me to search for Prettier integration instructions for your IDE?
Enter your IDE name, or skip:
1. Search for [IDE name]
2. Skip IDE configuration
If searching, use WebSearch to find instructions.
Lint/Prettier Setup Complete
Created:
+ .nvmrc (v20)
+ .editorconfig
+ .prettierrc
+ .prettierignore
+ .vscode/settings.json (or .idea/prettier.xml)
Installed:
+ prettier@3.2.5
+ @prettier/plugin-php@0.22.2
+ @shopify/prettier-plugin-liquid@1.4.1
Scripts added:
+ npm run format
+ npm run format:check
+ npm run format:staged
Next steps:
1. Run 'npm run format' to format all files
2. Review changes with 'git diff'
3. Consider enabling /dogma:lint stop hook (ENV: CLAUDE_MB_DOGMA_LINT_ON_STOP=true)
This section contains detailed instructions for manual reference. Use these when users need more context or troubleshooting help.
https://prettier.io/docs/en/why-prettier
Der bei weitem wichtigste Grund fuer die Einfuehrung von Prettier ist das Beenden der staendigen Debatten ueber Coding Styles. Es ist allgemein anerkannt, dass ein gemeinsamer Styleguide fuer ein Projekt und ein Team wertvoll ist, aber der Weg dorthin ist ein sehr schmerzhafter und wenig lohnender Prozess. Die Leute werden sehr emotional, wenn es um bestimmte Arten, Code zu schreiben, geht, und niemand verbringt gerne Zeit mit dem Schreiben und dem Empfang von Kritikpunkten.
npm install --save-dev prettier @prettier/plugin-php @shopify/prettier-plugin-liquid prettier-plugin-multiline-arrays
Plugins explained:
prettier - Core formatter@prettier/plugin-php - PHP support@shopify/prettier-plugin-liquid - Twig support (uses liquid-html parser)prettier-plugin-multiline-arrays - Multiline array support in TS, JS, JSON (not PHP yet)PHP multiline array workaround:
$foo = [
"bar" //
]
File | Settings | Languages & Frameworks | JavaScript | Prettier
node_modules/prettier in project**/*.{js,jsx,ts,tsx,html,twig,php,vue,css,scss,sass,less,json,yaml,yml,md,markdown,mdx,cjs,cts,mjs,mts,vue,astro}
File | Settings | Editor | Code Style
Scheme: Default (not Project!)
**/*.{svg,lock,sql,map,legacy,meta,log,example};/*/**/var/**/*File | Settings | Version Control | Commit
Enable only after entire project is formatted with Prettier.
Ctrl+Shift+L - Reformat with PrettierCtrl+Shift+Alt+P - Prettier action@Annotation, Import, Use supportIf sections should NOT be formatted by Prettier, use prettier-ignore: https://prettier.io/docs/en/ignore.html#javascript
// prettier-ignore
const uglyCode = {foo: "bar", baz: "qux"};
npm -v # Must output a version
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash
Add to ~/.bashrc if not present:
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
Restart terminal and verify:
nvm -v && node -v && npm -v
nvm list # Show installed versions
nvm install stable # Install stable version
nvm install 20 # Install specific version
nvm use stable # Activate version
nvm use 20 # Activate specific version
Use Fisher plugin:
fisher install jorgebucaran/nvm.fish
Download from: https://github.com/coreybutler/nvm-windows/releases (Assets > nvm-setup.exe)
Install and let it set PATH.
nvm version # Show nvm version
nvm install 20 # Install Node 20
nvm use 20 # Activate Node 20
Same as Ubuntu/Linux, or use Homebrew:
brew install nvm
Add to shell config (~/.zshrc or ~/.bash_profile):
export NVM_DIR="$HOME/.nvm"
[ -s "/opt/homebrew/opt/nvm/nvm.sh" ] && \. "/opt/homebrew/opt/nvm/nvm.sh"
[ -s "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" ] && \. "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm"