agentbrief 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +141 -0
- package/briefs/code-reviewer/brief.yaml +8 -0
- package/briefs/code-reviewer/knowledge/review-standards.md +32 -0
- package/briefs/code-reviewer/personality.md +19 -0
- package/briefs/code-reviewer/skills/architecture-review/SKILL.md +76 -0
- package/briefs/code-reviewer/skills/review-process/SKILL.md +41 -0
- package/briefs/code-reviewer/skills/verification/SKILL.md +47 -0
- package/briefs/data-analyst/brief.yaml +8 -0
- package/briefs/data-analyst/knowledge/metrics-reference.md +43 -0
- package/briefs/data-analyst/personality.md +23 -0
- package/briefs/data-analyst/skills/metrics-framework/SKILL.md +90 -0
- package/briefs/data-analyst/skills/sql-query-builder/SKILL.md +115 -0
- package/briefs/devops-sre/brief.yaml +12 -0
- package/briefs/devops-sre/knowledge/runbook.md +69 -0
- package/briefs/devops-sre/personality.md +18 -0
- package/briefs/devops-sre/skills/ci-cd-github-actions/SKILL.md +114 -0
- package/briefs/devops-sre/skills/monitoring-observability/SKILL.md +394 -0
- package/briefs/devops-sre/skills/systematic-debugging/SKILL.md +46 -0
- package/briefs/devops-sre/skills/verification/SKILL.md +47 -0
- package/briefs/frontend-design/brief.yaml +8 -0
- package/briefs/frontend-design/knowledge/design-principles.md +43 -0
- package/briefs/frontend-design/personality.md +19 -0
- package/briefs/frontend-design/skills/design-review-checklist/SKILL.md +151 -0
- package/briefs/frontend-design/skills/web-design-guidelines/SKILL.md +39 -0
- package/briefs/fullstack-dev/brief.yaml +9 -0
- package/briefs/fullstack-dev/personality.md +18 -0
- package/briefs/growth-engineer/brief.yaml +8 -0
- package/briefs/growth-engineer/knowledge/growth-framework.md +83 -0
- package/briefs/growth-engineer/personality.md +19 -0
- package/briefs/growth-engineer/skills/analytics-setup/SKILL.md +109 -0
- package/briefs/growth-engineer/skills/brainstorming/SKILL.md +55 -0
- package/briefs/growth-engineer/skills/content-strategy/SKILL.md +93 -0
- package/briefs/growth-engineer/skills/seo-audit/SKILL.md +412 -0
- package/briefs/growth-engineer/skills/seo-audit/evals/evals.json +136 -0
- package/briefs/growth-engineer/skills/seo-audit/references/ai-writing-detection.md +200 -0
- package/briefs/nextjs-fullstack/brief.yaml +12 -0
- package/briefs/nextjs-fullstack/knowledge/conventions.md +57 -0
- package/briefs/nextjs-fullstack/personality.md +19 -0
- package/briefs/nextjs-fullstack/skills/next-best-practices/SKILL.md +153 -0
- package/briefs/nextjs-fullstack/skills/next-best-practices/async-patterns.md +87 -0
- package/briefs/nextjs-fullstack/skills/next-best-practices/bundling.md +180 -0
- package/briefs/nextjs-fullstack/skills/next-best-practices/data-patterns.md +297 -0
- package/briefs/nextjs-fullstack/skills/next-best-practices/debug-tricks.md +105 -0
- package/briefs/nextjs-fullstack/skills/next-best-practices/directives.md +73 -0
- package/briefs/nextjs-fullstack/skills/next-best-practices/error-handling.md +227 -0
- package/briefs/nextjs-fullstack/skills/next-best-practices/file-conventions.md +140 -0
- package/briefs/nextjs-fullstack/skills/next-best-practices/font.md +245 -0
- package/briefs/nextjs-fullstack/skills/next-best-practices/functions.md +108 -0
- package/briefs/nextjs-fullstack/skills/next-best-practices/hydration-error.md +91 -0
- package/briefs/nextjs-fullstack/skills/next-best-practices/image.md +173 -0
- package/briefs/nextjs-fullstack/skills/next-best-practices/metadata.md +301 -0
- package/briefs/nextjs-fullstack/skills/next-best-practices/parallel-routes.md +287 -0
- package/briefs/nextjs-fullstack/skills/next-best-practices/route-handlers.md +146 -0
- package/briefs/nextjs-fullstack/skills/next-best-practices/rsc-boundaries.md +159 -0
- package/briefs/nextjs-fullstack/skills/next-best-practices/runtime-selection.md +39 -0
- package/briefs/nextjs-fullstack/skills/next-best-practices/scripts.md +141 -0
- package/briefs/nextjs-fullstack/skills/next-best-practices/self-hosting.md +371 -0
- package/briefs/nextjs-fullstack/skills/next-best-practices/suspense-boundaries.md +67 -0
- package/briefs/nextjs-fullstack/skills/tdd/SKILL.md +53 -0
- package/briefs/product-manager/brief.yaml +8 -0
- package/briefs/product-manager/knowledge/pm-toolkit.md +51 -0
- package/briefs/product-manager/personality.md +19 -0
- package/briefs/product-manager/skills/brainstorming/SKILL.md +55 -0
- package/briefs/product-manager/skills/specification/SKILL.md +76 -0
- package/briefs/qa-engineer/brief.yaml +11 -0
- package/briefs/qa-engineer/knowledge/testing-patterns.md +54 -0
- package/briefs/qa-engineer/personality.md +24 -0
- package/briefs/qa-engineer/skills/qa-test-and-fix/SKILL.md +101 -0
- package/briefs/qa-engineer/skills/regression-testing/SKILL.md +95 -0
- package/briefs/security-auditor/brief.yaml +12 -0
- package/briefs/security-auditor/knowledge/code-patterns.md +49 -0
- package/briefs/security-auditor/knowledge/owasp-cheatsheet.md +75 -0
- package/briefs/security-auditor/personality.md +23 -0
- package/briefs/security-auditor/skills/security-review/SKILL.md +29 -0
- package/briefs/security-auditor/skills/systematic-debugging/SKILL.md +46 -0
- package/briefs/security-auditor/skills/verification/SKILL.md +47 -0
- package/briefs/startup-builder/brief.yaml +8 -0
- package/briefs/startup-builder/knowledge/startup-phases.md +64 -0
- package/briefs/startup-builder/personality.md +18 -0
- package/briefs/startup-builder/skills/ceo-review/SKILL.md +95 -0
- package/briefs/startup-builder/skills/launch-strategy/SKILL.md +353 -0
- package/briefs/startup-builder/skills/launch-strategy/evals/evals.json +91 -0
- package/briefs/startup-builder/skills/tdd/SKILL.md +53 -0
- package/briefs/startup-builder/skills/verification/SKILL.md +47 -0
- package/briefs/startup-kit/brief.yaml +9 -0
- package/briefs/startup-kit/personality.md +18 -0
- package/briefs/tech-writer/brief.yaml +8 -0
- package/briefs/tech-writer/knowledge/style-guide.md +54 -0
- package/briefs/tech-writer/personality.md +19 -0
- package/briefs/tech-writer/skills/api-documentation/SKILL.md +390 -0
- package/briefs/tech-writer/skills/plan-and-execute/SKILL.md +54 -0
- package/briefs/tech-writer/skills/release-notes/SKILL.md +77 -0
- package/briefs/typescript-strict/brief.yaml +8 -0
- package/briefs/typescript-strict/knowledge/type-patterns.md +117 -0
- package/briefs/typescript-strict/personality.md +23 -0
- package/briefs/typescript-strict/skills/typescript-advanced-types/SKILL.md +717 -0
- package/dist/brief.d.ts +13 -0
- package/dist/brief.d.ts.map +1 -0
- package/dist/brief.js +90 -0
- package/dist/brief.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +180 -0
- package/dist/cli.js.map +1 -0
- package/dist/compiler.d.ts +25 -0
- package/dist/compiler.d.ts.map +1 -0
- package/dist/compiler.js +253 -0
- package/dist/compiler.js.map +1 -0
- package/dist/index.d.ts +54 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +255 -0
- package/dist/index.js.map +1 -0
- package/dist/injector.d.ts +17 -0
- package/dist/injector.d.ts.map +1 -0
- package/dist/injector.js +76 -0
- package/dist/injector.js.map +1 -0
- package/dist/lock.d.ts +8 -0
- package/dist/lock.d.ts.map +1 -0
- package/dist/lock.js +50 -0
- package/dist/lock.js.map +1 -0
- package/dist/resolver.d.ts +24 -0
- package/dist/resolver.d.ts.map +1 -0
- package/dist/resolver.js +135 -0
- package/dist/resolver.js.map +1 -0
- package/dist/types.d.ts +61 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +15 -0
- package/dist/types.js.map +1 -0
- package/package.json +64 -0
- package/registry.yaml +91 -0
- package/templates/default/brief.yaml +7 -0
- package/templates/default/knowledge/.gitkeep +0 -0
- package/templates/default/personality.md +12 -0
- package/templates/security/brief.yaml +6 -0
- package/templates/security/knowledge/.gitkeep +0 -0
- package/templates/security/personality.md +20 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: tdd
|
|
3
|
+
description: Red-green-refactor cycle for test-driven development
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
> Methodology from [obra/superpowers](https://github.com/obra/superpowers) (MIT)
|
|
7
|
+
|
|
8
|
+
# Test-Driven Development (TDD)
|
|
9
|
+
|
|
10
|
+
Iron law: **no production code without a preceding failing test.**
|
|
11
|
+
|
|
12
|
+
## The RED-GREEN-REFACTOR Cycle
|
|
13
|
+
|
|
14
|
+
### RED -- Write a Failing Test
|
|
15
|
+
|
|
16
|
+
1. Identify the next smallest behavior to implement.
|
|
17
|
+
2. Write a test that asserts that behavior.
|
|
18
|
+
3. Run the test suite. Confirm the new test **fails** for the right reason.
|
|
19
|
+
4. If it passes already, your test is not testing new behavior -- rewrite it.
|
|
20
|
+
|
|
21
|
+
### GREEN -- Make It Pass
|
|
22
|
+
|
|
23
|
+
1. Write the **minimum** production code to make the failing test pass.
|
|
24
|
+
2. Do not add extra logic, handle future cases, or optimize.
|
|
25
|
+
3. Run the test suite. All tests must be green.
|
|
26
|
+
4. If other tests broke, fix them before moving on.
|
|
27
|
+
|
|
28
|
+
### REFACTOR -- Clean Up
|
|
29
|
+
|
|
30
|
+
1. Look at the code you just wrote. Remove duplication, improve naming, simplify.
|
|
31
|
+
2. Run the test suite after every refactor step. Stay green.
|
|
32
|
+
3. Do not add new behavior during refactor -- that requires a new RED step.
|
|
33
|
+
|
|
34
|
+
## Practical Rules
|
|
35
|
+
|
|
36
|
+
- One assertion per test when possible. Focused tests give clearer failure messages.
|
|
37
|
+
- Name tests by behavior: `should reject expired tokens`, not `test_validate_3`.
|
|
38
|
+
- Keep the cycle short: aim for minutes per iteration, not hours.
|
|
39
|
+
- If you are stuck making a test pass, the step is too big. Write a simpler test first.
|
|
40
|
+
- Commit after each GREEN or REFACTOR step. Small commits are cheap insurance.
|
|
41
|
+
|
|
42
|
+
## When to Apply TDD
|
|
43
|
+
|
|
44
|
+
- New features: always.
|
|
45
|
+
- Bug fixes: write a test that reproduces the bug first, then fix.
|
|
46
|
+
- Refactoring existing untested code: add characterization tests before changing anything.
|
|
47
|
+
|
|
48
|
+
## Anti-patterns to Avoid
|
|
49
|
+
|
|
50
|
+
- Writing production code first and tests after (test-last is not TDD).
|
|
51
|
+
- Writing multiple tests before making any of them pass.
|
|
52
|
+
- Skipping the REFACTOR step -- tech debt accrues silently.
|
|
53
|
+
- Over-mocking: if your test has more mocks than assertions, rethink the design.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: verification
|
|
3
|
+
description: Enforce evidence-based verification before claiming any task is complete
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
> Methodology from [obra/superpowers](https://github.com/obra/superpowers) (MIT)
|
|
7
|
+
|
|
8
|
+
# Verification
|
|
9
|
+
|
|
10
|
+
Iron law: **no claims without fresh evidence.**
|
|
11
|
+
|
|
12
|
+
## The Verification Gate
|
|
13
|
+
|
|
14
|
+
Before you say "done", "works", "fixed", or "verified", you MUST:
|
|
15
|
+
|
|
16
|
+
1. **Run** the relevant command (test, build, lint, curl, etc.).
|
|
17
|
+
2. **Read** the full output -- not just the exit code.
|
|
18
|
+
3. **Confirm** the output matches the expected result.
|
|
19
|
+
4. **Only then** claim completion.
|
|
20
|
+
|
|
21
|
+
If you cannot run a verification command, say so explicitly. Never assume.
|
|
22
|
+
|
|
23
|
+
## What Counts as Verification
|
|
24
|
+
|
|
25
|
+
| Claim | Minimum Evidence |
|
|
26
|
+
|-------|-----------------|
|
|
27
|
+
| "Tests pass" | Paste or reference the test runner output showing green. |
|
|
28
|
+
| "Build succeeds" | Show the build command output with zero errors. |
|
|
29
|
+
| "Bug is fixed" | Show the reproduction case now producing correct output. |
|
|
30
|
+
| "File updated" | Read the file back and confirm the expected content. |
|
|
31
|
+
| "Service is running" | Hit the health endpoint and show the response. |
|
|
32
|
+
|
|
33
|
+
## Workflow
|
|
34
|
+
|
|
35
|
+
1. Finish your change.
|
|
36
|
+
2. Decide which claims you are about to make.
|
|
37
|
+
3. For each claim, run the matching verification step.
|
|
38
|
+
4. If any step fails, fix and re-verify. Do NOT skip ahead.
|
|
39
|
+
5. Report results with evidence (command + output).
|
|
40
|
+
|
|
41
|
+
## Anti-patterns to Avoid
|
|
42
|
+
|
|
43
|
+
- Saying "should work" without running anything.
|
|
44
|
+
- Running a command but not reading its output.
|
|
45
|
+
- Verifying one thing and claiming another.
|
|
46
|
+
- Treating a clean exit code as proof when the output contains warnings or partial failures.
|
|
47
|
+
- Re-using stale evidence from a previous run after making further changes.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
## Role
|
|
2
|
+
|
|
3
|
+
You are a startup generalist — part product manager, part growth engineer, part security-conscious developer. You help founders go from idea to launched product, balancing speed with quality. You think in build-measure-learn cycles and optimize for validated learning over perfection.
|
|
4
|
+
|
|
5
|
+
## Tone
|
|
6
|
+
|
|
7
|
+
- Bias toward action — ship fast, learn fast, iterate
|
|
8
|
+
- Data-driven — frame every feature as a hypothesis with a measurable outcome
|
|
9
|
+
- Security-aware — never cut corners on auth, secrets, or user data
|
|
10
|
+
|
|
11
|
+
## Constraints
|
|
12
|
+
|
|
13
|
+
- Never spend more than 2 weeks on a feature without user feedback
|
|
14
|
+
- Never build without defining the target metric first
|
|
15
|
+
- Never skip security review on auth, payments, or user data flows
|
|
16
|
+
- Always have a hypothesis for why you're building something
|
|
17
|
+
- Never propose a feature without articulating the user problem it solves
|
|
18
|
+
- Flag hardcoded credentials as Critical severity — no exceptions
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Technical Writing Style Guide
|
|
2
|
+
|
|
3
|
+
## Writing Principles
|
|
4
|
+
|
|
5
|
+
- **Audience-first** -- know who you are writing for. A getting-started guide reads differently from an API reference.
|
|
6
|
+
- **Show, do not just tell** -- every concept gets a code example. Abstract explanations alone are not enough.
|
|
7
|
+
- **Progressive disclosure** -- start simple, add complexity. Do not front-load every edge case.
|
|
8
|
+
- **Scannable structure** -- use headings, bullet points, tables, and code blocks. Dense paragraphs lose readers.
|
|
9
|
+
|
|
10
|
+
## Document Types
|
|
11
|
+
|
|
12
|
+
### Getting Started
|
|
13
|
+
- 5-minute path to first success
|
|
14
|
+
- Structure: Install -> configure -> hello world
|
|
15
|
+
- Minimize prerequisites, link to setup guides for tools
|
|
16
|
+
|
|
17
|
+
### How-To Guides
|
|
18
|
+
- Goal-oriented: "How to deploy to production"
|
|
19
|
+
- Step-by-step with prerequisites listed upfront
|
|
20
|
+
- Each step should be independently verifiable
|
|
21
|
+
|
|
22
|
+
### API Reference
|
|
23
|
+
- Every function, parameter, return type, and error
|
|
24
|
+
- Generated from code when possible (JSDoc, TypeDoc, etc.)
|
|
25
|
+
- Include request/response examples for every endpoint
|
|
26
|
+
|
|
27
|
+
### Architecture Docs
|
|
28
|
+
- System diagrams, data flow, design decisions
|
|
29
|
+
- Updated when architecture changes
|
|
30
|
+
- Include the "why" behind decisions, not just the "what"
|
|
31
|
+
|
|
32
|
+
### Troubleshooting
|
|
33
|
+
- Common errors and their solutions
|
|
34
|
+
- Organized by error message or symptom
|
|
35
|
+
- Searchable and scannable
|
|
36
|
+
|
|
37
|
+
## Style Rules
|
|
38
|
+
|
|
39
|
+
- **Active voice**: "The function returns" not "is returned by the function"
|
|
40
|
+
- **Second person**: "You can configure" not "One can configure" or "The user can configure"
|
|
41
|
+
- **Present tense**: "This command creates" not "This command will create"
|
|
42
|
+
- **Short sentences**: Under 25 words when possible
|
|
43
|
+
- **Define acronyms** on first use
|
|
44
|
+
- **Consistent terminology**: Pick one term and stick with it throughout
|
|
45
|
+
- **No filler words**: Remove "basically", "simply", "just", "obviously"
|
|
46
|
+
|
|
47
|
+
## Code Example Rules
|
|
48
|
+
|
|
49
|
+
- Every code example must be complete enough to copy-paste and run
|
|
50
|
+
- Show the expected output or result
|
|
51
|
+
- Use realistic variable names and data, not `foo` and `bar`
|
|
52
|
+
- Include error handling in examples that demonstrate API calls
|
|
53
|
+
- Specify the language in fenced code blocks for syntax highlighting
|
|
54
|
+
- If an example is partial, clearly mark it with comments (`// ... rest of setup`)
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
## Role
|
|
2
|
+
|
|
3
|
+
You are a technical documentation specialist. You write clear, structured, audience-aware documentation that helps developers understand and use software effectively. You treat docs like code -- they should be precise, tested, and maintained.
|
|
4
|
+
|
|
5
|
+
## Tone
|
|
6
|
+
|
|
7
|
+
- Clear and concise -- every sentence earns its place
|
|
8
|
+
- Audience-aware -- adjust depth and terminology to the reader
|
|
9
|
+
- Show, do not just tell -- prefer examples over abstract explanation
|
|
10
|
+
|
|
11
|
+
## Constraints
|
|
12
|
+
|
|
13
|
+
- Never write documentation without a code example for the main concept
|
|
14
|
+
- Never assume the reader knows internal jargon -- define it or link to a glossary
|
|
15
|
+
- Never write a wall of text -- break into sections with headings every 3-5 paragraphs
|
|
16
|
+
- Always test code examples before including them
|
|
17
|
+
- Always specify which version of the software the docs apply to
|
|
18
|
+
- Keep sentences under 25 words when possible
|
|
19
|
+
- Use active voice, second person, present tense
|
|
@@ -0,0 +1,390 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: api-documentation
|
|
3
|
+
description: Create comprehensive API documentation for developers. Use when documenting REST APIs, GraphQL schemas, or SDK methods. Handles OpenAPI/Swagger, interactive docs, examples, and API reference guides.
|
|
4
|
+
metadata:
|
|
5
|
+
tags: API-documentation, OpenAPI, Swagger, REST, GraphQL, developer-docs
|
|
6
|
+
platforms: Claude, ChatGPT, Gemini
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
# API Documentation
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
## When to use this skill
|
|
14
|
+
|
|
15
|
+
- **API Development**: When adding new endpoints
|
|
16
|
+
- **External Release**: Public API launch
|
|
17
|
+
- **Team Collaboration**: Frontend-backend interface definition
|
|
18
|
+
|
|
19
|
+
## Instructions
|
|
20
|
+
|
|
21
|
+
### Step 1: OpenAPI (Swagger) Spec
|
|
22
|
+
|
|
23
|
+
```yaml
|
|
24
|
+
openapi: 3.0.0
|
|
25
|
+
info:
|
|
26
|
+
title: User Management API
|
|
27
|
+
version: 1.0.0
|
|
28
|
+
description: API for managing users
|
|
29
|
+
contact:
|
|
30
|
+
email: api@example.com
|
|
31
|
+
|
|
32
|
+
servers:
|
|
33
|
+
- url: https://api.example.com/v1
|
|
34
|
+
description: Production
|
|
35
|
+
- url: https://staging-api.example.com/v1
|
|
36
|
+
description: Staging
|
|
37
|
+
|
|
38
|
+
paths:
|
|
39
|
+
/users:
|
|
40
|
+
get:
|
|
41
|
+
summary: List all users
|
|
42
|
+
description: Retrieve a paginated list of users
|
|
43
|
+
tags:
|
|
44
|
+
- Users
|
|
45
|
+
parameters:
|
|
46
|
+
- name: page
|
|
47
|
+
in: query
|
|
48
|
+
schema:
|
|
49
|
+
type: integer
|
|
50
|
+
default: 1
|
|
51
|
+
- name: limit
|
|
52
|
+
in: query
|
|
53
|
+
schema:
|
|
54
|
+
type: integer
|
|
55
|
+
default: 20
|
|
56
|
+
maximum: 100
|
|
57
|
+
responses:
|
|
58
|
+
'200':
|
|
59
|
+
description: Successful response
|
|
60
|
+
content:
|
|
61
|
+
application/json:
|
|
62
|
+
schema:
|
|
63
|
+
type: object
|
|
64
|
+
properties:
|
|
65
|
+
data:
|
|
66
|
+
type: array
|
|
67
|
+
items:
|
|
68
|
+
$ref: '#/components/schemas/User'
|
|
69
|
+
pagination:
|
|
70
|
+
$ref: '#/components/schemas/Pagination'
|
|
71
|
+
'401':
|
|
72
|
+
$ref: '#/components/responses/Unauthorized'
|
|
73
|
+
|
|
74
|
+
post:
|
|
75
|
+
summary: Create a new user
|
|
76
|
+
tags:
|
|
77
|
+
- Users
|
|
78
|
+
requestBody:
|
|
79
|
+
required: true
|
|
80
|
+
content:
|
|
81
|
+
application/json:
|
|
82
|
+
schema:
|
|
83
|
+
$ref: '#/components/schemas/CreateUserRequest'
|
|
84
|
+
responses:
|
|
85
|
+
'201':
|
|
86
|
+
description: User created
|
|
87
|
+
content:
|
|
88
|
+
application/json:
|
|
89
|
+
schema:
|
|
90
|
+
$ref: '#/components/schemas/User'
|
|
91
|
+
'400':
|
|
92
|
+
$ref: '#/components/responses/BadRequest'
|
|
93
|
+
|
|
94
|
+
components:
|
|
95
|
+
schemas:
|
|
96
|
+
User:
|
|
97
|
+
type: object
|
|
98
|
+
properties:
|
|
99
|
+
id:
|
|
100
|
+
type: string
|
|
101
|
+
format: uuid
|
|
102
|
+
email:
|
|
103
|
+
type: string
|
|
104
|
+
format: email
|
|
105
|
+
name:
|
|
106
|
+
type: string
|
|
107
|
+
createdAt:
|
|
108
|
+
type: string
|
|
109
|
+
format: date-time
|
|
110
|
+
required:
|
|
111
|
+
- id
|
|
112
|
+
- email
|
|
113
|
+
- name
|
|
114
|
+
|
|
115
|
+
CreateUserRequest:
|
|
116
|
+
type: object
|
|
117
|
+
properties:
|
|
118
|
+
email:
|
|
119
|
+
type: string
|
|
120
|
+
format: email
|
|
121
|
+
name:
|
|
122
|
+
type: string
|
|
123
|
+
minLength: 2
|
|
124
|
+
maxLength: 50
|
|
125
|
+
password:
|
|
126
|
+
type: string
|
|
127
|
+
minLength: 8
|
|
128
|
+
required:
|
|
129
|
+
- email
|
|
130
|
+
- name
|
|
131
|
+
- password
|
|
132
|
+
|
|
133
|
+
Pagination:
|
|
134
|
+
type: object
|
|
135
|
+
properties:
|
|
136
|
+
page:
|
|
137
|
+
type: integer
|
|
138
|
+
limit:
|
|
139
|
+
type: integer
|
|
140
|
+
total:
|
|
141
|
+
type: integer
|
|
142
|
+
|
|
143
|
+
responses:
|
|
144
|
+
Unauthorized:
|
|
145
|
+
description: Unauthorized
|
|
146
|
+
content:
|
|
147
|
+
application/json:
|
|
148
|
+
schema:
|
|
149
|
+
type: object
|
|
150
|
+
properties:
|
|
151
|
+
error:
|
|
152
|
+
type: string
|
|
153
|
+
example: "Authentication required"
|
|
154
|
+
|
|
155
|
+
BadRequest:
|
|
156
|
+
description: Bad Request
|
|
157
|
+
content:
|
|
158
|
+
application/json:
|
|
159
|
+
schema:
|
|
160
|
+
type: object
|
|
161
|
+
properties:
|
|
162
|
+
error:
|
|
163
|
+
type: string
|
|
164
|
+
example: "Invalid input"
|
|
165
|
+
|
|
166
|
+
securitySchemes:
|
|
167
|
+
bearerAuth:
|
|
168
|
+
type: http
|
|
169
|
+
scheme: bearer
|
|
170
|
+
bearerFormat: JWT
|
|
171
|
+
|
|
172
|
+
security:
|
|
173
|
+
- bearerAuth: []
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### Step 2: Generate Documentation from Code (JSDoc/Decorators)
|
|
177
|
+
|
|
178
|
+
**Express + TypeScript**:
|
|
179
|
+
```typescript
|
|
180
|
+
/**
|
|
181
|
+
* @swagger
|
|
182
|
+
* /api/users:
|
|
183
|
+
* post:
|
|
184
|
+
* summary: Create a new user
|
|
185
|
+
* tags: [Users]
|
|
186
|
+
* requestBody:
|
|
187
|
+
* required: true
|
|
188
|
+
* content:
|
|
189
|
+
* application/json:
|
|
190
|
+
* schema:
|
|
191
|
+
* type: object
|
|
192
|
+
* required:
|
|
193
|
+
* - email
|
|
194
|
+
* - name
|
|
195
|
+
* - password
|
|
196
|
+
* properties:
|
|
197
|
+
* email:
|
|
198
|
+
* type: string
|
|
199
|
+
* format: email
|
|
200
|
+
* name:
|
|
201
|
+
* type: string
|
|
202
|
+
* password:
|
|
203
|
+
* type: string
|
|
204
|
+
* minLength: 8
|
|
205
|
+
* responses:
|
|
206
|
+
* 201:
|
|
207
|
+
* description: User created successfully
|
|
208
|
+
* 400:
|
|
209
|
+
* description: Invalid input
|
|
210
|
+
*/
|
|
211
|
+
router.post('/users', async (req, res) => {
|
|
212
|
+
const { email, name, password } = req.body;
|
|
213
|
+
const user = await userService.createUser({ email, name, password });
|
|
214
|
+
res.status(201).json(user);
|
|
215
|
+
});
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### Step 3: Interactive Documentation
|
|
219
|
+
|
|
220
|
+
**Swagger UI Setup**:
|
|
221
|
+
```typescript
|
|
222
|
+
import swaggerUi from 'swagger-ui-express';
|
|
223
|
+
import YAML from 'yamljs';
|
|
224
|
+
|
|
225
|
+
const swaggerDocument = YAML.load('./openapi.yaml');
|
|
226
|
+
|
|
227
|
+
app.use('/api-docs', swaggerUi.serve, swaggerUi.setup(swaggerDocument, {
|
|
228
|
+
customCss: '.swagger-ui .topbar { display: none }',
|
|
229
|
+
customSiteTitle: "My API Documentation"
|
|
230
|
+
}));
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
### Step 4: Examples & Guides
|
|
234
|
+
|
|
235
|
+
```markdown
|
|
236
|
+
## API Documentation
|
|
237
|
+
|
|
238
|
+
### Authentication
|
|
239
|
+
|
|
240
|
+
All API requests require authentication using JWT tokens.
|
|
241
|
+
|
|
242
|
+
#### Getting a Token
|
|
243
|
+
\`\`\`bash
|
|
244
|
+
curl -X POST https://api.example.com/v1/auth/login \
|
|
245
|
+
-H "Content-Type: application/json" \
|
|
246
|
+
-d '{"email": "user@example.com", "password": "yourpassword"}'
|
|
247
|
+
\`\`\`
|
|
248
|
+
|
|
249
|
+
Response:
|
|
250
|
+
\`\`\`json
|
|
251
|
+
{
|
|
252
|
+
"accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
|
|
253
|
+
"refreshToken": "..."
|
|
254
|
+
}
|
|
255
|
+
\`\`\`
|
|
256
|
+
|
|
257
|
+
#### Using the Token
|
|
258
|
+
\`\`\`bash
|
|
259
|
+
curl -X GET https://api.example.com/v1/users \
|
|
260
|
+
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
|
|
261
|
+
\`\`\`
|
|
262
|
+
|
|
263
|
+
### Creating a User
|
|
264
|
+
|
|
265
|
+
**Endpoint**: `POST /v1/users`
|
|
266
|
+
|
|
267
|
+
**Request Body**:
|
|
268
|
+
\`\`\`json
|
|
269
|
+
{
|
|
270
|
+
"email": "john@example.com",
|
|
271
|
+
"name": "John Doe",
|
|
272
|
+
"password": "SecurePass123!"
|
|
273
|
+
}
|
|
274
|
+
\`\`\`
|
|
275
|
+
|
|
276
|
+
**Success Response** (201):
|
|
277
|
+
\`\`\`json
|
|
278
|
+
{
|
|
279
|
+
"id": "123e4567-e89b-12d3-a456-426614174000",
|
|
280
|
+
"email": "john@example.com",
|
|
281
|
+
"name": "John Doe",
|
|
282
|
+
"createdAt": "2025-01-15T10:00:00Z"
|
|
283
|
+
}
|
|
284
|
+
\`\`\`
|
|
285
|
+
|
|
286
|
+
**Error Response** (400):
|
|
287
|
+
\`\`\`json
|
|
288
|
+
{
|
|
289
|
+
"error": "Email already exists"
|
|
290
|
+
}
|
|
291
|
+
\`\`\`
|
|
292
|
+
|
|
293
|
+
### Rate Limiting
|
|
294
|
+
- 100 requests per 15 minutes per IP
|
|
295
|
+
- Header: `X-RateLimit-Remaining`
|
|
296
|
+
|
|
297
|
+
### Pagination
|
|
298
|
+
\`\`\`
|
|
299
|
+
GET /v1/users?page=2&limit=20
|
|
300
|
+
\`\`\`
|
|
301
|
+
|
|
302
|
+
Response includes pagination info:
|
|
303
|
+
\`\`\`json
|
|
304
|
+
{
|
|
305
|
+
"data": [...],
|
|
306
|
+
"pagination": {
|
|
307
|
+
"page": 2,
|
|
308
|
+
"limit": 20,
|
|
309
|
+
"total": 157,
|
|
310
|
+
"pages": 8
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
\`\`\`
|
|
314
|
+
|
|
315
|
+
### Error Codes
|
|
316
|
+
- `400` - Bad Request (validation error)
|
|
317
|
+
- `401` - Unauthorized (missing/invalid token)
|
|
318
|
+
- `403` - Forbidden (insufficient permissions)
|
|
319
|
+
- `404` - Not Found
|
|
320
|
+
- `409` - Conflict (duplicate resource)
|
|
321
|
+
- `429` - Too Many Requests (rate limit)
|
|
322
|
+
- `500` - Internal Server Error
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
## Output format
|
|
326
|
+
|
|
327
|
+
### API Documentation Structure
|
|
328
|
+
|
|
329
|
+
```
|
|
330
|
+
docs/
|
|
331
|
+
├── README.md # Overview
|
|
332
|
+
├── getting-started.md # Quick start guide
|
|
333
|
+
├── authentication.md # Auth guide
|
|
334
|
+
├── api-reference/
|
|
335
|
+
│ ├── users.md # Users endpoints
|
|
336
|
+
│ ├── auth.md # Auth endpoints
|
|
337
|
+
│ └── products.md # Products endpoints
|
|
338
|
+
├── guides/
|
|
339
|
+
│ ├── pagination.md
|
|
340
|
+
│ ├── error-handling.md
|
|
341
|
+
│ └── rate-limiting.md
|
|
342
|
+
├── examples/
|
|
343
|
+
│ ├── curl.md
|
|
344
|
+
│ ├── javascript.md
|
|
345
|
+
│ └── python.md
|
|
346
|
+
└── openapi.yaml # OpenAPI spec
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
## Constraints
|
|
350
|
+
|
|
351
|
+
### Required Rules (MUST)
|
|
352
|
+
|
|
353
|
+
1. **Real Examples**: Provide working code examples
|
|
354
|
+
2. **Error Cases**: Document not only success but also failure cases
|
|
355
|
+
3. **Keep Updated**: Update documentation when API changes
|
|
356
|
+
|
|
357
|
+
### Prohibited (MUST NOT)
|
|
358
|
+
|
|
359
|
+
1. **Real Keys in Examples**: Do not use real API keys/passwords in examples
|
|
360
|
+
2. **Vague Descriptions**: Unclear descriptions like "returns data"
|
|
361
|
+
|
|
362
|
+
## Best practices
|
|
363
|
+
|
|
364
|
+
1. **Try It Out**: Provide interactive documentation (Swagger UI)
|
|
365
|
+
2. **Provide SDK**: SDK and examples for major languages
|
|
366
|
+
3. **Changelog**: Document API changes
|
|
367
|
+
|
|
368
|
+
## References
|
|
369
|
+
|
|
370
|
+
- [OpenAPI Specification](https://swagger.io/specification/)
|
|
371
|
+
- [Swagger UI](https://swagger.io/tools/swagger-ui/)
|
|
372
|
+
- [Redoc](https://redocly.com/)
|
|
373
|
+
|
|
374
|
+
## Metadata
|
|
375
|
+
|
|
376
|
+
### Version
|
|
377
|
+
- **Current Version**: 1.0.0
|
|
378
|
+
- **Last Updated**: 2025-01-01
|
|
379
|
+
- **Compatible Platforms**: Claude, ChatGPT, Gemini
|
|
380
|
+
|
|
381
|
+
### Tags
|
|
382
|
+
`#API-documentation` `#OpenAPI` `#Swagger` `#REST` `#developer-docs` `#documentation`
|
|
383
|
+
|
|
384
|
+
## Examples
|
|
385
|
+
|
|
386
|
+
### Example 1: Basic usage
|
|
387
|
+
<!-- Add example content here -->
|
|
388
|
+
|
|
389
|
+
### Example 2: Advanced usage
|
|
390
|
+
<!-- Add advanced example content here -->
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: plan-and-execute
|
|
3
|
+
description: Write a detailed plan before coding and execute it step by step
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
> Methodology from [obra/superpowers](https://github.com/obra/superpowers) (MIT)
|
|
7
|
+
|
|
8
|
+
# Plan and Execute
|
|
9
|
+
|
|
10
|
+
Core rule: **write a detailed plan before writing any code.**
|
|
11
|
+
|
|
12
|
+
## Phase 1 -- Plan
|
|
13
|
+
|
|
14
|
+
1. Restate the goal in your own words. Confirm understanding with the user if ambiguous.
|
|
15
|
+
2. Identify inputs, outputs, constraints, and acceptance criteria.
|
|
16
|
+
3. Break the work into bite-sized steps (each step should take minutes, not hours).
|
|
17
|
+
4. Order the steps by dependency -- what must come first?
|
|
18
|
+
5. Write the plan out explicitly. Number every step.
|
|
19
|
+
|
|
20
|
+
## Phase 2 -- Execute Step by Step
|
|
21
|
+
|
|
22
|
+
1. Pick the next uncompleted step from the plan.
|
|
23
|
+
2. Do the work for that step and only that step.
|
|
24
|
+
3. Verify the step is done (run tests, read output, check the file).
|
|
25
|
+
4. Mark the step complete and note any deviations or discoveries.
|
|
26
|
+
5. If a step reveals the plan needs updating, update the plan before continuing.
|
|
27
|
+
|
|
28
|
+
## Phase 3 -- Handle Blockers
|
|
29
|
+
|
|
30
|
+
1. If you are stuck for more than a few minutes, stop.
|
|
31
|
+
2. State clearly: what you tried, what happened, and what you expected.
|
|
32
|
+
3. Ask the user for guidance rather than guessing.
|
|
33
|
+
4. Never silently skip a step or substitute a different approach without flagging it.
|
|
34
|
+
|
|
35
|
+
## Phase 4 -- Wrap Up
|
|
36
|
+
|
|
37
|
+
1. Walk through the completed plan. Confirm every step is verified.
|
|
38
|
+
2. Run a final end-to-end check (full build, full test suite, or manual walkthrough).
|
|
39
|
+
3. Summarize what was done, what changed, and any remaining open items.
|
|
40
|
+
|
|
41
|
+
## Practical Rules
|
|
42
|
+
|
|
43
|
+
- Plans are living documents -- update them as you learn more.
|
|
44
|
+
- Prefer many small steps over a few large ones.
|
|
45
|
+
- Each step should have a clear "done" condition.
|
|
46
|
+
- If the scope grows mid-execution, call it out and re-plan.
|
|
47
|
+
- Time-box exploratory steps to avoid rabbit holes.
|
|
48
|
+
|
|
49
|
+
## Anti-patterns to Avoid
|
|
50
|
+
|
|
51
|
+
- Starting to code before having a plan.
|
|
52
|
+
- Writing a plan but then ignoring it.
|
|
53
|
+
- Making a single giant step that bundles multiple concerns.
|
|
54
|
+
- Silently changing course when stuck instead of communicating.
|