Communitygithub.com

lguidolin/設計先行

在開始新功能、修復非微小的錯誤,或準備撰寫實作程式碼之前使用。需要此技能的徵兆:覺得「這個很簡單,直接寫程式就好」、在設計尚未批准前就打開編輯器、或是想法尚未轉化為規格與計畫。

設計先行 是什麼?

這項技能強制在工作流程中建立「先設計、後實作」的紀律,適用於Claude Code、Cursor、Codex等平台。它將任務分解為五個明確階段:腦力激盪、規格、計畫、執行、記錄,並嚴格禁止在設計獲得批准前撰寫任何程式碼。技能特別針對開發者常見的「覺得很簡單就直接寫」或「邊寫邊設計」等心理陷阱提供具體對策與常見合理化藉口的反駁。真實的瑣碎且可逆變更(如修正錯字)則可直接跳至執行階段。整體運作基於一個判斷原則:如果猜錯的成本高於設計步驟,那麼就應該先設計。最終目的是避免因過早實作而產生的重工,確保程式碼品質與專案效率。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/lguidolin/agent-skills/tree/main/skills/designing-before-building

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

先設計,再建置

概述

工作依序經過五個階段:腦力激盪 → 規格 → 計畫 → 執行 → 記錄。在設計清楚闡述並獲得批准之前,不進行任何實作。最簡單的任務,往往是未經審視的假設付出最高代價的地方。

違反這條規則的文字,就是違反它的精神。 「邊寫程式邊設計」並不是設計。

五個階段

  1. 腦力激盪。 探索意圖、限制條件與成功標準。一次只問一個問題。提出 2–3 種方案,包含權衡取捨與建議。收斂到一個設計,並獲得明確批准。此階段不寫程式。
  2. 規格。 將批准的設計寫入一份標註日期的文件。規格是建置內容的契約。
  3. 計畫。 在觸碰程式碼之前,將規格分解成一個有序、可審查的實作計畫。
  4. 執行。 根據計畫實作,並設定審查檢查點。
  5. 記錄。 將建置的內容與原因提煉成決策記錄(參閱 recording-decisions)。

分解大型工作。 如果需求涵蓋多個獨立的子系統,請在深入細節之前先進行分解。每個子專案獨立運作自己的週期,並按照依賴順序建置。

何時不使用

真正瑣碎且可逆的修改(例如錯字、日誌行、設定值)可直接跳至執行階段。判斷標準:錯誤猜測的成本是否高於設計步驟? 如果是,則先設計。

常見的合理化藉口

藉口現實
「這個太簡單了,不需要設計」簡單的任務隱藏著假設。花幾句話做設計很便宜;重寫程式碼則不然。
「我邊寫邊設計」在設計確定之前寫的程式碼,就是要重寫的程式碼。設計是獨立的一項活動。
「使用者已經告訴我要建置什麼了,那就是設計」需求只說明什麼,而非如何做。如何做才是設計。
「先探索程式碼庫就能知道做法」探索可以輔助設計,但不能取代對單一設計方案的批准。
「我們很趕時間」趕時間的時候,正是省略設計會產生白做工結果的時候。

紅旗警訊 — 立即停止

  • 在存在已批准的設計之前就打開編輯器
  • 「讓我先快速做個原型」沒有規格的原型就是未經審查的範圍
  • 在沒有計畫的情況下開始一個跨多個檔案的變更
  • 將使用者一行字的需求視為完整的規格

所有這些都代表:停止、設計、取得批准、然後建置。

完整理由說明:憲法第一條,收錄於 engineering-constitution/references/engineering-constitution.md。

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/engineering-constitution

Use when starting work in a project that follows the engineering constitution, orienting to its rules, or deciding which engineering practice applies to a task — spec writing, commits, testing, security, deploys, database, or UI work.

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.

相關技能