以 AI 机器人身份加入视频会议,提供语音、虚拟形象与屏幕共享四种模式。
文档
Code Formatter
试用Code formatting best practices and quick references for Python, JavaScript, JSON, Markdown, and common languages with Prettier, Black, ESLint, and other form...
它能做什么
Quick references for code formatting tools and style best practices.
技能文档
Code Formatter & Style Guide
Quick references for code formatting tools and style best practices.
🐍 Python Formatting
Black (Opinionated Formatter)
# Install
pip install black
# Format file
black file.py
# Format directory
black src/
# Check without modifying
black --check file.py
# Configuration (pyproject.toml)
[tool.black]
line-length = 88
target-version = ['py310']
isort (Import Sorting)
# Install
pip install isort
# Sort imports
isort file.py
isort src/
# Black-compatible config
[tool.isort]
profile = "black"
flake8 (Linting)
# Install
pip install flake8
# Lint
flake8 file.py
flake8 src/
# Config (setup.cfg)
[flake8]
max-line-length = 88
extend-ignore = E203, W503
ruff (Fast Linter & Formatter)
# Install
pip install ruff
# Lint
ruff check file.py
# Fix automatically
ruff check --fix file.py
# Format
ruff format file.py
💛 JavaScript/TypeScript Formatting
Prettier
# Install
npm install -D prettier
# Format
npx prettier --write file.js
npx prettier --write src/
# Check
npx prettier --check file.js
# Config (.prettierrc)
{
"semi": true,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "es5",
"printWidth": 80
}
# Ignore (.prettierignore)
node_modules/
build/
dist/
ESLint
# Install
npm install -D eslint
# Initialize
npx eslint --init
# Lint
npx eslint file.js
npx eslint src/
# Fix
npx eslint --fix file.js
# Config (.eslintrc.js)
module.exports = {
extends: ['eslint:recommended'],
parserOptions: { ecmaVersion: 2022 },
rules: {
'no-unused-vars': 'warn',
'no-console': 'warn'
}
}
Format on Save (VS Code)
// settings.json
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter"
}
}
📋 JSON Formatting
jq
# Pretty print JSON
jq '.' file.json
# Compact (one line)
jq -c '.' file.json
# Sort keys
jq -S '.' file.json
Prettier for JSON
npx prettier --write file.json
npx prettier --write *.json
Python json.tool
python3 -m json.tool file.json
python3 -m json.tool file.json --sort-keys
📝 Markdown Formatting
Prettier
npx prettier --write README.md
npx prettier --write docs/
markdownlint
# Install
npm install -D markdownlint-cli
# Lint
npx markdownlint README.md
npx markdownlint docs/
# Fix
npx markdownlint --fix README.md
Common Rules
- Line length: 80-120 chars
- ATX headers:
# HeadernotHeader ===== - Consistent list indentation (2 spaces)
- One blank line between sections
- Trailing whitespace removal
🔧 EditorConfig (Cross-Editor)
Create .editorconfig in project root:
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 2
[*.py]
indent_size = 4
[*.{json,yml,yaml}]
indent_size = 2
[*.md]
trim_trailing_whitespace = false
🚀 Quick Format Commands
| Language | Tool | Command |
|---|---|---|
| Python | black | black file.py |
| Python | ruff | ruff format file.py |
| JS/TS | Prettier | npx prettier --write file.js |
| JSON | jq | jq '.' file.json |
| Markdown | Prettier | npx prettier --write README.md |
| Shell | shfmt | shfmt -w script.sh |
| Go | gofmt | gofmt -w file.go |
| Rust | rustfmt | rustfmt file.rs |
💡 Best Practices
- Commit config files:
.prettierrc,.eslintrc,pyproject.toml,.editorconfig - Format on save: Set up your editor to auto-format
- Pre-commit hooks: Use
pre-commitorhuskyto enforce - Consistency: Pick one style and stick to it
- CI checks: Run formatters/lint in CI pipeline
Pre-commit Setup (.pre-commit-config.yaml)
repos:
- repo: https://github.com/psf/black
rev: 23.12.1
hooks:
- id: black
- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8
hooks:
- id: prettier
相关技能
在本地磁盘以分类纯 Markdown 文件保存需要长期留存的事实,与智能体内置记忆并存。
通过一次 REST API 调用,向 10 个社交平台发布视频、图片、文字与文档。
编写、调试与调优 Playwright 测试,涵盖定位器策略、追踪诊断与 CI 友好的超时配置。
诊断生产力系统反复失效的根因,给出最小干预——容量测算、瓶颈定位、可靠的本地记录。
通过托管的 OAuth GraphQL 接口查询与管理 Linear 的 issue、项目、团队、周期、标签和评论。
terrycarter1985 的更多技能
浏览全部技能为中国小学三到六年级英语书面作业打分,并给出符合年龄的鼓励式反馈。
Analyze stocks and cryptocurrencies using Yahoo Finance data. Supports portfolio management (create, add, remove assets), crypto analysis (Top 20 by market c...
Control whole-house music scenes combining Spotify playback with Airfoil speaker routing. Quick presets for morning, party, chill modes.
Generate reusable, policy-aligned customer service replies for e-commerce aftersales scenarios. Use when support staff need fast, compliant Chinese responses...
Control whole-house music scenes combining Spotify playback with Airfoil speaker routing. Quick presets for morning, party, chill modes.
Comprehensive developer cheatsheets and quick references for Git, Docker, Kubernetes, jq, curl, and common Linux commands. Use when needing quick lookups for...