Skip to content

Commit 1ef1ec4

Browse files
committed
feat: added new quotes and claude skill
1 parent ee62729 commit 1ef1ec4

File tree

4 files changed

+326
-0
lines changed

4 files changed

+326
-0
lines changed

.claude/commands/add-quote.md

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
# Add Quote
2+
3+
You are helping the user add one or more tech quotes to this repository. Follow these steps carefully:
4+
5+
## Step 1: Get Quote Information
6+
7+
Ask the user to provide quote information. They can provide:
8+
- **Single quote**: Just the quote text and author's name
9+
- **Multiple quotes**: A list of quotes, each with quote text and author's name
10+
11+
Format examples:
12+
- Single: "Quote text" - Author Name
13+
- Multiple: Numbered list or multiple quote/author pairs
14+
15+
## Step 2: Verify Quote Authenticity (For Each Quote)
16+
17+
CRITICAL: For EACH quote, verify it is legitimate and correctly attributed:
18+
1. Use WebSearch to search for the quote text along with the author's name
19+
2. Look for reliable sources that confirm:
20+
- The quote is real (not fabricated or misattributed)
21+
- The author attribution is correct
22+
- The exact wording matches reputable sources
23+
3. If you find discrepancies:
24+
- Inform the user about the issue (e.g., quote is commonly misattributed, slightly different wording exists, etc.)
25+
- Show them what you found and ask if they want to proceed with corrections
26+
- If the quote appears to be fabricated or cannot be verified, recommend NOT adding it
27+
4. If the quote is verified as authentic and correctly attributed, proceed to Step 3
28+
5. **For multiple quotes**: Verify all quotes before proceeding to add any of them
29+
30+
## Step 3: Check if Quotes Already Exist
31+
32+
CRITICAL: Before adding any quotes, verify none of them already exist:
33+
1. Read the `src/quotes.ts` file ONCE
34+
2. For EACH quote, search for the quote text (check for exact matches or very similar wording)
35+
3. If any quote already exists:
36+
- Inform the user that this quote is already in the database
37+
- Show them the existing quote details (ID, author, etc.)
38+
- Ask if they want to skip it or add a different quote instead
39+
- Do NOT add duplicates
40+
4. Only proceed with quotes that are new
41+
42+
## Step 4: Check for Existing Authors
43+
44+
IMPORTANT: For EACH quote, check if the author already exists in `src/quotes.ts`:
45+
1. Search for the author name (check for slight variations in naming, e.g., "E.W. Dijkstra" vs "Edsger Dijkstra")
46+
2. If the author exists:
47+
- Use the EXACT same `authorName` spelling
48+
- Use the EXACT same `authorDescription` classification
49+
- Use the EXACT same `authorWiki` URL (if present)
50+
- This ensures consistency across all quotes by the same author
51+
3. Build a list of authors that need to be researched (those not in the database)
52+
4. If all authors exist, proceed to Step 6
53+
5. If any authors are new, proceed to Step 5
54+
55+
## Step 5: Research New Authors (For Each New Author)
56+
57+
For EACH author that doesn't exist in the database, use WebSearch to find information:
58+
- Search for "{author name} Wikipedia" or "{author name} profession"
59+
- Determine the most appropriate classification from the allowed `AuthorDescription` types in `src/quotes.ts`:
60+
- 'Artist', 'Author', 'Composer', 'Computer Scientist', 'Designer', 'Director', 'Engineer', 'Entrepreneur', 'Hacker', 'Historian', 'Inventor', 'Linguist', 'Journalist', 'Martial Artist', 'Mathematician', 'Military Officer', 'Philosopher', 'Physicist', 'Scientist', 'Software Developer', 'Ethnographer'
61+
- Find the Wikipedia URL (format: `https://en.wikipedia.org/wiki/{Article_Name}`)
62+
- If the author doesn't have a Wikipedia page, the `authorWiki` field should be omitted
63+
- **For multiple quotes with the same new author**: Only research the author once and reuse the information
64+
65+
## Step 6: Add the Quotes
66+
67+
1. Prepare all quote objects to be added, following this format:
68+
```typescript
69+
{
70+
text: 'Quote text here',
71+
authorName: 'Author Name',
72+
authorDescription: 'Appropriate Classification',
73+
authorWiki: 'https://en.wikipedia.org/wiki/Article_Name' // omit if no Wikipedia page
74+
}
75+
```
76+
2. **For single quote**: Use the Edit tool to add the quote at the end of the quotes array (before the closing `]`)
77+
3. **For multiple quotes**: Use the Edit tool to add ALL quotes at once, appending them all at the end of the quotes array (before the closing `]`), with proper comma separation
78+
4. Ensure proper TypeScript formatting and escaping (especially for single quotes in text: use `\'`)
79+
80+
## Step 7: Validate and Build
81+
82+
1. Run `npm test` to ensure linting and type checking pass
83+
2. If tests fail, fix any issues and re-run
84+
3. Run `npm run build` to generate the static API files
85+
4. Verify the build completed successfully
86+
87+
## Step 8: Confirm Success
88+
89+
**For single quote:**
90+
1. Read the newly generated quote file from `dist/quotes/{id}.json` to verify it was created correctly
91+
2. Read the author file from `dist/authors/{author-slug}.json` to verify it was created/updated correctly
92+
3. Show the user:
93+
- The quote ID assigned
94+
- The quote JSON
95+
- A confirmation that the quote was successfully added
96+
97+
**For multiple quotes:**
98+
1. Read ALL newly generated quote files from `dist/quotes/{id}.json` to verify they were created correctly
99+
2. Read relevant author files from `dist/authors/{author-slug}.json` to verify they were created/updated correctly
100+
3. Show the user a summary table with:
101+
- Number of quotes added
102+
- Quote IDs assigned
103+
- Authors (new and existing)
104+
- Brief preview of each quote
105+
4. Provide a confirmation that all quotes were successfully added
106+
107+
## Important Notes
108+
109+
- **ALWAYS verify quote authenticity** using web search before adding it (for EACH quote when adding multiple)
110+
- **ALWAYS check if the quote already exists** to prevent duplicates (for EACH quote when adding multiple)
111+
- **ALWAYS check for existing authors** to maintain consistency across all quotes
112+
- If a quote cannot be verified or appears misattributed, DO NOT add it without user confirmation
113+
- The quote text should be added exactly as verified from reliable sources
114+
- Pay attention to proper escaping of single quotes in the text (use `\'`)
115+
- The `authorDescription` must exactly match one of the allowed types in the TypeScript enum
116+
- Author information (name, classification, wiki URL) must be identical across all quotes by the same author
117+
- **When adding multiple quotes**: Process verification in parallel when possible (multiple WebSearch calls), but add all quotes in a single Edit operation
118+
- **Batch operations**: Only run `npm test` and `npm run build` ONCE after all quotes are added

CLAUDE.md

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Project Overview
6+
7+
Tech-quotes is a static API for tech-related quotes, powered by GitHub Pages. The project uses TypeScript and generates static JSON files for quotes and authors that are served via GitHub Pages.
8+
9+
## Development Commands
10+
11+
### Test
12+
```bash
13+
npm test
14+
```
15+
Runs ESLint on TypeScript files and performs type checking with `tsc`. No separate unit tests exist.
16+
17+
### Build
18+
```bash
19+
npm run build
20+
```
21+
Removes the `dist` folder and executes the build script using Node.js with `tsx` loader. This generates all static JSON files, HTML files, and OpenAPI specifications.
22+
23+
## Architecture
24+
25+
### Data Source (`src/quotes.ts`)
26+
- **Single source of truth**: All quotes are defined in a TypeScript array of `RawQuote` objects
27+
- Each quote contains: `text`, `authorName`, `authorDescription`, and optional `authorWiki` URL
28+
- The file exports TypeScript interfaces: `RawQuote`, `Quote`, `Author`, `AuthorWithQuotes`, `AuthorDescription`
29+
30+
### Build Process (`scripts/build.ts`)
31+
The build script transforms the raw quote data into a static API structure:
32+
33+
1. **Directory Creation**: Creates `dist/`, `dist/quotes/`, and `dist/authors/` directories
34+
2. **Quote Processing**:
35+
- Generates individual JSON files for each quote (`quotes/{id}.json`)
36+
- Creates `quotes/all.json` with all quotes
37+
- Creates `quotes/stats.json` with metadata
38+
3. **Author Processing**:
39+
- Aggregates quotes by author
40+
- Generates individual JSON files for each author (`authors/{author-id}.json`)
41+
- Creates `authors/all.json` with all author IDs
42+
- Creates `authors/stats.json` with metadata
43+
4. **Additional Files**:
44+
- Copies and converts OpenAPI spec from YAML to JSON
45+
- Creates `index.html` (redirects to GitHub repo)
46+
- Creates `404.html`
47+
48+
### Key Design Patterns
49+
- **Slug Generation**: Author IDs are created using `slugify` with lowercase and strict mode
50+
- **URL Construction**: Base URL is configurable via `BASE_URL` environment variable (defaults to GitHub Pages URL)
51+
- **Type Safety**: Full TypeScript typing throughout with strict mode enabled
52+
53+
## Adding New Quotes
54+
55+
To add a new quote:
56+
57+
1. Edit `src/quotes.ts`
58+
2. Append a new object to the `quotes` array following the `RawQuote` interface
59+
3. Ensure `authorDescription` matches one of the allowed `AuthorDescription` types
60+
4. Run `npm run test && npm run build` to validate and regenerate the API
61+
5. Commit changes
62+
63+
## Configuration
64+
65+
- **TypeScript**: Uses NodeNext module resolution, ESNext target, strict mode enabled
66+
- **ESLint**: Extends `standard-with-typescript` configuration
67+
- **Node Version**: The project uses ES modules (`"type": "module"` in package.json)
68+
- **Module Loader**: Uses `--import tsx` for running TypeScript files directly
69+
70+
## Output Structure
71+
72+
The build generates a GitHub Pages-compatible static site in `dist/`:
73+
```
74+
dist/
75+
├── index.html (redirects to GitHub)
76+
├── 404.html
77+
├── openapi.yml
78+
├── openapi.json
79+
├── quotes/
80+
│ ├── stats.json
81+
│ ├── all.json
82+
│ ├── 0.json
83+
│ ├── 1.json
84+
│ └── ...
85+
└── authors/
86+
├── stats.json
87+
├── all.json
88+
├── {author-slug}.json
89+
└── ...
90+
```

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,25 @@ Returns
205205

206206
If you want to suggest a new tech quote here's how you can do that.
207207

208+
### Using Claude Code
209+
210+
If you're using [Claude Code](https://claude.ai/code), there's a convenient slash command available:
211+
212+
```bash
213+
/add-quote
214+
```
215+
216+
This command will guide you through the process of adding a new quote, including:
217+
- Verifying the quote is authentic and correctly attributed using web search
218+
- Checking for duplicate quotes
219+
- Checking for existing authors to ensure consistency
220+
- Researching the author and finding the appropriate classification
221+
- Adding the quote to `src/quotes.ts`
222+
- Running tests and building the static API files
223+
- Verifying the quote was added successfully
224+
225+
### Manual Process
226+
208227
- [Fork this repository](https://github.com/FullStackBulletin/tech-quotes/fork)
209228
- Edit the file [`src/quotes.ts`](/src/quotes.ts) and append the new fact at the bottom (make sure to follow the spec provided by the specific TypeScript types).
210229
- Run `npm run test && npm run build`

src/quotes.ts

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1190,6 +1190,105 @@ const quotes: RawQuote[] = [
11901190
text: 'Don\'t shoot a fly with a cannon',
11911191
authorName: 'Paolo Insogna',
11921192
authorDescription: 'Engineer'
1193+
},
1194+
{
1195+
text: 'The essential part of any program, the theory of it, is something that could not conceivably be expressed, but is inextricably bound to human beings.',
1196+
authorName: 'Peter Naur',
1197+
authorDescription: 'Computer Scientist',
1198+
authorWiki: 'https://en.wikipedia.org/wiki/Peter_Naur'
1199+
},
1200+
{
1201+
text: 'The most powerful tool we have as developers is automation',
1202+
authorName: 'Scott Hanselman',
1203+
authorDescription: 'Software Developer'
1204+
},
1205+
{
1206+
text: 'The only way to go fast, is to go well',
1207+
authorName: 'Robert C. Martin',
1208+
authorDescription: 'Software Developer',
1209+
authorWiki: 'https://en.wikipedia.org/wiki/Robert_C._Martin'
1210+
},
1211+
{
1212+
text: 'Controlling complexity is the essence of computer programming',
1213+
authorName: 'Brian Kernighan',
1214+
authorDescription: 'Computer Scientist',
1215+
authorWiki: 'https://en.wikipedia.org/wiki/Brian_Kernighan'
1216+
},
1217+
{
1218+
text: 'If you can\'t deploy your service, it\'s not done',
1219+
authorName: 'Jez Humble',
1220+
authorDescription: 'Software Developer'
1221+
},
1222+
{
1223+
text: 'One of my most productive days was throwing away 1000 lines of code',
1224+
authorName: 'Ken Thompson',
1225+
authorDescription: 'Computer Scientist',
1226+
authorWiki: 'https://en.wikipedia.org/wiki/Ken_Thompson'
1227+
},
1228+
{
1229+
text: 'Data trumps intuition',
1230+
authorName: 'Peter Norvig',
1231+
authorDescription: 'Computer Scientist',
1232+
authorWiki: 'https://en.wikipedia.org/wiki/Peter_Norvig'
1233+
},
1234+
{
1235+
text: 'Choose boring technology',
1236+
authorName: 'Dan McKinley',
1237+
authorDescription: 'Software Developer'
1238+
},
1239+
{
1240+
text: 'Shipping first-time code is like going into debt. A little debt speeds development so long as it is paid back promptly with refactoring',
1241+
authorName: 'Ward Cunningham',
1242+
authorDescription: 'Software Developer',
1243+
authorWiki: 'https://en.wikipedia.org/wiki/Ward_Cunningham'
1244+
},
1245+
{
1246+
text: 'Design is not just what it looks like and feels like. Design is how it works',
1247+
authorName: 'Steve Jobs',
1248+
authorDescription: 'Entrepreneur',
1249+
authorWiki: 'https://en.wikipedia.org/wiki/Steve_Jobs'
1250+
},
1251+
{
1252+
text: 'A little duplication is better than a little dependency',
1253+
authorName: 'John Ousterhout',
1254+
authorDescription: 'Computer Scientist',
1255+
authorWiki: 'https://en.wikipedia.org/wiki/John_Ousterhout'
1256+
},
1257+
{
1258+
text: 'The purpose of computing is insight, not numbers',
1259+
authorName: 'Richard Hamming',
1260+
authorDescription: 'Mathematician',
1261+
authorWiki: 'https://en.wikipedia.org/wiki/Richard_Hamming'
1262+
},
1263+
{
1264+
text: 'Any organization that designs a system will produce a design whose structure is a copy of the organization\'s communication structure',
1265+
authorName: 'Melvin Conway',
1266+
authorDescription: 'Computer Scientist',
1267+
authorWiki: 'https://en.wikipedia.org/wiki/Melvin_Conway'
1268+
},
1269+
{
1270+
text: 'Adding manpower to a late software project makes it later',
1271+
authorName: 'Frederick P. Brooks Jr.',
1272+
authorDescription: 'Computer Scientist',
1273+
authorWiki: 'https://en.wikipedia.org/wiki/Fred_Brooks'
1274+
},
1275+
{
1276+
text: 'The future is uncertain and you will never know less than you know right now',
1277+
authorName: 'Sandi Metz',
1278+
authorDescription: 'Software Developer',
1279+
authorWiki: 'https://en.wikipedia.org/wiki/Sandi_Metz'
1280+
},
1281+
{
1282+
text: 'The problem with poorly designed small applications is that if they are successful, they grow up to be poorly designed big applications',
1283+
authorName: 'Sandi Metz',
1284+
authorDescription: 'Software Developer',
1285+
authorWiki: 'https://en.wikipedia.org/wiki/Sandi_Metz'
1286+
},
1287+
{
1288+
text: 'The first way design fails is due to lack of it',
1289+
authorName: 'Sandi Metz',
1290+
authorDescription: 'Software Developer',
1291+
authorWiki: 'https://en.wikipedia.org/wiki/Sandi_Metz'
11931292
}
11941293
]
11951294

0 commit comments

Comments
 (0)