用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/Objective-Arts/lens-dist --skill style命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
正在显示 SKILL.md
| name | style |
| description | Google Coding Standards - universal style principles |
| allowed-tools | [] |
Google's style guides share a core belief: Code is read more than written. Optimize for the reader. Every formatting and naming decision should minimize cognitive load on the next person reading the code.
"Avoid clever tricks. Prefer simple, direct code that anyone can understand."
Readability trumps brevity. If a reviewer has to pause and think about what a line does, it's too clever.
Names should fully describe what something is or does. Avoid abbreviations unless universally understood.
Not this:
const d = new Date();
const ymdStr = d.toISOString().split('T')[0];
function proc(u) { return u.n + ' ' + u.e; }
This:
const currentDate = new Date();
const dateString = currentDate.toISOString().split('T')[0];
function formatUserDisplay(user) { return user.name + ' ' + user.email; }
Naming conventions:
userCount, fetchUserData)is, has, should, can (isActive, hasPermission)MAX_RETRY_COUNT)UserAccount, HttpClient)Each function should do one thing. If you need "and" to describe it, split it.
Not this:
function processUserAndSendEmail(user) {
validateUser(user);
enrichUserData(user);
saveToDatabase(user);
sendWelcomeEmail(user);
logAnalytics(user);
}
This:
function registerNewUser(user) {
const validUser = validateUser(user);
const enrichedUser = enrichUserData(validUser);
return saveToDatabase(enrichedUser);
}
function onUserRegistered(user) {
sendWelcomeEmail(user);
logAnalytics(user);
}
Guidelines:
Code should be self-documenting. Comments explain intent, not mechanics.
Not this:
// Increment counter by 1
counter++;
// Loop through users
for (const user of users) {
// Check if user is active
if (user.isActive) {
// Add to result
result.push(user);
}
}
This:
counter++;
const activeUsers = users.filter(user => user.isActive);
// Retry limit set to 3 based on network latency analysis from Q3 2024
// See: go/retry-analysis-doc
const MAX_RETRIES = 3;
When to comment:
Never comment:
Use automated formatters. Don't argue about style.
Rules:
Braces:
// Opening brace on same line (K&R style)
if (condition) {
doSomething();
} else {
doOther();
}
// Exception: chained methods may break before dots
fetch(url)
.then(response => response.json())
.then(data => process(data));
Don't swallow errors. Don't use exceptions for control flow.
Not this:
try {
return JSON.parse(data);
} catch (e) {
return null; // Silent failure
}
// Exception for control flow
try {
return findUser(id);
} catch (NotFoundError) {
return createUser(id);
}
This:
function parseJsonSafe(data: string): Result<unknown, ParseError> {
try {
return { ok: true, value: JSON.parse(data) };
} catch (error) {
return { ok: false, error: new ParseError(error.message) };
}
}
const existingUser = findUser(id);
if (!existingUser) {
return createUser(id);
}
return existingUser;
Order (with blank lines between groups):
Rules:
// Standard library
import * as fs from 'fs';
import * as path from 'path';
// Third-party
import { Router } from 'express';
import { z } from 'zod';
// Internal
import { UserService } from './services/user.js';
import { formatDate } from './utils/dates.js';
File structure:
Within a file:
// 1. Imports
// 2. Constants and types
// 3. Main class/function
// 4. Helper functions (private)
// 5. Exports (if not inline)
TODOs must include who, why, and ideally a tracking reference.
Not this:
// TODO: fix this later
// TODO: optimize
This:
// TODO(username): Extract to shared utility after feature freeze
// TODO(b/12345): Remove workaround when upstream bug is fixed
Before committing, ask:
Apply these checks:
Use a different skill when:
java (defensive design patterns)typescript, python-patterns, etc.)optimization (measurement-first optimization)algorithms (literate programming)Google Style is the universal formatting/clarity skill—use it alongside language-specific skills for consistent, readable code.
"Code is read more than written. Optimize for the reader, not the writer." — Google Engineering