Skip to content
Open
Empty file added .claude/skills/.gitkeep
Empty file.
Empty file added .specs/analysis/.gitkeep
Empty file.
20 changes: 20 additions & 0 deletions .specs/tasks/draft/add-code-quality-improvements.feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
title: Add code quality improvements
---

## Description

add code quality improvements logic across plugins and agents

## Steps

1. Add to @plugins/ddd/rules/ new rule `avoid-code-duplication`, use @plugins/customaize-agent/skills/create-rule/SKILL.md as instructions for creating the rule. This rule should include function dublication example, but not only this. It should focus more on concepts and logic duplication, and include examples for it. This cases should cover not only obvius code repetition, but also more generic conserns when repeatable concepts and logic are not extracted and reused. Research principles and practices that can be quoted, instead of writing own version of it.
2. Add to @plugins/ddd/rules/ new rule `boy-scout-rule`, use @plugins/customaize-agent/skills/create-rule/SKILL.md as instructions for creating the rule. This rule should cover the concept of "boy scout rule", which is a rule that force agent to allways leave the code better than they found it, when they touch it, by refactoring and improving it. This rule should include examples of how to properly do it, and how to avoid over-engineering and too much refactoring. Research principles and practices that can be quoted, instead of writing own version of it.
3. Add or update @plugins/sdd/agents/code-explorer.md new section to search for code/functions/logic/concepts that can be reused during implementation of the task. Include specific section in scratchpad template and add examples at the end of the agent file.
4. Update @plugins/sdd/agents/software-architect.md specific requirement to use reusable code/functions/logic/concepts when possible from codebase impact analysis during planing and include it as requirement for implementation of the task. Update strachpad template with it, and add examples at the end of the agent file.
5. Update @plugins/sdd/agents/qa-engineer.md to include regular checks section for each step. Specifically, agent should analyse what quality gates are avaiable, like build,lint,test,etc. And include in step requirements checklist that build/lint/test/... should pass, each as separate item. Also, in this regular checks section should be included check that newly written code not have any code dublication, and that it allign with CLAUDE.md/CONTRIBUTING.md/rules/etc (depending on what avaiable) and that it followed boy scout rule. And if software architecture plan mention any code/functions/logic/concepts that can be reused in this step, qa should include check that this code/functions/logic/concepts was used in the step.
6. Create new agent in @plugins/sdd/agents/ directory, name it `code-quality-reviewer`. This agent should be responsible for reviewing the code quality of the codebase, focusing on newly written code, but also checking that align with rest of codebase, project guidelines, style guides, and best practices, and that it reused all possible code/functions/logic/concepts from what existin in codebase. And include call of it in @plugins/sdd/skills/implement/SKILL.md file. It should become part of Phase 3: Final Verification and be spawned in parallel with judge agent. Code Quality Reviewer should provide very strict review of all newly written code using checks and scoring rubrics and return score and list of found issues. Then if score is below 3/5, orcestrator should launch developer agent to fix issues and then again code-quality-reviewer agent to verify. Orcestrator should iterate up to 3 times, until score will pass. In order to write code-quality-reviewer.md follow this process:
- Copy paste @plugins/sadd/agents/judge.md file to it and rename it to code-quality-reviewer.md. Modify there role, goal and anything that not align with code quality reviewer role.
- The default judge agent expect that it will receive yaml for checklist/scoring rubrics/etc. Write this yaml and include directly in code-quality-reviewer.md and update code-quality-reviewer.md to use this yaml instead of expecting it from user. In order to write yaml PRECISELY follow @plugins/sadd/agents/meta-judge.md. And use @plugins/ddd/rules/ files as basis for checks and scoring rubrics. Each of the rules should be presented in at least one checklist item or scoring rubric.
- Analyse Muda (Waste Analysis) method from @plugins/kaizen/skills/analyse/SKILL.md and include it as separate stage in code-quality-reviewer.md. Include exampels and all types of waste, update scratchbook templatae to include this stage properly. Code Quality Reviewer should follow this stage preciasly and report all found issues using it. And for each found issue, he should decrease final score, based on the impact of the issue.
7. Update @plugins/sdd/skills/implement/SKILL.md to add param `--skip-code-quality-review` to skip code quality review and `--code-quality-review-score` to set the score threshold for code quality review (default is 3/5).
71 changes: 71 additions & 0 deletions .specs/tasks/draft/add-template-markdown-generation.feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
---
title: Add template-based markdown file generation and manipulation
---

## Initial User Prompt

add template based markdown files generation and manipulation

### Acceptance Criteria

This project need cli tool which is capable of performing following operations:
- extracting structure of a markdown file (all headers and frontmatter) and displaying it in a tree like structure
- it should also show amount of lines and tokens (approximatly) in the file and per each section
- it should show list items amount
- extract and show only specific sections content of the file. It should support css like based selectors. For example:
- `h2#introduction` - show content of the h2 header with id `introduction`, including all subheaders in section
- `h3#subsection` - show content of the h3 header with id `subsection`, including all subheaders in section
- `h2#introduction,h3#subsection` - show content of the h2 header with id `introduction` and h3 header with id `subsection`, including all subheaders in section
- `h2#introduction,h3#subsection` - show content of the h2 header with id `introduction` and h3 header with id `subsection`, including all subheaders in section
- also add simular selectors for yaml frontmatter. For example:
- `fm` - show content of the yaml frontmatter
- `fm.title` - show content of the title property in yaml frontmatter
- `fm.title,fm.descriptionList[1].name` - show content of the title and description properties in yaml frontmatter
- generating a new markdown file from a template. Template should be also be a markdown or mdx file with section templating support, like handelbars, jade or simular.
- extracting specific sections of a markdown file and injecting them into a new markdown file based on the template (with ability to define which sections to include and which to exclude)
- going through directory and counting all markdown files lines amount and token amount (with ability to define which files to exclude) and save result of folder with per item stats to a file or simply output

### Specific use cases that it should support

- agent should be able to use cli like this: `cli structure some-markdown-file.md` and receive tree structure of the file, to avoid reading it fully. It will get amount of tokens, to decide if it should read the file fully or not.
- agent should be able to use cli like this: `cli read some-markdown-file.md --sections "h2#introduction,h2:other-section"` and receive the content of the sections
- should be possible to integrate to CI pipeline step that run in all `plugins/*/` folders logic that count amount of lines and tokens and save them to each `plugins/**/stats.yaml` file. So it will be visible how big each skill and agent file is
- should be possible to write tempalte markdown files that will be used to generate final makrdown file with ability to inject content from other files. For example:
`sdd/agents/code-quality-reviewer.tmpl.md`
```markdown
# Code Quality Reviewer

{{ @../../agents/base-personality.md }}

## Base judging instructions

{{ @../../sdd/agents/judge.md#base-judging-instructions }}

## Code Quality Rules

{{ @../../ddd/rules/*.md(exclude:#references)}}
```

CRITICAL: exact syntaxis not important, only important supported functionality. Better to reuse some existing solutions, rather than inventing own.

### Researcher requirements

This requirements for researcher only. Make research and create 3 skills for specific task. Your job to find a way to reuse some existing solutions or libraries for this task, instead of writing custom code.
- `markdown-parser` skill - find some existing library that can be used as core for markdown parsing and manipulation. Examples that you can start, but shouldn't stop: https://github.com/mdx-js/mdx, https://github.com/tinacms/tinacms, https://github.com/remarkjs/remark, https://github.com/markdoc/markdoc, https://github.com/vercel/streamdown, https://github.com/flowershow/markdowndb. If there nothing that can be utilized out of the box, find some code in such projects that provide minimal suitable implementation that can be copied and reused.
- `file-token-estimation` skill - find some existing library that can be used to estimate amount of tokens that it will take for LLM to read the file. It should be able to count not only total amount of tokens but sections also. Include in this skill file lenght estimation.
- `makrdown-to-html-selector` skill - research some library that can be used as part of css like selector picking of content. Something simular to what github uses to transform readme files to html with valid selectors. Agents will expect simular results when will try to pick content based on selectors.
- `markdown-template` skill - research some library solution that can be used to create makrdown tempaltes and generate content from them. It should be good enough to integrate with structure based selectors


### Architectual requirements

- Use typescript and nestjs and https://github.com/jmcdo29/nest-commander to create cli tool (nest-commander is criticl and not negotiable)
- use npm init, with name `mdb` (markdown database) to create project
- place code in `src/` folder and unit tests inside of `src/**/__tests__/` folders for each module
- create root tests/ folder that uses bash to test all commands by running tsx agains src and invoking commands as real user would do
- keep proper modules structure in `src/` folder, for example: `src/parser/`, `src/cli` and etc. Cli should be isolated from code, because in future business logic can be published as npm library.
- your job to find a proper way to decrease amount of code that will be written and use existing solutions, that researcher was able to find. if it possible. This project MUST be keept simple and easy to understand and maintain. Each code line counts.

## Description

// Will be filled in future stages by business analyst
Loading