Day 3 of 960 minCipher CadetHands-on lab

Day 3: Specs: Requirements, Design and Tasks

Taught by Mr Elite Updated

By the end of today you can

  • Explain what requirements.md, design.md and tasks.md are each for
  • Write acceptance criteria in EARS form that can be tested
  • Review a generated spec and find the gaps in it
  • Add security requirements for lockout and password storage that the agent did not suggest

Warm-up

Answer from memory first, then tap to check. Recalling yesterday is what makes it stick.

Why should you open only a dedicated project folder in Kiro and not a broad one such as your home folder?

The agent can read and change files in whatever folder is open, so a narrow folder limits what it can see and touch.

What should you do with every change the agent proposes before accepting it?

Read the diff, watch for outside links and unexpected files, and reject or edit anything you do not understand.

Imagine you ask an agent for a login page and get one in two minutes. It looks fine. Then you find it allows unlimited password guesses, stores passwords as plain text and never says what happens after a logout. The agent did exactly what you asked. You just did not ask for the important parts.

A spec fixes that. It is a short written plan the agent and you both agree on before any code exists. Today you will write one for a login feature, learn a tidy sentence pattern for requirements, and then check the plan for what is missing. Everything today is writing and reading. Nothing touches anyone else's system.

The three spec files and what each is for

In Kiro, spec-driven development means you describe the work in documents first, and the agent builds from those documents. A spec is three Markdown files (plain text files with simple formatting), kept together in a folder under .kiro/specs/. Each answers a different question.

requirements.md
What the feature must do, written as user stories and acceptance criteria. This is the what.
design.md
How it will be built: components, data, flows and security choices. This is the how.
tasks.md
A numbered checklist of small build steps, each linked back to a requirement. This is the order of work.
Acceptance criterion
One statement that is clearly either true or false once the feature is built. If you cannot test it, it is not a criterion.

The order matters. Requirements come first because a design built on vague requirements is just a confident guess. Tasks come last because they are only useful when the design is settled. You review each file before moving to the next.

Here is what the folder looks like once Kiro has finished. The folder name under specs is taken from your feature, so yours may be spelled slightly differently. If you can see all three files in the Explorer, the spec exists.

text
login-spec/
  .kiro/
    specs/
      user-authentication/
        requirements.md
        design.md
        tasks.md
The expected layout. One folder per feature, three files inside it.

Think of the approval step as a gate. Kiro will not write design.md until you accept requirements.md, and it will not write tasks.md until you accept the design. That pause is where you do your thinking. If you click approve without reading, you have thrown away the main benefit of working this way.

Quick check

A file lists 'Create users table', 'Add login endpoint' and 'Write tests' in order. Which spec file is it?

EARS: one sentence pattern for testable requirements

EARS stands for Easy Approach to Requirements Syntax. It gives every requirement the same shape, so vague wishes become checkable statements. The common form is: WHEN something happens, THE SYSTEM SHALL do something. SHALL means it is mandatory, not a suggestion.

text
WHEN a user submits a correct email and password, THE SYSTEM SHALL start a session and show the dashboard.
WHEN a user submits a wrong password, THE SYSTEM SHALL show the message "Email or password is incorrect".
Two EARS criteria. Each has a trigger (WHEN) and one observable result (SHALL).

Compare those with 'login should be secure and user friendly'. You cannot test that sentence. You can test both lines above by trying them. Notice the second one also avoids saying which part was wrong, which stops an attacker learning whether an email address has an account.

Two other openers are worth knowing. IF a bad condition occurs, THEN the system responds, which suits error cases. WHILE a state is true, the system behaves a certain way, which suits things like an active session. You do not need to memorise the full EARS family. Using WHEN and SHALL consistently already makes you a better reader of specs.

text
WHILE a session is active, THE SYSTEM SHALL show a Log out button on every page.
IF the database cannot be reached during login, THEN THE SYSTEM SHALL show a generic error and SHALL NOT reveal the technical cause.
A WHILE criterion for a state and an IF/THEN criterion for a failure. The second keeps internal details away from the user.

Here is how I turn a vague line into a good one. Start with 'Passwords must be strong'. Ask what event triggers it: a user registering. Ask what the system does: rejects weak passwords. Ask for an exact rule: under 12 characters. You end with WHEN a user registers with a password under 12 characters, THE SYSTEM SHALL reject it and explain the rule. Trigger, result, number.

Quick check

Which line is a proper EARS criterion?

Watch me do it: generate a login spec and read it critically

Now I will make a spec with Kiro. Use a fresh, empty project folder, as on Day 2. This runs only on your own machine and nothing here connects to a real login service.

text
Create a spec for a user authentication feature for a small web app: registration, login and logout using email and password. Keep it simple and use plain language.
A short feature prompt. It names the scope but says nothing about security, so we can see what the agent adds by itself.

I left security out on purpose. Now you can see what the agent volunteers and what it forgets. Agents often write the happy path well and skip the hostile one. You will probably find criteria for successful registration and login, and perhaps one for a wrong password, but little about repeated failures or how passwords are kept.

Reviewing a spec for gaps, with security in mind

Reviewing means asking what is not written. A gap in the spec becomes a gap in the code, because the agent only builds what it is told. Use these questions on requirements.md, and keep a plain text note of every gap you find.

Two security topics deserve a closer look. Lockout means temporarily blocking an account after too many failed attempts, which slows down password guessing. Password storage means never keeping the real password. You keep a hash, a one-way scrambled form made with a slow algorithm such as bcrypt or Argon2, plus a random salt so identical passwords do not produce identical hashes.

text
WHEN a user fails to log in 5 times within 10 minutes, THE SYSTEM SHALL block further attempts for that account for 15 minutes.
WHEN a password is saved, THE SYSTEM SHALL store only a salted bcrypt hash and SHALL NOT store or log the plain text password.
Two security requirements in EARS form. Use them as models, then write your own in your own words.

To add them, open requirements.md and type the new criteria under the most relevant user story, numbering them to follow the existing ones. Then ask Kiro in the chat to update design.md and tasks.md to match. Afterwards, reopen both files and search for the new words, such as lock and bcrypt. Seeing them appear confirms the change reached the whole spec.

Lab: separate instructions from data

A spec says what a system must do. The lab below is about one thing a spec for any AI feature should say: which text is data and which text is allowed to give orders. Keep that in mind as you work.

The lab is called What the Assistant Reads. Open it from the SecurityElites lab list for today. It shows an email assistant and the different kinds of text that reach its model. Your job is to sort them into trusted instructions and untrusted data. Everything happens inside the lab page, so you touch no real mailbox or account.

Treat it as a requirements exercise. Each decision you make is a rule you could write as an EARS line. Wrong choices usually come from forgetting that someone outside can write the text, even when it arrives through a channel you trust. The hints below the lab introduction give directions, not the answers.

Your turn

What the Assistant Reads

This lab, What the Assistant Reads, shows an email assistant that treats everything it reads as an instruction. It fits today because deciding what an input is allowed to do is exactly the kind of rule you should write into a spec. Work in the SecurityElites lab only.

Open the lab in a new tab

What to try

What to notice

  • Text from outside people is the riskiest, even when it arrives through a trusted channel.
  • The same model reading everything the same way is the root of the problem.
  • A clear rule is easier to test than a vague one, which is why EARS helps.

If it did not work

Approving requirements.md without reading it because it looks professional

Read every line and ask what is missing. Polished wording does not mean complete coverage.

Writing criteria such as 'the login must be secure'

Break it into testable EARS statements: lockout, hashing, generic errors, session expiry.

Letting the agent move on to tasks while the design is still vague

Finish and review each file in order. Fixing a spec costs minutes. Fixing built code costs far more.

Pasting real passwords or keys into a spec as examples

Use obvious fake values such as Example-Pass-123 and keep real secrets out of every file.

Recap

  • A spec is three files: requirements.md for what, design.md for how, tasks.md for order of work
  • EARS uses WHEN a trigger happens, THE SYSTEM SHALL give a result, so each line can be tested
  • Agents write the happy path well and often skip hostile cases
  • Review means asking what is missing, not only what is wrong
  • Login specs need lockout, salted password hashing and generic error messages
  • You approve each file before the next one is created

Cheat sheet

requirements.md
User stories and acceptance criteria: what the feature must do
design.md
Components, data and flows: how it will be built
tasks.md
Ordered build steps linked to requirements
WHEN ... THE SYSTEM SHALL ...
EARS pattern for a testable requirement
Lockout
Temporary block after repeated failed logins
Salted hash
One-way scrambled password with a random value added, made with bcrypt or Argon2
.kiro/specs/
Folder where Kiro keeps your spec files

Before the next day

Mission: Spec a login system and add what the agent missed

Create a complete spec for a user authentication system in Kiro, then improve it by hand. The skill is spotting what the agent did not think of, so the three security requirements must be your own additions.

About 40 min

You are done when: The three spec files from .kiro/specs/ (or screenshots of them) plus a short note listing your three added EARS security requirements.

Want more? Add a requirement for password reset that avoids revealing whether an email has an account, and write a one-line test idea for every requirement you added.

Quiz

4 questions. Your score is saved with your progress.

1. Why write requirements.md before design.md?

2. Which criterion is weakest as a testable requirement?

3. Why store a salted hash instead of the password?

4. The generated spec has happy-path login only. What is the best next move?

Finish the day

Mark the day complete to save your progress.

Go to Day 4

Next: Tomorrow you build a full-stack task app with the agent. The habit of reading each file and asking what is missing will carry over to reviewing every change it proposes.

Tell someone you are doing this:WhatsAppXLinkedIn

Your notes

Private to this device. Write what you want to remember from today.