create-ai-project 1.11.2
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/.claude/agents/acceptance-test-generator.md +316 -0
- package/.claude/agents/code-reviewer.md +193 -0
- package/.claude/agents/document-reviewer.md +182 -0
- package/.claude/agents/prd-creator.md +186 -0
- package/.claude/agents/quality-fixer.md +295 -0
- package/.claude/agents/requirement-analyzer.md +161 -0
- package/.claude/agents/rule-advisor.md +194 -0
- package/.claude/agents/task-decomposer.md +291 -0
- package/.claude/agents/task-executor.md +270 -0
- package/.claude/agents/technical-designer.md +343 -0
- package/.claude/agents/work-planner.md +181 -0
- package/.claude/agents-en/acceptance-test-generator.md +256 -0
- package/.claude/agents-en/code-reviewer.md +195 -0
- package/.claude/agents-en/design-sync.md +225 -0
- package/.claude/agents-en/document-reviewer.md +190 -0
- package/.claude/agents-en/integration-test-reviewer.md +195 -0
- package/.claude/agents-en/prd-creator.md +196 -0
- package/.claude/agents-en/quality-fixer-frontend.md +334 -0
- package/.claude/agents-en/quality-fixer.md +291 -0
- package/.claude/agents-en/requirement-analyzer.md +165 -0
- package/.claude/agents-en/rule-advisor.md +194 -0
- package/.claude/agents-en/task-decomposer.md +291 -0
- package/.claude/agents-en/task-executor-frontend.md +276 -0
- package/.claude/agents-en/task-executor.md +272 -0
- package/.claude/agents-en/technical-designer-frontend.md +441 -0
- package/.claude/agents-en/technical-designer.md +371 -0
- package/.claude/agents-en/work-planner.md +216 -0
- package/.claude/agents-ja/acceptance-test-generator.md +256 -0
- package/.claude/agents-ja/code-reviewer.md +195 -0
- package/.claude/agents-ja/design-sync.md +225 -0
- package/.claude/agents-ja/document-reviewer.md +192 -0
- package/.claude/agents-ja/integration-test-reviewer.md +195 -0
- package/.claude/agents-ja/prd-creator.md +194 -0
- package/.claude/agents-ja/quality-fixer-frontend.md +335 -0
- package/.claude/agents-ja/quality-fixer.md +292 -0
- package/.claude/agents-ja/requirement-analyzer.md +164 -0
- package/.claude/agents-ja/rule-advisor.md +194 -0
- package/.claude/agents-ja/task-decomposer.md +291 -0
- package/.claude/agents-ja/task-executor-frontend.md +276 -0
- package/.claude/agents-ja/task-executor.md +272 -0
- package/.claude/agents-ja/technical-designer-frontend.md +442 -0
- package/.claude/agents-ja/technical-designer.md +370 -0
- package/.claude/agents-ja/work-planner.md +213 -0
- package/.claude/commands/build.md +78 -0
- package/.claude/commands/design.md +27 -0
- package/.claude/commands/implement.md +79 -0
- package/.claude/commands/plan.md +43 -0
- package/.claude/commands/project-inject.md +76 -0
- package/.claude/commands/refine-rule.md +206 -0
- package/.claude/commands/review.md +78 -0
- package/.claude/commands/sync-rules.md +116 -0
- package/.claude/commands/task.md +13 -0
- package/.claude/commands-en/build.md +77 -0
- package/.claude/commands-en/design.md +39 -0
- package/.claude/commands-en/front-build.md +103 -0
- package/.claude/commands-en/front-design.md +42 -0
- package/.claude/commands-en/front-plan.md +40 -0
- package/.claude/commands-en/implement.md +75 -0
- package/.claude/commands-en/plan.md +45 -0
- package/.claude/commands-en/project-inject.md +76 -0
- package/.claude/commands-en/refine-rule.md +208 -0
- package/.claude/commands-en/review.md +78 -0
- package/.claude/commands-en/sync-rules.md +116 -0
- package/.claude/commands-en/task.md +13 -0
- package/.claude/commands-ja/build.md +75 -0
- package/.claude/commands-ja/design.md +37 -0
- package/.claude/commands-ja/front-build.md +103 -0
- package/.claude/commands-ja/front-design.md +42 -0
- package/.claude/commands-ja/front-plan.md +40 -0
- package/.claude/commands-ja/implement.md +73 -0
- package/.claude/commands-ja/plan.md +43 -0
- package/.claude/commands-ja/project-inject.md +76 -0
- package/.claude/commands-ja/refine-rule.md +206 -0
- package/.claude/commands-ja/review.md +78 -0
- package/.claude/commands-ja/sync-rules.md +116 -0
- package/.claude/commands-ja/task.md +13 -0
- package/.claude/settings.local.json +74 -0
- package/.husky/pre-commit +1 -0
- package/.husky/pre-push +3 -0
- package/.madgerc +14 -0
- package/.tsprunerc +11 -0
- package/CLAUDE.en.md +102 -0
- package/CLAUDE.ja.md +102 -0
- package/CLAUDE.md +111 -0
- package/LICENSE +21 -0
- package/README.ja.md +233 -0
- package/README.md +243 -0
- package/bin/create-project.js +87 -0
- package/biome.json +51 -0
- package/docs/adr/template-en.md +64 -0
- package/docs/adr/template-ja.md +64 -0
- package/docs/design/template-en.md +281 -0
- package/docs/design/template-ja.md +285 -0
- package/docs/guides/en/quickstart.md +111 -0
- package/docs/guides/en/rule-editing-guide.md +266 -0
- package/docs/guides/en/sub-agents.md +343 -0
- package/docs/guides/en/use-cases.md +308 -0
- package/docs/guides/ja/quickstart.md +112 -0
- package/docs/guides/ja/rule-editing-guide.md +266 -0
- package/docs/guides/ja/sub-agents.md +343 -0
- package/docs/guides/ja/use-cases.md +290 -0
- package/docs/guides/sub-agents.md +306 -0
- package/docs/plans/20250123-integration-test-improvement.md +993 -0
- package/docs/plans/template-en.md +130 -0
- package/docs/plans/template-ja.md +130 -0
- package/docs/prd/template-en.md +109 -0
- package/docs/prd/template-ja.md +109 -0
- package/docs/rules/ai-development-guide.md +260 -0
- package/docs/rules/architecture/implementation-approach.md +136 -0
- package/docs/rules/documentation-criteria.md +180 -0
- package/docs/rules/project-context.md +38 -0
- package/docs/rules/rules-index.yaml +137 -0
- package/docs/rules/technical-spec.md +47 -0
- package/docs/rules/typescript-testing.md +188 -0
- package/docs/rules/typescript.md +166 -0
- package/docs/rules-en/architecture/implementation-approach.md +136 -0
- package/docs/rules-en/coding-standards.md +333 -0
- package/docs/rules-en/documentation-criteria.md +184 -0
- package/docs/rules-en/frontend/technical-spec.md +143 -0
- package/docs/rules-en/frontend/typescript-testing.md +124 -0
- package/docs/rules-en/frontend/typescript.md +131 -0
- package/docs/rules-en/integration-e2e-testing.md +149 -0
- package/docs/rules-en/project-context.md +38 -0
- package/docs/rules-en/rules-index.yaml +211 -0
- package/docs/rules-en/technical-spec.md +86 -0
- package/docs/rules-en/typescript-testing.md +149 -0
- package/docs/rules-en/typescript.md +116 -0
- package/docs/rules-ja/architecture/implementation-approach.md +136 -0
- package/docs/rules-ja/coding-standards.md +333 -0
- package/docs/rules-ja/documentation-criteria.md +180 -0
- package/docs/rules-ja/frontend/technical-spec.md +143 -0
- package/docs/rules-ja/frontend/typescript-testing.md +124 -0
- package/docs/rules-ja/frontend/typescript.md +131 -0
- package/docs/rules-ja/integration-e2e-testing.md +149 -0
- package/docs/rules-ja/project-context.md +38 -0
- package/docs/rules-ja/rules-index.yaml +196 -0
- package/docs/rules-ja/technical-spec.md +86 -0
- package/docs/rules-ja/typescript-testing.md +149 -0
- package/docs/rules-ja/typescript.md +116 -0
- package/package.json +98 -0
- package/scripts/check-unused-exports.js +69 -0
- package/scripts/cleanup-test-processes.sh +32 -0
- package/scripts/post-setup.js +110 -0
- package/scripts/set-language.js +310 -0
- package/scripts/setup-project.js +199 -0
- package/scripts/show-coverage.js +74 -0
- package/src/index.ts +11 -0
- package/templates/.gitignore.template +52 -0
- package/tsconfig.json +50 -0
- package/vitest.config.mjs +47 -0
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# Quick Start Guide for AI Development
|
|
2
|
+
|
|
3
|
+
This guide walks you through setting up the AI Coding Project Boilerplate and implementing your first feature. Let's skip the complex stuff for now and just get it running.
|
|
4
|
+
|
|
5
|
+
## Setup (5 minutes to complete)
|
|
6
|
+
|
|
7
|
+
### For New Projects
|
|
8
|
+
|
|
9
|
+
Open your terminal and run these commands. Feel free to change the project name to whatever you like.
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npx github:shinpr/ai-coding-project-boilerplate my-awesome-project
|
|
13
|
+
cd my-awesome-project
|
|
14
|
+
npm install
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
That's it! You now have a `my-awesome-project` folder with all the necessary files ready to use.
|
|
18
|
+
|
|
19
|
+
### For Existing Projects
|
|
20
|
+
|
|
21
|
+
If you already have a TypeScript project, you can copy the necessary files. First, download the boilerplate to a temporary location.
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
# Download the boilerplate temporarily
|
|
25
|
+
npx github:shinpr/ai-coding-project-boilerplate temp-boilerplate
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Then copy the following files into the root directory of your existing project.
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
# Run in your existing project directory
|
|
32
|
+
cp -r temp-boilerplate/.claude/agents .claude/agents
|
|
33
|
+
cp -r temp-boilerplate/.claude/commands .claude/commands
|
|
34
|
+
cp -r temp-boilerplate/docs/rules docs/rules
|
|
35
|
+
cp -r temp-boilerplate/docs/adr docs/
|
|
36
|
+
cp -r temp-boilerplate/docs/design docs/
|
|
37
|
+
cp -r temp-boilerplate/docs/plans docs/
|
|
38
|
+
cp -r temp-boilerplate/docs/prd docs/
|
|
39
|
+
cp -r temp-boilerplate/docs/guides/en/sub-agents.md docs/guides/sub-agents.md
|
|
40
|
+
cp temp-boilerplate/CLAUDE.md .
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
If you want to change the directory structure, you'll need to adjust paths starting with `@docs/rules/` in sub-agents and command definition files. Also update `docs/rules-index.yaml` accordingly.
|
|
44
|
+
Because this can get complicated, we recommend sticking with the default structure unless you have specific needs.
|
|
45
|
+
|
|
46
|
+
## Launch Claude Code and Initial Setup
|
|
47
|
+
|
|
48
|
+
Launch Claude Code in your project directory.
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
claude
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Once launched, let's set up project-specific information. This is a crucial step for the AI to understand your project.
|
|
55
|
+
|
|
56
|
+
Run the following custom slash command inside Claude Code.
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
/project-inject
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
You'll be guided through an interactive dialog to clarify your project information. Feel free to answer casually - you can change this information later.
|
|
63
|
+
Once you finish answering, your project context will be saved to `docs/rules/project-context.md`. This enables the AI to understand your project's purpose and generate more appropriate code.
|
|
64
|
+
|
|
65
|
+
After reviewing the file and confirming it looks good, complete this step with the following command.
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
/sync-rules
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Let's Implement Your First Feature
|
|
72
|
+
|
|
73
|
+
Now let's create your first feature. Specify it using the following command in Claude Code.
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
/implement Create a simple API that returns "Hello"
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
The `/implement` command guides you through the entire workflow from design to implementation.
|
|
80
|
+
|
|
81
|
+
First, it analyzes your requirements to determine the feature scale. It might say something like "This is a medium-scale feature requiring about 3 files." Based on the scale, it creates necessary design documents.
|
|
82
|
+
|
|
83
|
+
For small features, it creates just a simple work plan. For large features, it creates a complete flow from PRD (Product Requirements Document) to Design Doc (Technical Design Document). After each design document is created, an automatic review is performed.
|
|
84
|
+
|
|
85
|
+
Once the design is complete, the AI will ask "Here's the design I've created. Could you review it?" Read through it and request changes if needed, or approve it if it looks good.
|
|
86
|
+
Depending on the Claude Code model you're using, it may automatically proceed to the next design document if your review is positive. At some point it will ask for your approval, so you can provide batch feedback then.
|
|
87
|
+
|
|
88
|
+
After design approval, integration test skeletons and a work plan are created. Once you review the implementation steps (requesting changes if needed) and approve, the actual implementation begins.
|
|
89
|
+
|
|
90
|
+
The AI breaks down the work plan into single-commit task units and autonomously implements each task using a TDD approach. After each task, it performs a defined 6-step quality check, fixes any errors, and creates a commit if everything passes. You can simply watch the progress.
|
|
91
|
+
|
|
92
|
+
When all tasks are complete, it will report "Implementation complete." Check `git log` to see a clean series of commits.
|
|
93
|
+
|
|
94
|
+
## Development Philosophy of This Boilerplate
|
|
95
|
+
|
|
96
|
+
Let me explain the thinking behind this boilerplate.
|
|
97
|
+
|
|
98
|
+
To maximize throughput with AI assistance, it's crucial to minimize human intervention. However, achieving high execution accuracy with AI requires careful context management—providing the right information at the right time. Without proper systems, humans need to guide the implementation process, which prevents throughput maximization.
|
|
99
|
+
|
|
100
|
+
This boilerplate solves this through systematic approaches: selecting appropriate context (rules, requirements, specifications) for each phase and limiting unnecessary information during task execution.
|
|
101
|
+
|
|
102
|
+
The workflow is: create design documents, review them with users to align understanding, use those documents as context for planning and task creation. Tasks are executed by sub-agents with dedicated contexts, which removes unnecessary information and stabilizes implementation. This system helps maintain quality even for projects too large to fit within a single coding agent's context window (Claude Opus 4.1 supports 200K tokens, Sonnet 4 beta supports up to 1M tokens, but the basic limit is 200K tokens).
|
|
103
|
+
|
|
104
|
+
For detailed mechanics, see [this article](https://dev.to/shinpr/zero-context-exhaustion-building-production-ready-ai-coding-teams-with-claude-code-sub-agents-31b).
|
|
105
|
+
|
|
106
|
+
## Troubleshooting
|
|
107
|
+
|
|
108
|
+
If things aren't working, check the following.
|
|
109
|
+
|
|
110
|
+
**If implementation stops midway**
|
|
111
|
+
Describe the current state to Claude Code and ask it to resume, for example: "You've completed up to the Design Doc creation, so please continue from there and complete the implementation."
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
# Rule Editing Guide
|
|
2
|
+
|
|
3
|
+
This guide explains the core concepts and best practices for writing effective rules that maximize LLM execution accuracy, based on how LLMs work.
|
|
4
|
+
|
|
5
|
+
## Project Philosophy and the Importance of Rule Files
|
|
6
|
+
|
|
7
|
+
This boilerplate is designed based on the concepts of "Agentic Coding" and "Context Engineering":
|
|
8
|
+
- **Agentic Coding**: LLMs autonomously making decisions and carrying out implementation tasks
|
|
9
|
+
- **Context Engineering**: Building mechanisms to provide appropriate context at the right time for LLMs to make proper decisions
|
|
10
|
+
|
|
11
|
+
For details, see [this article](https://dev.to/shinpr/zero-context-exhaustion-building-production-ready-ai-coding-teams-with-claude-code-sub-agents-31b).
|
|
12
|
+
|
|
13
|
+
Proper rule management and [sub-agents](https://docs.anthropic.com/en/docs/claude-code/sub-agents) are crucial keys to realizing these concepts.
|
|
14
|
+
|
|
15
|
+
Rule files are written to maximize LLM execution accuracy as described below.
|
|
16
|
+
|
|
17
|
+
Sub-agents have dedicated contexts separate from the main agent. They are designed to load only the necessary rule files to fulfill specific responsibilities.
|
|
18
|
+
When the main agent executes tasks, it uses "metacognition" (reflecting on and analyzing its own reasoning process) to understand task context, select necessary rules from the rule file collection, and execute tasks.
|
|
19
|
+
This approach maximizes execution accuracy by retrieving the right rules at the right time without excess or deficiency.
|
|
20
|
+
|
|
21
|
+
While it's impossible to completely control LLM output, it is possible to maximize execution accuracy by establishing proper systems.
|
|
22
|
+
Conversely, LLM execution accuracy can easily degrade depending on rule file content.
|
|
23
|
+
|
|
24
|
+
With the premise that complete control is impossible, executing tasks, reflecting on issues that arise, and feeding back into the system enables maintaining and improving execution accuracy.
|
|
25
|
+
When using this in actual projects and results don't match expectations, consider improving rule files.
|
|
26
|
+
|
|
27
|
+
## Determining Where to Document Rules
|
|
28
|
+
|
|
29
|
+
### File Roles and Scope
|
|
30
|
+
|
|
31
|
+
| File | Scope | When Applied | Example Content |
|
|
32
|
+
|------|-------|--------------|-----------------|
|
|
33
|
+
| **CLAUDE.md** | All tasks | Always | Approval required before Edit/Write, stop at 5+ file changes |
|
|
34
|
+
| **Rule files** | Specific technical domains | When using that technology | Use specific types, error handling required, functions under 30 lines |
|
|
35
|
+
| **Guidelines** | Specific workflows | When performing that workflow | Sub-agent selection strategies |
|
|
36
|
+
| **Design Docs** | Specific features | When developing that feature | Feature requirements, API specifications, security constraints |
|
|
37
|
+
|
|
38
|
+
### Decision Flow
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
When is this rule needed?
|
|
42
|
+
├─ Always → CLAUDE.md
|
|
43
|
+
├─ Only for specific feature development → Design Doc
|
|
44
|
+
├─ When using specific technology → Rule files
|
|
45
|
+
└─ When performing specific workflow → Guidelines
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## 9 Rule Principles for Maximizing LLM Execution Accuracy
|
|
49
|
+
|
|
50
|
+
Here are 9 rule creation principles based on LLM characteristics and this boilerplate's design philosophy.
|
|
51
|
+
While we provide a `/refine-rule` custom slash command to assist with rule modifications, we ultimately recommend interactive rule editing through dialogue rather than commands, as LLMs tend to have difficulty reaching issues without comparing output with thinking after generation.
|
|
52
|
+
|
|
53
|
+
### 1. Achieve Maximum Accuracy with Minimum Description (Context Pressure vs. Execution Accuracy)
|
|
54
|
+
|
|
55
|
+
Context is a precious resource. Avoid redundant explanations and include only essential information.
|
|
56
|
+
However, it's not just about being short - it must be the minimum description that doesn't cause decision hesitation.
|
|
57
|
+
|
|
58
|
+
```markdown
|
|
59
|
+
❌ Redundant description (22 words)
|
|
60
|
+
Please make sure to record all errors in the log when they occur
|
|
61
|
+
|
|
62
|
+
✅ Concise description (9 words)
|
|
63
|
+
All errors must be logged
|
|
64
|
+
|
|
65
|
+
❌ Over-abbreviated description (6 words)
|
|
66
|
+
Record all errors
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Aim for concise expressions that keep the same meaning. But don't shorten so much that ambiguity is introduced.
|
|
70
|
+
|
|
71
|
+
### 2. Completely Unify Notation
|
|
72
|
+
|
|
73
|
+
Always use the same terms for the same concepts. Notation inconsistencies hinder LLM understanding.
|
|
74
|
+
|
|
75
|
+
```markdown
|
|
76
|
+
# Term Definitions (Unified across project)
|
|
77
|
+
- API response/return value → Unified as `response`
|
|
78
|
+
- User/customer → Unified as `user`
|
|
79
|
+
- Error/abnormality → Unified as `error` (exception/failure may be used depending on context)
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### 3. Thoroughly Eliminate Duplication
|
|
83
|
+
|
|
84
|
+
Repeating the same content across multiple files wastes context capacity. Consolidate in one place.
|
|
85
|
+
|
|
86
|
+
```markdown
|
|
87
|
+
❌ Same content in multiple locations
|
|
88
|
+
# docs/rules/base.md
|
|
89
|
+
Standard error format: { success: false, error: string, code: number }
|
|
90
|
+
|
|
91
|
+
# docs/rules/api.md
|
|
92
|
+
Error responses follow standard error format `{ success: false, error: string, code: number }`
|
|
93
|
+
|
|
94
|
+
✅ Consolidated in one location
|
|
95
|
+
# docs/rules/base.md
|
|
96
|
+
Standard error format: { success: false, error: string, code: number }
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Check for duplication between files and eliminate contradictions and redundancy.
|
|
100
|
+
Eliminating duplication also reduces maintenance costs by preventing notation inconsistencies from update omissions.
|
|
101
|
+
|
|
102
|
+
### 4. Appropriately Aggregate Responsibilities
|
|
103
|
+
|
|
104
|
+
Consolidating related content in one file maintains single responsibility and prevents unnecessary context mixing in tasks.
|
|
105
|
+
|
|
106
|
+
```markdown
|
|
107
|
+
# Authentication consolidated in one file
|
|
108
|
+
docs/rules/auth.md
|
|
109
|
+
├── JWT Specification
|
|
110
|
+
├── Authentication Flow
|
|
111
|
+
├── Error Handling
|
|
112
|
+
└── Security Requirements
|
|
113
|
+
|
|
114
|
+
# ❌ Dispersed responsibilities
|
|
115
|
+
docs/rules/auth.md
|
|
116
|
+
├── JWT Specification
|
|
117
|
+
├── Error Handling
|
|
118
|
+
└── Security Requirements
|
|
119
|
+
docs/rules/flow.md
|
|
120
|
+
├── User Registration Flow
|
|
121
|
+
└── Authentication Flow
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
However, if a file becomes too large, reading costs increase, so aim for logical division or rule selection around 250 lines (approximately 1,500 tokens).
|
|
125
|
+
|
|
126
|
+
### 5. Set Measurable Decision Criteria
|
|
127
|
+
|
|
128
|
+
Ambiguous instructions cause interpretation inconsistencies. Clarify criteria with numbers and specific conditions.
|
|
129
|
+
|
|
130
|
+
```markdown
|
|
131
|
+
✅ Measurable criteria
|
|
132
|
+
- Function lines: 30 or less
|
|
133
|
+
- Cyclomatic complexity: 10 or less
|
|
134
|
+
- Response time: Within 200ms at p95
|
|
135
|
+
- Test coverage: 80% or more
|
|
136
|
+
|
|
137
|
+
❌ Ambiguous criteria
|
|
138
|
+
- Readable code
|
|
139
|
+
- Fast processing
|
|
140
|
+
- Sufficient tests
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Note that LLMs cannot understand time, so descriptions like "break down tasks to complete within 30 minutes" are not effective.
|
|
144
|
+
|
|
145
|
+
### 6. Show NG Patterns as Recommendations with Background
|
|
146
|
+
|
|
147
|
+
Showing recommended patterns with reasons is more effective than listing prohibitions.
|
|
148
|
+
|
|
149
|
+
```markdown
|
|
150
|
+
✅ Description in recommended format
|
|
151
|
+
【State Management】
|
|
152
|
+
Recommended: Use Zustand or Context API
|
|
153
|
+
Reason: Global variables are difficult to test and state tracking is complex
|
|
154
|
+
NG Example: window.globalState = { ... }
|
|
155
|
+
|
|
156
|
+
❌ List of prohibitions
|
|
157
|
+
- Don't use global variables
|
|
158
|
+
- Don't save values to window object
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
If prohibitions are needed, present them as background context rather than the main rule.
|
|
162
|
+
|
|
163
|
+
### 7. Verbalize Implicit Assumptions
|
|
164
|
+
|
|
165
|
+
Even things obvious to human developers must be explicitly stated for LLMs to understand.
|
|
166
|
+
|
|
167
|
+
```markdown
|
|
168
|
+
## Prerequisites
|
|
169
|
+
- Execution environment: Node.js 20.x on AWS Lambda
|
|
170
|
+
- Maximum execution time: 15 minutes (Lambda limit)
|
|
171
|
+
- Memory limit: 3GB
|
|
172
|
+
- Concurrent executions: 1000 (account limit)
|
|
173
|
+
- Timezone: All UTC
|
|
174
|
+
- Character encoding: UTF-8 only
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
Use the `/project-inject` command at project start or when project assumptions change to document project context as rules.
|
|
178
|
+
|
|
179
|
+
### 8. Arrange Descriptions by Importance
|
|
180
|
+
|
|
181
|
+
LLMs pay more attention to information at the beginning. Place most important rules first, exceptional cases last.
|
|
182
|
+
|
|
183
|
+
```markdown
|
|
184
|
+
# API Rules
|
|
185
|
+
|
|
186
|
+
## Critical Principles (Must follow)
|
|
187
|
+
1. All APIs require JWT authentication
|
|
188
|
+
2. Rate limit: 100 requests/minute
|
|
189
|
+
3. Timeout: 30 seconds
|
|
190
|
+
|
|
191
|
+
## Standard Specifications
|
|
192
|
+
- Methods: Follow REST principles
|
|
193
|
+
- Body: JSON format
|
|
194
|
+
- Character encoding: UTF-8
|
|
195
|
+
|
|
196
|
+
## Exceptional Cases (Only for special situations)
|
|
197
|
+
- multipart/form-data allowed only for file uploads
|
|
198
|
+
- WebSocket connections only at /ws endpoint
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
### 9. Clarify Scope Boundaries
|
|
202
|
+
|
|
203
|
+
Explicitly stating what is and isn't covered prevents unnecessary processing and misunderstandings.
|
|
204
|
+
|
|
205
|
+
```markdown
|
|
206
|
+
## Scope of This Rule
|
|
207
|
+
|
|
208
|
+
### Covered
|
|
209
|
+
- REST APIs in general
|
|
210
|
+
- GraphQL endpoints
|
|
211
|
+
- WebSocket communication
|
|
212
|
+
|
|
213
|
+
### Not Covered
|
|
214
|
+
- Static file delivery
|
|
215
|
+
- Health check endpoint (/health)
|
|
216
|
+
- Metrics endpoint (/metrics)
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
## Reference: Efficient Rule Writing
|
|
220
|
+
|
|
221
|
+
Rule files under `docs/rules` are created with these principles in mind.
|
|
222
|
+
Each is written with no duplication, single responsibility, and minimal description, serving as references when adding or creating new rules.
|
|
223
|
+
|
|
224
|
+
### Correspondence Between Rule Files and Applied Principles
|
|
225
|
+
|
|
226
|
+
| Rule File | Main Content | Examples of Applied Principles |
|
|
227
|
+
|-----------|-------------|--------------------------------|
|
|
228
|
+
| **typescript.md** | TypeScript code creation/modification/refactoring, modern type features | **Principle 2**: Unified notation (consistent terms like "any type completely prohibited")<br>**Principle 5**: Measurable criteria (20 fields max, 3 nesting levels max) |
|
|
229
|
+
| **typescript-testing.md** | Test creation, quality checks, development steps | **Principle 5**: Measurable criteria (coverage 70% or more)<br>**Principle 8**: Arrangement by importance (quality requirements at the top) |
|
|
230
|
+
| **ai-development-guide.md** | Technical decision criteria, anti-pattern detection, best practices | **Principle 6**: Show NG patterns in recommended format (anti-pattern collection)<br>**Principle 3**: Eliminate duplication (Rule of Three for consolidation decisions) |
|
|
231
|
+
| **technical-spec.md** | Technical design, environment setup, documentation process | **Principle 4**: Aggregate responsibilities (technical design in one file)<br>**Principle 7**: Verbalize implicit assumptions (security rules documented) |
|
|
232
|
+
| **project-context.md** | Project-specific information, implementation principles | **Principle 7**: Verbalize implicit assumptions (project characteristics documented)<br>**Principle 1**: Maximum accuracy with minimum description (concise bullet format) |
|
|
233
|
+
| **documentation-criteria.md** | Scale determination, document creation criteria | **Principle 5**: Measurable criteria (creation decision matrix)<br>**Principle 9**: Clarify scope boundaries (clearly state what's included/excluded) |
|
|
234
|
+
| **implementation-approach.md** | Implementation strategy selection, task breakdown, large-scale change planning | **Principle 8**: Arrangement by importance (Phase-ordered structure)<br>**Principle 6**: Show NG patterns in recommended format (risk analysis) |
|
|
235
|
+
|
|
236
|
+
All 9 principles are practiced across these files, serving as practical references for rule creation.
|
|
237
|
+
|
|
238
|
+
## Troubleshooting
|
|
239
|
+
|
|
240
|
+
### Problem: Rules are too long and overload the context window
|
|
241
|
+
|
|
242
|
+
**Solutions**
|
|
243
|
+
1. Find and remove duplications
|
|
244
|
+
2. Minimize examples
|
|
245
|
+
3. Utilize reference format
|
|
246
|
+
4. Move low-priority rules to separate files
|
|
247
|
+
|
|
248
|
+
### Problem: Inconsistent generation results
|
|
249
|
+
|
|
250
|
+
**Solutions**
|
|
251
|
+
1. Unify terms and notation
|
|
252
|
+
2. Quantify decision criteria
|
|
253
|
+
3. Clarify priorities
|
|
254
|
+
4. Eliminate contradicting rules
|
|
255
|
+
|
|
256
|
+
### Problem: Important rules are not followed
|
|
257
|
+
|
|
258
|
+
**Solutions**
|
|
259
|
+
1. Move to file beginning
|
|
260
|
+
2. Add 【Required】【Important】 tags
|
|
261
|
+
3. Add one specific example
|
|
262
|
+
4. Convert negative form to positive form
|
|
263
|
+
|
|
264
|
+
## Summary
|
|
265
|
+
|
|
266
|
+
Well-written rules stabilize LLM output. By following the 9 principles and continuously refining your rules, you can maximize LLM capabilities. Build the optimal rule set for your project through regular implementation review and improvement.
|