Up & Running with GitHub Spec Kit #2 - The /constitution Command

Net Ninja · Beginner ·💻 AI-Assisted Coding ·8mo ago

Key Takeaways

The video demonstrates how to use GitHub Spec Kit with Copilot to implement a spec-driven workflow, utilizing the /constitution command to update the constitution file and ensure adherence to project principles.

Full Transcript

Okay then my friends. Now we have spec kit set up inside the project. We can begin the specd driven development cycle. And we're going to start by using the constitution command to update the constitution file. So if we take a look inside the specify folder inside that we're going to see a constitution.mmd file within the memory directory. So this is just a markdown file that already contains a bit of template within it. And the whole premise of this constitution file is to outline some governing principles for your project or organization which are non-negotiable. For example, if accessibility should always be first and forefront no matter what, then that should go in your constitution file. If you must use certain frameworks or libraries like Next or Drizzle OM without fail, then that should go in your constitution file. If the UX must always be clean, simple, and clear no matter what, then that should go in your constitution file. And if you must unit test every single component, that should go in your constitution file. Then that file will be kept as memory for the coding agent to refer back to and ensure no matter what feature or task is being implemented, these principles are adhered to. Well, that's the idea anyway. So then we could manually fill this constitution file in ourselves or we could just use the constitution command that specit gave to us in copilot. So I could type forward slash constitution followed by a bit of input as to what kind of principles I want to put in this file. Now I'm just going to paste that in right now to save you watching me type this out from scratch. But it says, "Declare principles for clean code, simple UX, responsive design, and minimal dependencies, absolutely no testing, no unit tests, no integration tests, no end to end tests. This must supersede any other guidance. The project must use the Nex.js, React, and Tailwind versions as per the package.json file. And we can attach that file if we wanted to as context to the prompt as well. Now, I've deliberately pulled right back on the testing for two reasons. First, because I think the prompts that SpecKit provides are geared towards test-driven development, which can take a lot of time. And because this is only going to be a dummy throwaway app for a tutorial video, I want to pull back on that a lot. So you might see me occasionally trying to do that like in this constitution file. But for an application intended for production, I probably wouldn't pull back as much and instead I'd outline my testing preferences. And by the way, I would try this whole process out with different models, right? Because they do produce different results. I personally like Sonic for this stage because it goes through step by step in real time what it's doing and I can see that. But when it comes to making tasks, sometimes I might switch to GPT5. So definitely play around yourself and see what suits you best. Anyway, we're going to fire this off in a moment. And when we do that, because we use the constitution command, Copilot is going to find that custom constitution prompt in the GitHub folder and it's going to run it. So let's open that up and have a quick look inside to see exactly what it says. And by the way, it might read differently on yours because SpecKit is very new and there's changes coming thick and fast. But right here it says the user input is the dollar sign arguments and this arguments thing is how we access what a user types after the command no matter what that command is. So if we typed constitution to run that command which in turn fires this constitution prompt then any words typed directly after that command in the chat would be taken as the arguments and those arguments can then be accessed in this prompt and by the coding agent if we tell it to. Right? So then it also tells the agent to update the constitution file in the memory folder and to replace any placeholder tokens in square brackets based on our input after the command. And down here it provides concrete details on how to do that. So first of all it explains how to find the file and which parts to update. Then it tells the agent to collect possible values for the placeholders based on our import the arguments. After that, it instructs it to replace all those placeholder token values with values derived from our collected input. It also might update other specit template files based on this constitution to make sure they're in alignment with it. There's a few other steps down here as well after the agents filled in the blanks to make sure everything checks out correctly and the type of feedback it should give us in the chat when it's done. But essentially when we run this constitution command, it fires the constitution prompt which tells the coding agent to fill in the constitution file in the memory folder by extracting any input we give it and using that to fill in any placeholder tokens. And when we open this, we can see it's basically just a template with a bunch of different placeholders for different principles. And these are the placeholders copilot or whatever other coding agent you're using should be updating with our principles that we gave it. So then this constitution file would serve as a reference to all future specs or plans or code generated by the coding agent with the goal being that anything in this file should trump all other information because these are your non-negotiable principles. All right, so now let's close some of these files and we're going to hit enter on the prompt to see if it does what it should do. Now, it might take a little bit of time to complete, and along the way, it might ask us for permission to do certain things, which I'm going to give it. But right now, I'm just going to speed this up and come back when it's done. All right, so it looks like it's all done and you can see the output right here. If we scroll up a little bit, this is the kind of summary. So it says it successfully created the constitution with our specified principles. And down here it just lists the different principles we gave it. So clean code, simple UX, responsive design, minimal dependencies, and then also it's been very explicit in the no testing policy. So much so that it's gone to update other files as well. So if we click off this, you can see not only did we update the constitution file, but we also updated three other template files right here. And prior to running this command, these template files had in them information about testing the different features that we implement. And because I said, look, this is a non-negotiable thing that I want to put in the constitution, it's gone into all of these different files, read them, and updated them where it had any kind of testing in place and removed them or updated them to be explicit in that we don't want testing in place. So, that was good. Not only does it update this file, it updates other template files as well. All right, so let's just have a little scroll through this constitution file. And you can see now all of those placeholders are gone, right? And it's updated it with actual content. So this is the first core principle, clean code. I'm not going to read all of this out, but basically it's saying that the code must be readable, maintainable, etc., etc. And then down here we have a simple UX principle. Uh, then we have responsive design. I don't know whether I actually said to implement the responsive design. Let's have a little look if we scroll right up here because I can't remember saying that. Maybe I did. Simple. Oh, yeah, I did. Responsive design. Okay, so yeah, that is the next principle. Responsive design, minimal dependencies. Uh the technology stack is down here. So it's looked at the package.json file and found the different technologies we're using and put the versions here. Uh the development workflow down here. So code changes must be manually verified. Blah blah blah. Yeah. Governance. All right. So yeah, that all looks pretty good to me. I'm not going to go through these other files. I'm going to trust that it's updated them accordingly. What I am going to do is just commit these changes. So I'm going to use copilot to come up with the commit message. Commit that. All right. Okay then. So now we've run this first command which updates the constitution file with any governing principles. In turn that also updates any other template files in accordance with those principles so that when we come to use them later they'll incorporate that information. So going forward when we start to use other commands the idea is that this constitution file serves as memory or guidance to the coding agent and forces it to stay within these outlined principles. So we're kind of putting walls around the application and we're saying stay within these boundaries at all times. Anyway, now that's done, the next step is to start making a spec for a new feature, which we'll do in the next lesson.

Original Description

In this Spec Kit tutorial series / crash course, we'll see how it can be used to implement a spec-driven workflow with various AI coding agents like Claude Code and Copilot (we'll be using Copilot). 🍿🥷🏼 Get early access to this entire course: https://netninja.dev/p/up-running-with-spec-kit 🧠🥷🏼 Get the Git and GitHub Masterclass Course: https://netninja.dev/p/git-github-masterclass 🔥🥷🏼 Get instant access to ALL premium courses on NetNinja.dev: https://netninja.dev/ Other Course Links: 🔗👇 Get Spec Kit: https://github.com/github/spec-kit 🔗👇 Spec Kit docs: https://github.github.io/spec-kit/
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from Net Ninja · Net Ninja · 0 of 60

← Previous Next →
1 Regular Expressions (RegEx) Tutorial #14 - Matching a Username
Regular Expressions (RegEx) Tutorial #14 - Matching a Username
Net Ninja
2 Regular Expressions (RegEx) Tutorial #15 - Email RegEx Pattern
Regular Expressions (RegEx) Tutorial #15 - Email RegEx Pattern
Net Ninja
3 Regular Expressions (RegEx) Tutorial #16 - Finishing Touches
Regular Expressions (RegEx) Tutorial #16 - Finishing Touches
Net Ninja
4 GraphQL Tutorial #1 - Introduction to GraphQL
GraphQL Tutorial #1 - Introduction to GraphQL
Net Ninja
5 GraphQL Tutorial #2 - A Birdseye View of GraphQL
GraphQL Tutorial #2 - A Birdseye View of GraphQL
Net Ninja
6 GraphQL Tutorial #3 - Project (stack) Overview
GraphQL Tutorial #3 - Project (stack) Overview
Net Ninja
7 GraphQL Tutorial #4 - Making Queries (front-end preview)
GraphQL Tutorial #4 - Making Queries (front-end preview)
Net Ninja
8 GraphQL Tutorial #5 - Express App Setup
GraphQL Tutorial #5 - Express App Setup
Net Ninja
9 GraphQL Tutorial #6 - Setting up GraphQL
GraphQL Tutorial #6 - Setting up GraphQL
Net Ninja
10 GraphQL Tutorial #7 - GraphQL Schema
GraphQL Tutorial #7 - GraphQL Schema
Net Ninja
11 GraphQL Tutorial #8 - Root Query
GraphQL Tutorial #8 - Root Query
Net Ninja
12 GraphQL Tutorial #9 - The Resolve Function
GraphQL Tutorial #9 - The Resolve Function
Net Ninja
13 GraphQL Tutorial #10 - Testing Queries in Graphiql
GraphQL Tutorial #10 - Testing Queries in Graphiql
Net Ninja
14 GraphQL Tutorial #11 - GraphQL ID Type
GraphQL Tutorial #11 - GraphQL ID Type
Net Ninja
15 GraphQL Tutorial #12 - Author Type
GraphQL Tutorial #12 - Author Type
Net Ninja
16 GraphQL Tutorial #13 - Type Relations
GraphQL Tutorial #13 - Type Relations
Net Ninja
17 GraphQL Tutorial #14 - GraphQL Lists
GraphQL Tutorial #14 - GraphQL Lists
Net Ninja
18 GraphQL Tutorial #15 - More on Root Queries
GraphQL Tutorial #15 - More on Root Queries
Net Ninja
19 GraphQL Tutorial #16 - Connecting to mLab
GraphQL Tutorial #16 - Connecting to mLab
Net Ninja
20 GraphQL Tutorial #17 - Mongoose Models
GraphQL Tutorial #17 - Mongoose Models
Net Ninja
21 GraphQL Tutorial #18 - Mutations
GraphQL Tutorial #18 - Mutations
Net Ninja
22 GraphQL Tutorial #19 - More on Mutations
GraphQL Tutorial #19 - More on Mutations
Net Ninja
23 GraphQL Tutorial #20 - Updating the Resolve Functions
GraphQL Tutorial #20 - Updating the Resolve Functions
Net Ninja
24 GraphQL Tutorial #21 - GraphQL NonNull
GraphQL Tutorial #21 - GraphQL NonNull
Net Ninja
25 GraphQL Tutorial #22 - Adding a Front-end
GraphQL Tutorial #22 - Adding a Front-end
Net Ninja
26 GraphQL Tutorial #23 - Create React App
GraphQL Tutorial #23 - Create React App
Net Ninja
27 GraphQL Tutorial #24 - Book List Component
GraphQL Tutorial #24 - Book List Component
Net Ninja
28 GraphQL Tutorial #25 - Apollo Client Setup
GraphQL Tutorial #25 - Apollo Client Setup
Net Ninja
29 GraphQL Tutorial #26 - Making Queries from React
GraphQL Tutorial #26 - Making Queries from React
Net Ninja
30 GraphQL Tutorial #27 - Rendering Data in a Component
GraphQL Tutorial #27 - Rendering Data in a Component
Net Ninja
31 GraphQL Tutorial #28 - Add Book Component
GraphQL Tutorial #28 - Add Book Component
Net Ninja
32 GraphQL Tutorial #29 - External Query File
GraphQL Tutorial #29 - External Query File
Net Ninja
33 GraphQL Tutorial #30 - Updating Component State
GraphQL Tutorial #30 - Updating Component State
Net Ninja
34 GraphQL Tutorial #31 - Composing Queries
GraphQL Tutorial #31 - Composing Queries
Net Ninja
35 GraphQL Tutorial #32 - query variables
GraphQL Tutorial #32 - query variables
Net Ninja
36 GraphQL Tutorial #33 - Re-fetching Queries
GraphQL Tutorial #33 - Re-fetching Queries
Net Ninja
37 GraphQL Tutorial #34 - Book Details Component
GraphQL Tutorial #34 - Book Details Component
Net Ninja
38 GraphQL Tutorial #36 - Styling the App
GraphQL Tutorial #36 - Styling the App
Net Ninja
39 GraphQL Tutorial #35 - Making a Single Query
GraphQL Tutorial #35 - Making a Single Query
Net Ninja
40 Build Apps with Vue & Firebase - Udemy Course
Build Apps with Vue & Firebase - Udemy Course
Net Ninja
41 Updated Vue & Firebase Course (Udemy)
Updated Vue & Firebase Course (Udemy)
Net Ninja
42 Vue & Firebase Real-time Chat (Preview) #1 - Intro
Vue & Firebase Real-time Chat (Preview) #1 - Intro
Net Ninja
43 Vue & Firebase Real-time Chat (Preview) #2 - Project Structure
Vue & Firebase Real-time Chat (Preview) #2 - Project Structure
Net Ninja
44 Vue & Firebase Real-time Chat (Preview) #3 - Firestore Setup
Vue & Firebase Real-time Chat (Preview) #3 - Firestore Setup
Net Ninja
45 Vue & Firebase Real-time Chat (Preview) #4 - Welcome Screen
Vue & Firebase Real-time Chat (Preview) #4 - Welcome Screen
Net Ninja
46 Vue & Firebase Real-time Chat (Preview) #5 - Props in Routes
Vue & Firebase Real-time Chat (Preview) #5 - Props in Routes
Net Ninja
47 Vue & Firebase Real-time Chat (Preview) #6 - Route Guards
Vue & Firebase Real-time Chat (Preview) #6 - Route Guards
Net Ninja
48 Vue & Firebase Real-time Chat (Preview) #7 - Chat Window
Vue & Firebase Real-time Chat (Preview) #7 - Chat Window
Net Ninja
49 Vue & Firebase Real-time Chat (Preview) #8 - New Message Component
Vue & Firebase Real-time Chat (Preview) #8 - New Message Component
Net Ninja
50 Object Oriented JavaScript Tutorial #1 - Introduction
Object Oriented JavaScript Tutorial #1 - Introduction
Net Ninja
51 Object Oriented JavaScript Tutorial #2 - Object Literals
Object Oriented JavaScript Tutorial #2 - Object Literals
Net Ninja
52 Object Oriented JavaScript Tutorial #3 - Updating Properties
Object Oriented JavaScript Tutorial #3 - Updating Properties
Net Ninja
53 Object Oriented JavaScript Tutorial #4 - Classes
Object Oriented JavaScript Tutorial #4 - Classes
Net Ninja
54 Object Oriented JavaScript Tutorial #5  - Class Constructors
Object Oriented JavaScript Tutorial #5 - Class Constructors
Net Ninja
55 Object Oriented JavaScript Tutorial #6 - Class Methods
Object Oriented JavaScript Tutorial #6 - Class Methods
Net Ninja
56 Object Oriented JavaScript Tutorial #7 - Method Chaining
Object Oriented JavaScript Tutorial #7 - Method Chaining
Net Ninja
57 Object Oriented JavaScript Tutorial #8 - Class Inheritance
Object Oriented JavaScript Tutorial #8 - Class Inheritance
Net Ninja
58 Object Oriented JavaScript Tutorial #9 - Constructors (under the hood)
Object Oriented JavaScript Tutorial #9 - Constructors (under the hood)
Net Ninja
59 Object Oriented JavaScript Tutorial #10 - Prototype
Object Oriented JavaScript Tutorial #10 - Prototype
Net Ninja
60 Object Oriented JavaScript Tutorial #11 - Prototype Inheritance
Object Oriented JavaScript Tutorial #11 - Prototype Inheritance
Net Ninja

This video teaches how to use GitHub Spec Kit with Copilot to implement a spec-driven workflow, ensuring adherence to project principles and best practices. It covers the /constitution command, governing principles, and accessibility. By following this tutorial, viewers can learn how to use AI coding agents to improve their development workflow.

Key Takeaways
  1. Use the constitution command to update the constitution file
  2. Type forward slash constitution followed by input to specify principles
  3. Attach the package.json file as context to the prompt
  4. Run the constitution command to find the custom constitution prompt
  5. Access user input after the command using the arguments thing
  6. Implement responsive design
  7. Commit changes
  8. Use Copilot to come up with commit message
💡 The constitution file serves as a reference for the coding agent to ensure adherence to project principles, and the /constitution command allows for easy updates to the file.

Related Reads

📰
A Software Engineer’s Notes from a Generative AI Bootcamp
Learn how a software engineer applied generative AI concepts to their work after attending a bootcamp, and discover key takeaways for implementing AI in your own projects
Medium · Machine Learning
📰
I Copied OpenAI’s Exact Codex Setup — the One That Reviews 100% of Their PRs
Learn how to replicate OpenAI's Codex setup for reviewing 100% of pull requests
Medium · Programming
📰
Still in the Game: Why We Keep Coding Against the Machine
Learn how human coders can stay relevant in the age of AI by sharpening their skills and focusing on high-value tasks
Dev.to AI
📰
The AI Coding Agent Ecosystem in 2026: Every Major Tool, Framework, and Skill System Ranked
Learn about the AI coding agent ecosystem in 2026, including major tools, frameworks, and skill systems ranked for professionals
Dev.to AI
Up next
How to Create Presentations in Microsoft Cowork (Copilot) with Templafy MCP
Templafy
Watch →