building

Implementation skills for writing production code using TDD. Covers the RED‑GREEN‑REFACTOR loop, false‑RED detection, vertical slicing, scope expansion, test process discipline, and code generation patterns. Loaded by the component builder and defect investigator.

Last repository push
GitHub Stars
167
Forks
25
Issues / PRs
2

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "building" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-4d9a49afc56e725dc249b94d484051b395d02fd3d142c3ab6eef4aa1b5813704. Verify the upstream source and version against https://github.com/romiluz13/cc10x before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

github.com

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

Implementation skills for writing production code using TDD. Covers the RED‑GREEN‑REFACTOR loop, false‑RED detection, vertical slicing, scope expansion, test process discipline, and code generation patterns. Loaded by the component builder and defect investigator.

0 Downloads

Introduction source: third_party · romiluz13 · 0.0.1 Reference

SkillPi interpretation

Tasks
Iron Law:** NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST.
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: building
description: |
  Implementation skill for writing production code with TDD. Covers the RED-GREEN-REFACTOR
  cycle, false-RED detection, vertical slicing, scope escalation, test process discipline,
  and code generation patterns. Loaded by component-builder and bug-investigator.
allowed-tools: Read Write Edit Bash Grep Glob LSP
user-invocable: false

Building (Code Generation + TDD)

Iron Law: NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST.

Reference Files

Read only what's needed:

  • references/testing-patterns.md — test structure, isolation, naming; load when writing the first test of a cycle or a test feels awkward to structure
  • references/test-data-and-mocks.md — mock discipline, test data factories; load when a test needs fixtures/factories or you are about to mock anything
  • references/integration-and-live-proof.md — integration test guidance, live verification; load when the slice crosses a service/DB/API boundary or the plan names live proof

Test Process Discipline

  • Always use run mode: CI=true npm test, npx vitest run (NOT npx vitest), CI=true npx jest — watch mode never exits, so the agent hangs waiting for a prompt that never returns
  • Timeout guard: timeout 60s npx vitest run if uncertain about CI=true
  • After TDD cycle: pgrep -f "vitest|jest" || echo "Clean". Kill if found — orphaned watchers hold ports and re-run stale code, producing false greens in later cycles.
  • IDE vs CLI truth: If CLI tests pass with exit 0, trust CLI over IDE/LSP errors (stale cache)

RED → GREEN → REFACTOR

RED — Failing Test First

Write one failing test for the current slice. Run it. RED = a behavioral failure ("X is not a function", "expected 3, received undefined") — never a bare exit code.

False-RED guard (CRITICAL): Exit 1 from an import/syntax/collection ERROR is a broken harness, not a RED — fix the harness and re-run. Record the observed failure reason verbatim.

GREEN — Minimal Code

Write the minimum code to pass the test. No extra features, no abstractions for hypothetical futures. No unrelated test breakage. If existing tests break, fix the code not the tests.

REFACTOR — Clean Up

Improve code quality while keeping tests green. If tests fail during refactor, revert — a red test proves it wasn't a refactor, and debugging forward mixes two changes. Re-run after every refactor step.

Safety-Check Guard (MANDATORY): Never simplify away a safety check during refactoring. Safety checks include:

  • Input validation at trust boundaries (API entry points, user input, external data)
  • Error handling that prevents data loss or corruption
  • Security checks (auth, authorization, sanitization)
  • Accessibility checks (ARIA, keyboard navigation, semantic HTML)

If a safety check seems unnecessary, verify with a test that proves it's dead code before removing. "Looks redundant" is not sufficient evidence.

Vertical Slicing (CRITICAL)

Build in thin vertical slices that cross all layers: UI → API → logic → data → test. A horizontal slice (all UI, then all API, then all logic — or all tests first, then all implementation) defers integration risk to the end and produces untestable layers. Each slice should be independently verifiable and shippable.

Seam Discipline

One seam, one test, one minimal implementation per cycle. Each test is a tracer bullet that responds to what the last cycle taught you — work one vertical slice at a time.

Test only at pre-agreed seams. A seam is the public boundary where you observe behavior without reaching inside. Before writing any test, know which seam you're testing at. Prefer existing seams to new ones; use the highest seam possible; the fewer seams across the codebase, the better (ideal is one). If the plan provides a ### Test Seams subsection or an Interfaces block, draw your seams from there.

Implementation-coupled anti-pattern. A test is implementation-coupled if it mocks internal collaborators, tests private methods, or verifies through a side channel (querying the database instead of using the interface). The tell: the test breaks when you refactor but behavior hasn't changed. Test through the public interface, not internals.

Record your seams (enforced contract fields). Your Router Contract carries two seam fields:

  • TEST_SEAMS: [seam names you actually tested at]
  • SEAM_GATE_STATUS: "confirmed" | "proposed" | "disagreed" | "not_applicable"

Set SEAM_GATE_STATUS as follows:

  • confirmed — the plan provided test_seams and you used them (TEST_SEAMS non-empty, matching the plan).
  • proposed — no plan (direct/no-plan path) OR a legacy plan whose phase omits test_seams; you proposed seams at BUILD_PREFLIGHT (TEST_SEAMS non-empty).
  • disagreed — the plan's proposed seam cannot exercise the phase's real risk. Record the disagreement in DECISIONS and either propose a better seam (TEST_SEAMS non-empty with the better seam) or block on genuine ambiguity (STATUS: FAIL, REMEDIATION_REASON: "Ambiguous test surface — no seam exercises the real risk").
  • not_applicable — build_scope=trivial; no seam expectation.

The router validates these per build_scope (see the contract-override table). This is the enforced gate — not advisory.

Study Project Patterns First

Before writing code: read 2-3 existing similar components in the repo. Match naming, file structure, export style, test patterns. Follow the project's conventions — don't introduce a new pattern when an existing one works.

LSP before writing: Use LSP to find definitions, references, and type information before writing code that interfaces with existing modules.

Scope Escalation (SCOPE_INCREASES)

If the build scope grows beyond the approved phase — new files not in the plan, new dependencies, API contract changes — emit SCOPE_INCREASES: ["new scope item"] in the contract. The router decides whether to escalate to a full BUILD (with planner + reviewer) or approve the expansion.

Decision Checkpoints (return FAIL when triggered):

Trigger Action
Changing >3 files not in plan FAIL with extra files named
Choosing between 2+ valid patterns FAIL with competing options
Breaking existing API contract FAIL with impacted callers
Adding dependency not in plan FAIL with dependency name
Touching a later planned phase early FAIL with skipped phase

Minimal Diffs

Write minimal diffs. A bug fix doesn't need surrounding cleanup. A one-shot operation doesn't need a helper. Don't add error handling, fallbacks, or validation for scenarios that cannot happen. Trust internal code and framework guarantees in production code — no runtime re-validation for scenarios the types or the framework already exclude; only validate at system boundaries. When your feature depends on a framework behavior, pin it with a test instead: guarantees have edge cases, and the test costs less than the defensive code.

Rationalization Table

Excuse Reality
"Too simple to test" Simple code breaks. Test takes 30 seconds.
"I'll write tests after" "After" never comes. Write the test first — it IS the spec.
"It's just a refactor" Refactors break things. Run the tests before AND after.
"The existing tests cover this" Then your new test will pass immediately — that's a false RED.
"I manually tested it" Manual testing doesn't survive the next refactor or CI run.
"Adding tests would slow down delivery" Debugging untested code takes longer than writing the test.
"The framework handles this" Pin the depended-on behavior with a test — don't re-validate at runtime.

Red Flags — STOP and Reconsider

  • You're about to write production code without a failing test
  • You're skipping the RED step because "the test will obviously fail"
  • You're adding error handling for a scenario that can't happen
  • You're introducing an abstraction with only one caller
  • You're changing code unrelated to the current phase
  • You're about to commit without running the full test suite
  • You're considering deleting a test to make the build pass
  • You're adding a dependency not in the plan

Tautological Test Anti-Pattern

A tautological test recomputes the expected value the same way the code does — it passes by construction and can never disagree.

// BAD — tautological: recomputes expected value using same logic
const expected = items.reduce((sum, x) => sum + x.value, 0);
expect(calculateTotal(items)).toBe(expected);

// GOOD — expected value comes from an independent source of truth
expect(calculateTotal([{value: 10}, {value: 20}, {value: 30}])).toBe(60);

Rule: Expected values must come from a known-good literal, a worked example, or the spec — never from re-running the same algorithm the code uses.

Loop Caps

  • TDD Failure Cap: GREEN fails 3 consecutive times on same test → FAIL with error — three failures means the approach is wrong, not unlucky
  • Build/Lint Loop Cap: Same error recurs after 3 fix attempts → FAIL with error_code + file

Coverage Threshold

If coverage-thresholds.json exists, run coverage and compare. Below thresholds → FAIL. If no thresholds file, skip coverage check.

Test Prioritization

Ranked by bugs caught per token — behavioral tests catch the most; performance tests without a stated requirement are speculative work.

  1. Behavioral tests (does the function do what it should?)
  2. Edge case tests (empty input, null, boundary values)
  3. Integration tests (does it work with real dependencies?)
  4. Performance tests (only if performance is a stated requirement)

Design for Testability

If tests are hard to write, the code is hard to test — fix the code, not the test. Pure functions are easy to test. Side effects are hard. Isolate side effects at boundaries; keep core logic pure.

When Stuck

  • RED won't fail: check if the test is actually exercising the code path
  • GREEN won't pass: re-read the test, check if the assertion matches the requirement
  • Existing tests break: your change has a side effect you didn't expect — revert and isolate

Pure HTML/CSS/JS exception: If no test runner exists, TDD evidence may use manual browser verification. Set TDD_RED_EXIT=1, TDD_GREEN_EXIT=0 with manual check evidence.

Version history

  1. v12.8.0 GitHub ↗
    Original release notes

    ## v12.8.0 — cc10x-guide skill + documentation overhaul User feedback drove a documentation-first release: the README was a reference manual instead of a landing page, and the plugin shipped no way to ask Claude about cc10x itself. Two behavioral fixes fell out of the setup-correctness audit. ### Added - **New skill: `cc10x-guide`** (19 → 20 skills) — model-invoked help desk for cc10x itself. Answers "what is cc10x", "how do I configure it", "why isn't it activating" with short authoritative answers plus pointers to the canonical on-disk files (README sections, `claude-settings-template.json`, memory contract, router references). Lean (~145 lines), pointer-based, read-only by contract — negatively scoped in its description so work requests still route to `cc10x-router` and upgrades to the `update` skill. - **README restructured for the <5-minute user** — Quick Start moved directly under Install; How It Works reduced to one diagram + one paragraph; all architecture content collapsed into a `<details>` deep dive; version history collapsed; HTML explorers linked from the hero. No content deleted — everything moved or folded. ### Fixed - **Setup-created `patterns.md` violated the memory contract.** The README setup flow emitted `## Architecture Patterns` / `## Code Conventions` and omitted the contract-required `## Project SKILL_HINTS` Edit anchor — agents anchoring to that heading failed against setup-created files. The setup template now emits exactly the canonical headings from `memory-file-contracts.md`. - **Permission templates unified.** README and `claude-settings-template.json` had drifted in both directions and both missed commands every workflow runs. Both now carry the same 14-entry list, adding `Bash(git rev-parse:*)` (phase base SHAs), `Bash(python3:*)` (router-run `review_package.py` / `phase_brief.py`), `Bash(git blame:*)`, `Bash(git branch:*)`, and `Bash(mkdir -p docs/solutions)`. `Write(docs/*)` remains unprompted-by-default deliberately — outward-facing artifacts keep their approval friction. ### Changed - **`doc_consistency_check.py` extended** — now also asserts `marketplace.json`'s `metadata.version` and `plugins[0].version` match `plugin.json`, closing the version-drift seam on the marketplace install surface. - **Version bumped to 12.8.0** in all locations: `plugin.json`, `marketplace.json` (3 strings), README banner + footer, docs status notes (5 files). ### Skill count 19 → 20 skills (excluding router, per `doc_consistency_check.py` counting rule)

  2. v11.1.0 GitHub ↗
    Original release notes

    Minor release — all changes are **additive** over v11.0.0. Driven by a system-level architecture comparison against superpowers + matt-pocock that honestly mapped where cc10x leads (back-half verification: independent verifier + REVERT + test-honesty gates, parallel silent-failure-hunter, fail-closed hooks) and where it trailed (the execution engine). This closes the engine gap without disturbing the per-phase build loop, which stays the default. ## Execution engine - **New runnable scripts** `cc10x_phase_brief` + `cc10x_review_package` (dependency-free) — produce the dispatch-by-reference brief and the recorded-`BASE..HEAD` diff package. Resolves a live contradiction where the policy + reviewer relied on a diff package no script produced. - **Recorded-BASE diffing** across 4 agents — kills lossy `HEAD~N` / working-tree truncation that dropped earlier commits of a multi-commit TDD phase from review. - **Reviewer SPEC_COMPLIANCE verdict split** (Missing / Extra / Misunderstood), separate from code quality. - **Inline no-subagent execution fallback** — keeps the fail-closed gates when subagents are unavailable or work is too coupled to split. - **Per-TASK dispatch** as an opt-in mode (per-phase stays default), optional final whole-branch review, on-BLOCKED-change-something rule, feedback-loop-first debugging, brainstorming glossary + synthesize-now. ## Four net-new skills (19 → 23) - **receiving-code-review** — verify human/external feedback before agreeing (closes the ungoverned PR-comment loop). - **codebase-deepening** — deletion-test retrofit for shallow LLM-grown modules. - **frontend-design-critique** — two isolated assessments + anchored rubric + AI-slop ban-list, RTL-aware. - **handoff-package** — portable secrets-redacted cross-tool/session handoff. Four validators green at every commit; live harness 4/4 PASS. 🤖 Generated with [Claude Code](https://claude.com/claude-code)

  3. v11.0.0 GitHub ↗
    Original release notes

    **First v11 release.** Three campaigns, all validator-gated (4 validators green at every commit; full live harness 4/4 PASS). ## De-version the state namespace `.cc10x/v10/` → `.cc10x/`. The version identifier now lives **only** in `plugin.json` and on GitHub — never in the on-disk state path. Fresh start: no automatic migration of existing `.cc10x/v10/` state (orphaned and ignored on upgrade). ## Revitalization - **Complexity gradient restored** — trivial BUILD work runs a reduced graph; full chain for standard/planned work, with scope/blocked escalation. - **Artifact substrate hardened** — copyable skeleton + fail-closed corruption guard. - **Router supremacy softened** — router is the default for multi-step work (not an absolute gate); `EnterPlanMode` ingestible; gated `build-finish` finishing menu. - **Doc-drift guard** — new validator keeps README counts/versions in sync with disk on every commit. - **Fork-strip** — the 4 superpowers forks trimmed to cc10x-deltas with `DIVERGENCE` notes + an eval suite. ## Upstream idea harvest (superpowers 6.0.2 + matt-pocock + superpowers-lab) Comprehensive harvest adapted to cc10x's accountability identity: - **Guard dispatch INPUTS, not just outputs** — the router self-checks its own dispatch prompts so it cannot pre-judge/soften a read-only verifier. - **Bidirectional review** — `FINDING_DISPUTED` (verifier-adjudicated), `PLAN_DEFECT`, fix-wave consolidation, re-review precondition gate. - **Baseline-before-change + feedback-loop-first debugging.** - **Test/mock honesty gates, behavioral-RED enforcement, model-tier policy, read-only ORIENT intent.** - **5 net-new skills** (14 → 19): `skill-eval-harness`, `authoring-cc10x-guidance`, `finding-duplicate-functions`, `prototyping`, `mcp-cli`. Positioning: *superpowers makes Claude capable; cc10x makes Claude accountable.* 🤖 Generated with [Claude Code](https://claude.com/claude-code)

  4. v10.1.17 GitHub ↗
    Original release notes

    ### Reference-first skill decomposition for safer CC10X prompt growth Expanded the new `references/` pattern across the four highest-leverage advisory skills without changing router, hook, or agent orchestration. The SKILL files now stay focused on control-plane rules while the heavier checklists and playbooks load only when needed. #### Added - **Debugging references:** Root-cause playbooks and investigation hygiene for build/type failures, runtime crashes, browser issues, git bisect, context discipline, and architectural escalation. - **Code review references:** Concern-first review ordering, security checklist, and quality heuristics for maintainability, hidden failures, edge cases, and UI quick scans. - **Frontend references:** UI state/feedback guidance, accessibility and forms guidance, and performance/layout guidance for responsive behavior and color mode checks. - **TDD references:** Testing patterns, test-data/mocks guidance, and integration/live-proof escalation guidance that connects TDD to the existing CC10X live verification lane. - **Audit coverage:** `cc10x_harness_audit.py` now fails if any of the new reference files are missing. #### Changed - **4 skills slimmed under the soft prompt budget:** `debugging-patterns`, `code-review-patterns`, `frontend-patterns`, and `test-driven-development` now explicitly point to one-level-deep references following `skill-creator` progressive disclosure. - **Prompt surface inventory:** Added advisory-surface guidance for the new extracted review and TDD reference layers.

  5. v9.1.1 GitHub ↗
    Original release notes

    ## [9.1.1] - 2026-03-07 ### MCP startup warning fix #### Fixed - Removed shipped plugin MCP config from `plugins/cc10x/.mcp.json` so CC10X no longer triggers startup warnings when Bright Data or Octocode environment variables are not configured. - Changed CC10X MCP support from plugin-bundled config to **optional user-configured Claude Code MCP servers**. The recommended server names remain `brightdata` and `octocode`. - Updated router/docs/audit language so MCP acceleration is documented as user-configured and fallback-safe instead of plugin-shipped.

Only the five most recent versions are shown. View full version history at the source ↗

Current listing version

0.0.1

Verify the source revision ↗

Safety and assessment details

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value85/100

Highlights

  • 提供完整的 TDD 开发流程指导,涵盖 RED-GREEN-REFACTOR 循环、假 RED 检测、垂直切片等核心工程实践
  • 包含测试纪律、范围扩展、代码生成模式等实用内容,对开发者具有高频实用价值
Trigger Precision95/100

Highlights

  • description 明确说明技能用途(TDD 编写生产代码),触发词清晰完整,边界明确
Structure and Standards95/100

Highlights

  • 文档结构完整,包含 Phase 划分、步骤说明、出口条件、端到端示例
  • frontmatter 完整,单文件未超 500 行,排版规范
Execution Reliability90/100

Highlights

  • 工具来源明确,参数正确,覆盖主要异常(False-RED guard、Safety-Check Guard、Loop Caps)
  • 不可逆操作有确认机制(决策检查点返回 FAIL),执行流程可靠
Evidence Verifiability (mean of the first four)91/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

  • Install or fetch external dependencies

    Use official sources and pin versions. Check install scripts in an isolated environment. This document check does not cover code downloaded later.

    Mentioned in main document · lines 25, 26

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.