Communitygithub.com

lguidolin/工程章程

在遵循工程章程的项目中开始工作时使用,用于熟悉其规则或决定适用于任务的具体工程实践——规范编写、提交、测试、安全、部署、数据库或UI工作。

工程章程 是什么?

该技能是一份可移植的工程实践章程,将其分解为聚焦的子技能。它扮演着索引角色,阐述了不可违背的原则(例如“先理解再构建”、“严格执行YAGNI”、“自动化重复性工作”),并根据具体任务引导用户选择相应的子技能(如设计规范、决策记录、测试控制、安全等)。技能分为两层:**第一层**涵盖所有项目通用的实践(如设计、提交、测试、安全、可观测性),**第二层**针对特定技术栈(如PostgreSQL、GraphQL、Kubernetes)。它强调“软件工程是随时间整合的编程”,优先考虑长期可维护性而非首次部署。支持Claude Code、Cursor等AI代理平台,通过引用`references/engineering-constitution.md`来确保规则与技能捆绑传输。用户指令优先级高于本文档,且规则需绑定到工具或标记为审阅者判断才能强制执行。

兼容平台✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/lguidolin/agent-skills/tree/main/skills/engineering-constitution

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

工程章程 是做什么的?

概述

一份可移植的工程实践章程,分解为聚焦的子技能。此技能是索引:它阐述了不可违背的原则,并为你路由到适合具体任务的子技能。完整的推理过程位于 references/engineering-constitution.md 中,该文件与本 SKILL.md 捆绑在一起,因此无论技能安装在哪里,它都会随之传输。

核心理念: 软件工程是随时间整合的编程。 为长期存在的系统进行优化——操作它、安全地更改它、在它崩溃时恢复它——而不是首次部署。

八项不可违背的原则

  1. 先理解再构建。 没有经过批准的设计,就不写代码。
  2. 记录每个决策及其理由——以及你拒绝的方案。
  3. 测试是一种控制,而不是形式——行为变更应测试优先。 失败的测试是信息,绝不能编辑掉。结构变更则需通过未编辑的现有测试套件全部通过来把关。
  4. 严格遵守YAGNI原则。
  5. 自动化重复性工作。
  6. 软件工程是随时间整合的编程。
  7. 不执行的规则就是建议。 将规则绑定到工具,或将其标记为需要审阅者判断。
  8. 用户的明确指令优先于本文档。 优先级:用户 → 章程 → 工具默认值。

我需要哪个技能?

第一层——通用(适用于每个项目):

你的任务技能
开始一个特性,将想法转化为规范/计划designing-before-building
已做出决定,记录下来(ADR、索引、延迟的想法)recording-decisions
提交、编写提交信息、自动化发布conventional-commits-and-releases
编写/更改测试;权限/角色规则;重构中测试失败tests-as-a-control
编写或重构代码;结构化变更;DRY决策change-hygiene-and-code-craft
构建UI、组件、样式、无障碍interface-craft-and-accessibility
CI、推送前钩子、任务运行器、合并门禁merge-gates-and-automation
日志、指标、链路追踪、健康检查、SLO、告警observability-and-slos
不可信输入、密钥、认证、依赖、威胁建模defense-in-depth-security
热点路径、分页、N+1、列表端点、公共接口performance-and-scale
规划部署、回滚或事件/事后分析resilience-and-deploy-safety

第二层——特定技术栈(仅在相关工具/主题存在时加载):

你的任务技能
PostgreSQL、PostGraphile、RLS、SQL文件、应用→GraphQL→DB路径postgres-postgraphile-rls-and-sql
在UI和测试之间共享的GraphQL查询;路由/模式契约测试graphql-contract-testing
架构变更且数据必须保留——迁移、回填zero-downtime-migrations
部署到Kubernetes/AKS、云密钥、渐进式发布、每个PR的环境cloud-delivery-aks

这些技能如何应用于新项目

  • 第一层不变迁移。 上述每个技能适用于任何项目——Web应用、管道、CLI、库。
  • 第二层可替换。 当技术栈不同时,第二层技能不会触发(其描述针对特定技术栈),你可以替换为等效技能。它们所实现的原则(单一数据路径、最终强制执行点低、契约边界、可逆部署)仍然成立。
  • 按生命周期缩放。 预发布或仅本地项目将零停机迁移、金丝雀发布和正式事件处理过程作为立即编写规则,触发时激活。在项目的第一个决策记录中声明其模式。

红旗

如果你即将编写代码、提交、部署或修改测试,而尚未查阅上述相关技能——请先停下来加载它。章程覆盖默认习惯(原则7);习惯正是它要纠正的。

Individual skills in this repo

This repo contains 18 individual skills — each has its own dedicated page.

lguidolin/change-hygiene-and-code-craft

Use when writing or refactoring code, structuring a commit or PR, or deciding whether to abstract duplication. Symptoms — mixing reorg with logic changes, a PR doing several things at once, a file growing large, the second copy of similar code, or unsure whether to DRY something up.

lguidolin/cloud-delivery-aks

Use when deploying to Kubernetes or Azure Kubernetes Service (AKS), configuring cloud secrets, setting up progressive rollout/canary, per-PR ephemeral environments, or k8s health probes. Keywords — Kubernetes, AKS, Key Vault, Argo Rollouts, Flagger, canary, blue-green, liveness, readiness, PodDisruptionBudget, HPA, rollback, GHCR.

lguidolin/commit-history-rewrite

Use when an existing repository has messy commit history that needs to conform to conventional commits before adopting release-please, or when intermediate WIP/fixup/merge commits need to be cleaned up.

lguidolin/conventional-commits-and-releases

Use when committing, writing a commit message, opening a PR that will be squash-merged, or configuring automated versioning/changelogs. Keywords — conventional commits, release-please, semver, feat/fix/chore, breaking change, changelog.

lguidolin/defense-in-depth-security

Use when handling untrusted input, secrets, authentication/authorization, or dependencies — or threat-modeling a new surface. Keywords — STRIDE, threat model, least privilege, secrets management, supply chain, dependency scanning, input validation, audit log, defense in depth.

lguidolin/designing-before-building

Use when starting a feature, fixing a non-trivial bug, or about to write implementation code — before any code exists. Symptoms you need this: "this is simple, I'll just code it", reaching for the editor before a design is approved, or an idea that hasn't been turned into a spec and plan.

lguidolin/graphql-contract-testing

Use when writing a GraphQL query/mutation that the UI and a test will share, or building route/schema contract or smoke tests. Symptoms — copying a query into a test, a test asserting on query text, schema change that didn't break the UI build, or RLS/permission drift. Keywords — graphql-codegen, typed document, contract test, route smoke test.

lguidolin/init-repo-CI

Use when setting up a new repository with conventional commits, release-please, and CI automation, or when retrofitting an existing repository that lacks automated versioning and PR validation workflows.

lguidolin/interface-craft-and-accessibility

Use when building or styling UI — components, layouts, forms, design tokens — or making accessibility decisions. Keywords — a11y, WCAG, keyboard navigation, focus state, contrast, design system, minimalist UI, component reuse, ARIA, semantic HTML.

lguidolin/merge-gates-and-automation

Use when setting up or changing CI, pre-push hooks, or a task runner, or deciding what must pass before merge. Symptoms — tempted to put authoritative checks only in a local hook, skip CI, bypass with --no-verify, or unsure what gates a merge vs. runs locally.

lguidolin/observability-and-slos

Use when adding logging, metrics, tracing, health checks, SLOs, or alerting — or when building a service surface that needs to be operable and debuggable. Keywords — structured logs, OpenTelemetry, correlation id, RED metrics, liveness, readiness, SLI, SLO, error budget, alerting.

lguidolin/performance-and-scale

Use when working on hot paths, list endpoints, pagination, data-access in loops, or public interfaces/schemas. Symptoms — unbounded queries, N+1 access, no latency budget, optimizing without measuring, or changing an interface many consumers depend on. Keywords — pagination, N+1, Hyrum's Law, performance budget, bundle size.

lguidolin/postgres-postgraphile-rls-and-sql

Use when writing PostgreSQL, PostGraphile config, Row-Level Security policies, SQL schema files, or working on the Browser→App→PostGraphile→Postgres data path. Keywords — RLS, SECURITY DEFINER, search_path, pgSettings, grants, roles, GraphQL depth limit, query cost, statement_timeout, SQL file organization.

lguidolin/recording-decisions

Use when a design or architecture decision has been made and needs to be captured — writing a decision record or ADR, updating a decision index, noting a deferred idea, or superseding a past decision. Keywords — ADR, decision record, rationale, rejected alternatives, dependency index.

lguidolin/resilience-and-deploy-safety

Use when planning a deploy, designing a rollback, or responding to an incident or writing a postmortem. Keywords — deploy safety, rollback, immutable artifact, progressive delivery, canary, blast radius, incident response, blameless postmortem, error budget.

lguidolin/ship-it

Use when the user wants to ship work — push, PR, archive decision records, merge, and clean up. Handles the full lifecycle from committing final changes through post-merge cleanup including converting specs/plans to compact decision records.

lguidolin/tests-as-a-control

Use when writing or modifying tests, when a test breaks during a refactor, or when testing permission/role rules. Symptoms — tempted to edit a test to make it pass, testing only the happy path, a deny-test that started passing, flaky tests, or unsure what to assert.

lguidolin/zero-downtime-migrations

Use when changing a database schema where data must survive the change — adding/removing/renaming columns, constraints, indexes, or backfilling. Symptoms — a destructive migration bundled with a code deploy, a NOT NULL column with a backfill, a table-locking UPDATE, or a rename. Keywords — expand/contract, parallel change, backfill, NOT VALID, CREATE INDEX CONCURRENTLY, graphile-migrate.

相关技能