agent-ctx 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/LICENSE +21 -0
- package/README.md +133 -0
- package/dist/bin/agent-ctx.d.ts +7 -0
- package/dist/bin/agent-ctx.d.ts.map +1 -0
- package/dist/bin/agent-ctx.js +8 -0
- package/dist/bin/agent-ctx.js.map +1 -0
- package/dist/bin/agentrc.d.ts +7 -0
- package/dist/bin/agentrc.d.ts.map +1 -0
- package/dist/bin/agentrc.js +8 -0
- package/dist/bin/agentrc.js.map +1 -0
- package/dist/commands/add.d.ts +12 -0
- package/dist/commands/add.d.ts.map +1 -0
- package/dist/commands/add.js +17 -0
- package/dist/commands/add.js.map +1 -0
- package/dist/commands/centralize.d.ts +12 -0
- package/dist/commands/centralize.d.ts.map +1 -0
- package/dist/commands/centralize.js +111 -0
- package/dist/commands/centralize.js.map +1 -0
- package/dist/commands/clean.d.ts +13 -0
- package/dist/commands/clean.d.ts.map +1 -0
- package/dist/commands/clean.js +109 -0
- package/dist/commands/clean.js.map +1 -0
- package/dist/commands/doctor.d.ts +12 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +168 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/init.d.ts +14 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +189 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/update.d.ts +13 -0
- package/dist/commands/update.d.ts.map +1 -0
- package/dist/commands/update.js +97 -0
- package/dist/commands/update.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +76 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/bridges.d.ts +35 -0
- package/dist/lib/bridges.d.ts.map +1 -0
- package/dist/lib/bridges.js +171 -0
- package/dist/lib/bridges.js.map +1 -0
- package/dist/lib/config.d.ts +31 -0
- package/dist/lib/config.d.ts.map +1 -0
- package/dist/lib/config.js +75 -0
- package/dist/lib/config.js.map +1 -0
- package/dist/lib/i18n.d.ts +22 -0
- package/dist/lib/i18n.d.ts.map +1 -0
- package/dist/lib/i18n.js +170 -0
- package/dist/lib/i18n.js.map +1 -0
- package/dist/lib/logger.d.ts +55 -0
- package/dist/lib/logger.d.ts.map +1 -0
- package/dist/lib/logger.js +168 -0
- package/dist/lib/logger.js.map +1 -0
- package/dist/lib/templates.d.ts +46 -0
- package/dist/lib/templates.d.ts.map +1 -0
- package/dist/lib/templates.js +88 -0
- package/dist/lib/templates.js.map +1 -0
- package/dist/lib/utils.d.ts +39 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.js +127 -0
- package/dist/lib/utils.js.map +1 -0
- package/dist/lib/wizard.d.ts +22 -0
- package/dist/lib/wizard.d.ts.map +1 -0
- package/dist/lib/wizard.js +197 -0
- package/dist/lib/wizard.js.map +1 -0
- package/package.json +63 -0
- package/src/templates/en/base/_agents.md +62 -0
- package/src/templates/en/base/_architecture.md +90 -0
- package/src/templates/en/base/_bootstrap.md +89 -0
- package/src/templates/en/base/_doc.md +65 -0
- package/src/templates/en/base/_mcp.md +81 -0
- package/src/templates/en/base/_project_state.md +48 -0
- package/src/templates/en/base/_rule.md +56 -0
- package/src/templates/en/base/_skill.md +60 -0
- package/src/templates/en/docs/doc-readme.md +43 -0
- package/src/templates/en/docs/mcp-readme.md +21 -0
- package/src/templates/en/memory/active_context.md +38 -0
- package/src/templates/en/memory/progress.md +35 -0
- package/src/templates/en/memory/project_brief.md +34 -0
- package/src/templates/en/memory/tech_context.md +44 -0
- package/src/templates/en/rules/rule-coding-standards.md +22 -0
- package/src/templates/en/skills/skill-agents.md +74 -0
- package/src/templates/en/skills/skill-api.md +117 -0
- package/src/templates/en/skills/skill-architecture.md +87 -0
- package/src/templates/en/skills/skill-generating.md +116 -0
- package/src/templates/en/skills/skill-git.md +109 -0
- package/src/templates/en/skills/skill-project-state.md +99 -0
- package/src/templates/en/skills/skill-react.md +94 -0
- package/src/templates/en/skills/skill-rules.md +100 -0
- package/src/templates/en/skills/skill-testing.md +139 -0
- package/src/templates/es/base/_agents.md +62 -0
- package/src/templates/es/base/_architecture.md +90 -0
- package/src/templates/es/base/_bootstrap.md +89 -0
- package/src/templates/es/base/_doc.md +65 -0
- package/src/templates/es/base/_mcp.md +81 -0
- package/src/templates/es/base/_project_state.md +48 -0
- package/src/templates/es/base/_rule.md +56 -0
- package/src/templates/es/base/_skill.md +60 -0
- package/src/templates/es/docs/doc-readme.md +43 -0
- package/src/templates/es/docs/mcp-readme.md +21 -0
- package/src/templates/es/memory/active_context.md +38 -0
- package/src/templates/es/memory/progress.md +35 -0
- package/src/templates/es/memory/project_brief.md +34 -0
- package/src/templates/es/memory/tech_context.md +44 -0
- package/src/templates/es/rules/rule-coding-standards.md +22 -0
- package/src/templates/es/skills/skill-agents.md +74 -0
- package/src/templates/es/skills/skill-api.md +117 -0
- package/src/templates/es/skills/skill-architecture.md +87 -0
- package/src/templates/es/skills/skill-generating.md +116 -0
- package/src/templates/es/skills/skill-git.md +108 -0
- package/src/templates/es/skills/skill-project-state.md +99 -0
- package/src/templates/es/skills/skill-react.md +94 -0
- package/src/templates/es/skills/skill-rules.md +100 -0
- package/src/templates/es/skills/skill-testing.md +139 -0
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: generating-skills
|
|
3
|
+
description: Create new agent skills following SKILL.md best practices. Use when creating, validating, or improving skill files for AI agent consumption.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Generating Skills
|
|
7
|
+
|
|
8
|
+
Create effective skills that AI agents can discover and use.
|
|
9
|
+
|
|
10
|
+
## When to use
|
|
11
|
+
|
|
12
|
+
- Creating a new skill from scratch
|
|
13
|
+
- Validating existing skill format
|
|
14
|
+
- Improving skill discoverability
|
|
15
|
+
- Converting documentation to skill format
|
|
16
|
+
|
|
17
|
+
## Standard Folder Structure
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
skill-name/
|
|
21
|
+
├── SKILL.md # Required: instructions + metadata
|
|
22
|
+
├── scripts/ # Optional: executable utilities
|
|
23
|
+
├── references/ # Optional: detailed documentation
|
|
24
|
+
└── assets/ # Optional: templates, resources
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
For simple skills, a single `SKILL.md` file is sufficient.
|
|
28
|
+
|
|
29
|
+
## YAML Frontmatter Requirements
|
|
30
|
+
|
|
31
|
+
```yaml
|
|
32
|
+
---
|
|
33
|
+
name: skill-name
|
|
34
|
+
description: What the skill does and when to use it. Third person. Max 1024 chars.
|
|
35
|
+
---
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Name Validation
|
|
39
|
+
|
|
40
|
+
- Maximum 64 characters
|
|
41
|
+
- Lowercase letters, numbers, hyphens only
|
|
42
|
+
- No consecutive hyphens (`--`)
|
|
43
|
+
- Cannot start/end with hyphen
|
|
44
|
+
- Pattern: `^[a-z0-9]+(-[a-z0-9]+)*$`
|
|
45
|
+
|
|
46
|
+
**Good names**: `api-design`, `git-workflow`, `processing-pdfs`
|
|
47
|
+
**Bad names**: `APIDesign`, `git--workflow`, `-api-design`
|
|
48
|
+
|
|
49
|
+
### Description Guidelines
|
|
50
|
+
|
|
51
|
+
- Write in third person
|
|
52
|
+
- Include both what it does AND when to use it
|
|
53
|
+
- Be specific with trigger terms
|
|
54
|
+
- Max 1024 characters
|
|
55
|
+
|
|
56
|
+
**Good**: `Design REST APIs with consistent patterns. Use when creating endpoints or handling errors.`
|
|
57
|
+
**Bad**: `Helps with APIs`
|
|
58
|
+
|
|
59
|
+
## SKILL.md Template
|
|
60
|
+
|
|
61
|
+
```markdown
|
|
62
|
+
---
|
|
63
|
+
name: skill-name
|
|
64
|
+
description: Brief description in third person. Include when to use.
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
# Skill Name
|
|
68
|
+
|
|
69
|
+
Brief overview.
|
|
70
|
+
|
|
71
|
+
## When to use
|
|
72
|
+
|
|
73
|
+
- Trigger condition 1
|
|
74
|
+
- Trigger condition 2
|
|
75
|
+
|
|
76
|
+
## Quick start
|
|
77
|
+
|
|
78
|
+
Minimal example to get started.
|
|
79
|
+
|
|
80
|
+
## Implementation steps
|
|
81
|
+
|
|
82
|
+
1. Step 1
|
|
83
|
+
2. Step 2
|
|
84
|
+
|
|
85
|
+
## Best practices
|
|
86
|
+
|
|
87
|
+
### ✅ Do
|
|
88
|
+
- Good practice
|
|
89
|
+
|
|
90
|
+
### ❌ Avoid
|
|
91
|
+
- Anti-pattern
|
|
92
|
+
|
|
93
|
+
## References
|
|
94
|
+
|
|
95
|
+
- [Link](url)
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Token Efficiency
|
|
99
|
+
|
|
100
|
+
- Keep SKILL.md under 500 lines
|
|
101
|
+
- Split content into separate files for complex skills
|
|
102
|
+
- Use progressive disclosure (reference files loaded on-demand)
|
|
103
|
+
- Assume Claude knows common patterns
|
|
104
|
+
|
|
105
|
+
## Workflow Checklist
|
|
106
|
+
|
|
107
|
+
Copy and track progress:
|
|
108
|
+
|
|
109
|
+
```
|
|
110
|
+
- [ ] Name follows lowercase-hyphen format
|
|
111
|
+
- [ ] Description is specific and includes triggers
|
|
112
|
+
- [ ] "When to use" section present
|
|
113
|
+
- [ ] Quick start example included
|
|
114
|
+
- [ ] Best practices documented
|
|
115
|
+
- [ ] Under 500 lines
|
|
116
|
+
```
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: git-workflow
|
|
3
|
+
description: Git conventions, branching strategies, and commit message formatting. Use when creating commits, branches, PRs, or resolving git conflicts.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Git Workflow
|
|
7
|
+
|
|
8
|
+
Git conventions, commits, and workflow patterns.
|
|
9
|
+
|
|
10
|
+
## When to use
|
|
11
|
+
|
|
12
|
+
- Writing commit messages
|
|
13
|
+
- Creating feature branches
|
|
14
|
+
- Managing pull requests
|
|
15
|
+
- Resolving conflicts or rebasing
|
|
16
|
+
|
|
17
|
+
## Commit Messages (Conventional Commits)
|
|
18
|
+
|
|
19
|
+
### Format
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
<type>(<scope>): <description>
|
|
23
|
+
|
|
24
|
+
[optional body]
|
|
25
|
+
|
|
26
|
+
[optional footer]
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Types
|
|
30
|
+
|
|
31
|
+
| Type | Description |
|
|
32
|
+
|------|-------------|
|
|
33
|
+
| `feat` | New feature |
|
|
34
|
+
| `fix` | Bug fix |
|
|
35
|
+
| `docs` | Documentation only |
|
|
36
|
+
| `style` | Formatting (no code change) |
|
|
37
|
+
| `refactor` | Code refactoring |
|
|
38
|
+
| `test` | Add/modify tests |
|
|
39
|
+
| `chore` | Maintenance, deps |
|
|
40
|
+
| `perf` | Performance improvement |
|
|
41
|
+
|
|
42
|
+
### Examples
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
feat(auth): add login with Google OAuth
|
|
46
|
+
fix(api): handle null response in user fetch
|
|
47
|
+
docs: update installation guide
|
|
48
|
+
refactor(utils): simplify date formatting function
|
|
49
|
+
|
|
50
|
+
# Breaking change
|
|
51
|
+
feat(api)!: change response format
|
|
52
|
+
|
|
53
|
+
BREAKING CHANGE: Response now returns data in `result` instead of `data`
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Branching Strategy (Git Flow)
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
main (production)
|
|
60
|
+
│
|
|
61
|
+
└── develop (development)
|
|
62
|
+
│
|
|
63
|
+
├── feature/new-feature
|
|
64
|
+
├── bugfix/fix-bug
|
|
65
|
+
└── release/v1.2.0
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Create Feature Branch
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
git checkout develop
|
|
72
|
+
git pull origin develop
|
|
73
|
+
git checkout -b feature/descriptive-name
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Useful Commands
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
# Stash
|
|
80
|
+
git stash # Save changes
|
|
81
|
+
git stash pop # Restore changes
|
|
82
|
+
|
|
83
|
+
# Interactive Rebase
|
|
84
|
+
git rebase -i HEAD~3 # Last 3 commits
|
|
85
|
+
|
|
86
|
+
# Cherry Pick
|
|
87
|
+
git cherry-pick abc123 # Apply specific commit
|
|
88
|
+
|
|
89
|
+
# Bisect (find bug)
|
|
90
|
+
git bisect start
|
|
91
|
+
git bisect bad # Current commit has bug
|
|
92
|
+
git bisect good abc123 # Known good commit
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Best practices
|
|
96
|
+
|
|
97
|
+
### ✅ Do
|
|
98
|
+
|
|
99
|
+
- Atomic commits (one logical change per commit)
|
|
100
|
+
- Small, focused PRs
|
|
101
|
+
- Rebase before merge
|
|
102
|
+
- Squash WIP commits
|
|
103
|
+
|
|
104
|
+
### ❌ Avoid
|
|
105
|
+
|
|
106
|
+
- Commits with just "fix" or "update"
|
|
107
|
+
- Giant PRs (>500 lines)
|
|
108
|
+
- Force push to shared branches
|
|
109
|
+
- Mixing refactors with features
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: tracking-project-state
|
|
3
|
+
description: Manage project state documentation for AI agent context. Use when updating current work status, priorities, or project phase.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Tracking Project State
|
|
7
|
+
|
|
8
|
+
Maintain a living document of current project status for AI agents.
|
|
9
|
+
|
|
10
|
+
## When to use
|
|
11
|
+
|
|
12
|
+
- Starting or completing major tasks
|
|
13
|
+
- Changing project priorities
|
|
14
|
+
- Blocking issues arise
|
|
15
|
+
- Sprint or phase transitions
|
|
16
|
+
|
|
17
|
+
## Project State Structure
|
|
18
|
+
|
|
19
|
+
```markdown
|
|
20
|
+
# Project State
|
|
21
|
+
|
|
22
|
+
## Current Phase
|
|
23
|
+
[Development / Testing / Maintenance / etc.]
|
|
24
|
+
|
|
25
|
+
## Active Work
|
|
26
|
+
|
|
27
|
+
### In Progress
|
|
28
|
+
- [ ] Feature X - [brief status]
|
|
29
|
+
- [ ] Bug fix Y - [brief status]
|
|
30
|
+
|
|
31
|
+
### Blocked
|
|
32
|
+
- Issue Z - [reason] - [owner]
|
|
33
|
+
|
|
34
|
+
## Recent Completions
|
|
35
|
+
- ✅ Feature A (date)
|
|
36
|
+
- ✅ Bug fix B (date)
|
|
37
|
+
|
|
38
|
+
## Next Priorities
|
|
39
|
+
1. Priority task 1
|
|
40
|
+
2. Priority task 2
|
|
41
|
+
|
|
42
|
+
## Known Issues
|
|
43
|
+
- Issue description - [severity]
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Update Frequency
|
|
47
|
+
|
|
48
|
+
Update project_state.md when:
|
|
49
|
+
- Starting significant work
|
|
50
|
+
- Completing features or fixes
|
|
51
|
+
- Encountering blockers
|
|
52
|
+
- Changing priorities
|
|
53
|
+
- Beginning new sprint/phase
|
|
54
|
+
|
|
55
|
+
## Best Practices
|
|
56
|
+
|
|
57
|
+
### ✅ Do
|
|
58
|
+
|
|
59
|
+
- Keep it current (update same day)
|
|
60
|
+
- Be specific about status
|
|
61
|
+
- Include blockers and owners
|
|
62
|
+
- Date recent completions
|
|
63
|
+
- Limit to top priorities
|
|
64
|
+
|
|
65
|
+
### ❌ Avoid
|
|
66
|
+
|
|
67
|
+
- Stale information (>1 week old)
|
|
68
|
+
- Too much detail (link to issues instead)
|
|
69
|
+
- Historical log (keep only recent)
|
|
70
|
+
- Vague status updates
|
|
71
|
+
|
|
72
|
+
## Integration with AI Agents
|
|
73
|
+
|
|
74
|
+
AI agents check project_state.md to:
|
|
75
|
+
- Understand what's being worked on
|
|
76
|
+
- Avoid conflicting changes
|
|
77
|
+
- Prioritize their suggestions
|
|
78
|
+
- Provide contextual help
|
|
79
|
+
|
|
80
|
+
## File Location
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
project/
|
|
84
|
+
└── .context/
|
|
85
|
+
└── project_state.md # Current project state
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Quick Update Template
|
|
89
|
+
|
|
90
|
+
When updating, use this format:
|
|
91
|
+
|
|
92
|
+
```markdown
|
|
93
|
+
## Update [Date]
|
|
94
|
+
|
|
95
|
+
**Completed**: [what was finished]
|
|
96
|
+
**In Progress**: [what's being worked on]
|
|
97
|
+
**Next**: [upcoming priority]
|
|
98
|
+
**Blocked**: [any blockers] (if applicable)
|
|
99
|
+
```
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: react-patterns
|
|
3
|
+
description: React component patterns, hooks, and best practices for TypeScript. Use when creating components, custom hooks, or optimizing rendering.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# React Patterns
|
|
7
|
+
|
|
8
|
+
Patterns and best practices for React development.
|
|
9
|
+
|
|
10
|
+
## When to use
|
|
11
|
+
|
|
12
|
+
- Creating reusable components
|
|
13
|
+
- Handling complex state
|
|
14
|
+
- Optimizing rendering performance
|
|
15
|
+
- Building custom hooks
|
|
16
|
+
|
|
17
|
+
## Component Patterns
|
|
18
|
+
|
|
19
|
+
### Functional Component with Typed Props
|
|
20
|
+
|
|
21
|
+
```tsx
|
|
22
|
+
interface ButtonProps {
|
|
23
|
+
variant: 'primary' | 'secondary';
|
|
24
|
+
children: React.ReactNode;
|
|
25
|
+
onClick?: () => void;
|
|
26
|
+
disabled?: boolean;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function Button({ variant, children, onClick, disabled }: ButtonProps) {
|
|
30
|
+
return (
|
|
31
|
+
<button
|
|
32
|
+
className={`btn btn-${variant}`}
|
|
33
|
+
onClick={onClick}
|
|
34
|
+
disabled={disabled}
|
|
35
|
+
>
|
|
36
|
+
{children}
|
|
37
|
+
</button>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Custom Hook
|
|
43
|
+
|
|
44
|
+
```tsx
|
|
45
|
+
function useToggle(initialValue = false) {
|
|
46
|
+
const [value, setValue] = useState(initialValue);
|
|
47
|
+
|
|
48
|
+
const toggle = useCallback(() => setValue(v => !v), []);
|
|
49
|
+
const setTrue = useCallback(() => setValue(true), []);
|
|
50
|
+
const setFalse = useCallback(() => setValue(false), []);
|
|
51
|
+
|
|
52
|
+
return { value, toggle, setTrue, setFalse };
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Compound Components
|
|
57
|
+
|
|
58
|
+
```tsx
|
|
59
|
+
const Card = ({ children }) => <div className="card">{children}</div>;
|
|
60
|
+
Card.Header = ({ children }) => <div className="card-header">{children}</div>;
|
|
61
|
+
Card.Body = ({ children }) => <div className="card-body">{children}</div>;
|
|
62
|
+
|
|
63
|
+
// Usage:
|
|
64
|
+
<Card>
|
|
65
|
+
<Card.Header>Title</Card.Header>
|
|
66
|
+
<Card.Body>Content</Card.Body>
|
|
67
|
+
</Card>
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Directory Structure
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
components/
|
|
74
|
+
├── ui/ # Base components (Button, Input, Modal)
|
|
75
|
+
├── features/ # Feature-specific components
|
|
76
|
+
├── layouts/ # Layouts and wrappers
|
|
77
|
+
└── hooks/ # Reusable custom hooks
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Best practices
|
|
81
|
+
|
|
82
|
+
### ✅ Do
|
|
83
|
+
|
|
84
|
+
- Use `useMemo` and `useCallback` for optimization
|
|
85
|
+
- Type all props with TypeScript
|
|
86
|
+
- Extract logic to custom hooks
|
|
87
|
+
- Use composition over inheritance
|
|
88
|
+
|
|
89
|
+
### ❌ Avoid
|
|
90
|
+
|
|
91
|
+
- Excessive props drilling (use Context)
|
|
92
|
+
- useEffect without correct dependencies
|
|
93
|
+
- State in the wrong component
|
|
94
|
+
- Rendering lists without `key`
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: creating-rules
|
|
3
|
+
description: Define coding rules and standards documentation. Use when establishing or updating coding conventions, linter rules, or team standards.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Creating Coding Rules
|
|
7
|
+
|
|
8
|
+
Define and document coding standards that AI agents and developers must follow.
|
|
9
|
+
|
|
10
|
+
## When to use
|
|
11
|
+
|
|
12
|
+
- Establishing new coding conventions
|
|
13
|
+
- Documenting existing team standards
|
|
14
|
+
- Adding linter or formatter rules
|
|
15
|
+
- Clarifying ambiguous code patterns
|
|
16
|
+
|
|
17
|
+
## Rule Document Structure
|
|
18
|
+
|
|
19
|
+
```markdown
|
|
20
|
+
# Rule: [Rule Name]
|
|
21
|
+
|
|
22
|
+
> Brief description of the rule
|
|
23
|
+
|
|
24
|
+
## Why this rule exists
|
|
25
|
+
|
|
26
|
+
[Explain the problem this prevents or benefit it provides]
|
|
27
|
+
|
|
28
|
+
## Requirements
|
|
29
|
+
|
|
30
|
+
- Requirement 1
|
|
31
|
+
- Requirement 2
|
|
32
|
+
|
|
33
|
+
## ✅ Correct Examples
|
|
34
|
+
|
|
35
|
+
[Code showing correct usage]
|
|
36
|
+
|
|
37
|
+
## ❌ Incorrect Examples
|
|
38
|
+
|
|
39
|
+
[Code showing what to avoid]
|
|
40
|
+
|
|
41
|
+
## Exceptions
|
|
42
|
+
|
|
43
|
+
[Valid exceptions or "No exceptions"]
|
|
44
|
+
|
|
45
|
+
## Enforcement
|
|
46
|
+
|
|
47
|
+
- [ ] Linter rule: [rule name]
|
|
48
|
+
- [ ] Code review checklist
|
|
49
|
+
- [ ] Automated test
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Common Rule Categories
|
|
53
|
+
|
|
54
|
+
### Code Style
|
|
55
|
+
|
|
56
|
+
- Naming conventions (camelCase, PascalCase)
|
|
57
|
+
- File organization
|
|
58
|
+
- Import ordering
|
|
59
|
+
- Comment standards
|
|
60
|
+
|
|
61
|
+
### Architecture
|
|
62
|
+
|
|
63
|
+
- Component structure
|
|
64
|
+
- State management patterns
|
|
65
|
+
- API design patterns
|
|
66
|
+
- Error handling
|
|
67
|
+
|
|
68
|
+
### Quality
|
|
69
|
+
|
|
70
|
+
- Test coverage requirements
|
|
71
|
+
- Performance thresholds
|
|
72
|
+
- Security practices
|
|
73
|
+
- Accessibility standards
|
|
74
|
+
|
|
75
|
+
## Writing Effective Rules
|
|
76
|
+
|
|
77
|
+
### ✅ Do
|
|
78
|
+
|
|
79
|
+
- Provide concrete examples
|
|
80
|
+
- Explain the "why" not just the "what"
|
|
81
|
+
- Include both correct and incorrect examples
|
|
82
|
+
- Make rules enforceable (linter, tests)
|
|
83
|
+
|
|
84
|
+
### ❌ Avoid
|
|
85
|
+
|
|
86
|
+
- Vague requirements
|
|
87
|
+
- Rules without examples
|
|
88
|
+
- Conflicting rules
|
|
89
|
+
- Overly strict exceptions
|
|
90
|
+
|
|
91
|
+
## File Organization
|
|
92
|
+
|
|
93
|
+
```
|
|
94
|
+
.context/
|
|
95
|
+
└── rules/
|
|
96
|
+
├── coding-standards.md # Main standards
|
|
97
|
+
├── naming-conventions.md # Naming rules
|
|
98
|
+
├── testing-rules.md # Test requirements
|
|
99
|
+
└── security-rules.md # Security practices
|
|
100
|
+
```
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: testing-practices
|
|
3
|
+
description: Testing strategies, patterns, and best practices with Jest/Vitest. Use when writing unit tests, integration tests, or mocking dependencies.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Testing Practices
|
|
7
|
+
|
|
8
|
+
Strategies and patterns for effective testing.
|
|
9
|
+
|
|
10
|
+
## When to use
|
|
11
|
+
|
|
12
|
+
- Writing unit tests
|
|
13
|
+
- Creating integration tests
|
|
14
|
+
- Mocking dependencies
|
|
15
|
+
- Testing React components
|
|
16
|
+
|
|
17
|
+
## Testing Pyramid
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
/\
|
|
21
|
+
/ \ E2E Tests (Playwright, Cypress)
|
|
22
|
+
/----\
|
|
23
|
+
/ \ Integration Tests
|
|
24
|
+
/--------\
|
|
25
|
+
/ \ Unit Tests
|
|
26
|
+
/____________\
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Unit Tests (Vitest)
|
|
30
|
+
|
|
31
|
+
### Basic Test
|
|
32
|
+
|
|
33
|
+
```typescript
|
|
34
|
+
import { describe, it, expect } from 'vitest';
|
|
35
|
+
import { sum } from './sum';
|
|
36
|
+
|
|
37
|
+
describe('sum', () => {
|
|
38
|
+
it('should add two positive numbers', () => {
|
|
39
|
+
expect(sum(1, 2)).toBe(3);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it('should handle negative numbers', () => {
|
|
43
|
+
expect(sum(-1, 1)).toBe(0);
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Test with Setup/Teardown
|
|
49
|
+
|
|
50
|
+
```typescript
|
|
51
|
+
describe('UserService', () => {
|
|
52
|
+
let service: UserService;
|
|
53
|
+
|
|
54
|
+
beforeEach(() => {
|
|
55
|
+
service = new UserService();
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
afterEach(() => {
|
|
59
|
+
vi.clearAllMocks();
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it('should create a user', async () => {
|
|
63
|
+
const user = await service.create({ name: 'Test' });
|
|
64
|
+
expect(user.id).toBeDefined();
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Mocking
|
|
70
|
+
|
|
71
|
+
```typescript
|
|
72
|
+
// Module mock
|
|
73
|
+
vi.mock('./database', () => ({
|
|
74
|
+
query: vi.fn().mockResolvedValue([{ id: 1, name: 'Test' }])
|
|
75
|
+
}));
|
|
76
|
+
|
|
77
|
+
// Function mock
|
|
78
|
+
const mockFetch = vi.fn().mockResolvedValue({
|
|
79
|
+
json: () => Promise.resolve({ data: 'test' })
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
// Spy
|
|
83
|
+
const spy = vi.spyOn(console, 'log');
|
|
84
|
+
myFunction();
|
|
85
|
+
expect(spy).toHaveBeenCalledWith('expected message');
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## React Testing Library
|
|
89
|
+
|
|
90
|
+
```typescript
|
|
91
|
+
import { render, screen, fireEvent } from '@testing-library/react';
|
|
92
|
+
|
|
93
|
+
test('should display and interact with button', async () => {
|
|
94
|
+
const handleClick = vi.fn();
|
|
95
|
+
render(<Button onClick={handleClick}>Click me</Button>);
|
|
96
|
+
|
|
97
|
+
const button = screen.getByRole('button', { name: /click me/i });
|
|
98
|
+
expect(button).toBeInTheDocument();
|
|
99
|
+
|
|
100
|
+
await fireEvent.click(button);
|
|
101
|
+
expect(handleClick).toHaveBeenCalledTimes(1);
|
|
102
|
+
});
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Test Structure
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
__tests__/
|
|
109
|
+
├── unit/
|
|
110
|
+
│ ├── services/
|
|
111
|
+
│ └── utils/
|
|
112
|
+
├── integration/
|
|
113
|
+
│ └── api/
|
|
114
|
+
└── e2e/
|
|
115
|
+
└── flows/
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Best practices
|
|
119
|
+
|
|
120
|
+
### ✅ Do
|
|
121
|
+
|
|
122
|
+
- One assertion per test (when possible)
|
|
123
|
+
- Descriptive names: `should_X_when_Y`
|
|
124
|
+
- Arrange-Act-Assert (AAA)
|
|
125
|
+
- Independent tests
|
|
126
|
+
|
|
127
|
+
### ❌ Avoid
|
|
128
|
+
|
|
129
|
+
- Tests that depend on order
|
|
130
|
+
- Logic in tests
|
|
131
|
+
- Flaky tests (intermittent)
|
|
132
|
+
- Mocking everything
|
|
133
|
+
|
|
134
|
+
## Coverage Targets
|
|
135
|
+
|
|
136
|
+
- Statements: 80%
|
|
137
|
+
- Branches: 75%
|
|
138
|
+
- Functions: 80%
|
|
139
|
+
- Lines: 80%
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Contexto para Agentes IA
|
|
2
|
+
|
|
3
|
+
> **LEE ESTO PRIMERO** — Este archivo es el punto de entrada para cualquier agente IA trabajando en este proyecto.
|
|
4
|
+
|
|
5
|
+
Eres un desarrollador experto senior uniéndote a este proyecto.
|
|
6
|
+
Tu objetivo es ayudar a construir, refactorizar y mantener este código siguiendo estrictamente nuestra arquitectura y reglas.
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Índice de Conocimiento
|
|
11
|
+
|
|
12
|
+
Antes de escribir **cualquier** código, **DEBES** leer y entender:
|
|
13
|
+
|
|
14
|
+
| Prioridad | Archivo | Propósito |
|
|
15
|
+
|-----------|---------|-----------|
|
|
16
|
+
| 1 | `.context/architecture.md` | Stack tecnológico completo, estructura, flujo de datos |
|
|
17
|
+
| 2 | `.context/rules/coding-standards.md` | Convenciones de código, reglas TypeScript, naming |
|
|
18
|
+
| 3 | `.context/project_state.md` | Tareas actuales, TODOs, bloqueantes |
|
|
19
|
+
| 4 | `.context/skills/` | Patrones para React, APIs, testing, etc. |
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Memory Bank
|
|
24
|
+
|
|
25
|
+
Para persistencia de sesión y continuidad de contexto, revisa:
|
|
26
|
+
|
|
27
|
+
- `.context/memory/project_brief.md` — Resumen de alto nivel del proyecto
|
|
28
|
+
- `.context/memory/tech_context.md` — Decisiones técnicas y su justificación
|
|
29
|
+
- `.context/memory/active_context.md` — Foco actual y cambios recientes
|
|
30
|
+
- `.context/memory/progress.md` — Trabajo completado y milestones
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Inicio Rápido para Agentes
|
|
35
|
+
|
|
36
|
+
1. **Lee** este archivo completamente
|
|
37
|
+
2. **Abre** `.context/architecture.md` para entender el stack
|
|
38
|
+
3. **Revisa** `.context/rules/coding-standards.md` para convenciones
|
|
39
|
+
4. **Consulta** `.context/project_state.md` para prioridades actuales
|
|
40
|
+
5. **Sigue** todos los patrones en `.context/skills/` cuando aplique
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Instrucciones Específicas del Proyecto
|
|
45
|
+
|
|
46
|
+
<!--
|
|
47
|
+
TODO: Añade tus instrucciones específicas aquí.
|
|
48
|
+
Ejemplos:
|
|
49
|
+
- "Siempre usa pnpm, no npm"
|
|
50
|
+
- "Ejecuta `pnpm test` antes de commitear"
|
|
51
|
+
- "La rama main está protegida, usa feature branches"
|
|
52
|
+
-->
|
|
53
|
+
|
|
54
|
+
[Añade tus instrucciones específicas del proyecto aquí]
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Notas
|
|
59
|
+
|
|
60
|
+
- Este archivo fue generado por [agent-ctx](https://github.com/avicdro/agent-ctx)
|
|
61
|
+
- Personaliza todos los archivos `.context/` según tu proyecto
|
|
62
|
+
- Mantén este archivo actualizado conforme evoluciona tu proyecto
|