Token导航 LogoToken导航TokenDH.com
研究检索需要联网github未标认证来源可访问clear审计未展示

coding-philosophy编码哲学

Agent Skill

coding-philosophy 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

309

周安装

13

GitHub Stars

公开资料未说明

下载量

108
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:coding-philosophy(编码哲学)
来源仓库:https://github.com/codyswanngt/lisa
仓库路径:skills/coding-philosophy
安装命令:
npx skills add codyswanngt/lisa --skill "coding-philosophy"
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

AgentSkills.tonpx skills
npx skills add codyswanngt/lisa --skill "coding-philosophy"

简介

用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中使用。

  • 根据关键词或任务场景快速定位候选结果。
  • 通过 npx 命令添加并指定技能名称来安装。
  • 安装命令:npx skills add codyswanngt/lisa --skill "coding-philosophy"。
  • 安装前建议确认权限范围和维护状态。

SKILL.md

Coding Philosophy

Overview

This skill enforces the core coding philosophy for this project: immutability, predictable structure, functional transformations, test-driven development, clean deletion, and simplicity. All code should follow these principles to maintain consistency, testability, and clarity.

Guiding Principles: YAGNI + SOLID + DRY + KISS

Follow these software engineering principles, deferring to Occam's Razor/KISS whenever principles conflict:

KISS (Keep It Simple, Stupid) - The Tiebreaker

When principles conflict, always choose the simpler solution. Occam's Razor applies to code: the simplest solution that works is usually correct.

// KISS: Simple direct approach
const isAdmin = user.role === "admin";

// Over-engineered: Abstraction without value
const isAdmin = RoleChecker.getInstance().checkRole(user, RoleTypes.ADMIN);

YAGNI (You Ain't Gonna Need It)

Don't build features, abstractions, or flexibility you don't need right now.

// Correct: Solve today's problem
const formatDate = (date: Date) => date.toISOString().split("T")[0];

// Wrong: Building for hypothetical future needs
const formatDate = (date: Date, format?: string, locale?: string, timezone?: string) => {
  // 50 lines handling cases that may never be used
};

DRY (Don't Repeat Yourself) - With KISS Constraint

Extract duplication only when:

  1. The same logic appears 3+ times
  2. The abstraction is simpler than the duplication
  3. The extracted code has a clear single purpose
// DRY + KISS: Extract when clearly beneficial
const formatPlayerName = (first: string, last: string) => `${first} ${last}`;

// Anti-pattern: Premature abstraction for 2 usages
// Keep inline if simpler and only used twice

SOLID Principles - Applied Pragmatically

Apply SOLID when it reduces complexity, not dogmatically:

PrincipleApply WhenSkip When
Single ResponsibilityFunction does 2+ unrelated thingsSplitting adds complexity
Open/ClosedExtension points have clear use casesNo foreseeable extensions
Liskov SubstitutionUsing inheritance hierarchiesUsing composition (preferred)
Interface SegregationConsumers need different subsetsInterface is already small
Dependency InversionTesting requires mocking external servicesDirect dependency is simpler
// Good SRP: Each function has one job
const validateEmail = (email: string) => EMAIL_REGEX.test(email);
const formatEmail = (email: string) => email.toLowerCase().trim();

// Over-applied SRP: Don't split a simple 3-line function into 3 files

Decision Framework

When unsure, ask in order:

  1. Do I need this now? (YAGNI) → If no, don't build it
  2. Is there a simpler way? (KISS) → Choose the simpler option
  3. Am I repeating myself 3+ times? (DRY) → Extract if the abstraction is simpler
  4. Does this function do one thing? (SOLID-SRP) → Split only if clearer

Core Principles

1. Immutability First

Never mutate data. Always create new references.

// Correct - spread creates new object
const updated = { ...user, name: "New Name" };

// Incorrect - mutation
user.name = "New Name";

2. Function Structure Ordering

All functions, hooks, and components follow a strict ordering:

1. Variable definitions and derived state (const, useState, useMemo, useCallback)
2. Side effects (useEffect, function calls with no return value)
3. Return statement

3. Functional Transformations

Use map, filter, reduce instead of imperative loops and mutations.

// Correct - functional transformation
const names = users.map(u => u.name);

// Incorrect - imperative mutation
const names = [];
users.forEach(u => names.push(u.name));

4. Test-Driven Development (TDD)

Always write failing tests before implementation code. This is mandatory, not optional.

TDD Cycle:
1. RED: Write a failing test that defines expected behavior
2. GREEN: Write the minimum code to make the test pass
3. REFACTOR: Clean up while keeping tests green
// Step 1: Write the failing test FIRST
describe("formatPlayerName", () => {
  it("should format first and last name", () => {
    expect(formatPlayerName("John", "Doe")).toBe("John Doe");
  });

  it("should handle empty last name", () => {
    expect(formatPlayerName("John", "")).toBe("John");
  });
});

// Step 2: THEN write implementation to make tests pass
const formatPlayerName = (first: string, last: string): string =>
  last ? `${first} ${last}` : first;

TDD is non-negotiable because it:

  • Forces you to think about the API before implementation
  • Ensures every feature has test coverage
  • Prevents over-engineering (you only write what's needed to pass tests)
  • Documents expected behavior

5. Clean Deletion

Delete old code completely. No deprecation warnings, migration shims, or backward-compatibility layers unless explicitly requested.

// Correct: Remove the old code entirely
// (Old function is gone, new function exists)
const calculateScore = (player: Player): number => player.stats.overall;

// Wrong: Keeping deprecated versions around
/** @deprecated Use calculateScore instead */
const getPlayerScore = (player: Player): number => calculateScore(player);
const calculateScoreV2 = (player: Player): number => player.stats.overall;

Clean deletion rules:

  • When replacing code, delete the old version completely
  • Never create V2, New, or Old suffixed functions/variables
  • Never add @deprecated comments - just remove the code
  • Never write migration code unless explicitly asked
  • Trust git history for recovery if needed

Why clean deletion:

  • Reduces cognitive load (one way to do things)
  • Prevents confusion about which version to use
  • Keeps bundle size small
  • YAGNI: If no one is using it, delete it

Detailed Guidelines

For comprehensive examples and patterns, see the reference files:

Quick Reference

Variable Declaration

PatternStatusExample
constRequiredconst value = calculate();
letForbiddenUse ternary or reduce instead
varForbiddenNever use

Array Operations

Instead ofUse
arr.push(item)[...arr, item]
arr.pop()arr.slice(0, -1)
arr.splice(i, 1)arr.filter((_, idx) => idx!== i)
arr.sort()[...arr].sort()
arr[i] = valuearr.map((v, idx) => idx === i? value: v)
forEach with mutationreduce or map

Object Operations

Instead ofUse
obj.key = value{...obj, key: value}
delete obj.key({key: _,...rest} = obj)
Object.assign(obj,...){...obj,...other}

Building Lookup Objects

// Correct - reduce with spread
const lookup = items.reduce(
  (acc, item) => ({ ...acc, [item.id]: item }),
  {} as Record<string, Item>
);

// Incorrect - forEach with Map.set
const lookup = new Map();
items.forEach(item => lookup.set(item.id, item));

Conditional Values

// Correct - ternary expression
const status = isComplete ? "done" : "pending";

// Incorrect - let with reassignment
let status = "pending";
if (isComplete) {
  status = "done";
}

Hook Structure Example

export const usePlayerData = (playerId: string) => {
  // 1. VARIABLES & STATE (first)
  const [isLoading, setIsLoading] = useState(true);
  const { data } = useQuery(GetPlayerDocument, { variables: { playerId } });

  const playerName = useMemo(() => data?.player?.name ?? "Unknown", [data]);

  const handleRefresh = useCallback(() => {
    refetch();
  }, [refetch]);

  // 2. SIDE EFFECTS (second)
  useEffect(() => {
    console.log("Player loaded:", playerName);
  }, [playerName]);

  // 3. RETURN (last)
  return { playerName, isLoading, handleRefresh };
};

Container Component Example

const PlayerCardContainer: React.FC<Props> = ({ playerId }) => {
  // 1. VARIABLES & STATE
  const { data, loading } = useQuery(GetPlayerDocument, { variables: { playerId } });
  const { colors } = useTheme();

  const formattedStats = useMemo(
    () => data?.stats?.map(s => ({ ...s, display: formatStat(s) })) ?? [],
    [data?.stats]
  );

  const handlePress = useCallback(() => {
    router.push(`/players/${playerId}`);
  }, [playerId]);

  // 2. SIDE EFFECTS (none in this example)

  // 3. RETURN
  return (
    <PlayerCardView
      stats={formattedStats}
      colors={colors}
      loading={loading}
      onPress={handlePress}
    />
  );
};

Utility Function Example

export const calculateTeamRankings = (
  players: readonly Player[]
): readonly TeamRanking[] => {
  // 1. VARIABLES & DERIVED VALUES
  const validPlayers = players.filter(p => p.team && p.score != null);

  const teamScores = validPlayers.reduce(
    (acc, player) => ({
      ...acc,
      [player.team.id]: {
        teamId: player.team.id,
        totalScore: (acc[player.team.id]?.totalScore ?? 0) + player.score,
        count: (acc[player.team.id]?.count ?? 0) + 1,
      },
    }),
    {} as Record<string, { teamId: string; totalScore: number; count: number }>
  );

  const rankings = Object.values(teamScores).map(t => ({
    teamId: t.teamId,
    avgScore: t.totalScore / t.count,
  }));

  const sorted = [...rankings].sort((a, b) => b.avgScore - a.avgScore);

  // 2. NO SIDE EFFECTS IN PURE FUNCTIONS

  // 3. RETURN
  return sorted;
};

Anti-Patterns to Avoid

Never use let for conditional assignment

// Wrong
let result;
if (condition) {
  result = valueA;
} else {
  result = valueB;
}

// Correct
const result = condition ? valueA : valueB;

Never mutate arrays

// Wrong
const items = [];
data.forEach(d => items.push(transform(d)));

// Correct
const items = data.map(d => transform(d));

Never use Map when Record suffices

// Wrong
const lookup = new Map<string, User>();
users.forEach(u => lookup.set(u.id, u));
const user = lookup.get(userId);

// Correct
const lookup = users.reduce(
  (acc, u) => ({ ...acc, [u.id]: u }),
  {} as Record<string, User>
);
const user = lookup[userId];

Never sort in place

// Wrong - mutates original
const sorted = items.sort((a, b) => a.value - b.value);

// Correct - creates new array
const sorted = [...items].sort((a, b) => a.value - b.value);

Never place useEffect before variable definitions

// Wrong
useEffect(() => {
  /* ... */
}, [value]);
const value = useMemo(() => calculate(), [dep]);

// Correct
const value = useMemo(() => calculate(), [dep]);
useEffect(() => {
  /* ... */
}, [value]);

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Claude Code

30.16%
按下载量换算33

windsurf

23.17%
按下载量换算25

trae

17.93%
按下载量换算19

OpenCode

11.19%
按下载量换算12

Codex

7.24%
按下载量换算8

Antigravity

3.32%
按下载量换算4

安全审计

暂无安全审计结果可展示。

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills