@botdigit/agent-blueprint 1.0.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/AGENTS.md +204 -0
- package/LICENSE +21 -0
- package/PROMPT.md +22 -0
- package/README.md +248 -0
- package/bin/cli.js +160 -0
- package/frameworks/axum/SKILL.md +73 -0
- package/frameworks/django/SKILL.md +71 -0
- package/frameworks/fastapi/SKILL.md +73 -0
- package/frameworks/laravel/SKILL.md +67 -0
- package/frameworks/nextjs/SKILL.md +60 -0
- package/frameworks/rails/SKILL.md +78 -0
- package/frameworks/react/SKILL.md +58 -0
- package/frameworks/spring/SKILL.md +79 -0
- package/install.sh +83 -0
- package/llms.txt +26 -0
- package/package.json +47 -0
- package/skills/00-orchestrator/.gitkeep +26 -0
- package/skills/00-orchestrator/SKILL.md +368 -0
- package/skills/00-orchestrator/decision-tree.md +93 -0
- package/skills/00-orchestrator/project-detection.md +81 -0
- package/skills/00-orchestrator/skill-selection.md +87 -0
- package/skills/00-orchestrator/workflow.md +25 -0
- package/skills/01-discovery/SKILL.md +66 -0
- package/skills/02-project-context/SKILL.md +89 -0
- package/skills/03-business-architecture/SKILL.md +231 -0
- package/skills/04-architecture/SKILL.md +131 -0
- package/skills/05-documentation/SKILL.md +133 -0
- package/skills/06-codebase-audit/SKILL.md +127 -0
- package/skills/07-security/SKILL.md +159 -0
- package/skills/08-testing/SKILL.md +120 -0
- package/skills/09-performance/SKILL.md +96 -0
- package/skills/10-audit/SKILL.md +112 -0
- package/stacks/dotnet/SKILL.md +56 -0
- package/stacks/go/SKILL.md +61 -0
- package/stacks/java/SKILL.md +58 -0
- package/stacks/javascript/SKILL.md +47 -0
- package/stacks/php/SKILL.md +51 -0
- package/stacks/python/SKILL.md +52 -0
- package/stacks/ruby/SKILL.md +51 -0
- package/stacks/rust/SKILL.md +55 -0
- package/stacks/typescript/SKILL.md +55 -0
- package/templates/adr/ADR-TEMPLATE.md +64 -0
- package/templates/api-spec/API_SPEC_TEMPLATE.md +137 -0
- package/templates/architecture/ARCHITECTURE_TEMPLATE.md +81 -0
- package/templates/business-requirements/BUSINESS_REQUIREMENTS_TEMPLATE.md +77 -0
- package/templates/changelog/CHANGELOG_TEMPLATE.md +37 -0
- package/templates/database/DATABASE_TEMPLATE.md +77 -0
- package/templates/deployment/DEPLOYMENT_TEMPLATE.md +80 -0
- package/templates/project-brief/PROJECT_BRIEF_TEMPLATE.md +72 -0
- package/templates/runbook/RUNBOOK_TEMPLATE.md +54 -0
- package/templates/security/SECURITY_TEMPLATE.md +93 -0
- package/templates/testing/TESTING_TEMPLATE.md +87 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Go Stack Skill
|
|
2
|
+
|
|
3
|
+
**Version:** 1.0.0
|
|
4
|
+
**Compatible:** project_skills >= 1.0
|
|
5
|
+
**Requires:** (activated by orchestrator on detection)
|
|
6
|
+
**Outputs:** (none — guidance only)
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Purpose
|
|
11
|
+
|
|
12
|
+
Guidance for working with Go projects. Activated automatically when `go.mod` and `.go` files are detected.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Conventions
|
|
17
|
+
|
|
18
|
+
### Idiomatic Go
|
|
19
|
+
|
|
20
|
+
- Follow Effective Go and the Go FAQs.
|
|
21
|
+
- Simple, readable code is preferred over clever code.
|
|
22
|
+
- Explicit error handling is a feature. Do not ignore errors with `_` unless there is a specific reason and a comment.
|
|
23
|
+
- Zero values should be useful where practical.
|
|
24
|
+
|
|
25
|
+
### Error handling
|
|
26
|
+
|
|
27
|
+
- Errors are values. Handle them.
|
|
28
|
+
- Wrap errors with context using `fmt.Errorf("...: %w", err)` or similar.
|
|
29
|
+
- Do not use panics for expected errors.
|
|
30
|
+
|
|
31
|
+
### Types
|
|
32
|
+
|
|
33
|
+
- Go's type system is structural. Use it.
|
|
34
|
+
- Interfaces should be small and defined where they are used, not where they are implemented.
|
|
35
|
+
- Avoid unnecessary abstraction. Go prefers concrete code over abstraction layers.
|
|
36
|
+
|
|
37
|
+
### Concurrency
|
|
38
|
+
|
|
39
|
+
- Goroutines are cheap but not free. Do not spawn unbounded goroutines.
|
|
40
|
+
- Use channels, `sync`, or context appropriately. Each has a purpose.
|
|
41
|
+
- Always have a plan for canceling concurrent work (context, done channel).
|
|
42
|
+
|
|
43
|
+
### Dependencies
|
|
44
|
+
|
|
45
|
+
- `go mod` manages dependencies. `go.sum` should be committed.
|
|
46
|
+
- Vendor directory is optional and project-dependent.
|
|
47
|
+
|
|
48
|
+
### Tooling
|
|
49
|
+
|
|
50
|
+
- `gofmt` / `goimports` for formatting. The project should enforce this.
|
|
51
|
+
- `go vet` for static analysis.
|
|
52
|
+
- The project may use additional linters. Follow the project's choice.
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## Anti-patterns
|
|
57
|
+
|
|
58
|
+
- Ignoring errors.
|
|
59
|
+
- Using goroutines without a way to stop them.
|
|
60
|
+
- Over-engineering with interfaces and abstraction layers.
|
|
61
|
+
- Unbounded concurrency.
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Java Stack Skill
|
|
2
|
+
|
|
3
|
+
**Version:** 1.0.0
|
|
4
|
+
**Compatible:** project_skills >= 1.0
|
|
5
|
+
**Requires:** (activated by orchestrator on detection)
|
|
6
|
+
**Outputs:** (none — guidance only)
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Purpose
|
|
11
|
+
|
|
12
|
+
Guidance for working with Java projects. Activated automatically when `pom.xml`, `build.gradle`, or `.java` files are detected.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Conventions
|
|
17
|
+
|
|
18
|
+
### Version
|
|
19
|
+
|
|
20
|
+
- Java 17 or 21 are current LTS versions. The project's version is in the build file or runtime.
|
|
21
|
+
- Older versions should be noted as technical debt if upgrade is feasible.
|
|
22
|
+
|
|
23
|
+
### Style
|
|
24
|
+
|
|
25
|
+
- Follow the project's style guide. If none exists, follow standard Java conventions.
|
|
26
|
+
- Use the project's formatter and linter (`checkstyle`, `spotless`, ` ErrorProne`, ` SonarQube`, or similar).
|
|
27
|
+
|
|
28
|
+
### Type system
|
|
29
|
+
|
|
30
|
+
- Java has a static type system. Use it.
|
|
31
|
+
- Avoid `Object` and raw types where specific types are known.
|
|
32
|
+
- Generics are a tool, not a requirement for every class.
|
|
33
|
+
|
|
34
|
+
### Error handling
|
|
35
|
+
|
|
36
|
+
- Use exceptions for exceptional conditions.
|
|
37
|
+
- Checked exceptions are a Java feature. Use them where appropriate, but do not overuse them to the point of unreadability.
|
|
38
|
+
- Do not swallow exceptions silently.
|
|
39
|
+
|
|
40
|
+
### Dependencies
|
|
41
|
+
|
|
42
|
+
- Maven: `pom.xml` manages dependencies.
|
|
43
|
+
- Gradle: `build.gradle` manages dependencies.
|
|
44
|
+
- Review dependencies for maintenance and licensing.
|
|
45
|
+
|
|
46
|
+
### Frameworks
|
|
47
|
+
|
|
48
|
+
- Spring Boot is common. If the project uses it, follow the framework skill.
|
|
49
|
+
- The framework skill is more specific than this stack skill. Both may be active.
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## Anti-patterns
|
|
54
|
+
|
|
55
|
+
- Empty catch blocks.
|
|
56
|
+
- Overuse of inheritance when composition would do.
|
|
57
|
+
- Unnecessary abstraction layers.
|
|
58
|
+
- Mixing concerns in large classes.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# JavaScript Stack Skill
|
|
2
|
+
|
|
3
|
+
**Version:** 1.0.0
|
|
4
|
+
**Compatible:** project_skills >= 1.0
|
|
5
|
+
**Requires:** (activated by orchestrator on detection)
|
|
6
|
+
**Outputs:** (none — guidance only)
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Purpose
|
|
11
|
+
|
|
12
|
+
Guidance for working with JavaScript projects. Activated automatically when `package.json` and `.js` files are detected.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Conventions
|
|
17
|
+
|
|
18
|
+
### Types
|
|
19
|
+
|
|
20
|
+
- JavaScript has no type system. Data at boundaries (API inputs, external data, user input) must be validated at runtime.
|
|
21
|
+
- Document expected shapes in JSDoc where practical.
|
|
22
|
+
- If the project grows, consider whether TypeScript would reduce risk. Propose the change in an ADR if it is warranted — do not impose it.
|
|
23
|
+
|
|
24
|
+
### Module system
|
|
25
|
+
|
|
26
|
+
- Use ES modules (`import`/`export`) if the project targets modern environments.
|
|
27
|
+
- Follow the project's existing module convention.
|
|
28
|
+
|
|
29
|
+
### Error handling
|
|
30
|
+
|
|
31
|
+
- Use `Error` instances, not string throws.
|
|
32
|
+
- Handle errors at the appropriate level.
|
|
33
|
+
- Do not silently swallow errors.
|
|
34
|
+
|
|
35
|
+
### Tooling
|
|
36
|
+
|
|
37
|
+
- The project's linting and formatting configuration is the source of truth.
|
|
38
|
+
- `package-lock.json` or `npm-shrinkwrap.json` should be committed if the project uses npm.
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Anti-patterns
|
|
43
|
+
|
|
44
|
+
- Assuming data shapes without validation.
|
|
45
|
+
- Callback pyramids where async/await is available.
|
|
46
|
+
- Unhandled promise rejections.
|
|
47
|
+
- Global state without clear ownership.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# PHP Stack Skill
|
|
2
|
+
|
|
3
|
+
**Version:** 1.0.0
|
|
4
|
+
**Compatible:** project_skills >= 1.0
|
|
5
|
+
**Requires:** (activated by orchestrator on detection)
|
|
6
|
+
**Outputs:** (none — guidance only)
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Purpose
|
|
11
|
+
|
|
12
|
+
Guidance for working with PHP projects. Activated automatically when `composer.json` or `.php` files are detected.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Conventions
|
|
17
|
+
|
|
18
|
+
### Version
|
|
19
|
+
|
|
20
|
+
- PHP 8.x is the current standard. The project's required version is in `composer.json` or `php.ini`/runtime.
|
|
21
|
+
- Older PHP versions should be noted as technical debt if the project would benefit from upgrading.
|
|
22
|
+
|
|
23
|
+
### Type system
|
|
24
|
+
|
|
25
|
+
- PHP has a type system. Use it: parameter types, return types, property types, iterable and array types where appropriate.
|
|
26
|
+
- `strict_types=1` is recommended for new code. Respect the project's existing declaration.
|
|
27
|
+
- Do not use `mixed` as a substitute for thinking about the type.
|
|
28
|
+
|
|
29
|
+
### Dependencies
|
|
30
|
+
|
|
31
|
+
- `composer.lock` should be committed for applications.
|
|
32
|
+
- Review dependencies. PHP has a large ecosystem; not all packages are equally maintained.
|
|
33
|
+
|
|
34
|
+
### Error handling
|
|
35
|
+
|
|
36
|
+
- Use exceptions for exceptional conditions.
|
|
37
|
+
- Configure error reporting appropriately for development and production.
|
|
38
|
+
- Do not expose PHP errors to users in production.
|
|
39
|
+
|
|
40
|
+
### Tooling
|
|
41
|
+
|
|
42
|
+
- The project's linter (`phpstan`, `psalm`, `pint`, `php-cs-fixer`, or similar) is the project's choice.
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Anti-patterns
|
|
47
|
+
|
|
48
|
+
- Ignoring return types and parameter types.
|
|
49
|
+
- Using arrays where a typed object would be clearer.
|
|
50
|
+
- Mixing presentation and logic without a reason.
|
|
51
|
+
- Hardcoded secrets in PHP files.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Python Stack Skill
|
|
2
|
+
|
|
3
|
+
**Version:** 1.0.0
|
|
4
|
+
**Compatible:** project_skills >= 1.0
|
|
5
|
+
**Requires:** (activated by orchestrator on detection)
|
|
6
|
+
**Outputs:** (none — guidance only)
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Purpose
|
|
11
|
+
|
|
12
|
+
Guidance for working with Python projects. Activated automatically when `pyproject.toml`, `requirements.txt`, `setup.py`, or `.py` files are detected.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Conventions
|
|
17
|
+
|
|
18
|
+
### Version and tooling
|
|
19
|
+
|
|
20
|
+
- The project's Python version is determined by `pyproject.toml`, `requirements.txt`, or the runtime environment. Follow it.
|
|
21
|
+
- Use virtual environments. The project's choice of `venv`, `poetry`, `uv`, `pipenv`, or similar is the project's choice.
|
|
22
|
+
|
|
23
|
+
### Type hints
|
|
24
|
+
|
|
25
|
+
- Use type hints where they add clarity. They are optional in Python but valuable in larger projects.
|
|
26
|
+
- Runtime validation is still required for external data. Type hints are not runtime checks.
|
|
27
|
+
- `mypy` or similar may be in use. Follow the project's strictness setting.
|
|
28
|
+
|
|
29
|
+
### Code style
|
|
30
|
+
|
|
31
|
+
- Follow PEP 8 unless the project has chosen otherwise.
|
|
32
|
+
- The project's formatter (`ruff`, `black`, `autopep8`, or none) is the project's choice.
|
|
33
|
+
|
|
34
|
+
### Error handling
|
|
35
|
+
|
|
36
|
+
- Use specific exception types.
|
|
37
|
+
- Do not use bare `except:`.
|
|
38
|
+
- Handle exceptions at the appropriate level.
|
|
39
|
+
|
|
40
|
+
### Dependencies
|
|
41
|
+
|
|
42
|
+
- Pin versions in production. `requirements.txt` with pinned versions, `poetry.lock`, or similar.
|
|
43
|
+
- Review dependencies for known vulnerabilities.
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Anti-patterns
|
|
48
|
+
|
|
49
|
+
- Bare `except:`.
|
|
50
|
+
- Using exceptions for control flow where a conditional would do.
|
|
51
|
+
- Global mutable state.
|
|
52
|
+
- Assuming types at runtime based on type hints.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Ruby Stack Skill
|
|
2
|
+
|
|
3
|
+
**Version:** 1.0.0
|
|
4
|
+
**Compatible:** project_skills >= 1.0
|
|
5
|
+
**Requires:** (activated by orchestrator on detection)
|
|
6
|
+
**Outputs:** (none — guidance only)
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Purpose
|
|
11
|
+
|
|
12
|
+
Guidance for working with Ruby projects. Activated automatically when `Gemfile` or `.rb` files are detected.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Conventions
|
|
17
|
+
|
|
18
|
+
### Version
|
|
19
|
+
|
|
20
|
+
- Ruby 3.x is current. The project's version is in the `Gemfile` or `.ruby-version`.
|
|
21
|
+
- Follow the project's version.
|
|
22
|
+
|
|
23
|
+
### Style
|
|
24
|
+
|
|
25
|
+
- Follow the community style guide unless the project has chosen otherwise.
|
|
26
|
+
- The project's linter and formatter (`rubocop`, or none) is the project's choice.
|
|
27
|
+
|
|
28
|
+
### Types
|
|
29
|
+
|
|
30
|
+
- Ruby is dynamically typed. Runtime validation is required for external data.
|
|
31
|
+
- Type hints (RBS, Sorbet) may be in use. Follow the project's choice.
|
|
32
|
+
|
|
33
|
+
### Error handling
|
|
34
|
+
|
|
35
|
+
- Use exceptions for exceptions.
|
|
36
|
+
- Handle exceptions at the appropriate level.
|
|
37
|
+
- Do not use exceptions for control flow.
|
|
38
|
+
|
|
39
|
+
### Dependencies
|
|
40
|
+
|
|
41
|
+
- `Gemfile.lock` should be committed.
|
|
42
|
+
- Review gems for maintenance and licensing.
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Anti-patterns
|
|
47
|
+
|
|
48
|
+
- Magic numbers and strings without explanation.
|
|
49
|
+
- Overly clever metaprogramming without clear necessity.
|
|
50
|
+
- N+1 queries (Ruby projects often use ORMs; this is a common issue).
|
|
51
|
+
- Silent failures (swallowed exceptions, `nil` where an error would be clearer).
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Rust Stack Skill
|
|
2
|
+
|
|
3
|
+
**Version:** 1.0.0
|
|
4
|
+
**Compatible:** project_skills >= 1.0
|
|
5
|
+
**Requires:** (activated by orchestrator on detection)
|
|
6
|
+
**Outputs:** (none — guidance only)
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Purpose
|
|
11
|
+
|
|
12
|
+
Guidance for working with Rust projects. Activated automatically when `Cargo.toml` is detected.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Conventions
|
|
17
|
+
|
|
18
|
+
### Memory and safety
|
|
19
|
+
|
|
20
|
+
- Rust's ownership system is a feature. Do not use `unsafe` unless you have a specific, documented reason.
|
|
21
|
+
- Prefer safe abstractions over unsafe code.
|
|
22
|
+
- When `unsafe` is necessary, document why and scope it as tightly as possible.
|
|
23
|
+
|
|
24
|
+
### Error handling
|
|
25
|
+
|
|
26
|
+
- Use `Result` for fallible operations. Do not use `panic` for recoverable errors.
|
|
27
|
+
- Use `thiserror` or similar for library error types, `anyhow` or similar for applications — matching the project's choice.
|
|
28
|
+
- Errors should be informative. A `Result<(), Box<dyn Error>>` is acceptable for a quick script; a typed error enum is better for a library or critical path.
|
|
29
|
+
|
|
30
|
+
### Types
|
|
31
|
+
|
|
32
|
+
- Make illegal states unrepresentable where practical.
|
|
33
|
+
- Use the type system to encode constraints.
|
|
34
|
+
- Avoid `unwrap()` in production code. Use `expect()` with a message when panicking is the intended behavior, and handle the error properly when it is not.
|
|
35
|
+
|
|
36
|
+
### Async
|
|
37
|
+
|
|
38
|
+
- The project's async runtime is its choice (`tokio`, `async-std`, or none for synchronous projects).
|
|
39
|
+
- Do not mix runtimes.
|
|
40
|
+
- Async does not make a slow operation fast. It allows concurrent waiting. Understand the difference.
|
|
41
|
+
|
|
42
|
+
### Dependencies
|
|
43
|
+
|
|
44
|
+
- `Cargo.lock` should be committed for applications.
|
|
45
|
+
- Review dependencies for licensing and maintenance status.
|
|
46
|
+
- Rust compiles what it needs. Unused dependencies are not a runtime cost but are a maintenance burden.
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Anti-patterns
|
|
51
|
+
|
|
52
|
+
- Using `unwrap()` as a substitute for error handling.
|
|
53
|
+
- Using `unsafe` to avoid learning the safe API.
|
|
54
|
+
- Over-using generics to the point of unreadability.
|
|
55
|
+
- Ignoring `clippy` warnings without reason.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# TypeScript Stack Skill
|
|
2
|
+
|
|
3
|
+
**Version:** 1.0.0
|
|
4
|
+
**Compatible:** project_skills >= 1.0
|
|
5
|
+
**Requires:** (activated by orchestrator on detection)
|
|
6
|
+
**Outputs:** (none — guidance only)
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Purpose
|
|
11
|
+
|
|
12
|
+
Guidance for working with TypeScript projects. Activated automatically when `package.json` and `.ts` files are detected.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Conventions
|
|
17
|
+
|
|
18
|
+
### Types
|
|
19
|
+
|
|
20
|
+
- Prefer `type` for unions and intersections, `interface` for object shapes that may be extended.
|
|
21
|
+
- Do not use `any`. Use `unknown` when the type is genuinely unknown, and narrow from there.
|
|
22
|
+
- Export types that are part of the public API.
|
|
23
|
+
- Avoid type assertions (`as T`) unless you have a specific reason and a comment explaining it.
|
|
24
|
+
|
|
25
|
+
### Runtime
|
|
26
|
+
|
|
27
|
+
- TypeScript compiles to JavaScript. Types are not runtime checks. Validate data at boundaries (API inputs, external data, user input) using runtime validation, not type assertions.
|
|
28
|
+
- Use a runtime validation library if the project handles external data (Zod, Valibot, io-ts, or similar). The choice is the project's.
|
|
29
|
+
|
|
30
|
+
### Module system
|
|
31
|
+
|
|
32
|
+
- Use ES modules (`import`/`export`).
|
|
33
|
+
- Prefer explicit imports over namespace imports.
|
|
34
|
+
- Barrel files (`index.ts`) are acceptable for public API surfaces but should not be overused.
|
|
35
|
+
|
|
36
|
+
### Error handling
|
|
37
|
+
|
|
38
|
+
- Use typed errors where appropriate.
|
|
39
|
+
- Do not throw string literals.
|
|
40
|
+
- Handle errors at the appropriate level — not everywhere, not nowhere.
|
|
41
|
+
|
|
42
|
+
### Tooling
|
|
43
|
+
|
|
44
|
+
- The project's tsconfig is the source of truth. Do not override it without reason.
|
|
45
|
+
- Strict mode should be on unless there is a documented reason.
|
|
46
|
+
- The project's linter and formatter are the project's choice. Follow them.
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Anti-patterns
|
|
51
|
+
|
|
52
|
+
- Using `any` to silence the compiler.
|
|
53
|
+
- Type assertions to bypass type errors without understanding why the error exists.
|
|
54
|
+
- Duplicate types between frontend and backend without a shared source.
|
|
55
|
+
- Runtime assumptions based on TypeScript types.
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# ADR: [Title]
|
|
2
|
+
|
|
3
|
+
**Status:** [proposed | accepted | deprecated | superseded]
|
|
4
|
+
**Date:** [YYYY-MM-DD]
|
|
5
|
+
**Deciders:** [who decided]
|
|
6
|
+
**Superseded by:** [ADR number, if applicable]
|
|
7
|
+
**Supersedes:** [ADR number, if applicable]
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Context
|
|
12
|
+
|
|
13
|
+
What is the problem or decision this ADR addresses? Why is this decision needed?
|
|
14
|
+
|
|
15
|
+
Describe the situation. Include relevant constraints, requirements, and forces.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Decision
|
|
20
|
+
|
|
21
|
+
What was decided?
|
|
22
|
+
|
|
23
|
+
Be specific. This is what the project will do (or did).
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Consequences
|
|
28
|
+
|
|
29
|
+
What does this decision imply?
|
|
30
|
+
|
|
31
|
+
### Positive
|
|
32
|
+
|
|
33
|
+
- [consequence]
|
|
34
|
+
- [consequence]
|
|
35
|
+
|
|
36
|
+
### Negative
|
|
37
|
+
|
|
38
|
+
- [consequence]
|
|
39
|
+
- [consequence]
|
|
40
|
+
|
|
41
|
+
### Neutral
|
|
42
|
+
|
|
43
|
+
- [consequence]
|
|
44
|
+
- [consequence]
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Alternatives Considered
|
|
49
|
+
|
|
50
|
+
What else was considered and why was it not chosen?
|
|
51
|
+
|
|
52
|
+
### [Alternative 1]
|
|
53
|
+
|
|
54
|
+
[Brief description and reason for rejection]
|
|
55
|
+
|
|
56
|
+
### [Alternative 2]
|
|
57
|
+
|
|
58
|
+
[Brief description and reason for rejection]
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## References
|
|
63
|
+
|
|
64
|
+
[Any relevant documents, issues, discussions, or external references]
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
# API Specification Template
|
|
2
|
+
|
|
3
|
+
**API Name:** [e.g., Core REST API / Public V1 API]
|
|
4
|
+
**Base URL:** `https://api.example.com/v1`
|
|
5
|
+
**Authentication:** [Bearer Token (JWT) / API Key / Session Cookie]
|
|
6
|
+
**Protocol:** [REST / GraphQL / gRPC]
|
|
7
|
+
**Last Updated:** [YYYY-MM-DD]
|
|
8
|
+
**Status:** [Draft / Stable / Deprecated]
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## 1. Authentication & Security
|
|
13
|
+
|
|
14
|
+
- **Scheme:** `Authorization: Bearer <token>`
|
|
15
|
+
- **Token Expiry:** [e.g., Access 15m, Refresh 7d]
|
|
16
|
+
- **Rate Limits:**
|
|
17
|
+
- Standard tier: `100 req / minute`
|
|
18
|
+
- Authenticated tier: `1000 req / minute`
|
|
19
|
+
- Rate limit response headers: `X-RateLimit-Limit`, `X-RateLimit-Remaining`, `Retry-After`
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## 2. Standard Response Envelopes
|
|
24
|
+
|
|
25
|
+
### Success Envelope (200 OK / 201 Created)
|
|
26
|
+
```json
|
|
27
|
+
{
|
|
28
|
+
"success": true,
|
|
29
|
+
"data": { ... },
|
|
30
|
+
"meta": {
|
|
31
|
+
"page": 1,
|
|
32
|
+
"per_page": 20,
|
|
33
|
+
"total": 150
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Error Envelope (4xx / 5xx)
|
|
39
|
+
```json
|
|
40
|
+
{
|
|
41
|
+
"success": false,
|
|
42
|
+
"error": {
|
|
43
|
+
"code": "RESOURCE_NOT_FOUND",
|
|
44
|
+
"message": "Human-readable error explanation",
|
|
45
|
+
"details": []
|
|
46
|
+
},
|
|
47
|
+
"request_id": "req_01hz8..."
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## 3. Endpoints
|
|
54
|
+
|
|
55
|
+
### 3.1 [Resource Name] Collection
|
|
56
|
+
|
|
57
|
+
#### `GET /v1/[resources]`
|
|
58
|
+
*List resources with pagination and filters.*
|
|
59
|
+
|
|
60
|
+
**Query Parameters:**
|
|
61
|
+
| Parameter | Type | Required | Default | Description |
|
|
62
|
+
|---|---|---|---|---|
|
|
63
|
+
| `page` | integer | No | `1` | Current page number |
|
|
64
|
+
| `limit` | integer | No | `20` | Items per page (max: 100) |
|
|
65
|
+
| `sort` | string | No | `created_at:desc` | Sort field and direction |
|
|
66
|
+
| `filter` | string | No | - | Query filter |
|
|
67
|
+
|
|
68
|
+
**Response (200 OK):**
|
|
69
|
+
```json
|
|
70
|
+
{
|
|
71
|
+
"success": true,
|
|
72
|
+
"data": [
|
|
73
|
+
{
|
|
74
|
+
"id": "res_12345",
|
|
75
|
+
"created_at": "2026-09-09T12:00:00Z"
|
|
76
|
+
}
|
|
77
|
+
],
|
|
78
|
+
"meta": {
|
|
79
|
+
"page": 1,
|
|
80
|
+
"per_page": 20,
|
|
81
|
+
"total": 1
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
#### `POST /v1/[resources]`
|
|
89
|
+
*Create a new resource.*
|
|
90
|
+
|
|
91
|
+
**Request Body:**
|
|
92
|
+
```json
|
|
93
|
+
{
|
|
94
|
+
"name": "string (required, max: 120)",
|
|
95
|
+
"status": "ACTIVE | INACTIVE"
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
**Response (201 Created):**
|
|
100
|
+
```json
|
|
101
|
+
{
|
|
102
|
+
"success": true,
|
|
103
|
+
"data": {
|
|
104
|
+
"id": "res_12345",
|
|
105
|
+
"status": "ACTIVE"
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
### 3.2 Individual Resource Operations
|
|
113
|
+
|
|
114
|
+
#### `GET /v1/[resources]/:id`
|
|
115
|
+
*Fetch single resource by ID.*
|
|
116
|
+
|
|
117
|
+
#### `PUT /v1/[resources]/:id`
|
|
118
|
+
*Replace or full update.*
|
|
119
|
+
|
|
120
|
+
#### `PATCH /v1/[resources]/:id`
|
|
121
|
+
*Partial update of fields.*
|
|
122
|
+
|
|
123
|
+
#### `DELETE /v1/[resources]/:id`
|
|
124
|
+
*Delete or soft-delete resource.*
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## 4. Error Code Reference
|
|
129
|
+
|
|
130
|
+
| HTTP Status | Error Code | Description |
|
|
131
|
+
|---|---|---|
|
|
132
|
+
| `400 Bad Request` | `VALIDATION_FAILED` | Request payload failed schema validation |
|
|
133
|
+
| `401 Unauthorized` | `UNAUTHENTICATED` | Missing or invalid auth credentials |
|
|
134
|
+
| `403 Forbidden` | `PERMISSION_DENIED` | Insufficient role or scope |
|
|
135
|
+
| `404 Not Found` | `NOT_FOUND` | Target entity does not exist |
|
|
136
|
+
| `429 Too Many Requests` | `RATE_LIMIT_EXCEEDED` | Request quota exhausted |
|
|
137
|
+
| `500 Internal Server Error` | `INTERNAL_ERROR` | Unexpected server fault |
|