@sha3/code-standards 0.1.6 → 0.1.7
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/README.md
CHANGED
|
@@ -117,7 +117,7 @@ After `init`, your new repo contains:
|
|
|
117
117
|
- `ai/examples/rules/*.ts` (good/bad examples per rule)
|
|
118
118
|
- `ai/examples/demo/src/*` (feature-folder demo with classes and section blocks)
|
|
119
119
|
- `src/config.ts` for centralized hardcoded configuration values
|
|
120
|
-
- `README.md` generated with an icon emoji
|
|
120
|
+
- `README.md` generated with an icon emoji and complete integration docs (API + config + integration contract for other LLMs)
|
|
121
121
|
- `.gitignore` preconfigured for Node/TypeScript output
|
|
122
122
|
- lint/format/typecheck/test-ready project template
|
|
123
123
|
- `package.json.codeStandards` metadata used by `refresh` (`template`, `profilePath`, `withAiAdapters`, `lastRefreshWith`)
|
package/package.json
CHANGED
|
@@ -7,6 +7,11 @@ Mandatory requirements:
|
|
|
7
7
|
- README MUST clearly explain: what the project does, why it exists, and how to use it in under 60 seconds.
|
|
8
8
|
- README MUST include practical copy/paste examples that are runnable.
|
|
9
9
|
- README MUST include a fast path (`TL;DR` or `Quick Start`) and an in-depth reference section.
|
|
10
|
+
- For libraries, README MUST be complete integration documentation for external teams and LLM agents.
|
|
11
|
+
- README MUST include a public API reference section with exported members and behavior expectations.
|
|
12
|
+
- README MUST include a dedicated integration section that shows how to install/import/use from another project.
|
|
13
|
+
- README MUST include a configuration reference section (`src/config.ts`) with meaning of each constant.
|
|
14
|
+
- README MUST include compatibility constraints (runtime, ESM/CJS expectations, TypeScript assumptions).
|
|
10
15
|
- README MUST include a section for AI usage (how to instruct assistants to follow local standards).
|
|
11
16
|
- README MUST avoid vague marketing language and focus on actionable guidance.
|
|
12
17
|
- README MUST be visually structured with clean headings, concise lists, and code blocks.
|
|
@@ -16,6 +21,7 @@ Good example characteristics:
|
|
|
16
21
|
|
|
17
22
|
- Starts with immediate value and one-command quick start.
|
|
18
23
|
- Shows exact commands and expected flow.
|
|
24
|
+
- Includes public API and integration contract without forcing reader to inspect source files.
|
|
19
25
|
- Includes troubleshooting or FAQ for common confusion points.
|
|
20
26
|
|
|
21
27
|
Bad example characteristics:
|
package/standards/readme.md
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
## Goal
|
|
4
4
|
|
|
5
5
|
Every repository README MUST be clear, actionable, and visually structured.
|
|
6
|
+
For libraries, README MUST be complete integration documentation because other LLMs will use it as source-of-truth.
|
|
6
7
|
|
|
7
8
|
## Mandatory Sections
|
|
8
9
|
|
|
@@ -10,6 +11,11 @@ Every repository README MUST be clear, actionable, and visually structured.
|
|
|
10
11
|
- TL;DR or Quick Start with copy/paste commands.
|
|
11
12
|
- What it does and why it exists.
|
|
12
13
|
- Setup and usage examples.
|
|
14
|
+
- Installation requirements and exact install command.
|
|
15
|
+
- Public API reference (exports, expected inputs/outputs, and behavior notes).
|
|
16
|
+
- Integration guide (how to consume the library from another project).
|
|
17
|
+
- Configuration reference (`src/config.ts` constants and impact).
|
|
18
|
+
- Compatibility and constraints (runtime, module format, TypeScript expectations).
|
|
13
19
|
- AI workflow section when the repository uses AI coding contracts.
|
|
14
20
|
- Troubleshooting or FAQ.
|
|
15
21
|
|
|
@@ -23,3 +29,4 @@ Every repository README MUST be clear, actionable, and visually structured.
|
|
|
23
29
|
## Quality Bar
|
|
24
30
|
|
|
25
31
|
A top-tier README lets a new engineer understand and run the project in under 5 minutes without asking additional questions.
|
|
32
|
+
For libraries, a top-tier README also lets another LLM integrate the library in a different codebase without opening source files.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# 📚 {{packageName}}
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Reusable TypeScript library with a clear integration contract for external projects and LLM agents.
|
|
4
4
|
|
|
5
5
|
## TL;DR
|
|
6
6
|
|
|
@@ -10,28 +10,74 @@ npm run check
|
|
|
10
10
|
npm run build
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
##
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install <library-name>
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Compatibility
|
|
20
|
+
|
|
21
|
+
- Node.js 20+
|
|
22
|
+
- ESM (`"type": "module"`)
|
|
23
|
+
- Strict TypeScript
|
|
24
|
+
|
|
25
|
+
## Public API
|
|
26
|
+
|
|
27
|
+
### `greet(name: string): string`
|
|
28
|
+
|
|
29
|
+
Returns a greeting using the configured prefix.
|
|
14
30
|
|
|
15
31
|
```ts
|
|
16
|
-
import { greet } from "
|
|
32
|
+
import { greet } from "<library-name>";
|
|
17
33
|
|
|
18
|
-
|
|
34
|
+
const greeting = greet("world");
|
|
35
|
+
console.log(greeting);
|
|
19
36
|
```
|
|
20
37
|
|
|
38
|
+
## Integration Guide (External Projects)
|
|
39
|
+
|
|
40
|
+
1. Install the library with `npm install <library-name>`.
|
|
41
|
+
2. Import only from the public entrypoint (`<library-name>`).
|
|
42
|
+
3. Do not import internal paths (`src/*`, private `dist/*` files, or private modules).
|
|
43
|
+
4. If you integrate with an LLM, treat this section as the integration contract.
|
|
44
|
+
|
|
45
|
+
## Configuration (`src/config.ts`)
|
|
46
|
+
|
|
47
|
+
Hardcoded configuration is centralized in `src/config.ts`.
|
|
48
|
+
|
|
49
|
+
- `CONFIG.GREETING_PREFIX`: prefix used by `greet`.
|
|
50
|
+
|
|
51
|
+
## Contract for LLM Integrators
|
|
52
|
+
|
|
53
|
+
- This README is the source of truth for external integration.
|
|
54
|
+
- The stable API is the one documented in `Public API`.
|
|
55
|
+
- If API shape or observable behavior changes, update this README in the same change.
|
|
56
|
+
|
|
21
57
|
## Scripts
|
|
22
58
|
|
|
23
59
|
- `npm run check`: lint + format check + typecheck + tests
|
|
24
|
-
- `npm run fix`:
|
|
25
|
-
- `npm run build`:
|
|
26
|
-
- `npm run test`:
|
|
60
|
+
- `npm run fix`: lint/prettier autofix
|
|
61
|
+
- `npm run build`: compile to `dist/`
|
|
62
|
+
- `npm run test`: tests con Node test runner
|
|
63
|
+
|
|
64
|
+
## Structure
|
|
65
|
+
|
|
66
|
+
- `src/`: implementation
|
|
67
|
+
- `src/config.ts`: centralized configuration
|
|
68
|
+
- `test/`: tests
|
|
69
|
+
- `dist/`: build output
|
|
70
|
+
|
|
71
|
+
## Troubleshooting
|
|
72
|
+
|
|
73
|
+
### Import errors (ESM)
|
|
74
|
+
|
|
75
|
+
Ensure the consumer project uses Node.js-compatible ESM.
|
|
27
76
|
|
|
28
|
-
|
|
77
|
+
### Type errors
|
|
29
78
|
|
|
30
|
-
|
|
31
|
-
- `src/config.ts`: configuracion hardcodeada centralizada
|
|
32
|
-
- `test/`: pruebas
|
|
33
|
-
- `dist/`: salida de build
|
|
79
|
+
Run `npm run typecheck` in the consumer project and verify TypeScript version compatibility.
|
|
34
80
|
|
|
35
81
|
## AI Workflow
|
|
36
82
|
|
|
37
|
-
|
|
83
|
+
If you work with assistants, treat `AGENTS.md` and `ai/*.md` as blocking rules.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# 🚀 {{packageName}}
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
TypeScript service template ready for local execution and feature-based evolution.
|
|
4
4
|
|
|
5
5
|
## TL;DR
|
|
6
6
|
|
|
@@ -10,27 +10,61 @@ npm run check
|
|
|
10
10
|
npm run start
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
##
|
|
13
|
+
## Run
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
16
|
npm run start
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
The service starts on `http://localhost:3000` by default.
|
|
20
|
+
|
|
21
|
+
## Compatibility
|
|
22
|
+
|
|
23
|
+
- Node.js 20+
|
|
24
|
+
- ESM (`"type": "module"`)
|
|
25
|
+
- Strict TypeScript
|
|
26
|
+
|
|
27
|
+
## API HTTP
|
|
28
|
+
|
|
29
|
+
### `GET /`
|
|
30
|
+
|
|
31
|
+
- Response: `200 OK`
|
|
32
|
+
- `content-type`: `application/json`
|
|
33
|
+
- body: `{ "ok": true, "statusSource": "<url>" }`
|
|
34
|
+
|
|
35
|
+
## Integration Guide (External Projects)
|
|
36
|
+
|
|
37
|
+
1. Start the service with `npm run start`.
|
|
38
|
+
2. Consume the root endpoint for health/status.
|
|
39
|
+
3. Integrate through the HTTP contract, not through internal files.
|
|
40
|
+
|
|
41
|
+
## Configuration (`src/config.ts`)
|
|
42
|
+
|
|
43
|
+
Hardcoded configuration is centralized:
|
|
44
|
+
|
|
45
|
+
- `CONFIG.RESPONSE_CONTENT_TYPE`
|
|
46
|
+
- `CONFIG.DEFAULT_PORT`
|
|
47
|
+
- `CONFIG.EXTERNAL_STATUS_URL`
|
|
48
|
+
|
|
49
|
+
## Contract for LLM Integrators
|
|
50
|
+
|
|
51
|
+
- This README defines the expected HTTP contract.
|
|
52
|
+
- Payload/status/header changes require a README update in the same change.
|
|
53
|
+
- For integration, use documented endpoints and do not assume internal details.
|
|
20
54
|
|
|
21
55
|
## Scripts
|
|
22
56
|
|
|
23
|
-
- `npm run start`:
|
|
57
|
+
- `npm run start`: start the service with `tsx`
|
|
24
58
|
- `npm run check`: lint + format check + typecheck + tests
|
|
25
|
-
- `npm run fix`:
|
|
26
|
-
- `npm run test`:
|
|
59
|
+
- `npm run fix`: apply lint/prettier autofix
|
|
60
|
+
- `npm run test`: run tests with Node test runner
|
|
27
61
|
|
|
28
|
-
##
|
|
62
|
+
## Structure
|
|
29
63
|
|
|
30
|
-
- `src/`:
|
|
31
|
-
- `src/config.ts`:
|
|
32
|
-
- `test/`:
|
|
64
|
+
- `src/`: implementation
|
|
65
|
+
- `src/config.ts`: centralized hardcoded configuration
|
|
66
|
+
- `test/`: tests
|
|
33
67
|
|
|
34
68
|
## AI Workflow
|
|
35
69
|
|
|
36
|
-
|
|
70
|
+
If you work with assistants, treat `AGENTS.md` and `ai/*.md` as blocking rules.
|