GitHub Copilot Building a To-Do App

A small project ties every skill together. You will build a simple to-do list page that adds tasks, marks them complete, and removes them. The project uses HTML, CSS, and JavaScript, and Copilot assists at each step. Work in a new folder and keep every change small so you can test as you go.

The Finished Result

┌───────────────────────────────────────┐
│  MY TASKS                             │
│  [ Type a task here...      ] [ Add ] │
├───────────────────────────────────────┤
│  [ ] Buy groceries           [Delete] │
│  [x] Finish report           [Delete] │
│  [ ] Call the dentist        [Delete] │
└───────────────────────────────────────┘

Project Plan

FIVE STEPS
1. Create the page structure
2. Add the style
3. Add tasks with JavaScript
4. Complete and delete tasks
5. Test and polish
→ Each step ends with a browser check

Step 1: Create the Structure

Create a file named index.html. Type a comment that describes the page and let Copilot draft the markup.

PROMPT (as a comment):
<!-- Page with a heading, a text input, an Add button, and an empty list -->

COPILOT SUGGESTS:
<h1>My Tasks</h1>
<input type="text" id="taskInput" placeholder="Type a task here...">
<button id="addBtn">Add</button>
<ul id="taskList"></ul>

Step 2: Add the Style

Ask Copilot for clean, simple styling. Mention the look you want, such as centered, rounded, and light.

PROMPT: Style the page with a centered card, rounded corners,
        light gray background, and spaced list items

RESULT: CSS rules for body, input, button, and list items

Step 3: Add Tasks

Write a comment in your script file and review the code Copilot proposes.

// When Add is clicked, read the input, create a list item, and clear the input

const input = document.getElementById('taskInput');
const addBtn = document.getElementById('addBtn');
const list = document.getElementById('taskList');

addBtn.addEventListener('click', () => {
  const text = input.value.trim();
  if (text === '') return;
  const li = document.createElement('li');
  li.textContent = text;
  list.appendChild(li);
  input.value = '';
});

Test the page. Type a task, click Add, and confirm that it appears. Try an empty entry and confirm that nothing happens.

Step 4: Complete and Delete

Ask Copilot to extend the code so a click on a task toggles a done style, and a Delete button removes the item.

PROMPT: Clicking a task toggles the class "done".
        Each task gets a Delete button that removes it.

COPILOT ADDS:
li.addEventListener('click', () => li.classList.toggle('done'));
const del = document.createElement('button');
del.textContent = 'Delete';
del.addEventListener('click', (e) => {
  e.stopPropagation();
  li.remove();
});
li.appendChild(del);

Step 5: Test and Polish

Ask Copilot to review the code for problems and to suggest improvements. Typical ideas include saving tasks in the browser so they survive a refresh, allowing the Enter key to add a task, and showing a count of remaining tasks.

TEST LIST
[ ] Add a normal task
[ ] Add a very long task
[ ] Try an empty task
[ ] Mark a task done and undo it
[ ] Delete the first, middle, and last tasks
[ ] Refresh the page and watch what happens

Ask Copilot to Write Tests

Select your task function and use the tests command. Copilot generates checks for adding, completing, and deleting tasks. Run the tests and fix any failures with the fix command.

Extend the Project

Add Due Dates

Ask Copilot to add a date field and sort tasks by the nearest date.

Add Categories

Group tasks into work, home, and study with a drop-down menu.

Add Documentation

Use the doc command to write a README that explains how to run the project.

What You Practiced

This project used comments as prompts, inline suggestions, chat questions, slash commands, and careful review. Repeat the same pattern on a new idea, such as a budget tracker or a quiz page. Each small project strengthens your skill and your trust in your own judgment.