Awesome CopilotAdventures

Product guidance checked

Add a brownfield dashboard feature with Spec Kit

An existing project has behavior, consumers, tests and conventions. A new feature must integrate with those constraints instead of regenerating the project.

Lab briefing

A central dashboard connects grouped document trays to a separate metadata module.

Original concept illustration (SVG)

Add owner-scoped metadata while preserving the dashboard.

At a glance Your route
Level and time 300; 85 minutes (facilitation estimate)
Starting action Keep baseline tests green while the new feature starts red.
Learner materials Download 14-brownfield.zip
Workspace Open the extracted kit root; run the baseline from . relative to that root
Expected initial check The supplied baseline tests pass.
Setup help Download, extract, local Git and optional GitHub

[!NOTE] A trusted test actor is a seam, not production authentication.

Concepts · First task · Evidence checklist · Reset

Learning objectives

  • Characterize existing endpoints/module contracts before initializing scaffolding.
  • Specify a feature as a bounded delta.
  • Keep identity separate from model- or request-supplied fields.
  • Verify old and new behavior together.

Before you start

Complete Spec Kit preparation. Prepare 14-brownfield using the work-drive guide. This bundled dashboard module replaces the mandatory external repository import. No LocalDB, cloud account changes, binary upload, or public repository is needed.

Concepts and use cases

Existing constraint New requirement
health() response stays unchanged Add document metadata
projects() preserves IDs and shape Register only under an existing project
No production authentication in the fixture Inject a trusted test actor; never accept owner identity from input
Module callers must not mutate state Return copies of metadata records

Exercise scenario

The dashboard already lists a training project. Add document titles and IDs scoped to the current fixture actor. Actual file uploads, malware scanning, external storage, and real user authentication are explicitly separate work.

Task 1 - Run the old and new contracts separately

node --test --test-concurrency=1 baseline.test.mjs
node --test --test-concurrency=1 feature.test.mjs
  1. Confirm the baseline is green.
  2. Confirm the feature tests fail because the feature is not implemented.
  3. Record the exact messages and exit codes.
  4. Read requirements.md; map DOC-1..4 to tests and identify missing knowledge.

Task 2 - Adopt Spec Kit without replacing the application

  1. Make a baseline commit in the disposable project.
  2. Inspect .github, .specify and editor files before specify init --here.
  3. Review every scaffolding change and preserve project-owned instructions.
  4. Create a constitution that preserves DOC-1 and bans unrelated modernization.

Do not use --force as a substitute for conflict resolution.

Task 3 - Specify the delta and clarify ownership

/speckit-specify Add document metadata to the existing dashboard in requirements.md.
Preserve health/projects exactly. Derive ownerId from a trusted actor supplied by
the application boundary, not from document input. Reject missing project/title,
overlong title, missing actor and owner spoofing. No file upload.

Use /speckit-clarify to answer:

  • Who establishes the actor in production?
  • What is the maximum title length?
  • Does a failed add leave partial state?
  • May another actor list these records?

The fixture’s injected actor is a test seam, not proof of production authentication.

Task 4 - Plan with compatibility gates

Use /speckit-plan to require:

  1. Existing health and projects unchanged.
  2. New metadata storage and validation confined to the module.
  3. Owner-scoped listing with defensive copies.
  4. Combined execution of baseline and feature tests.
  5. Explicit error propagation, no silent fallback owner.

For .NET, propose an authenticated controller/service adaptation; for TypeScript, add explicit input/output types. Both must preserve DOC-1..4. Do not claim those adapters were run unless you implement and execute their tests.

Task 5 - Implement and evaluate the delta

  1. Run /speckit-tasks and /speckit-analyze.

  2. Review mappings to both legacy and new tests.

  3. Implement one slice, then run:

    node --test --test-concurrency=1 baseline.test.mjs feature.test.mjs
    
  4. Inspect the entire diff, not just the new method.

  5. Temporarily remove owner filtering. Confirm the cross-actor test fails, then restore it.

  6. Use /speckit-converge as a review aid, not evidence that tests ran.

Verify your work

  • Old tests stay green alongside the new feature.
  • Ownership comes from the trusted boundary.
  • Wrong actor, spoofed owner and invalid input are rejected or isolated.
  • The feature introduces no binary upload or new network service.
  • The compatibility gate is represented in spec, tasks and executed tests.

Troubleshooting

If the generated code rewrites the whole dashboard, stop and compare the baseline. If tests pass only individually, inspect shared state. If an “owner” string is read from user input, it is not authorization.

Independent practice

Specify a separate binary-upload feature with size limits, content validation, storage ownership, malware handling and deletion policy. Keep it a design exercise until its own fixtures and tests exist.

Reset

Save evidence, then restore only dashboard.mjs in the disposable copy. Keep the curriculum and upstream material untouched; remove no shared branches or accounts.

Official references

Search

Search in English. Source paths and executable examples retain their original text.